Buttons submenu



Attached is a patch that moves the 5 add button menu items
(Log out, lock, screenshot, run and search) from the main "Add to panel"
menu to a submenu.

I've removed the "button" from the names of each menu item as seeing
Button every line looks funny. Should the "Lock" item be renamed "Lock
Screen" or "Lock Display" or "Lock Computer" or something?

iain
-- 
"I think what we don't need is this worldwide apathy where people wait
for a leader. It shouldn't be like that, especially after Spetember 11.
England feels a bit like Germany before Adolf Hitler came along. There's
more unemployment, more crime and people are wondering, `Who is going to
get us out of this shit?` It's very dangerous." -- Alec Empire
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/ChangeLog,v
retrieving revision 1.1923
diff -U2 -r1.1923 ChangeLog
--- ChangeLog	17 Nov 2002 00:08:00 -0000	1.1923
+++ ChangeLog	25 Nov 2002 01:02:21 -0000
@@ -1,2 +1,9 @@
+2002-11-24  Iain <iain prettypeople org>
+
+	* menu.c (setup_stock_menu_item): Check if the stock_is is NULL.
+	(create_button_menu): Create a submenu for the buttons.
+	(make_add_submenu): Create a buttons submenu and move all the buttons
+	into it.
+
 2002-11-17  Mark McLoughlin  <mark skynet ie>
 
Index: menu.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/menu.c,v
retrieving revision 1.622
diff -U2 -r1.622 menu.c
--- menu.c	12 Nov 2002 09:22:37 -0000	1.622
+++ menu.c	25 Nov 2002 01:02:22 -0000
@@ -2906,6 +2906,8 @@
 		       const char *title)
 {
-	panel_load_menu_image_deferred (
+	if (stock_id != NULL) {
+		panel_load_menu_image_deferred (
 			item, stock_id, NULL, NULL, FALSE);
+	}
 
 	setup_menuitem (item, NULL, title);
@@ -3012,4 +3014,57 @@
 }
 
+static GtkWidget *
+create_button_menu (GtkWidget *menu,
+		    gboolean fake_submenus)
+{
+	GtkWidget *menuitem;
+	
+	if (menu == NULL) {
+		menu = menu_new ();
+	}
+
+	menuitem = gtk_image_menu_item_new ();
+	setup_stock_menu_item (menuitem, PANEL_STOCK_LOGOUT, _("Log Out"));
+	gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+	g_signal_connect (menuitem, "activate",
+			  G_CALLBACK (add_action_button_to_panel),
+			  GINT_TO_POINTER (PANEL_ACTION_LOGOUT));
+	setup_internal_applet_drag (menuitem, "ACTION:logout:NEW");
+	
+	menuitem = gtk_image_menu_item_new ();
+	setup_stock_menu_item (menuitem, PANEL_STOCK_LOCKSCREEN, _("Lock"));
+	gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+	g_signal_connect (menuitem, "activate",
+			  G_CALLBACK (add_action_button_to_panel),
+			  GINT_TO_POINTER (PANEL_ACTION_LOCK));
+	setup_internal_applet_drag (menuitem, "ACTION:lock:NEW");
+
+	menuitem = gtk_image_menu_item_new ();
+	setup_stock_menu_item (menuitem, PANEL_STOCK_SCREENSHOT, _("Screenshot"));
+	gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+	g_signal_connect (menuitem, "activate",
+			  G_CALLBACK (add_action_button_to_panel),
+			  GINT_TO_POINTER (PANEL_ACTION_SCREENSHOT));
+	setup_internal_applet_drag (menuitem, "ACTION:screenshot:NEW");
+
+	menuitem = gtk_image_menu_item_new ();
+	setup_stock_menu_item (menuitem, PANEL_STOCK_SEARCHTOOL, _("Search"));
+	gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+	g_signal_connect (menuitem, "activate",
+			  G_CALLBACK (add_action_button_to_panel),
+			  GINT_TO_POINTER (PANEL_ACTION_SEARCH));
+	setup_internal_applet_drag (menuitem, "ACTION:search:NEW");
+
+	menuitem = gtk_image_menu_item_new ();
+	setup_stock_menu_item (menuitem, PANEL_STOCK_RUN, _("Run"));
+	gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+	g_signal_connect (menuitem, "activate",
+			  G_CALLBACK (add_action_button_to_panel),
+			  GINT_TO_POINTER (PANEL_ACTION_RUN));
+	setup_internal_applet_drag (menuitem, "ACTION:run:NEW");
+
+	return menu;
+}	
+		
 static void
 remove_panel_accept (GtkWidget *w,
@@ -3347,4 +3402,13 @@
 	g_signal_connect (G_OBJECT (m),"show",
 			  G_CALLBACK (submenu_to_display), NULL);
+
+	menuitem = gtk_image_menu_item_new ();
+	setup_stock_menu_item (menuitem, NULL, _("Button"));
+	gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+	
+	m = create_button_menu (NULL, fake_submenus);
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), m);
+	g_signal_connect (G_OBJECT (m), "show",
+			  G_CALLBACK (submenu_to_display), NULL);
 	
   	menuitem = gtk_image_menu_item_new ();
@@ -3364,43 +3428,4 @@
 	setup_internal_applet_drag(menuitem, "DRAWER:NEW");
 
-	menuitem = gtk_image_menu_item_new ();
-	setup_stock_menu_item (menuitem, PANEL_STOCK_LOGOUT, _("Log Out Button"));
-	gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
-	g_signal_connect (menuitem, "activate",
-			  G_CALLBACK (add_action_button_to_panel),
-			  GINT_TO_POINTER (PANEL_ACTION_LOGOUT));
-	setup_internal_applet_drag (menuitem, "ACTION:logout:NEW");
-	
-	menuitem = gtk_image_menu_item_new ();
-	setup_stock_menu_item (menuitem, PANEL_STOCK_LOCKSCREEN, _("Lock Button"));
-	gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
-	g_signal_connect (menuitem, "activate",
-			  G_CALLBACK (add_action_button_to_panel),
-			  GINT_TO_POINTER (PANEL_ACTION_LOCK));
-	setup_internal_applet_drag (menuitem, "ACTION:lock:NEW");
-
-	menuitem = gtk_image_menu_item_new ();
-	setup_stock_menu_item (menuitem, PANEL_STOCK_SCREENSHOT, _("Screenshot Button"));
-	gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
-	g_signal_connect (menuitem, "activate",
-			  G_CALLBACK (add_action_button_to_panel),
-			  GINT_TO_POINTER (PANEL_ACTION_SCREENSHOT));
-	setup_internal_applet_drag (menuitem, "ACTION:screenshot:NEW");
-
-	menuitem = gtk_image_menu_item_new ();
-	setup_stock_menu_item (menuitem, PANEL_STOCK_SEARCHTOOL, _("Search Button"));
-	gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
-	g_signal_connect (menuitem, "activate",
-			  G_CALLBACK (add_action_button_to_panel),
-			  GINT_TO_POINTER (PANEL_ACTION_SEARCH));
-	setup_internal_applet_drag (menuitem, "ACTION:search:NEW");
-
-	menuitem = gtk_image_menu_item_new ();
-	setup_stock_menu_item (menuitem, PANEL_STOCK_RUN, _("Run Button"));
-	gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
-	g_signal_connect (menuitem, "activate",
-			  G_CALLBACK (add_action_button_to_panel),
-			  GINT_TO_POINTER (PANEL_ACTION_RUN));
-	setup_internal_applet_drag (menuitem, "ACTION:run:NEW");
 }
 


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