From: Christian Dywan Date: Thu, 25 Feb 2010 22:09:31 +0000 (+0100) Subject: Include previous searches in History panel items X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f886f71536e4cee8011a3908f9eb727fa1cefd9;p=midori Include previous searches in History panel items --- diff --git a/midori/main.c b/midori/main.c index 70eb1b06..9e2f3770 100644 --- a/midori/main.c +++ b/midori/main.c @@ -373,9 +373,9 @@ midori_history_initialize (KatzeArray* array, "CREATE TABLE IF NOT EXISTS " "search (keywords text, uri text, day integer);" "CREATE TEMP VIEW history_view AS SELECT " - "1 AS type, uri, title FROM history;" + "1 AS type, uri, title, day FROM history;" "CREATE TEMP VIEW search_view AS SELECT " - "2 AS type, uri, keywords AS title FROM search;", + "2 AS type, uri, keywords AS title, day FROM search;", NULL, NULL, errmsg) != SQLITE_OK) return NULL; diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c index b10a9fc8..f86260cb 100644 --- a/midori/midori-locationaction.c +++ b/midori/midori-locationaction.c @@ -361,7 +361,7 @@ midori_location_action_popup_timeout_cb (gpointer data) sqlcmd = "SELECT type, uri, title, count() AS ct FROM history_view " "WHERE uri LIKE ?1 OR title LIKE ?1 GROUP BY uri " "UNION ALL " - "SELECT type, uri, title, count() AS ct FROM search_view " + "SELECT type, replace(uri, '%s', title) AS uri, title, count() AS ct FROM search_view " "WHERE title LIKE ?1 GROUP BY uri " "ORDER BY ct DESC LIMIT ?2"; sqlite3_prepare_v2 (db, sqlcmd, strlen (sqlcmd) + 1, &stmt, NULL); @@ -450,12 +450,10 @@ midori_location_action_popup_timeout_cb (gpointer data) FAVICON_COL, icon, -1); else if (type == 2 /* search_view */) { - gchar* search_uri = sokoke_search_uri ((gchar*)uri, (gchar*)title); gchar* search_title = g_strdup_printf (_("Search for %s"), title); gtk_list_store_insert_with_values (store, NULL, matches, - URI_COL, search_uri, TITLE_COL, search_title, YALIGN_COL, 0.25, + URI_COL, uri, TITLE_COL, search_title, YALIGN_COL, 0.25, STYLE_COL, 1, FAVICON_COL, icon, -1); - g_free (search_uri); g_free (search_title); } diff --git a/panels/midori-history.c b/panels/midori-history.c index 0d6c186e..41b19514 100644 --- a/panels/midori-history.c +++ b/panels/midori-history.c @@ -210,9 +210,12 @@ midori_history_read_from_db (MidoriHistory* history, { gchar* filterstr; - sqlcmd = "SELECT uri, title, date " - "FROM history WHERE uri LIKE ? or title LIKE ? " - "GROUP BY uri ORDER BY date ASC"; + sqlcmd = "SELECT uri, title, day FROM history_view " + "WHERE uri LIKE ? or title LIKE ? GROUP BY uri " + "UNION ALL " + "SELECT replace(uri, '%s', title) AS uri, title, day " + "FROM search_view WHERE title LIKE ?1 GROUP BY uri " + "ORDER BY day ASC"; result = sqlite3_prepare_v2 (db, sqlcmd, -1, &statement, NULL); filterstr = g_strdup_printf ("%%%s%%", filter); sqlite3_bind_text (statement, 1, filterstr, -1, g_free);