Patch for panel -- done better this time



I found out I do not need to keep pointers to every newly-created
GnomePixmap around (of course not; I was stupid), so I ditched that,
and I added the Lock Screen icon to the appropriate entry in the foot
menu, too.

BTW, last time I've got absolutely no reaction whatsoever to this
patch, has anyone noticed it? The HACKING file tells me to submit
patches to the list though...

===START DIFF===

--- menu.c.old	Sun Aug  8 13:06:20 1999
+++ menu.c	Mon Aug  9 15:54:48 1999
@@ -2430,7 +2430,10 @@
 	make_panel_submenu(panel_menu,TRUE);
 
 	menuitem = gtk_menu_item_new ();
-	setup_menuitem (menuitem, NULL, _("Remove this panel"));
+	setup_menuitem (menuitem,
+					gnome_stock_pixmap_widget(panel_menu,
+											  GNOME_STOCK_PIXMAP_REMOVE),
+					_("Remove this panel"));
 	gtk_menu_append (GTK_MENU (panel_menu), menuitem);
 	gtk_signal_connect_object (GTK_OBJECT (menuitem), "activate",
 				   GTK_SIGNAL_FUNC(gtk_widget_destroy),
@@ -2583,6 +2586,8 @@
 {
 	GtkWidget *menuitem;
 	GtkWidget *m;
+	char *pixmap_filename;
+	GnomePixmap *pixmap;
 
 	menuitem = gtk_menu_item_new ();
 	setup_menuitem (menuitem, 0, _("Add applet"));
@@ -2593,35 +2598,75 @@
 			   GTK_SIGNAL_FUNC(submenu_to_display),
 			   menuitem);
 
-	menuitem = gtk_menu_item_new ();
-	setup_menuitem (menuitem, 0, _("Add main menu"));
+	/* Menu entries with external pixmaps:
+	   1. Get file name with gnome_pixmap_file
+	   2. Warn if lookup failed
+	   3. Get pixmap from file with gnome_pixmap_new_from_file_at_size
+	   4. Warn if load failed
+	   5. Use pixmap. Yahoo.
+	   
+	   Gurus, please tell me if any of these steps are superfluous, thanks.
+	   mawa */
+
+	pixmap_filename = gnome_pixmap_file("gnome-logo-icon-transparent.png");
+	if (NULL == pixmap_filename)
+	  g_warning(_("Could not find pixmap `gnome-logo-icon-transparent.png'"));
+	pixmap =
+	  GNOME_PIXMAP(gnome_pixmap_new_from_file_at_size(pixmap_filename, 24, 24));
+	if (NULL == pixmap)
+	  g_warning(_("Could not load pixmap %s"), pixmap_filename);
+	menuitem = gtk_menu_item_new ();
+	setup_menuitem (menuitem, 
+					GTK_WIDGET(pixmap),
+					_("Add main menu"));
 	gtk_menu_append (GTK_MENU (menu), menuitem);
 	gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
 			   GTK_SIGNAL_FUNC(add_menu_to_panel),
 			   NULL);
 	setup_internal_applet_drag(menuitem, "MENU:MAIN");
 
+	pixmap_filename = gnome_pixmap_file("panel-drawer.png");
+	if (NULL == pixmap_filename)
+	  g_warning(_("Could not find pixmap `panel-drawer.png'"));
+	pixmap = GNOME_PIXMAP(gnome_pixmap_new_from_file_at_size(pixmap_filename, 24, 24));
+	if (NULL == pixmap)
+	  g_warning(_("Could not load pixmap %s"), pixmap_filename);
 	menuitem = gtk_menu_item_new ();
-	setup_menuitem (menuitem, 0, _("Add drawer"));
+	setup_menuitem (menuitem,
+					GTK_WIDGET(pixmap),
+					_("Add drawer"));
 	gtk_menu_append (GTK_MENU (menu), menuitem);
 	gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
 			   (GtkSignalFunc) add_drawer_to_panel,
 			   NULL);
 	setup_internal_applet_drag(menuitem, "DRAWER:NEW");
 
-
-	menuitem = gtk_menu_item_new ();
-	setup_menuitem (menuitem, 0, _("Add log out button"));
+	pixmap_filename = gnome_pixmap_file("gnome-term-night.png");
+	if (NULL == pixmap_filename)
+	  g_warning(_("Could not find pixmap `gnome-term-night.png'"));
+	pixmap = GNOME_PIXMAP(gnome_pixmap_new_from_file_at_size(pixmap_filename, 24, 24));
+	if (NULL == pixmap)
+	  g_warning(_("Could not load pixmap %s"), pixmap_filename);
+	menuitem = gtk_menu_item_new ();
+	setup_menuitem (menuitem, 
+					GTK_WIDGET(pixmap),
+					_("Add log out button"));
 	gtk_menu_append (GTK_MENU (menu), menuitem);
 	gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
 			   GTK_SIGNAL_FUNC(add_logout_to_panel),
 			   NULL);
 	setup_internal_applet_drag(menuitem, "LOGOUT:NEW");
 
-	
-	
+	pixmap_filename = gnome_pixmap_file("gnome-lockscreen.png");
+	if (NULL == pixmap_filename)
+	  g_warning(_("Could not find pixmap `gnome-lockscreen.png'"));
+	pixmap = GNOME_PIXMAP(gnome_pixmap_new_from_file_at_size(pixmap_filename, 24, 24));
+	if (NULL == pixmap)
+	  g_warning(_("Could not load pixmap %s"), pixmap_filename);	
 	menuitem = gtk_menu_item_new ();
-	setup_menuitem (menuitem, 0, _("Add lock button"));
+	setup_menuitem (menuitem,
+					GTK_WIDGET(pixmap),
+					_("Add lock button"));
 	gtk_menu_append (GTK_MENU (menu), menuitem);
 	gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
 			   GTK_SIGNAL_FUNC(add_lock_to_panel),
@@ -2636,8 +2681,16 @@
 			   GTK_SIGNAL_FUNC(ask_about_swallowing_cb),NULL);
 	setup_internal_applet_drag(menuitem, "SWALLOW:ASK");
 
-	menuitem = gtk_menu_item_new ();
-	setup_menuitem (menuitem, 0, _("Add new launcher"));
+	pixmap_filename = gnome_pixmap_file("launcher-program.png");
+	if (NULL == pixmap_filename)
+	  g_warning(_("Could not find pixmap `launcherprogram.png'"));
+	pixmap = GNOME_PIXMAP(gnome_pixmap_new_from_file_at_size(pixmap_filename, 24, 24));
+	if (NULL == pixmap)
+	  g_warning(_("Could not load pixmap %s"), pixmap_filename);	
+	menuitem = gtk_menu_item_new ();
+	setup_menuitem (menuitem, 
+					GTK_WIDGET(pixmap),
+					_("Add new launcher"));
 	gtk_menu_append (GTK_MENU (menu), menuitem);
 	gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
 			   GTK_SIGNAL_FUNC(ask_about_launcher_cb),NULL);
@@ -2684,7 +2737,10 @@
 	add_menu_separator(menu);
 
         menuitem = gtk_menu_item_new ();
-	setup_menuitem (menuitem, 0, _("Create new panel"));
+	setup_menuitem (menuitem,
+					gnome_stock_pixmap_widget(menu,
+											  GNOME_STOCK_PIXMAP_NEW),
+					_("Create new panel"));
 	gtk_menu_append (GTK_MENU (menu), menuitem);
 	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem),
 				   create_add_panel_submenu());
@@ -2707,6 +2763,8 @@
 {
 	GtkWidget *menuitem;
 	GtkWidget *panel_menu;
+	char *pixmap_filename;
+	GnomePixmap *pixmap;
 	char *char_tmp;
 
 	/* Panel entry */
@@ -2726,8 +2784,16 @@
 
 	add_menu_separator (menu);
 
-	menuitem = gtk_menu_item_new ();
-	setup_menuitem (menuitem, 0, _("Lock screen"));
+	pixmap_filename = gnome_pixmap_file("gnome-lockscreen.png");
+	if (NULL == pixmap_filename)
+	  g_warning(_("Could not find pixmap `gnome-lockscreen.png'"));
+	pixmap = GNOME_PIXMAP(gnome_pixmap_new_from_file_at_size(pixmap_filename, 24, 24));
+	if (NULL == pixmap)
+	  g_warning(_("Could not load pixmap %s"), pixmap_filename);
+	menuitem = gtk_menu_item_new ();
+	setup_menuitem (menuitem, 
+					GTK_WIDGET(pixmap),
+					_("Lock screen"));
 	gtk_menu_append (GTK_MENU (menu), menuitem);
 	gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
 			    GTK_SIGNAL_FUNC(panel_lock), 0);

===END DIFF===

mawa
-- 
My guess is Absoft did things right.  Now if we could just get
Microsoft on the bandwagon.
                                                       -- Bill Seymour



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