humm... yeah that probably fixes it..
I understand the problem... it's because you disable the file event, and when you get a line, you just suppose you might get something else and you wait for the next event, problem is that if the filevent is disabled, you'll never get notified that the read is complete... also, even if the fileevent was still set, we still would have a problem because the $temp variable is only local and will get reset to an empty string on the next fileevent call... so actually your fix fixes it but it's not the optimal solution, I would go with something like this :

proc dialog_event { fileId } {
        variable dialog_event_data

        fileevent $fileId readable ""

        if { ![info exists dialog_event_data($fileId)] } {
                set dialog_event_data($fileId) ""
        }

        if { [gets $fileId line] < 0 } {
                if [catch {close $fileId}] {
                        #If the user pressed Cancel we get here
                        set ::desktop_integration::answer ""
                        array unset dialog_event_data $fileId
                } else {
                        set ::desktop_integration::answer $temp
                        array unset dialog_event_data $fileId

                }
        } else {
                append dialog_event_data($fileId) $line
                fileevent $fileId readable "[info level 0]"
        }
}

that should do the trick.. can it be tested and fixed.. I just wrote it in my mail client, so don't know if there's any syntax errors and of course I can't test it...

KKRT


On Sat, 31 Dec 2005 14:28:24 -0500, Vivia Nikolaidou <[EMAIL PROTECTED]> wrote:

On Sat, 31 Dec 2005, Youness Alaoui wrote:

vivia... what did you change ? I understand that sending the whole file is

Added line 487 :

475        proc dialog_event { fileId } {
                fileevent $fileId readable ""
                set temp ""
                if { [gets $fileId line] < 0 } {
                        if [catch {close $fileId}] {
                                #If the user pressed Cancel we get here
                                set ::desktop_integration::answer ""
                        } else {
                                set ::desktop_integration::answer $temp
                        }
                } else {
                        append temp $line
487                     set ::desktop_integration::answer $temp
                }

Without it, file selection won't work. But I don't like what I did, even
though I don't really understand it...


better as we may not know if a diff should be applied on cvs version or on the version Karel sent... but in that case, sending the whole file, could you
please attach a diff with it at the same time as the complete file?
one huge reason for me is that all I need to do is look at the diff, without it, I would need to put the file on my machine, connect through FTP to my linux box, upload it there, do the same with Karel's version, then diff.. OR save/ftp/upload then open vnc, open amsn through vnc, load the plugin, realize I can't load the plugin because I have no kde and no gnome installed, then do
the diff :P
This comment also applies to Karel, not just Vivia!

anyways, I'm too lazy to use diff, so I don't know what you changed, but I have a question that was always killing me, when I was cleaning that code :
proc question_event { fileId } {
        if [catch {close $fileId}] {
        set ::desktop_integration::answer "no"
        } else {
        set ::desktop_integration::answer "yes"
        }
}

why would a close fail on the fileId ?? is it because the fileId is never opened ? because there was never any output on stdout.. but I don't think so because once you have an FD, then the FD is valid... so I just don't get why a
failing close would mean 'no'... and a successful one means 'yes'..
I can't test because I have no zenity, no k..whatever that is...
but an explanation would be nice..

Karel, your solution, to detect when you have a first load is :
proc init { }
registerplugin
set config(first_time) 1

.. do all the stuff here ...

if {[info exists ::{Desktop Integration_cfg}(first_time)] &&
[set ::{Desktop Integration_cfg}(first_time)] == 0 } {
checks_when_loaded
}

set config(first_time) 0

}

hope that helps you... (in no code, it means that your configuration is inside a proc named ::${plugin_name}_cfg make sure it's the plugin's name, not it's
namespace, so if you have a space in your plugin name, make sure to put
brackets around it)

KaKaRoTo


On Sat, 31 Dec 2005 10:09:19 -0500, Vivia Nikolaidou <[EMAIL PROTECTED]>
wrote:

>
> I am resending the file, modified from Karel's changes. Please see if it
> works now - at least it works for me.
>
> But I have a feeling that it's not a good solution... anyway, if it
> works... :)



--
KaKaRoTo


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Amsn-devel mailing list
Amsn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amsn-devel



---

"Where is the life that we have lost in living?
 Where is the wisdom that we have lost in knowledge?
 Where is the knowledge that we have lost in information?"

OEO;



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Amsn-devel mailing list
Amsn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amsn-devel



--
KaKaRoTo


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Amsn-devel mailing list
Amsn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amsn-devel

Reply via email to