Show tokens in Manage Search Engines dialog

This commit is contained in:
Christian Dywan 2009-02-01 23:13:00 +01:00
parent ddef47a205
commit acaa1741bd

View file

@ -729,7 +729,7 @@ midori_search_action_dialog_render_icon_cb (GtkTreeViewColumn* column,
search_action = g_object_get_data (G_OBJECT (treeview), "search-action"); search_action = g_object_get_data (G_OBJECT (treeview), "search-action");
icon = midori_search_action_get_icon (search_action, item, treeview); 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); g_object_unref (icon);
} }
@ -753,6 +753,24 @@ midori_search_action_dialog_render_text (GtkTreeViewColumn* column,
g_free (markup); 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 ("<b>%s</b>", token ? token : "");
g_object_set (renderer, "markup", markup, "yalign", 0.0, NULL);
g_free (markup);
}
static void static void
midori_search_action_editor_name_changed_cb (GtkWidget* entry, midori_search_action_editor_name_changed_cb (GtkWidget* entry,
GtkWidget* dialog) 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, gtk_tree_view_column_set_cell_data_func (column, renderer_text,
(GtkTreeCellDataFunc)midori_search_action_dialog_render_text, (GtkTreeCellDataFunc)midori_search_action_dialog_render_text,
treeview, NULL); 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); gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
scrolled = gtk_scrolled_window_new (NULL, NULL); scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),