From acaa1741bdaa762e04b409fb0ff7309de28b1d3c Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sun, 1 Feb 2009 23:13:00 +0100 Subject: [PATCH] Show tokens in Manage Search Engines dialog --- midori/midori-searchaction.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/midori/midori-searchaction.c b/midori/midori-searchaction.c index ea5b40c0..a5ec24e3 100644 --- a/midori/midori-searchaction.c +++ b/midori/midori-searchaction.c @@ -729,7 +729,7 @@ midori_search_action_dialog_render_icon_cb (GtkTreeViewColumn* column, search_action = g_object_get_data (G_OBJECT (treeview), "search-action"); icon = midori_search_action_get_icon (search_action, item, treeview); - g_object_set (renderer, "pixbuf", icon, NULL); + g_object_set (renderer, "pixbuf", icon, "yalign", 0.25, NULL); g_object_unref (icon); } @@ -753,6 +753,24 @@ midori_search_action_dialog_render_text (GtkTreeViewColumn* column, g_free (markup); } +static void +midori_search_action_dialog_render_token (GtkTreeViewColumn* column, + GtkCellRenderer* renderer, + GtkTreeModel* model, + GtkTreeIter* iter, + GtkWidget* treeview) +{ + KatzeItem* item; + const gchar* token; + gchar* markup; + + gtk_tree_model_get (model, iter, 0, &item, -1); + token = katze_item_get_token (item); + markup = g_markup_printf_escaped ("%s", token ? token : ""); + g_object_set (renderer, "markup", markup, "yalign", 0.0, NULL); + g_free (markup); +} + static void midori_search_action_editor_name_changed_cb (GtkWidget* entry, GtkWidget* dialog) @@ -1100,6 +1118,11 @@ midori_search_action_get_dialog (MidoriSearchAction* search_action) gtk_tree_view_column_set_cell_data_func (column, renderer_text, (GtkTreeCellDataFunc)midori_search_action_dialog_render_text, treeview, NULL); + renderer_text = gtk_cell_renderer_text_new (); + gtk_tree_view_column_pack_start (column, renderer_text, TRUE); + gtk_tree_view_column_set_cell_data_func (column, renderer_text, + (GtkTreeCellDataFunc)midori_search_action_dialog_render_token, + treeview, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column); scrolled = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),