[Xfce4-commits] <midori:master> Attach bookmark table and union bookmarks in location completion
Christian Dywan
noreply at xfce.org
Mon Jul 19 21:44:04 CEST 2010
Updating branch refs/heads/master
to 9a098e2656d681c38180e9f3779433e1100e5905 (commit)
from 687de063f9bf8f2ec26bfcdf2921f3a768cb06e7 (commit)
commit 9a098e2656d681c38180e9f3779433e1100e5905
Author: Alexander Butenko <a.butenka at gmail.com>
Date: Mon Jul 19 21:07:26 2010 +0200
Attach bookmark table and union bookmarks in location completion
midori/main.c | 15 ++++++++++++---
midori/midori-locationaction.c | 3 +++
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/midori/main.c b/midori/main.c
index b8c823c..35f9b99 100644
--- a/midori/main.c
+++ b/midori/main.c
@@ -351,12 +351,14 @@ search_engines_save_to_file (KatzeArray* search_engines,
static sqlite3*
midori_history_initialize (KatzeArray* array,
const gchar* filename,
+ const gchar* bookmarks_filename,
char** errmsg)
{
sqlite3* db;
gboolean has_day;
sqlite3_stmt* stmt;
gint result;
+ gchar* sql;
has_day = FALSE;
@@ -401,6 +403,11 @@ midori_history_initialize (KatzeArray* array,
"DROP TABLE backup;"
"COMMIT;",
NULL, NULL, errmsg);
+
+ sql = g_strdup_printf ("ATTACH DATABASE '%s' AS bookmarks", bookmarks_filename);
+ sqlite3_exec (db, sql, NULL, NULL, errmsg);
+ g_free (sql);
+
return db;
}
@@ -1546,6 +1553,7 @@ main (int argc,
gchar** extensions;
MidoriWebSettings* settings;
gchar* config_file;
+ gchar* bookmarks_file;
MidoriStartup load_on_startup;
KatzeArray* search_engines;
KatzeArray* bookmarks;
@@ -1881,9 +1889,9 @@ main (int argc,
midori_startup_timer ("Search read: \t%f");
bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
- katze_assign (config_file, build_config_filename ("bookmarks.db"));
+ bookmarks_file = build_config_filename ("bookmarks.db");
errmsg = NULL;
- if ((db = midori_bookmarks_initialize (bookmarks, config_file, &errmsg)) == NULL)
+ if ((db = midori_bookmarks_initialize (bookmarks, bookmarks_file, &errmsg)) == NULL)
{
g_string_append_printf (error_messages,
_("Bookmarks couldn't be loaded: %s\n"), errmsg);
@@ -1938,12 +1946,13 @@ main (int argc,
katze_assign (config_file, build_config_filename ("history.db"));
errmsg = NULL;
- if ((db = midori_history_initialize (history, config_file, &errmsg)) == NULL)
+ if ((db = midori_history_initialize (history, config_file, bookmarks_file ,&errmsg)) == NULL)
{
g_string_append_printf (error_messages,
_("The history couldn't be loaded: %s\n"), errmsg);
g_free (errmsg);
}
+ g_free (bookmarks_file);
g_object_set_data (G_OBJECT (history), "db", db);
midori_startup_timer ("History read: \t%f");
diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c
index 3d4baec..927e80e 100644
--- a/midori/midori-locationaction.c
+++ b/midori/midori-locationaction.c
@@ -361,6 +361,9 @@ midori_location_action_popup_timeout_cb (gpointer data)
"UNION ALL "
"SELECT type, replace(uri, '%s', title) AS uri, title, count() AS ct FROM search_view "
"WHERE title LIKE ?1 GROUP BY uri "
+ "UNION ALL "
+ "SELECT '1' AS type, uri, title, '100' AS ct FROM bookmarks "
+ "WHERE title LIKE ?1 AND uri !='' "
"ORDER BY ct DESC LIMIT ?2";
sqlite3_prepare_v2 (db, sqlcmd, strlen (sqlcmd) + 1, &stmt, NULL);
}
More information about the Xfce4-commits
mailing list