Drop bookmark type field and save meta boolean properly
This commit is contained in:
parent
73376c0ea1
commit
f907128904
3 changed files with 14 additions and 13 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue