GtkFileChooserButton::file-set



I need to catch when the file has changed in a
GtkFileChooserButton. I thought connecting to "file-set" was
enough but this signal is not emitted when the user cancels
(although bug 555351 does not agree [1]). Here is the proof:


#include <gtk/gtk.h>

int main(int argc, char **argv)
{
    GtkWidget *window, *chooser;

    gtk_init(&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    chooser = gtk_file_chooser_button_new(NULL,
                                          GTK_FILE_CHOOSER_ACTION_OPEN);
    gtk_container_add(GTK_CONTAINER(window), chooser);

    g_signal_connect_swapped(chooser, "file-set",
                             G_CALLBACK(g_print), "file-set\n");

    gtk_widget_show_all(window);
    gtk_main();

    return 0;
}


What am I supposed to do? I can provide my custom dialog to
GtkFileChooserButton but checking when the file has changed in a
file chooser seems a too natural request for requiring such
effort.

Ciao.
-- 
Nicola

[1] https://bugzilla.gnome.org/show_bug.cgi?id=555351



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]