[gnac] Improved the notification icon's tooltips.
- From: Benoît Dupasquier <bdupasqu src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnac] Improved the notification icon's tooltips.
- Date: Tue, 25 Aug 2009 16:18:50 +0000 (UTC)
commit 57d2c729ea3597c00ac2c70324cd1f6f47e143ab
Author: Benoît Dupasquier <bdupasqu src gnome org>
Date: Tue Aug 25 18:18:35 2009 +0200
Improved the notification icon's tooltips.
src/gnac-ui.c | 50 +++++++++++++++++++++++++++-----------------------
1 files changed, 27 insertions(+), 23 deletions(-)
---
diff --git a/src/gnac-ui.c b/src/gnac-ui.c
index f3af5d3..67fdb57 100644
--- a/src/gnac-ui.c
+++ b/src/gnac-ui.c
@@ -351,40 +351,44 @@ gnac_ui_query_tooltip_cb(GtkStatusIcon *status_icon,
{
LibgnacTags *tags;
GFile *tooltip_file;
+ gchar *text;
tooltip_file = g_file_new_for_uri(tooltip_path);
tags = libgnac_metadata_extract(metadata, tooltip_file, NULL);
if (libgnac_metadata_tags_exist(tags,
- GST_TAG_ARTIST, GST_TAG_ALBUM, GST_TAG_TITLE, NULL))
+ GST_TAG_ARTIST, GST_TAG_ALBUM, GST_TAG_TITLE, NULL))
{
- gchar *text;
text = g_markup_printf_escaped(" <b>%s</b>\n"
- " <span color=\"#888\">%s</span> %s "
- "<span color=\"#888\">%s</span> %s",
- g_value_get_string(LIBGNAC_METADATA_TAG_TITLE(tags)),
- /* To translators: title by artist from album */
- _("by"), g_value_get_string(LIBGNAC_METADATA_TAG_ARTIST(tags)),
- _("from"), g_value_get_string(LIBGNAC_METADATA_TAG_ALBUM(tags)));
- gtk_tooltip_set_markup(tooltip, text);
-
- /* check wether we have a cover to display */
- if (libgnac_metadata_tag_exists(tags, GST_TAG_IMAGE))
- {
- GdkPixbuf *pixbuf;
- pixbuf = g_value_get_object(LIBGNAC_METADATA_TAG_IMAGE(tags));
- pixbuf = gnac_utils_scale_pixbuf(pixbuf, 80, 80);
- pixbuf = gnac_utils_add_border_to_pixbuf(pixbuf);
- gtk_tooltip_set_icon(tooltip, pixbuf);
- }
- }
- else
+ " <span color=\"#888\">%s</span> %s "
+ "<span color=\"#888\">%s</span> %s ",
+ g_value_get_string(LIBGNAC_METADATA_TAG_TITLE(tags)),
+ /* To translators: title by artist from album */
+ _("by"), g_value_get_string(LIBGNAC_METADATA_TAG_ARTIST(tags)),
+ _("from"), g_value_get_string(LIBGNAC_METADATA_TAG_ALBUM(tags)));
+ }
+ else
+ {
+ gchar *name;
+ name = gnac_utils_get_display_name(tooltip_path, NULL);
+ text = g_markup_printf_escaped(" <b>%s</b> ", name);
+ g_free(name);
+ }
+
+ gtk_tooltip_set_markup(tooltip, text);
+
+ /* check wether we have a cover to display */
+ if (libgnac_metadata_tag_exists(tags, GST_TAG_IMAGE))
{
- gtk_tooltip_set_text(tooltip,
- gnac_utils_get_display_name(tooltip_path, NULL));
+ GdkPixbuf *pixbuf;
+ pixbuf = g_value_get_object(LIBGNAC_METADATA_TAG_IMAGE(tags));
+ pixbuf = gnac_utils_scale_pixbuf(pixbuf, 80, 80);
+ pixbuf = gnac_utils_add_border_to_pixbuf(pixbuf);
+ gtk_tooltip_set_icon(tooltip, pixbuf);
}
g_object_unref(tooltip_file);
+ g_free(text);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]