Show description or URI below search suggestions

In fact, laying out the completion popup is problematic
if we have rows of different heights.
This commit is contained in:
Christian Dywan 2012-02-20 21:56:06 +01:00
parent a064a5f120
commit f3a4bd4b6a

View file

@ -562,9 +562,11 @@ midori_location_action_popup_timeout_cb (gpointer data)
else if (type == 2 /* search_view */) else if (type == 2 /* search_view */)
{ {
gchar* search_title = g_strdup_printf (_("Search for %s"), title); gchar* search_title = g_strdup_printf (_("Search for %s"), title);
gchar* search_desc = g_strdup_printf ("%s\n%s", search_title, uri);
gtk_list_store_insert_with_values (store, NULL, matches, gtk_list_store_insert_with_values (store, NULL, matches,
URI_COL, uri, TITLE_COL, search_title, YALIGN_COL, 0.25, URI_COL, uri, TITLE_COL, search_desc, YALIGN_COL, 0.25,
STYLE_COL, 1, FAVICON_COL, icon, -1); STYLE_COL, 1, FAVICON_COL, icon, -1);
g_free (search_desc);
g_free (search_title); g_free (search_title);
} }
if (icon != NULL) if (icon != NULL)
@ -588,17 +590,22 @@ midori_location_action_popup_timeout_cb (gpointer data)
{ {
gchar* uri; gchar* uri;
gchar* title; gchar* title;
const gchar* text;
gchar* desc;
GdkPixbuf* icon; GdkPixbuf* icon;
uri = midori_uri_for_search (katze_item_get_uri (item), action->key); uri = midori_uri_for_search (katze_item_get_uri (item), action->key);
title = g_strdup_printf (_("Search with %s"), katze_item_get_name (item)); title = g_strdup_printf (_("Search with %s"), katze_item_get_name (item));
text = katze_item_get_text (item);
desc = g_strdup_printf ("%s\n%s", title, text ? text : uri);
icon = midori_search_action_get_icon (item, action->treeview, NULL, FALSE); icon = midori_search_action_get_icon (item, action->treeview, NULL, FALSE);
gtk_list_store_insert_with_values (store, NULL, matches + i, gtk_list_store_insert_with_values (store, NULL, matches + i,
URI_COL, uri, TITLE_COL, title, YALIGN_COL, 0.25, URI_COL, uri, TITLE_COL, desc, YALIGN_COL, 0.25,
BACKGROUND_COL, style ? &style->bg[GTK_STATE_NORMAL] : NULL, BACKGROUND_COL, style ? &style->bg[GTK_STATE_NORMAL] : NULL,
STYLE_COL, 1, FAVICON_COL, icon, -1); STYLE_COL, 1, FAVICON_COL, icon, -1);
g_free (uri); g_free (uri);
g_free (title); g_free (title);
g_free (desc);
if (icon != NULL) if (icon != NULL)
g_object_unref (icon); g_object_unref (icon);
i++; i++;