nautilus r13596 - in trunk: . src/file-manager



Author: alexl
Date: Mon Jan 14 13:46:30 2008
New Revision: 13596
URL: http://svn.gnome.org/viewvc/nautilus?rev=13596&view=rev

Log:
2008-01-14  Alexander Larsson  <alexl redhat com>

        * src/file-manager/fm-directory-view.c:
        (search_in_menu_items):
        (extension_action_callback):
	Check recursively for valid menu items (#508878)
	Patch from Choe Hwanjin.



Modified:
   trunk/ChangeLog
   trunk/src/file-manager/fm-directory-view.c

Modified: trunk/src/file-manager/fm-directory-view.c
==============================================================================
--- trunk/src/file-manager/fm-directory-view.c	(original)
+++ trunk/src/file-manager/fm-directory-view.c	Mon Jan 14 13:46:30 2008
@@ -4318,6 +4318,40 @@
 	g_free (data);
 }
 
+static gboolean
+search_in_menu_items (GList* items, const char *item_name)
+{
+	GList* list;
+	
+	for (list = items; list != NULL; list = list->next) {
+		NautilusMenu* menu;
+		char *name;
+		
+		g_object_get (list->data, "name", &name, NULL);
+		if (strcmp (name, item_name) == 0) {
+			g_free (name);
+			return TRUE;
+		}
+		g_free (name);
+
+		menu = NULL;
+		g_object_get (list->data, "menu", &menu, NULL);
+		if (menu != NULL) {
+			gboolean ret;
+			GList* submenus;
+
+			submenus = nautilus_menu_get_items (menu);
+			ret = search_in_menu_items (submenus, name);
+			nautilus_menu_item_list_free (submenus);
+			g_object_unref (menu);
+			if (ret) {
+			    return TRUE;
+			}
+		}
+	}
+	return FALSE;
+}
+
 static void
 extension_action_callback (GtkAction *action,
 			   gpointer callback_data)
@@ -4336,19 +4370,7 @@
 	items = get_all_extension_menu_items (gtk_widget_get_toplevel (GTK_WIDGET (data->view)), 
 					      data->selection);
 	
-	is_valid = FALSE;
-	for (l = items; l != NULL; l = l->next) {
-		char *name;
-		
-		g_object_get (l->data, "name", &name, NULL);
-		
-		if (strcmp (name, item_name) == 0) {
-			is_valid = TRUE;
-			g_free (name);
-			break;
-		}
-		g_free (name);
-	}
+	is_valid = search_in_menu_items (items, item_name);
 
 	for (l = items; l != NULL; l = l->next) {
 		g_object_unref (l->data);



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