summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-02-17 17:02:14 +0100
committerStefano Karapetsas <[email protected]>2014-02-17 17:02:14 +0100
commit453154a00f0f17e20340e408055e224ea57cc4e8 (patch)
tree01006728be3b989e2a0cacd20b4e287a5d63eec9
parent9043b93048346404662950b55b5d60b7e588e375 (diff)
downloadmate-panel-453154a00f0f17e20340e408055e224ea57cc4e8.tar.bz2
mate-panel-453154a00f0f17e20340e408055e224ea57cc4e8.tar.xz
Fix mate-panel --reset
-rw-r--r--mate-panel/applet.c3
-rw-r--r--mate-panel/panel-action-protocol.c2
-rw-r--r--mate-panel/panel-menu-bar.c3
-rw-r--r--mate-panel/panel-menu-items.c3
-rw-r--r--mate-panel/panel-profile.c9
-rw-r--r--mate-panel/panel-reset.c14
-rw-r--r--mate-panel/panel-reset.h2
7 files changed, 27 insertions, 9 deletions
diff --git a/mate-panel/applet.c b/mate-panel/applet.c
index ce637d29..3d81eab4 100644
--- a/mate-panel/applet.c
+++ b/mate-panel/applet.c
@@ -180,7 +180,8 @@ mate_panel_applet_locked_change_notify (GSettings *settings,
AppletInfo *info;
PanelWidget *panel_widget;
- g_assert (applet != NULL);
+ if (applet == NULL || !GTK_IS_WIDGET (applet))
+ return;
info = (AppletInfo *) g_object_get_data (G_OBJECT (applet),
"applet_info");
diff --git a/mate-panel/panel-action-protocol.c b/mate-panel/panel-action-protocol.c
index 12a7f667..3a4efa72 100644
--- a/mate-panel/panel-action-protocol.c
+++ b/mate-panel/panel-action-protocol.c
@@ -118,8 +118,8 @@ panel_action_protocol_filter (GdkXEvent *gdk_xevent,
display = gdk_screen_get_display (screen);
window = gdk_x11_window_lookup_for_display (display, xevent->xclient.window);
#else
- screen = gdk_drawable_get_screen (window);
window = gdk_window_lookup (xevent->xclient.window);
+ screen = gdk_drawable_get_screen (window);
#endif
if (!window)
return GDK_FILTER_CONTINUE;
diff --git a/mate-panel/panel-menu-bar.c b/mate-panel/panel-menu-bar.c
index 358eac95..9776fa1f 100644
--- a/mate-panel/panel-menu-bar.c
+++ b/mate-panel/panel-menu-bar.c
@@ -115,6 +115,9 @@ static void panel_menu_bar_update_visibility (GSettings* settings, gchar* key, P
GtkWidget* image;
gchar *str;
+ if (!GTK_IS_WIDGET (menubar))
+ return;
+
gtk_widget_set_visible (GTK_WIDGET (menubar->priv->applications_item), g_settings_get_boolean (settings, PANEL_MENU_BAR_SHOW_APPLICATIONS_KEY));
gtk_widget_set_visible (GTK_WIDGET (menubar->priv->places_item), g_settings_get_boolean (settings, PANEL_MENU_BAR_SHOW_PLACES_KEY));
gtk_widget_set_visible (GTK_WIDGET (menubar->priv->desktop_item), g_settings_get_boolean (settings, PANEL_MENU_BAR_SHOW_DESKTOP_KEY));
diff --git a/mate-panel/panel-menu-items.c b/mate-panel/panel-menu-items.c
index 5db5265b..1f4e6475 100644
--- a/mate-panel/panel-menu-items.c
+++ b/mate-panel/panel-menu-items.c
@@ -1117,6 +1117,9 @@ panel_place_menu_item_recreate_menu (GtkWidget *widget)
{
PanelPlaceMenuItem *place_item;
+ if (!GTK_IS_WIDGET (widget))
+ return;
+
place_item = PANEL_PLACE_MENU_ITEM (widget);
if (place_item->priv->menu) {
diff --git a/mate-panel/panel-profile.c b/mate-panel/panel-profile.c
index 3dad813b..b5504a7e 100644
--- a/mate-panel/panel-profile.c
+++ b/mate-panel/panel-profile.c
@@ -82,6 +82,7 @@ static GQuark queued_changes_quark = 0;
static GQuark commit_timeout_quark = 0;
static void panel_profile_object_id_list_update (gchar **objects);
+static void panel_profile_ensure_toplevel_per_screen (void);
static void
panel_profile_set_toplevel_id (PanelToplevel *toplevel,
@@ -778,6 +779,8 @@ panel_profile_toplevel_change_notify (GSettings *settings,
gchar *key,
PanelToplevel *toplevel)
{
+ if (toplevel == NULL || !PANEL_IS_TOPLEVEL (toplevel))
+ return;
#define UPDATE_STRING(k, n) \
if (!strcmp (key, k)) { \
@@ -880,6 +883,8 @@ panel_profile_background_change_notify (GSettings *settings,
PanelWidget *panel_widget;
PanelBackground *background;
+ if (toplevel == NULL || !PANEL_IS_TOPLEVEL (toplevel))
+ return;
panel_widget = panel_toplevel_get_panel_widget (toplevel);
if (panel_widget == NULL)
return;
@@ -1594,6 +1599,10 @@ panel_profile_toplevel_id_list_notify (GSettings *settings,
(PanelProfileGetIdFunc) panel_profile_get_toplevel_id,
(PanelProfileDestroyFunc) panel_profile_destroy_toplevel);
+ /* if there are no panels, reset layout to default */
+ if (g_slist_length (toplevel_ids) == 0)
+ panel_profile_ensure_toplevel_per_screen ();
+
g_slist_free (existing_toplevels);
g_slist_free (toplevel_ids);
}
diff --git a/mate-panel/panel-reset.c b/mate-panel/panel-reset.c
index e441f554..6670fc17 100644
--- a/mate-panel/panel-reset.c
+++ b/mate-panel/panel-reset.c
@@ -30,17 +30,19 @@
#include <glib.h>
#include "panel-reset.h"
#include "panel-schemas.h"
-#include <libpanel-util/panel-dconf.h>
void
panel_reset()
{
- panel_dconf_recursive_reset (PANEL_GENERAL_PATH, NULL);
- panel_dconf_recursive_reset (PANEL_TOPLEVEL_PATH, NULL);
- panel_dconf_recursive_reset (PANEL_OBJECT_PATH, NULL);
+ GSettings *settings;
- /* TODO: send a dbus message to mate-panel, if active, to reload the panel
- * configuration */
+ settings = g_settings_new (PANEL_SCHEMA);
+ g_settings_set_strv (settings, PANEL_OBJECT_ID_LIST_KEY, NULL);
+ g_settings_sync ();
+ g_settings_set_strv (settings, PANEL_TOPLEVEL_ID_LIST_KEY, NULL);
+ g_settings_sync ();
+
+ g_object_unref (settings);
}
#endif /* !__PANEL_RESET_C__ */
diff --git a/mate-panel/panel-reset.h b/mate-panel/panel-reset.h
index 242fb3ca..125b6b3d 100644
--- a/mate-panel/panel-reset.h
+++ b/mate-panel/panel-reset.h
@@ -28,7 +28,7 @@
extern "C" {
#endif /* __cplusplus */
-void panel_reset();
+void panel_reset(void);
#ifdef __cplusplus
}