Show title in location combo and the URI below in small font

This commit is contained in:
Christian Dywan 2008-11-04 02:50:25 +01:00
parent 50e078e728
commit 6159e49018

View file

@ -466,11 +466,11 @@ midori_location_entry_render_text_cb (GtkCellLayout* layout,
gtk_tree_model_get (model, iter, URI_COL, &uri, TITLE_COL, &title, -1); gtk_tree_model_get (model, iter, URI_COL, &uri, TITLE_COL, &title, -1);
if (title) if (title)
desc = g_markup_printf_escaped ("<b>%s</b> - %s", uri, title); desc = g_markup_printf_escaped ("%s\n<small>%s</small>", title, uri);
else else
desc = g_markup_printf_escaped ("<b>%s</b>", uri); desc = g_markup_printf_escaped ("%s", uri);
g_object_set (renderer, "markup", desc, "xpad", 5, "ypad", 5, NULL); g_object_set (renderer, "markup", desc, NULL);
g_object_set (renderer, "ellipsize-set", TRUE, g_object_set (renderer, "ellipsize-set", TRUE,
"ellipsize", PANGO_ELLIPSIZE_END, NULL); "ellipsize", PANGO_ELLIPSIZE_END, NULL);
@ -580,7 +580,8 @@ midori_location_entry_init (MidoriLocationEntry* location_entry)
store = gtk_list_store_new (N_COLS, store = gtk_list_store_new (N_COLS,
GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN); GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
filter_model = gtk_tree_model_filter_new (GTK_TREE_MODEL (store), NULL); filter_model = gtk_tree_model_filter_new (GTK_TREE_MODEL (store), NULL);
gtk_tree_model_filter_set_visible_column (GTK_TREE_MODEL_FILTER (filter_model), VISIBLE_COL); gtk_tree_model_filter_set_visible_column (
GTK_TREE_MODEL_FILTER (filter_model), VISIBLE_COL);
g_object_set (location_entry, "model", filter_model, NULL); g_object_set (location_entry, "model", filter_model, NULL);
g_object_unref (store); g_object_unref (store);
@ -592,15 +593,13 @@ midori_location_entry_init (MidoriLocationEntry* location_entry)
renderer = gtk_cell_renderer_pixbuf_new (); renderer = gtk_cell_renderer_pixbuf_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (location_entry), gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (location_entry),
renderer, FALSE); renderer, FALSE);
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (location_entry), renderer, gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (location_entry),
midori_location_entry_render_pixbuf_cb, renderer, midori_location_entry_render_pixbuf_cb, NULL, NULL);
NULL, NULL);
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (location_entry), gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (location_entry),
renderer, TRUE); renderer, TRUE);
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (location_entry), renderer, gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (location_entry),
midori_location_entry_render_text_cb, renderer, midori_location_entry_render_text_cb, NULL, NULL);
NULL, NULL);
gtk_combo_box_set_active (GTK_COMBO_BOX (location_entry), -1); gtk_combo_box_set_active (GTK_COMBO_BOX (location_entry), -1);
@ -918,7 +917,8 @@ midori_location_entry_prepend_item (MidoriLocationEntry* location_entry,
if (n > MAX_ITEMS) if (n > MAX_ITEMS)
{ {
gtk_tree_model_iter_nth_child (model, &index, NULL, n - 1); gtk_tree_model_iter_nth_child (model, &index, NULL, n - 1);
gtk_list_store_set (GTK_LIST_STORE (model), &index, VISIBLE_COL, FALSE, -1); gtk_list_store_set (GTK_LIST_STORE (model),
&index, VISIBLE_COL, FALSE, -1);
} }
gtk_list_store_set (GTK_LIST_STORE (model), &iter, VISIBLE_COL, TRUE, -1); gtk_list_store_set (GTK_LIST_STORE (model), &iter, VISIBLE_COL, TRUE, -1);
midori_location_entry_set_item (location_entry, &iter, item); midori_location_entry_set_item (location_entry, &iter, item);