static void extension_action_callback (GtkAction *action, gpointer callback_data) { nemo_menu_item_activate (NEMO_MENU_ITEM (callback_data)); }
static void add_extension_menu_items (NemoWindow *window, guint merge_id, GtkActionGroup *action_group, GList *menu_items, const char *subdirectory) { GtkUIManager *ui_manager; GList *l; ui_manager = window->details->ui_manager; for (l = menu_items; l; l = l->next) { NemoMenuItem *item; NemoMenu *menu; GtkAction *action; char *path; item = NEMO_MENU_ITEM (l->data); g_object_get (item, "menu", &menu, NULL); action = nemo_action_from_menu_item (item); gtk_action_group_add_action_with_accel (action_group, action, NULL); path = g_build_path ("/", POPUP_PATH_EXTENSION_ACTIONS, subdirectory, NULL); gtk_ui_manager_add_ui (ui_manager, merge_id, path, gtk_action_get_name (action), gtk_action_get_name (action), (menu != NULL) ? GTK_UI_MANAGER_MENU : GTK_UI_MANAGER_MENUITEM, FALSE); g_free (path); path = g_build_path ("/", MENU_PATH_EXTENSION_ACTIONS, subdirectory, NULL); gtk_ui_manager_add_ui (ui_manager, merge_id, path, gtk_action_get_name (action), gtk_action_get_name (action), (menu != NULL) ? GTK_UI_MANAGER_MENU : GTK_UI_MANAGER_MENUITEM, FALSE); g_free (path); /* recursively fill the menu */ if (menu != NULL) { char *subdir; GList *children; children = nemo_menu_get_items (menu); subdir = g_build_path ("/", subdirectory, "/", gtk_action_get_name (action), NULL); add_extension_menu_items (window, merge_id, action_group, children, subdir); nemo_menu_item_list_free (children); g_free (subdir); } } }