Refresh bookmark sidebar on new items

This commit is contained in:
Alexander Butenko 2010-06-14 02:39:42 -04:00 committed by Christian Dywan
parent 0b99bbdd4e
commit 09d9615964
3 changed files with 25 additions and 7 deletions

3
TODO
View file

@ -94,8 +94,9 @@ TODO:
BOOKMARK ISSUES:
. Show on toolbar is not working
. Refresh of sidebar is not done
. Bookmark menu is not populated
. Bookmark toolbar is broken
. Import is broken
. Integration with locationbar search
. Can't remove folder
. Can't select folder while adding new bookmark

View file

@ -935,7 +935,17 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
#if HAVE_SQLITE
midori_bookmarks_remove_item_from_db (db, bookmark);
if (!strcmp (selected, _("Toplevel folder")))
{
GtkTreeView* treeview;
GtkTreeModel* model;
midori_bookmarks_insert_item_db (db, bookmark, "");
treeview = g_object_get_data (G_OBJECT (browser->bookmarks), "treeview");
model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
/* FIXME: We need to add item in the end of the list */
gtk_tree_store_insert_with_values (GTK_TREE_STORE (model),
NULL, NULL, 999, 0, bookmark, -1);
}
else
midori_bookmarks_insert_item_db (db, bookmark, selected);
#endif

View file

@ -474,6 +474,7 @@ midori_bookmarks_set_app (MidoriBookmarks* bookmarks,
g_object_ref (app);
bookmarks->array = katze_object_get_object (app, "bookmarks");
g_object_set_data (G_OBJECT (bookmarks->array), "treeview", bookmarks->treeview);
#if HAVE_SQLITE
midori_bookmarks_read_from_db (bookmarks, GTK_TREE_STORE (model), NULL, "");
@ -729,13 +730,19 @@ midori_bookmarks_delete_activate_cb (GtkWidget* menuitem,
#if HAVE_SQLITE
sqlite3* db;
#endif
GtkTreeModel* model;
GtkTreeIter iter;
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (bookmarks->treeview),
&model, &iter))
{
item = (KatzeItem*)g_object_get_data (G_OBJECT (menuitem), "KatzeItem");
#if HAVE_SQLITE
db = g_object_get_data (G_OBJECT (bookmarks->array), "db");
midori_bookmarks_remove_item_from_db (db, item);
#endif
/* FIXME: Refresh menu */
gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
}
}
static void