[Xfce4-commits] <midori:master> Drop bookmark type field and save meta boolean properly
Christian Dywan
noreply at xfce.org
Thu Jul 1 23:38:07 CEST 2010
Updating branch refs/heads/master
to f9071289048eea2309c981c902e23e73be8342eb (commit)
from 73376c0ea1e8e078c4e4ef958033def84dec8b78 (commit)
commit f9071289048eea2309c981c902e23e73be8342eb
Author: Alexander Butenko <a.butenka at gmail.com>
Date: Thu Jul 1 17:03:24 2010 -0400
Drop bookmark type field and save meta boolean properly
midori/main.c | 2 +-
midori/midori-browser.c | 4 ++--
panels/midori-bookmarks.c | 21 +++++++++++----------
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/midori/main.c b/midori/main.c
index 0b40b41..9c38e3b 100644
--- a/midori/main.c
+++ b/midori/main.c
@@ -447,7 +447,7 @@ midori_bookmarks_initialize (KatzeArray* array,
if (sqlite3_exec (db,
"CREATE TABLE IF NOT EXISTS "
- "bookmarks (uri text, title text, folder text, type integer, "
+ "bookmarks (uri text, title text, folder text, "
"desc text, app integer, toolbar integer);",
NULL, NULL, errmsg) != SQLITE_OK)
return NULL;
diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index 99488a9..8113567 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -842,7 +842,7 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
#if HAVE_SQLITE
i = 0;
n = 1;
- sqlcmd = "SELECT title from bookmarks where type=0";
+ sqlcmd = "SELECT title from bookmarks where uri=''";
result = sqlite3_prepare_v2 (db, sqlcmd, -1, &statement, NULL);
while ((result = sqlite3_step (statement)) == SQLITE_ROW)
{
@@ -6540,7 +6540,7 @@ midori_bookmarkbar_populate (MidoriBrowser* browser)
subsqlcmd = g_strdup_printf ("SELECT uri, title, app FROM bookmarks WHERE "
" folder = '%s'", katze_item_get_name (item));
- subfolder = katze_array_from_sqlite (db, sqlcmd);
+ subfolder = katze_array_from_sqlite (db, subsqlcmd);
katze_item_set_name (KATZE_ITEM (subfolder), katze_item_get_name (item));
midori_bookmarkbar_insert_item (browser->bookmarkbar, KATZE_ITEM (subfolder));
g_free (subsqlcmd);
diff --git a/panels/midori-bookmarks.c b/panels/midori-bookmarks.c
index 791f786..3bd2ef4 100644
--- a/panels/midori-bookmarks.c
+++ b/panels/midori-bookmarks.c
@@ -177,11 +177,13 @@ midori_bookmarks_insert_item_db (sqlite3* db,
{
gchar* sqlcmd;
char* errmsg = NULL;
- int type = 0;
gchar* parent;
+ gchar* uri;
if (KATZE_ITEM_IS_BOOKMARK (item))
- type = 1;
+ uri = g_strdup (katze_item_get_uri (item));
+ else
+ uri = g_strdup ("");
if (folder)
parent = g_strdup (folder);
@@ -194,14 +196,13 @@ midori_bookmarks_insert_item_db (sqlite3* db,
handling of katze_item_get_meta_integer(). */
/* FIXME: Need proper single quote escaping. */
sqlcmd = g_strdup_printf (
- "INSERT into bookmarks (uri, title, folder, type, toolbar, app) values"
- " ('%s', '%s', '%s', %d, %d, %d)",
- katze_item_get_uri (item),
+ "INSERT into bookmarks (uri, title, folder, toolbar, app) values"
+ " ('%s', '%s', '%s', %d, %d)",
+ uri,
katze_item_get_name (item),
parent,
- type,
- (int)katze_item_get_meta_integer (item, "toolbar"),
- (int)katze_item_get_meta_integer (item, "app"));
+ katze_item_get_meta_boolean (item, "toolbar"),
+ katze_item_get_meta_boolean (item, "app"));
if (sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg) != SQLITE_OK)
{
@@ -209,6 +210,7 @@ midori_bookmarks_insert_item_db (sqlite3* db,
sqlite3_free (errmsg);
}
+ g_free (uri);
g_free (parent);
g_free (sqlcmd);
}
@@ -226,8 +228,7 @@ midori_bookmarks_remove_item_from_db (sqlite3* db,
katze_item_get_uri (item));
else
sqlcmd = sqlite3_mprintf (
- "DELETE FROM bookmarks WHERE folder = '%q' OR title = '%q'",
- katze_item_get_name (item),
+ "DELETE FROM bookmarks WHERE title = '%q'",
katze_item_get_name (item));
if (sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg) != SQLITE_OK)
More information about the Xfce4-commits
mailing list