From ce56f60ccdb2604ac1de4257e84321806213dbcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Forysiuk?= Date: Sun, 29 Aug 2010 23:29:10 +0200 Subject: [PATCH] Show addon filename and/ or description in tooltip --- extensions/addons.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/extensions/addons.c b/extensions/addons.c index 3bd043b0..7f5d68a1 100644 --- a/extensions/addons.c +++ b/extensions/addons.c @@ -827,8 +827,9 @@ addons_update_elements (MidoriExtension* extension, if (liststore) gtk_list_store_clear (liststore); else - liststore = gtk_list_store_new (3, G_TYPE_POINTER, + liststore = gtk_list_store_new (4, G_TYPE_POINTER, G_TYPE_INT, + G_TYPE_STRING, G_TYPE_STRING); keyfile = g_key_file_new (); @@ -842,6 +843,9 @@ addons_update_elements (MidoriExtension* extension, elements = NULL; while (addon_files) { + gchar* filename; + gchar* tooltip; + fullpath = addon_files->data; element = g_new (struct AddonElement, 1); element->displayname = g_filename_display_basename (fullpath); @@ -888,10 +892,22 @@ addons_update_elements (MidoriExtension* extension, element->enabled = FALSE; } + filename = g_path_get_basename (element->fullpath); + if (element->description) + { + tooltip = g_strdup_printf ("%s\n\n%s", + filename, element->description); + g_free (filename); + } + else + tooltip = filename; + gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, - 0, element, 1, 0, 2, element->fullpath, -1); + 0, element, 1, 0, 2, element->fullpath, + 3, tooltip, -1); + g_free (tooltip); addon_files = g_slist_next (addon_files); elements = g_slist_prepend (elements, element); } @@ -936,7 +952,7 @@ addons_init (Addons* addons) (GtkTreeCellDataFunc)addons_treeview_render_text_cb, addons->treeview, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (addons->treeview), column); - gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (addons->treeview), 2); + gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (addons->treeview), 3); g_signal_connect (addons->treeview, "row-activated", G_CALLBACK (addons_treeview_row_activated_cb), addons);