[gnome-panel] panel: Port confirm_panel_remove key to GSettings



commit 00266f6183220c9dc902998b242f53528942dc56
Author: Vincent Untz <vuntz gnome org>
Date:   Wed Mar 23 18:58:22 2011 +0100

    panel: Port confirm_panel_remove key to GSettings

 gnome-panel/panel-config-global.c   |   13 -------------
 gnome-panel/panel-config-global.h   |    1 -
 gnome-panel/panel-global.schemas.in |    6 ++----
 gnome-panel/panel-schemas.h         |    3 +++
 gnome-panel/panel.c                 |   10 +++++++++-
 5 files changed, 14 insertions(+), 19 deletions(-)
---
diff --git a/gnome-panel/panel-config-global.c b/gnome-panel/panel-config-global.c
index 8b2d4d9..68b1416 100644
--- a/gnome-panel/panel-config-global.c
+++ b/gnome-panel/panel-config-global.c
@@ -35,7 +35,6 @@
 
 typedef struct {
 	guint               tooltips_enabled : 1;
-	guint               confirm_panel_remove : 1;
 	guint               highlight_when_over : 1;
 } GlobalConfig;
 
@@ -58,14 +57,6 @@ panel_global_config_get_tooltips_enabled (void)
 	return global_config.tooltips_enabled;
 }
 
-gboolean
-panel_global_config_get_confirm_panel_remove (void)
-{
-	g_assert (global_config_initialised == TRUE);
-
-	return global_config.confirm_panel_remove;
-}
-
 static void
 panel_global_config_set_entry (GConfEntry *entry)
 {
@@ -84,10 +75,6 @@ panel_global_config_set_entry (GConfEntry *entry)
 		global_config.tooltips_enabled =
 				gconf_value_get_bool (value);
 
-	else if (strcmp (key, "confirm_panel_remove") == 0)
-		global_config.confirm_panel_remove =
-			gconf_value_get_bool (value);
-
 	else if (strcmp (key, "highlight_launchers_on_mouseover") == 0)
 		global_config.highlight_when_over =
 			gconf_value_get_bool (value);
diff --git a/gnome-panel/panel-config-global.h b/gnome-panel/panel-config-global.h
index 89759c4..fd72ebc 100644
--- a/gnome-panel/panel-config-global.h
+++ b/gnome-panel/panel-config-global.h
@@ -34,7 +34,6 @@ void panel_global_config_load (void);
 
 gboolean panel_global_config_get_highlight_when_over  (void);
 gboolean panel_global_config_get_tooltips_enabled     (void);
-gboolean panel_global_config_get_confirm_panel_remove (void);
 
 G_END_DECLS
 
diff --git a/gnome-panel/panel-global.schemas.in b/gnome-panel/panel-global.schemas.in
index 026b10c..cc6a18e 100644
--- a/gnome-panel/panel-global.schemas.in
+++ b/gnome-panel/panel-global.schemas.in
@@ -171,10 +171,8 @@ Panel Global Config Schema File -  work in progress
         <type>bool</type>
         <default>true</default>
         <locale name="C">
-          <short>Confirm panel removal</short>
-          <long>If true, a dialog is shown asking for confirmation
-                if the user wants to remove a panel.
-          </long>
+          <short>Deprecated</short>
+          <long></long>
         </locale>
       </schema>
 
diff --git a/gnome-panel/panel-schemas.h b/gnome-panel/panel-schemas.h
index 6ee9f2b..325c88e 100644
--- a/gnome-panel/panel-schemas.h
+++ b/gnome-panel/panel-schemas.h
@@ -1,6 +1,9 @@
 #ifndef __PANEL_SCHEMAS_H__
 #define __PANEL_SCHEMAS_H__
 
+#define PANEL_GENERAL_SCHEMA                    "org.gnome.gnome-panel.general"
+#define PANEL_GENERAL_CONFIRM_PANEL_REMOVAL_KEY "confirm-panel-removal"
+
 #define PANEL_RUN_SCHEMA                 "org.gnome.gnome-panel.run-dialog"
 #define PANEL_RUN_HISTORY_KEY            "history"
 #define PANEL_RUN_ENABLE_COMPLETION_KEY  "enable-autocompletion"
diff --git a/gnome-panel/panel.c b/gnome-panel/panel.c
index ac23c76..ecb838b 100644
--- a/gnome-panel/panel.c
+++ b/gnome-panel/panel.c
@@ -43,6 +43,7 @@
 #include "panel-globals.h"
 #include "panel-lockdown.h"
 #include "panel-icon-names.h"
+#include "panel-schemas.h"
 
 enum {
 	TARGET_URL,
@@ -1370,11 +1371,18 @@ panel_query_deletion (PanelToplevel *toplevel)
 void
 panel_delete (PanelToplevel *toplevel)
 {
+	GSettings   *settings;
+	gboolean     confirm;
 	PanelWidget *panel_widget;
 
+	settings = g_settings_new (PANEL_GENERAL_SCHEMA);
+	confirm = g_settings_get_boolean (settings,
+					  PANEL_GENERAL_CONFIRM_PANEL_REMOVAL_KEY);
+	g_object_unref (settings);
+
 	panel_widget = panel_toplevel_get_panel_widget (toplevel);
 
-	if (!panel_global_config_get_confirm_panel_remove () ||
+	if (!confirm ||
 	    !g_list_length (panel_widget->applet_list)) {
 		panel_delete_without_query (toplevel);
 		return;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]