From 053048d05eeb5ba5b1c847276209a4910f893405 Mon Sep 17 00:00:00 2001 From: Alexander Butenko Date: Sat, 19 Jun 2010 09:56:50 -0400 Subject: [PATCH] Fixed handling of bookmark meta data sqlite doesn't store negative value but rather 0 and 1, so we work with these values now. As a side effect it makes the code easier to read. --- TODO | 1 - midori/midori-browser.c | 10 ++++------ panels/midori-bookmarks.c | 12 ------------ 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/TODO b/TODO index 6d51e175..75e1dd9e 100644 --- a/TODO +++ b/TODO @@ -93,7 +93,6 @@ TODO: . Prevent dead tabs: download, aborted page BOOKMARK ISSUES: - . Show on toolbar is not working . Bookmark menu is not populated . Bookmark toolbar is broken . Import is broken diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 21708791..0db0f51f 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -893,7 +893,7 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser, gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); check_toolbar = gtk_check_button_new_with_mnemonic (_("Show in the tool_bar")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_toolbar), - katze_item_get_meta_string (bookmark, "toolbar") != NULL); + katze_item_get_meta_integer (bookmark, "toolbar")); gtk_box_pack_start (GTK_BOX (hbox), check_toolbar, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (content_area), hbox); gtk_widget_show_all (hbox); @@ -908,7 +908,7 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser, gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); check_app = gtk_check_button_new_with_mnemonic (_("Run as _web application")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_app), - katze_item_get_meta_string (bookmark, "app") != NULL); + katze_item_get_meta_integer (bookmark, "app")); gtk_box_pack_start (GTK_BOX (hbox), check_app, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (content_area), hbox); gtk_widget_show_all (hbox); @@ -926,15 +926,13 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser, gtk_entry_get_text (GTK_ENTRY (entry_desc))); /* FIXME: Toolbar is not working?? */ katze_item_set_meta_integer (bookmark, "toolbar", - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_toolbar)) - ? 1 : -1); + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_toolbar))); if (!KATZE_IS_ARRAY (bookmark)) { katze_item_set_uri (bookmark, gtk_entry_get_text (GTK_ENTRY (entry_uri))); katze_item_set_meta_integer (bookmark, "app", - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_app)) - ? 1 : -1); + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_app))); } if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_toolbar))) diff --git a/panels/midori-bookmarks.c b/panels/midori-bookmarks.c index dcd84c38..cbac36c7 100644 --- a/panels/midori-bookmarks.c +++ b/panels/midori-bookmarks.c @@ -174,12 +174,6 @@ midori_bookmarks_read_from_db (MidoriBookmarks* bookmarks, app = sqlite3_column_int64 (statement, 3); toolbar = sqlite3_column_int64 (statement, 4); - - if (app == 0) - app = -1; - if (toolbar == 0) - toolbar = -1; - item = katze_item_new (); katze_item_set_name (item, (gchar*)title); katze_item_set_meta_integer (item, "toolbar", toolbar); @@ -235,12 +229,6 @@ midori_bookmarks_insert_item_db (sqlite3* db, else parent = g_strdup (""); - if (katze_item_get_meta_integer (item, "toolbar") == -1) - katze_item_set_meta_integer (item, "toolbar", 0); - - if (katze_item_get_meta_integer (item, "app") == -1) - katze_item_set_meta_integer (item, "app", 0); - sqlcmd = sqlite3_mprintf ( "INSERT into bookmarks (uri, title, folder, type, toolbar, app) values" " ('%q', '%q', '%q', %u, %u, %u)",