summaryrefslogtreecommitdiff
path: root/src/nautilus-window-toolbars.c
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2000-08-10 21:51:50 +0000
committerDarin Adler <darin@src.gnome.org>2000-08-10 21:51:50 +0000
commit52052b37a4a5a11a9a1af504c9afc8559423fa97 (patch)
tree6ba93ad592f5f1e8ca27b686023997fff9bd30a4 /src/nautilus-window-toolbars.c
parent0f63097b211d497ff6ffe23591bd46196fb646f7 (diff)
downloadnautilus-52052b37a4a5a11a9a1af504c9afc8559423fa97.tar.gz
Fixed bug 2081 (crash changing themes). The problem was that
the code to unregister the preference callback was doing it with the wrong callback data. * src/nautilus-window-private.h: * src/nautilus-window-toolbars.c: (set_up_button), (set_up_toolbar_images), (set_up_toolbar_images_callback), (nautilus_window_initialize_toolbars), (nautilus_window_toolbar_remove_theme_callback): * src/nautilus-window.c: (nautilus_window_destroy): Unregister the preference callback properly. This required passing in the window pointer.
Diffstat (limited to 'src/nautilus-window-toolbars.c')
-rw-r--r--src/nautilus-window-toolbars.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/nautilus-window-toolbars.c b/src/nautilus-window-toolbars.c
index 03d5a13ba..89198b6f3 100644
--- a/src/nautilus-window-toolbars.c
+++ b/src/nautilus-window-toolbars.c
@@ -283,7 +283,9 @@ find_toolbar_child(GtkToolbar *toolbar, GtkWidget *button)
/* set up the toolbar info based on the current theme selection from preferences */
static void
-setup_button(GtkWidget* button, const char *theme_name, const char *icon_name)
+set_up_button (GtkWidget* button,
+ const char *theme_name,
+ const char *icon_name)
{
GnomeStock *stock_widget;
char *full_name;
@@ -333,24 +335,30 @@ setup_button(GtkWidget* button, const char *theme_name, const char *icon_name)
static void
-setup_toolbar_images(NautilusWindow *window)
+set_up_toolbar_images (NautilusWindow *window)
{
char *theme_name;
theme_name = nautilus_theme_get_theme_data ("toolbar", "ICON_THEME");
- setup_button (window->back_button, theme_name, GNOME_STOCK_PIXMAP_BACK);
- setup_button (window->forward_button, theme_name, GNOME_STOCK_PIXMAP_FORWARD);
- setup_button (window->up_button, theme_name, GNOME_STOCK_PIXMAP_UP);
- setup_button (window->home_button, theme_name, GNOME_STOCK_PIXMAP_HOME);
- setup_button (window->reload_button, theme_name, GNOME_STOCK_PIXMAP_REFRESH);
- setup_button (window->search_local_button, theme_name, GNOME_STOCK_PIXMAP_SEARCH);
- setup_button (window->search_web_button, theme_name, GNOME_STOCK_PIXMAP_SEARCH);
- setup_button (window->stop_button, theme_name, GNOME_STOCK_PIXMAP_STOP);
+ set_up_button (window->back_button, theme_name, GNOME_STOCK_PIXMAP_BACK);
+ set_up_button (window->forward_button, theme_name, GNOME_STOCK_PIXMAP_FORWARD);
+ set_up_button (window->up_button, theme_name, GNOME_STOCK_PIXMAP_UP);
+ set_up_button (window->home_button, theme_name, GNOME_STOCK_PIXMAP_HOME);
+ set_up_button (window->reload_button, theme_name, GNOME_STOCK_PIXMAP_REFRESH);
+ set_up_button (window->search_local_button, theme_name, GNOME_STOCK_PIXMAP_SEARCH);
+ set_up_button (window->search_web_button, theme_name, GNOME_STOCK_PIXMAP_SEARCH);
+ set_up_button (window->stop_button, theme_name, GNOME_STOCK_PIXMAP_STOP);
g_free(theme_name);
}
+static void
+set_up_toolbar_images_callback (gpointer callback_data)
+{
+ set_up_toolbar_images (NAUTILUS_WINDOW (callback_data));
+}
+
/* allocate a new toolbar */
void
nautilus_window_initialize_toolbars (NautilusWindow *window)
@@ -367,7 +375,7 @@ nautilus_window_initialize_toolbars (NautilusWindow *window)
gnome_app_fill_toolbar_with_data (GTK_TOOLBAR (toolbar), toolbar_info, app->accel_group, app);
remember_buttons(window, toolbar_info);
- setup_toolbar_images(window);
+ set_up_toolbar_images (window);
gnome_app_set_toolbar (app, GTK_TOOLBAR (toolbar));
@@ -384,17 +392,19 @@ nautilus_window_initialize_toolbars (NautilusWindow *window)
window);
/* add callback for preference changes */
- nautilus_preferences_add_callback(NAUTILUS_PREFERENCES_THEME,
- (NautilusPreferencesCallback) setup_toolbar_images,
- window);
+ nautilus_preferences_add_callback
+ (NAUTILUS_PREFERENCES_THEME,
+ set_up_toolbar_images_callback,
+ window);
}
void
-nautilus_window_toolbar_remove_theme_callback (void)
+nautilus_window_toolbar_remove_theme_callback (NautilusWindow *window)
{
nautilus_preferences_remove_callback
(NAUTILUS_PREFERENCES_THEME,
- (NautilusPreferencesCallback) setup_toolbar_images, NULL);
+ set_up_toolbar_images_callback,
+ window);
}