Store 'description' property of a bookmark

This commit is contained in:
Alexander Butenko 2010-07-23 13:57:59 -04:00 committed by Christian Dywan
parent 1339dc671b
commit 5e250cc70d
3 changed files with 13 additions and 6 deletions

View file

@ -796,6 +796,12 @@ katze_item_set_value_from_column (sqlite3_stmt* stmt,
folder = sqlite3_column_text (stmt, column); folder = sqlite3_column_text (stmt, column);
katze_item_set_meta_string (item, name, (gchar*)folder); katze_item_set_meta_string (item, name, (gchar*)folder);
} }
else if (g_str_equal (name, "desc"))
{
const unsigned char* text;
text = sqlite3_column_text (stmt, column);
katze_item_set_text (item, (gchar*)text);
}
else else
g_warn_if_reached (); g_warn_if_reached ();
} }

View file

@ -6372,7 +6372,7 @@ midori_bookmarkbar_populate (MidoriBrowser* browser)
if (!db) if (!db)
return; return;
sqlcmd = "SELECT uri, title, app, folder, toolbar FROM bookmarks WHERE " sqlcmd = "SELECT uri, title, desc, 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);
@ -6392,7 +6392,7 @@ midori_bookmarkbar_populate (MidoriBrowser* browser)
KatzeArray* subfolder; KatzeArray* subfolder;
gchar* subsqlcmd; gchar* subsqlcmd;
subsqlcmd = g_strdup_printf ("SELECT uri, title, app FROM bookmarks WHERE " subsqlcmd = g_strdup_printf ("SELECT uri, title, desc, app FROM bookmarks WHERE "
" folder = '%s' and uri != ''", katze_item_get_name (item)); " folder = '%s' and uri != ''", katze_item_get_name (item));
subfolder = katze_array_from_sqlite (db, subsqlcmd); subfolder = katze_array_from_sqlite (db, subsqlcmd);
katze_item_set_name (KATZE_ITEM (subfolder), katze_item_get_name (item)); katze_item_set_name (KATZE_ITEM (subfolder), katze_item_get_name (item));

View file

@ -157,7 +157,7 @@ midori_bookmarks_read_from_db (MidoriBookmarks* bookmarks,
if (keyword && *keyword) if (keyword && *keyword)
{ {
gchar* filterstr; gchar* filterstr;
sqlcmd = "SELECT uri, title, app, toolbar, folder from bookmarks where " sqlcmd = "SELECT uri, title, desc, app, toolbar, folder from bookmarks where "
" title like ? ORDER BY uri DESC"; " title like ? ORDER BY uri DESC";
result = sqlite3_prepare_v2 (db, sqlcmd, -1, &statement, NULL); result = sqlite3_prepare_v2 (db, sqlcmd, -1, &statement, NULL);
filterstr = g_strdup_printf ("%%%s%%", keyword); filterstr = g_strdup_printf ("%%%s%%", keyword);
@ -168,7 +168,7 @@ midori_bookmarks_read_from_db (MidoriBookmarks* bookmarks,
{ {
if (!folder) if (!folder)
folder = ""; folder = "";
sqlcmd = "SELECT uri, title, app, toolbar, folder from bookmarks where " sqlcmd = "SELECT uri, title, desc, app, toolbar, folder from bookmarks where "
" folder = ? ORDER BY uri DESC"; " folder = ? ORDER BY uri DESC";
result = sqlite3_prepare_v2 (db, sqlcmd, -1, &statement, NULL); result = sqlite3_prepare_v2 (db, sqlcmd, -1, &statement, NULL);
sqlite3_bind_text (statement, 1, g_strdup (folder), -1, g_free); sqlite3_bind_text (statement, 1, g_strdup (folder), -1, g_free);
@ -232,10 +232,11 @@ midori_bookmarks_insert_item_db (sqlite3* db,
parent = g_strdup (""); parent = g_strdup ("");
sqlcmd = sqlite3_mprintf ( sqlcmd = sqlite3_mprintf (
"INSERT into bookmarks (uri, title, folder, toolbar, app) values" "INSERT into bookmarks (uri, title, desc, folder, toolbar, app) values"
" ('%q', '%q', '%q', %d, %d)", " ('%q', '%q', '%q', '%q', %d, %d)",
uri, uri,
katze_item_get_name (item), katze_item_get_name (item),
katze_item_get_text (item),
parent, parent,
katze_item_get_meta_boolean (item, "toolbar"), katze_item_get_meta_boolean (item, "toolbar"),
katze_item_get_meta_boolean (item, "app")); katze_item_get_meta_boolean (item, "app"));