[gnome-panel/wip/3.0-freeze-break] panel: Rename *_load_from_gconf to *_load



commit 90113026a85a27e21e9a429e4db4f38c74c11243
Author: Vincent Untz <vuntz gnome org>
Date:   Fri Mar 25 14:40:20 2011 +0100

    panel: Rename *_load_from_gconf to *_load

 gnome-panel/launcher.c            |    7 +++--
 gnome-panel/launcher.h            |    3 +-
 gnome-panel/panel-action-button.c |   47 +++++++++++++++++---------------
 gnome-panel/panel-action-button.h |    6 +++-
 gnome-panel/panel-menu-bar.c      |   14 ++-------
 gnome-panel/panel-menu-bar.h      |    3 +-
 gnome-panel/panel-menu-button.c   |   45 ++++++++++++++++---------------
 gnome-panel/panel-menu-button.h   |    3 +-
 gnome-panel/panel-object-loader.c |   53 +++++++++++++++++++-----------------
 gnome-panel/panel-separator.c     |    7 +++--
 gnome-panel/panel-separator.h     |    3 +-
 11 files changed, 99 insertions(+), 92 deletions(-)
---
diff --git a/gnome-panel/launcher.c b/gnome-panel/launcher.c
index 105a38b..961f395 100644
--- a/gnome-panel/launcher.c
+++ b/gnome-panel/launcher.c
@@ -810,9 +810,10 @@ load_launcher_applet (const char       *location,
 }
 
 void
-launcher_load_from_gconf (PanelWidget *panel_widget,
-			  int          position,
-			  const char  *id)
+launcher_load (GSettings   *settings,
+	       PanelWidget *panel_widget,
+	       int          position,
+	       const char  *id)
 {
 	GConfClient *client;
 	Launcher    *launcher;
diff --git a/gnome-panel/launcher.h b/gnome-panel/launcher.h
index 3ff609a..5cbece9 100644
--- a/gnome-panel/launcher.h
+++ b/gnome-panel/launcher.h
@@ -51,7 +51,8 @@ void		launcher_launch    		(Launcher  *launcher,
 
 void		launcher_properties		(Launcher  *launcher);
 
-void            launcher_load_from_gconf        (PanelWidget *panel_widget,
+void            launcher_load                   (GSettings   *settings,
+						 PanelWidget *panel_widget,
 						 gint         position,
 						 const char  *id);
 
diff --git a/gnome-panel/panel-action-button.c b/gnome-panel/panel-action-button.c
index 28f74c8..b559e30 100644
--- a/gnome-panel/panel-action-button.c
+++ b/gnome-panel/panel-action-button.c
@@ -680,11 +680,11 @@ panel_action_button_style_updated (PanelActionButton *button)
 }
 
 static void
-panel_action_button_load (PanelActionButtonType  type,
-			  PanelWidget           *panel,
-			  int                    position,
-			  gboolean               exactpos,
-			  const char            *id)
+panel_action_button_load_helper (PanelActionButtonType  type,
+				 PanelWidget           *panel,
+				 int                    position,
+				 gboolean               exactpos,
+				 const char            *id)
 {
 	PanelActionButton *button;
 
@@ -738,27 +738,30 @@ panel_action_button_create (PanelToplevel         *toplevel,
 }
 
 void
-panel_action_button_load_from_gconf (PanelWidget *panel,
-				     int          position,
-				     gboolean     exactpos,
-				     const char  *id)
-{
-	int          type;
-	const char  *key;
-	char        *action_type;
-
-	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id, "action_type");
-	action_type = gconf_client_get_string (panel_gconf_get_client (), key, NULL);
+panel_action_button_load (GSettings *settings,
+			  PanelWidget *panel,
+			  int          position,
+			  gboolean     exactpos,
+			  const char  *id,
+			  const char  *detail_for_type)
+{
+	int type = PANEL_ACTION_NONE;
+	int i;
+
+	for (i = 0; panel_action_type_map[i].str != NULL; i++) {
+		if (g_strcmp0 (detail_for_type,
+			       panel_action_type_map[i].str) == 0) {
+			type = panel_action_type_map[i].enum_value;
+			break;
+		}
+	}
 
-	if (!gconf_string_to_enum (panel_action_type_map, action_type, &type)) {
-		g_warning ("Unkown action type '%s' from %s", action_type, key);
-		g_free (action_type);
+	if (type == PANEL_ACTION_NONE) {
+		g_warning ("Unkown action type '%s", detail_for_type);
 		return;
 	}
 
-	g_free (action_type);
-
-	panel_action_button_load (type, panel,
+	panel_action_button_load_helper (type, panel,
 				  position, exactpos, id);
 }
 
diff --git a/gnome-panel/panel-action-button.h b/gnome-panel/panel-action-button.h
index 27ac7d8..3b3dc36 100644
--- a/gnome-panel/panel-action-button.h
+++ b/gnome-panel/panel-action-button.h
@@ -63,10 +63,12 @@ void       panel_action_button_create           (PanelToplevel         *toplevel
 void       panel_action_button_set_type         (PanelActionButton     *button,
 						 PanelActionButtonType  type);
 
-void       panel_action_button_load_from_gconf  (PanelWidget            *panel,
+void       panel_action_button_load             (GSettings              *settings,
+						 PanelWidget            *panel,
 						 int                     position,
 						 gboolean                exactpos,
-						 const char             *id);
+						 const char             *id,
+						 const char             *detail);
 
 void       panel_action_button_invoke_menu      (PanelActionButton      *button,
 						 const char             *callback_name);
diff --git a/gnome-panel/panel-menu-bar.c b/gnome-panel/panel-menu-bar.c
index 772ee1b..86d62b6 100644
--- a/gnome-panel/panel-menu-bar.c
+++ b/gnome-panel/panel-menu-bar.c
@@ -383,8 +383,9 @@ panel_menu_bar_on_draw (GtkWidget *widget,
 	return FALSE;
 }
 
-static void
-panel_menu_bar_load (PanelWidget *panel,
+void
+panel_menu_bar_load (GSettings   *settings,
+		     PanelWidget *panel,
 		     int          position,
 		     gboolean     exactpos,
 		     const char  *id)
@@ -431,15 +432,6 @@ panel_menu_bar_load (PanelWidget *panel,
 }
 
 void
-panel_menu_bar_load_from_gconf (PanelWidget *panel,
-				int          position,
-				gboolean     exactpos,
-				const char  *id)
-{
-	panel_menu_bar_load (panel, position, exactpos, id);
-}
-
-void
 panel_menu_bar_create (PanelToplevel *toplevel,
 		       int            position)
 {
diff --git a/gnome-panel/panel-menu-bar.h b/gnome-panel/panel-menu-bar.h
index 87e4c5e..3e30993 100644
--- a/gnome-panel/panel-menu-bar.h
+++ b/gnome-panel/panel-menu-bar.h
@@ -56,7 +56,8 @@ GType      panel_menu_bar_get_type  (void) G_GNUC_CONST;
 void       panel_menu_bar_create           (PanelToplevel *toplevel,
 					    int            position);
 
-void       panel_menu_bar_load_from_gconf  (PanelWidget  *panel,
+void       panel_menu_bar_load             (GSettings    *settings,
+					    PanelWidget  *panel,
 					    int           position,
 					    gboolean      exactpos,
 					    const char   *id);
diff --git a/gnome-panel/panel-menu-button.c b/gnome-panel/panel-menu-button.c
index da9616b..62d5543 100644
--- a/gnome-panel/panel-menu-button.c
+++ b/gnome-panel/panel-menu-button.c
@@ -621,15 +621,15 @@ panel_menu_button_disconnect_from_gconf (PanelMenuButton *button)
 }
 
 static void
-panel_menu_button_load (const char  *menu_path,
-			gboolean     use_menu_path,
-			const char  *custom_icon,
-			gboolean     use_custom_icon,
-			const char  *tooltip,
-			PanelWidget *panel,
-			int          position,
-			gboolean     exactpos,
-			const char  *id)
+panel_menu_button_load_helper (const char  *menu_path,
+			       gboolean     use_menu_path,
+			       const char  *custom_icon,
+			       gboolean     use_custom_icon,
+			       const char  *tooltip,
+			       PanelWidget *panel,
+			       int          position,
+			       gboolean     exactpos,
+			       const char  *id)
 {
 	PanelMenuButton *button;
 	AppletInfo      *info;
@@ -853,10 +853,11 @@ panel_menu_button_set_use_custom_icon (PanelMenuButton *button,
 }
 
 void
-panel_menu_button_load_from_gconf (PanelWidget *panel,
-				   int          position,
-				   gboolean     exactpos,
-				   const char  *id)
+panel_menu_button_load (GSettings   *settings,
+			PanelWidget *panel,
+			int          position,
+			gboolean     exactpos,
+			const char  *id)
 {
 	GConfClient  *client;
 	char         *scheme;
@@ -894,15 +895,15 @@ panel_menu_button_load_from_gconf (PanelWidget *panel,
 	key = panel_gconf_full_key (PANEL_GCONF_OBJECTS, id, "use_custom_icon");
 	use_custom_icon = gconf_client_get_bool (client, key, NULL);
 
-	panel_menu_button_load (menu_path,
-				use_menu_path,
-				custom_icon,
-				use_custom_icon,
-				tooltip,
-				panel,
-				position,
-				exactpos,
-				id);
+	panel_menu_button_load_helper (menu_path,
+				       use_menu_path,
+				       custom_icon,
+				       use_custom_icon,
+				       tooltip,
+				       panel,
+				       position,
+				       exactpos,
+				       id);
 
 	g_free (menu_path);
 	g_free (custom_icon);
diff --git a/gnome-panel/panel-menu-button.h b/gnome-panel/panel-menu-button.h
index c8e8561..399e5e7 100644
--- a/gnome-panel/panel-menu-button.h
+++ b/gnome-panel/panel-menu-button.h
@@ -73,7 +73,8 @@ gboolean   panel_menu_button_get_use_menu_path   (PanelMenuButton  *button);
 void       panel_menu_button_set_use_custom_icon (PanelMenuButton  *button,
 						  gboolean          use_custom_icon);
 
-void       panel_menu_button_load_from_gconf     (PanelWidget      *panel,
+void       panel_menu_button_load                (GSettings        *settings,
+						  PanelWidget      *panel,
 						  int               position,
 						  gboolean          exactpos,
 						  const char       *id);
diff --git a/gnome-panel/panel-object-loader.c b/gnome-panel/panel-object-loader.c
index c8848dc..010099f 100644
--- a/gnome-panel/panel-object-loader.c
+++ b/gnome-panel/panel-object-loader.c
@@ -195,41 +195,44 @@ panel_object_loader_idle_handler (gpointer dummy)
 
         switch (object_type) {
         case PANEL_OBJECT_APPLET:
-                panel_applet_frame_load (
-                                object->settings,
-                                panel_widget,
-                                object->position,
-                                object->id);
+                panel_applet_frame_load (object->settings,
+                                         panel_widget,
+                                         object->position,
+                                         object->id);
                 break;
         case PANEL_OBJECT_MENU:
-                panel_menu_button_load_from_gconf (panel_widget,
-                                object->position,
-                                TRUE,
-                                object->id);
+                panel_menu_button_load (object->settings,
+                                        panel_widget,
+                                        object->position,
+                                        TRUE,
+                                        object->id);
                 break;
         case PANEL_OBJECT_LAUNCHER:
-                launcher_load_from_gconf (panel_widget,
-                                object->position,
-                                object->id);
+                launcher_load (object->settings,
+                               panel_widget,
+                               object->position,
+                               object->id);
                 break;
         case PANEL_OBJECT_ACTION:
-                panel_action_button_load_from_gconf (
-                                panel_widget,
-                                object->position,
-                                TRUE,
-                                object->id);
+                panel_action_button_load (object->settings,
+                                          panel_widget,
+                                          object->position,
+                                          TRUE,
+                                          object->id,
+                                          object_type_detail);
                 break;
         case PANEL_OBJECT_MENU_BAR:
-                panel_menu_bar_load_from_gconf (
-                                panel_widget,
-                                object->position,
-                                TRUE,
-                                object->id);
+                panel_menu_bar_load (object->settings,
+                                     panel_widget,
+                                     object->position,
+                                     TRUE,
+                                     object->id);
                 break;
         case PANEL_OBJECT_SEPARATOR:
-                panel_separator_load_from_gconf (panel_widget,
-                                object->position,
-                                object->id);
+                panel_separator_load (object->settings,
+                                      panel_widget,
+                                      object->position,
+                                      object->id);
                 break;
         default:
                 g_assert_not_reached ();
diff --git a/gnome-panel/panel-separator.c b/gnome-panel/panel-separator.c
index f8ace3c..572933a 100644
--- a/gnome-panel/panel-separator.c
+++ b/gnome-panel/panel-separator.c
@@ -228,9 +228,10 @@ panel_separator_set_orientation (PanelSeparator   *separator,
 }
 
 void
-panel_separator_load_from_gconf (PanelWidget *panel,
-				 int          position,
-				 const char  *id)
+panel_separator_load (GSettings *settings,
+		      PanelWidget *panel,
+		      int          position,
+		      const char  *id)
 {
 	PanelSeparator *separator;
 
diff --git a/gnome-panel/panel-separator.h b/gnome-panel/panel-separator.h
index 5df4858..b7dbb2c 100644
--- a/gnome-panel/panel-separator.h
+++ b/gnome-panel/panel-separator.h
@@ -54,7 +54,8 @@ struct _PanelSeparatorClass {
 GType  panel_separator_get_type          (void) G_GNUC_CONST;	
 void   panel_separator_create            (PanelToplevel    *toplevel,
 					  int               position);
-void   panel_separator_load_from_gconf   (PanelWidget      *panel_widget,
+void   panel_separator_load              (GSettings        *settings,
+					  PanelWidget      *panel_widget,
 					  gint              position,
 					  const char       *id);
 void   panel_separator_set_orientation   (PanelSeparator   *separator,



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