Commit 4c9ca1a3 authored by Jan Djärv's avatar Jan Djärv
Browse files

* gtkutil.c (xg_toggle_notify_cb): New function.

(xg_toggle_visibility_cb): Move setting of x_gtk_show_hidden_files to
xg_toggle_notify_cb.
(xg_get_file_with_chooser): Add callback to xg_toggle_notify_cb when
parameter value changes so the toggle button gets updated.
parent 62c5f375
2006-01-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
* gtkutil.c (xg_toggle_notify_cb): New function.
(xg_toggle_visibility_cb): Move setting of x_gtk_show_hidden_files to
xg_toggle_notify_cb.
(xg_get_file_with_chooser): Add callback to xg_toggle_notify_cb when
parameter value changes so the toggle button gets updated.
2006-01-06 Nick Roberts <nickrob@snap.net.nz>
 
* .gdbinit: Fix typo.
......
......@@ -1220,6 +1220,9 @@ xg_get_file_name_from_chooser (w)
return gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w));
}
/* Callback called when the "Show hidden files" toggle is pressed.
WIDGET is the toggle widget, DATA is the file chooser dialog. */
static void
xg_toggle_visibility_cb (widget, data)
GtkWidget *widget;
......@@ -1227,10 +1230,47 @@ xg_toggle_visibility_cb (widget, data)
{
GtkFileChooser *dialog = GTK_FILE_CHOOSER (data);
gboolean visible;
extern int x_gtk_show_hidden_files;
g_object_get (G_OBJECT (dialog), "show-hidden", &visible, NULL);
g_object_set (G_OBJECT (dialog), "show-hidden", !visible, NULL);
x_gtk_show_hidden_files = !visible;
}
/* Callback called when a property changes in a file chooser.
GOBJECT is the file chooser dialog, ARG1 describes the property.
USER_DATA is the toggle widget in the file chooser dialog.
We use this to update the "Show hidden files" toggle when the user
changes that property by right clicking in the file list. */
static void
xg_toggle_notify_cb (gobject, arg1, user_data)
GObject *gobject;
GParamSpec *arg1;
gpointer user_data;
{
extern int x_gtk_show_hidden_files;
if (strcmp (arg1->name, "show-hidden") == 0)
{
GtkFileChooser *dialog = GTK_FILE_CHOOSER (gobject);
GtkWidget *wtoggle = GTK_WIDGET (user_data);
gboolean visible, toggle_on;
g_object_get (G_OBJECT (gobject), "show-hidden", &visible, NULL);
toggle_on = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (wtoggle));
if (!!visible != !!toggle_on)
{
g_signal_handlers_block_by_func (G_OBJECT (wtoggle),
G_CALLBACK (xg_toggle_visibility_cb),
gobject);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (wtoggle), visible);
g_signal_handlers_unblock_by_func
(G_OBJECT (wtoggle),
G_CALLBACK (xg_toggle_visibility_cb),
gobject);
}
x_gtk_show_hidden_files = visible;
}
}
/* Read a file name from the user using a file chooser dialog.
......@@ -1283,7 +1323,9 @@ xg_get_file_with_chooser (f, prompt, default_filename,
}
gtk_widget_show (wtoggle);
g_signal_connect (G_OBJECT (wtoggle), "clicked",
G_CALLBACK (xg_toggle_visibility_cb), G_OBJECT(filewin));
G_CALLBACK (xg_toggle_visibility_cb), filewin);
g_signal_connect (G_OBJECT (filewin), "notify",
G_CALLBACK (xg_toggle_notify_cb), wtoggle);
message[0] = '\0';
if (action != GTK_FILE_CHOOSER_ACTION_SAVE)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment