diff options
author | monsta <[email protected]> | 2015-12-18 11:53:40 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2016-01-11 15:20:26 +0300 |
commit | cd5c8b6c8af0c86050c60baaeb0a138210308668 (patch) | |
tree | 4521d6a057ab7cfde84872d15b6a46ea64a6e3a8 | |
parent | 5b859fd0eb1dbbfca129f80828de4741a9f900b4 (diff) | |
download | mate-panel-cd5c8b6c8af0c86050c60baaeb0a138210308668.tar.bz2 mate-panel-cd5c8b6c8af0c86050c60baaeb0a138210308668.tar.xz |
drawer: some fixes
-rw-r--r-- | mate-panel/drawer.c | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/mate-panel/drawer.c b/mate-panel/drawer.c index 3d9ee804..da33ea0e 100644 --- a/mate-panel/drawer.c +++ b/mate-panel/drawer.c @@ -47,20 +47,26 @@ toplevel_destroyed (GtkWidget *widget, Drawer *drawer) { drawer->toplevel = NULL; - gtk_widget_destroy (drawer->button); + + if (drawer->button) { + gtk_widget_destroy (drawer->button); + drawer->button = NULL; + } } static void destroy_drawer (GtkWidget *widget, Drawer *drawer) { - if (drawer->toplevel) + if (drawer->toplevel) { gtk_widget_destroy (GTK_WIDGET (drawer->toplevel)); - drawer->toplevel = NULL; + drawer->toplevel = NULL; + } - if (drawer->close_timeout_id) + if (drawer->close_timeout_id) { g_source_remove (drawer->close_timeout_id); - drawer->close_timeout_id = 0; + drawer->close_timeout_id = 0; + } } static void @@ -413,37 +419,20 @@ drawer_button_size_allocated (GtkWidget *widget, } static void -panel_drawer_use_custom_icon_changed (GSettings *settings, +panel_drawer_custom_icon_changed (GSettings *settings, gchar *key, Drawer *drawer) { - gboolean use_custom_icon; - char *custom_icon = NULL; - - use_custom_icon = g_settings_get_boolean (settings, key); - - if (use_custom_icon) { - custom_icon = g_settings_get_string (settings, PANEL_OBJECT_CUSTOM_ICON_KEY); - } - - button_widget_set_icon_name (BUTTON_WIDGET (drawer->button), custom_icon); + g_return_if_fail (drawer != NULL); + g_return_if_fail (drawer->button != NULL); - g_free (custom_icon); -} + gboolean use_custom_icon = g_settings_get_boolean (settings, PANEL_OBJECT_USE_CUSTOM_ICON_KEY); + char *custom_icon = g_settings_get_string (settings, PANEL_OBJECT_CUSTOM_ICON_KEY); -static void -panel_drawer_custom_icon_changed (GSettings *settings, - gchar *key, - Drawer *drawer) -{ - char *custom_icon; - custom_icon = g_settings_get_string (settings, key); - - if (custom_icon && custom_icon [0]) { - gboolean use_custom_icon; - use_custom_icon = g_settings_get_boolean (settings, PANEL_OBJECT_USE_CUSTOM_ICON_KEY); - if (use_custom_icon) - button_widget_set_icon_name (BUTTON_WIDGET (drawer->button), custom_icon); + if (use_custom_icon && custom_icon != NULL && custom_icon [0] != '\0') { + button_widget_set_icon_name (BUTTON_WIDGET (drawer->button), custom_icon); + } else { + button_widget_set_icon_name (BUTTON_WIDGET (drawer->button), PANEL_ICON_DRAWER); } g_free (custom_icon); @@ -464,7 +453,7 @@ panel_drawer_connect_to_gsettings (Drawer *drawer) { g_signal_connect (drawer->info->settings, "changed::" PANEL_OBJECT_USE_CUSTOM_ICON_KEY, - G_CALLBACK (panel_drawer_use_custom_icon_changed), + G_CALLBACK (panel_drawer_custom_icon_changed), drawer); g_signal_connect (drawer->info->settings, "changed::" PANEL_OBJECT_CUSTOM_ICON_KEY, |