LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File gnome-panel-menu-bar-migrate.patch of Package gnome-panel-nld (Project home:winddss:gnome-panel-nld)

Index: gnome-panel/applet.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/applet.c,v
retrieving revision 1.250
diff -u -p -u -r1.250 applet.c
--- gnome-panel/applet.c	22 Oct 2005 07:06:03 -0000	1.250
+++ gnome-panel/applet.c	28 Apr 2006 19:16:59 -0000
@@ -800,6 +800,54 @@ panel_applet_on_load_queue (const char *
 	return FALSE;
 }
 
+#define MAIN_MENU_IID "OAFIID:GNOME_MainMenu"
+#define MIGRATED_GCONF_KEY "/apps/panel/global/x_novell_main_menu_migrated"
+
+static GSList *menu_bars_to_migrate = NULL;
+
+static gboolean
+novell_menu_bar_migrated (void)
+{
+	GConfClient *client;
+	gboolean migrated;
+
+	client = panel_gconf_get_client ();
+	migrated = gconf_client_get_bool (client, MIGRATED_GCONF_KEY, NULL);
+
+	return migrated;
+}
+
+static void
+novell_menu_bar_migrate (void)
+{
+	GSList *l;
+	GConfClient *client;
+
+	for (l = menu_bars_to_migrate; l; l = l->next) {
+		PanelAppletToLoad *applet;
+		PanelToplevel *toplevel;
+
+		applet = l->data;
+		toplevel = panel_profile_get_toplevel_by_id (applet->toplevel_id);
+
+		if (toplevel) {
+			panel_applet_frame_create (toplevel,
+						   applet->position,
+						   MAIN_MENU_IID);
+			panel_profile_remove_from_list (PANEL_GCONF_OBJECTS,
+							applet->id);
+		}
+
+		free_applet_to_load (applet);
+	}
+
+	g_slist_free (menu_bars_to_migrate);
+	menu_bars_to_migrate = NULL;
+
+	client = panel_gconf_get_client ();
+	gconf_client_set_bool (client, MIGRATED_GCONF_KEY, TRUE, NULL);
+}
+
 static gboolean
 panel_applet_load_idle_handler (gpointer dummy)
 {
@@ -807,9 +855,11 @@ panel_applet_load_idle_handler (gpointer
 	PanelToplevel     *toplevel = NULL;
 	PanelWidget       *panel_widget;
 	GSList            *l;
+	gboolean           free_applet = TRUE;
 
 	if (!panel_applets_to_load) {
 		panel_applet_have_load_idle = FALSE;
+		novell_menu_bar_migrate ();
 		return FALSE;
 	}
 
@@ -828,6 +878,7 @@ panel_applet_load_idle_handler (gpointer
 		g_slist_free (panel_applets_to_load);
 		panel_applets_to_load = NULL;
 		panel_applet_have_load_idle = FALSE;
+		novell_menu_bar_migrate ();
 		return FALSE;
 	}
 
@@ -888,6 +939,14 @@ panel_applet_load_idle_handler (gpointer
 				applet->id);
 		break;
 	case PANEL_OBJECT_MENU_BAR:
+		
+		if (!novell_menu_bar_migrated ()) {
+			menu_bars_to_migrate = g_slist_prepend (menu_bars_to_migrate,
+								applet);
+			free_applet = FALSE;
+			break;
+		}
+
 		panel_menu_bar_load_from_gconf (
 				panel_widget,
 				applet->locked,
@@ -899,7 +958,8 @@ panel_applet_load_idle_handler (gpointer
 		break;
 	}
 
-	free_applet_to_load (applet);
+	if (free_applet)
+		free_applet_to_load (applet);
 
 	return TRUE;
 }