]> spindle.queued.net Git - midori/commitdiff
Show tokens in Manage Search Engines dialog
authorChristian Dywan <christian@twotoasts.de>
Sun, 1 Feb 2009 22:13:00 +0000 (23:13 +0100)
committerChristian Dywan <christian@twotoasts.de>
Sun, 1 Feb 2009 22:13:00 +0000 (23:13 +0100)
midori/midori-searchaction.c

index ea5b40c0ec80d6f41cf17904fea1c7d52f18acb1..a5ec24e3d889c30f3964de38cdc179b0aa300608 100644 (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");
     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 ("<b>%s</b>", 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),