Clear the bookmarkbar before populating and populate after editing

This commit is contained in:
Alexander Butenko 2010-07-19 20:55:59 +02:00 committed by Christian Dywan
parent b944ce0c83
commit 687de063f9

View file

@ -182,6 +182,12 @@ void
midori_bookmarks_remove_item_from_db (sqlite3* db, midori_bookmarks_remove_item_from_db (sqlite3* db,
KatzeItem* item); KatzeItem* item);
static void
midori_bookmarkbar_populate (MidoriBrowser* browser);
static void
midori_bookmarkbar_clear (GtkWidget* toolbar);
static void static void
midori_browser_new_history_item (MidoriBrowser* browser, midori_browser_new_history_item (MidoriBrowser* browser,
KatzeItem** item); KatzeItem** item);
@ -947,6 +953,8 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
g_free (selected); g_free (selected);
return_status = TRUE; return_status = TRUE;
} }
if (gtk_widget_get_visible (browser->bookmarkbar))
midori_bookmarkbar_populate (browser);
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);
return return_status; return return_status;
} }
@ -6331,7 +6339,9 @@ midori_bookmarkbar_populate (MidoriBrowser* browser)
const gchar* sqlcmd; const gchar* sqlcmd;
KatzeArray* array; KatzeArray* array;
KatzeItem* item; KatzeItem* item;
gint i; gint i = 0;
midori_bookmarkbar_clear (browser->bookmarkbar);
homepage = gtk_action_create_tool_item (_action_by_name (browser, "Homepage")); homepage = gtk_action_create_tool_item (_action_by_name (browser, "Homepage"));
gtk_tool_item_set_is_important (GTK_TOOL_ITEM (homepage), TRUE); gtk_tool_item_set_is_important (GTK_TOOL_ITEM (homepage), TRUE);
@ -6344,7 +6354,7 @@ midori_bookmarkbar_populate (MidoriBrowser* browser)
if (!db) if (!db)
return; return;
sqlcmd = "SELECT uri, title, app, folder FROM bookmarks WHERE " sqlcmd = "SELECT uri, title, app, folder, toolbar FROM bookmarks WHERE "
" toolbar = 1 ORDER BY uri ASC"; " toolbar = 1 ORDER BY uri ASC";
array = katze_array_from_sqlite (db, sqlcmd); array = katze_array_from_sqlite (db, sqlcmd);