void nautilus_menus_append_bookmark_to_menu (NautilusWindow *window, NautilusBookmark *bookmark, const char *parent_path, const char *parent_id, guint index_in_parent, GtkActionGroup *action_group, guint merge_id, GCallback refresh_callback, NautilusBookmarkFailedCallback failed_callback) { BookmarkHolder *bookmark_holder; char action_name[128]; char *name; GdkPixbuf *pixbuf; GtkAction *action; g_assert (NAUTILUS_IS_WINDOW (window)); g_assert (NAUTILUS_IS_BOOKMARK (bookmark)); bookmark_holder = bookmark_holder_new (bookmark, window, refresh_callback, failed_callback); name = nautilus_bookmark_get_name (bookmark); /* Create menu item with pixbuf */ pixbuf = nautilus_bookmark_get_pixbuf (bookmark, GTK_ICON_SIZE_MENU); g_snprintf (action_name, sizeof (action_name), "%s%d", parent_id, index_in_parent); action = gtk_action_new (action_name, name, _("Go to the location specified by this bookmark"), NULL); g_object_set_data_full (G_OBJECT (action), "menu-icon", g_object_ref (pixbuf), g_object_unref); g_signal_connect_data (action, "activate", G_CALLBACK (activate_bookmark_in_menu_item), bookmark_holder, bookmark_holder_free_cover, 0); gtk_action_group_add_action (action_group, GTK_ACTION (action)); g_object_unref (action); gtk_ui_manager_add_ui (window->details->ui_manager, merge_id, parent_path, action_name, action_name, GTK_UI_MANAGER_MENUITEM, FALSE); g_object_unref (pixbuf); g_free (name); }
void athena_menus_append_bookmark_to_menu (AthenaWindow *window, AthenaBookmark *bookmark, const char *parent_path, const char *parent_id, guint index_in_parent, GtkActionGroup *action_group, guint merge_id, GCallback refresh_callback, AthenaBookmarkFailedCallback failed_callback) { BookmarkHolder *bookmark_holder; char action_name[128]; const char *name; char *path; GIcon *icon; GtkAction *action; GtkWidget *menuitem; g_assert (ATHENA_IS_WINDOW (window)); g_assert (ATHENA_IS_BOOKMARK (bookmark)); bookmark_holder = bookmark_holder_new (bookmark, window, refresh_callback, failed_callback); name = athena_bookmark_get_name (bookmark); /* Create menu item with pixbuf */ icon = athena_bookmark_get_icon (bookmark); g_snprintf (action_name, sizeof (action_name), "%s%d", parent_id, index_in_parent); action = gtk_action_new (action_name, name, _("Go to the location specified by this bookmark"), NULL); g_object_set_data_full (G_OBJECT (action), "menu-icon", icon, g_object_unref); g_signal_connect_data (action, "activate", G_CALLBACK (activate_bookmark_in_menu_item), bookmark_holder, bookmark_holder_free_cover, 0); gtk_action_group_add_action (action_group, GTK_ACTION (action)); g_object_unref (action); gtk_ui_manager_add_ui (window->details->ui_manager, merge_id, parent_path, action_name, action_name, GTK_UI_MANAGER_MENUITEM, FALSE); path = g_strdup_printf ("%s/%s", parent_path, action_name); menuitem = gtk_ui_manager_get_widget (window->details->ui_manager, path); gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (menuitem), TRUE); g_free (path); }