patch for project combo button



-- 
axel c <axel banzais org>
Index: project-tool.c
===================================================================
RCS file: /cvs/gnome/scaffold/plugins/project-manager/project-tool.c,v
retrieving revision 1.50
diff -u -p -r1.50 project-tool.c
--- project-tool.c	14 Sep 2003 17:32:42 -0000	1.50
+++ project-tool.c	18 Sep 2003 11:08:22 -0000
@@ -439,6 +439,7 @@ recent_project_cb (GdlRecent  *recent,
 		   const char *uri,
 		   gpointer    data)
 {
+	
 	ProjectTool *proj_tool = (ProjectTool *)data;
 
 	set_build (proj_tool, uri);
@@ -1102,6 +1103,30 @@ session_save_cb (ScaffoldShell *shell,
 }
 
 static void
+proj_recent_helper (gchar *element, GtkWidget *menup)
+{
+	GtkMenuShell	*menu;
+	GtkWidget		*item;
+	const gchar		*element_base;
+
+	g_return_if_fail (element != NULL);
+	g_return_if_fail (menup != NULL);
+	g_return_if_fail (GTK_IS_MENU (menup));
+
+	menu = GTK_MENU_SHELL (menup);
+
+	element_base = g_path_get_basename (element);
+
+	if (element_base)
+	{
+		item = gtk_menu_item_new_with_label (element);
+		gtk_widget_show (item);
+		gtk_menu_shell_append (menu, item);
+	}
+
+}
+	
+static void
 shell_set (ScaffoldTool *tool)
 {
 	ProjectTool *proj_tool;
@@ -1110,6 +1135,8 @@ shell_set (ScaffoldTool *tool)
 	GdkPixbuf *icon;
 	BonoboControl *control;
 
+	GSList		*proj_recent_list = NULL;
+
 	g_return_if_fail (tool != NULL);
 	g_return_if_fail (SCAFFOLD_IS_TOOL (tool));
 
@@ -1136,8 +1163,8 @@ shell_set (ScaffoldTool *tool)
 	proj_tool->project_menu = gtk_menu_new ();
 	gdl_combo_button_set_label (GDL_COMBO_BUTTON (proj_tool->project_combo),
 				    _("Project"));
-	gdl_combo_button_set_menu (GDL_COMBO_BUTTON (proj_tool->project_combo),
-				   GTK_MENU (proj_tool->project_menu));
+	//gdl_combo_button_set_menu (GDL_COMBO_BUTTON (proj_tool->project_combo),
+	//			   GTK_MENU (proj_tool->project_menu));
 	icon = gdk_pixbuf_new_from_file (SCAFFOLD_IMAGES "/scaffold-open-project.png", NULL);
 	gdl_combo_button_set_icon (GDL_COMBO_BUTTON (proj_tool->project_combo), icon);
 	gdk_pixbuf_unref (icon);
@@ -1207,6 +1234,15 @@ shell_set (ScaffoldTool *tool)
 	gdl_recent_set_ui_component (recent, tool->uic);
 
 	proj_tool->recent = recent;
+
+	proj_recent_list = gdl_recent_get_list (recent);
+	if (proj_recent_list)
+	{
+		g_slist_foreach (proj_recent_list, (GFunc)proj_recent_helper, proj_tool->project_menu);		
+		gdl_combo_button_set_menu (GDL_COMBO_BUTTON (proj_tool->project_combo),
+                   GTK_MENU (proj_tool->project_menu));
+		g_slist_free (proj_recent_list);
+	}
 }
 
 static void


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