On 14 June 2012 16:54, James Morris jwm.art@gmail.com wrote:
Hi,
I've got a problem with the selection-changed signal being emitted
as soon as gtk_dialog_run is called on a GtkFileChooserDialog. I tried
delaying connection of the callback until right before calling
gtk_dialog_run but there were still four calls (in a row AFAICT) to
the callback.
I am now using g_timeout_add as a work-around to delay connection of
the signal to my callback and thus prevent the four initial
selection-changed emissions activating the callback.
To put this in context, it's for auto-previewing audio files.
The simple implementation causes an audio file to be previewed when
gtk_dialog_run is called* or when the current folder is changed in the
chooser. By using a dont_preview boolean and connecting the
current-folder-changed signal to a callback I can then use
g_timeout_add to cancel the dont_preview flag. The flag must be set
before gtk_dialog_run is called, and will always be set when the
folder is changed.
*provided the item initially selected in the chooser is an audio file.
Is this normal? Is there a more standard way of doing this?
I'm guessing it is normal/standard and that work-a-rounds are
necessary if you want to do something like this.
I'm using GTK 2.24.10 in 64bit Arch Linux.
Thanks,
James.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list