diff --git a/midori/midori-browser.c b/midori/midori-browser.c index a2bf527a..2edca995 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -2561,7 +2561,7 @@ midori_browser_get_toolbar_actions (MidoriBrowser* browser) { static const gchar* actions[] = { "WindowNew", "TabNew", "Open", "SaveAs", "Print", "Find", - "Fullscreen", "Preferences", "Window", + "Fullscreen", "Preferences", "Window", "Bookmarks", "ReloadStop", "ZoomIn", "TabClose", "ZoomOut", "Separator", "Back", "Forward", "Homepage", "Panel", "Trash", "Search", "BookmarkAdd", "Previous", "Next", NULL }; @@ -2820,6 +2820,45 @@ midori_browser_bookmark_popup (GtkWidget* widget, KatzeItem* item, MidoriBrowser* browser); +static gboolean +_action_bookmarks_populate_folder (GtkAction* action, + GtkMenuShell* menu, + KatzeArray* folder, + MidoriBrowser* browser) +{ + const char* sqlcmd = "SELECT uri, title, app, folder " + "FROM bookmarks WHERE folder = '%q' ORDER BY uri ASC"; + sqlite3* db = g_object_get_data (G_OBJECT (browser->bookmarks), "db"); + const gchar* folder_name; + char* sqlcmd_folder; + KatzeArray* bookmarks; + GtkWidget* menuitem; + + if (!db) + return; + + /* Clear items from dummy array here */ + gtk_container_foreach (GTK_CONTAINER (menu), + (GtkCallback)(gtk_widget_destroy), NULL); + + folder_name = katze_item_get_name (KATZE_ITEM (folder)); + sqlcmd_folder = sqlite3_mprintf (sqlcmd, folder_name ? folder_name : ""); + bookmarks = katze_array_from_sqlite (db, sqlcmd_folder); + sqlite3_free (sqlcmd_folder); + if (!bookmarks || katze_array_is_empty (bookmarks)) + { + menuitem = gtk_image_menu_item_new_with_label (_("Empty")); + gtk_widget_set_sensitive (menuitem, FALSE); + gtk_menu_shell_append (menu, menuitem); + gtk_widget_show (menuitem); + return TRUE; + } + + katze_array_action_generate_menu (KATZE_ARRAY_ACTION (action), bookmarks, + menu, GTK_WIDGET (browser)); + return TRUE; +} + static void _action_window_populate_popup (GtkAction* action, GtkMenu* menu, @@ -5246,6 +5285,7 @@ static const gchar* ui_markup = "" "" "" + "" "" "" "