diff options
author | monsta <[email protected]> | 2015-12-18 11:53:40 +0300 |
---|---|---|
committer | Monsta <[email protected]> | 2015-12-21 12:06:28 +0300 |
commit | fe8847c1ac00ee0767316610d436d799808859e8 (patch) | |
tree | 20cd920f45fd7668c86c199745c8e0a3b1db645b | |
parent | 51edda9fc670c38c57fa3739280086dc310c6df7 (diff) | |
download | mate-panel-fe8847c1ac00ee0767316610d436d799808859e8.tar.bz2 mate-panel-fe8847c1ac00ee0767316610d436d799808859e8.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, |