Added metadata tooltips to the thumbnails in the Background tab. Needs
2007-06-17 Denis Washington <denisw@svn.gnome.org> * appearance-desktop.c: (desktop_init): (wp_view_tooltip_cb): * gnome-wp-item.c: (gnome_wp_item_update_description): Added metadata tooltips to the thumbnails in the Background tab. Needs GTK+ 2.11 to compile (but is surrounded with GTK_CHECK_VERSION() for compilation with older gtk+ versions). svn path=/trunk/; revision=7738
This commit is contained in:
parent
7470581e75
commit
45b4503f34
3 changed files with 70 additions and 26 deletions
|
@ -1,3 +1,11 @@
|
|||
2007-06-17 Denis Washington <denisw@svn.gnome.org>
|
||||
|
||||
* appearance-desktop.c: (desktop_init): (wp_view_tooltip_cb):
|
||||
* gnome-wp-item.c: (gnome_wp_item_update_description):
|
||||
Added metadata tooltips to the thumbnails in the Background tab.
|
||||
Needs GTK+ 2.11 to compile (but is surrounded with GTK_CHECK_VERSION()
|
||||
for compilation with older gtk+ versions).
|
||||
|
||||
2007-06-17 Denis Washington <denisw@svn.gnome.org>
|
||||
|
||||
* appearance-style.c: (prepare_list):
|
||||
|
|
|
@ -715,6 +715,38 @@ wp_dragged_image (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION (2,11,0)
|
||||
static gboolean
|
||||
wp_view_tooltip_cb (GtkWidget *widget,
|
||||
gint x,
|
||||
gint y,
|
||||
gboolean keyboard_mode,
|
||||
GtkTooltip *tooltip,
|
||||
AppearanceData *data)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
GtkTreeIter iter;
|
||||
gchar *wpfile;
|
||||
GnomeWPItem *item;
|
||||
|
||||
path = gtk_icon_view_get_path_at_pos (data->wp_view, x, y);
|
||||
|
||||
if (path == NULL)
|
||||
return FALSE;
|
||||
|
||||
gtk_tree_model_get_iter (data->wp_model, &iter, path);
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
gtk_tree_model_get (data->wp_model, &iter, 2, &wpfile, -1);
|
||||
item = g_hash_table_lookup (data->wp_hash, wpfile);
|
||||
|
||||
gtk_tooltip_set_markup (tooltip,
|
||||
g_strdup_printf ("%s", item->description));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static gint
|
||||
wp_list_sort (GtkTreeModel *model,
|
||||
GtkTreeIter *a, GtkTreeIter *b,
|
||||
|
@ -889,6 +921,13 @@ desktop_init (AppearanceData *data)
|
|||
GtkWidget *add_button;
|
||||
GtkFileFilter *filter;
|
||||
|
||||
#if GTK_CHECK_VERSION (2,11,0)
|
||||
GtkSettings *settings;
|
||||
|
||||
settings = gtk_settings_get_default ();
|
||||
g_object_set (G_OBJECT (settings), "gtk-tooltip-timeout", 500, NULL);
|
||||
#endif
|
||||
|
||||
data->wp_update_gconf = TRUE;
|
||||
|
||||
data->wp_hash = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
@ -928,6 +967,10 @@ desktop_init (AppearanceData *data)
|
|||
data->wp_view = GTK_ICON_VIEW (glade_xml_get_widget (data->xml, "wp_view"));
|
||||
gtk_icon_view_set_model (data->wp_view, GTK_TREE_MODEL (data->wp_model));
|
||||
|
||||
#if GTK_CHECK_VERSION (2,11,0)
|
||||
g_object_set (G_OBJECT (data->wp_view), "has-tooltip", TRUE, NULL);
|
||||
#endif
|
||||
|
||||
g_signal_connect_after (G_OBJECT (data->wp_view), "realize",
|
||||
G_CALLBACK (wp_select_after_realize), data);
|
||||
|
||||
|
@ -997,6 +1040,11 @@ desktop_init (AppearanceData *data)
|
|||
g_signal_connect (G_OBJECT (data->wp_view), "selection-changed",
|
||||
G_CALLBACK (wp_props_wp_selected), data);
|
||||
|
||||
#if GTK_CHECK_VERSION (2,11,0)
|
||||
g_signal_connect (G_OBJECT (data->wp_view), "query-tooltip",
|
||||
G_CALLBACK (wp_view_tooltip_cb), data);
|
||||
#endif
|
||||
|
||||
wp_set_sensitivities (data);
|
||||
|
||||
data->wp_filesel = gtk_file_chooser_dialog_new_with_backend (_("Add Wallpaper"),
|
||||
|
|
|
@ -354,32 +354,20 @@ void gnome_wp_item_update_description (GnomeWPItem * item) {
|
|||
g_free (item->description);
|
||||
|
||||
if (!strcmp (item->filename, "(none)")) {
|
||||
item->description = g_strdup_printf ("<b>%s</b>", item->name);
|
||||
item->description = g_strdup (item->name);
|
||||
} else {
|
||||
gchar * info;
|
||||
|
||||
/*
|
||||
Translators: This message is used to render the type and size of the
|
||||
background images in gnome-background-properites. The first "%s" will
|
||||
be replaced by the image type, and the two "%d %s"s will be replaced
|
||||
with the images' dimensions. For example, in US English, this may be
|
||||
displayed as "JPEG Image, 1600 pixels x 1200 pixels".
|
||||
|
||||
Do not translate the "background size|" type. Remove it from the
|
||||
translation.
|
||||
*/
|
||||
info = g_strdup_printf (Q_("background size|%s, %d %s x %d %s"),
|
||||
gnome_vfs_mime_get_description (item->fileinfo->mime_type),
|
||||
item->width,
|
||||
ngettext ("pixel", "pixels", item->width),
|
||||
item->height,
|
||||
ngettext ("pixel", "pixels", item->height));
|
||||
|
||||
item->description = g_markup_printf_escaped ("<b>%s</b>\n"
|
||||
"%s",
|
||||
item->name,
|
||||
info);
|
||||
|
||||
g_free (info);
|
||||
item->description =
|
||||
g_markup_printf_escaped (_("<big><b>%s</b></big>\n"
|
||||
"<b>Width:</b> %d %s\n"
|
||||
"<b>Height:</b> %d %s\n"
|
||||
"<b>Type:</b> %s\n"
|
||||
"<b>Location:</b> %s"),
|
||||
item->name,
|
||||
item->width,
|
||||
ngettext ("pixel", "pixels", item->width),
|
||||
item->height,
|
||||
ngettext ("pixel", "pixels", item->height),
|
||||
gnome_vfs_mime_get_description (item->fileinfo->mime_type),
|
||||
g_path_get_dirname (item->filename));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue