All pastes #248738 Raw Edit

Untitled

public text v1 · immutable
#248738 ·published 2006-11-14 23:18 UTC
rendered paste body
Index: gnome-panel/panel-menu-items.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-menu-items.c,v
retrieving revision 1.36
diff -u -p -u -p -r1.36 panel-menu-items.c
--- gnome-panel/panel-menu-items.c	14 Nov 2006 22:42:41 -0000	1.36
+++ gnome-panel/panel-menu-items.c	14 Nov 2006 23:17:49 -0000
@@ -1055,6 +1055,7 @@ panel_menu_items_append_lock_logout (Gtk
 {
 	gboolean    separator_inserted;
 	GList      *children;
+	GList      *last;
 	GtkWidget  *item;
 	const char *translate;
 	char       *label;
@@ -1062,12 +1063,11 @@ panel_menu_items_append_lock_logout (Gtk
 
 	separator_inserted = FALSE;
 	children = gtk_container_get_children (GTK_CONTAINER (menu));
-
-	if (children != NULL) {
-		while (children->next != NULL)
-			children = children->next;
-		separator_inserted = GTK_IS_SEPARATOR (GTK_WIDGET (children->data));
+	last = g_list_last (children);
+	if (last != NULL) {
+		separator_inserted = GTK_IS_SEPARATOR (GTK_WIDGET (last->data));
 	}
+	g_list_free (children);
 
 	if (panel_lock_screen_action_available ("lock")) {
 		item = panel_menu_items_create_action_item (PANEL_ACTION_LOCK);