aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2010-06-28 17:28:07 +0200
committerSebastien Bacher <seb128@ubuntu.com>2010-06-28 17:28:07 +0200
commit26d4014fcf17ab3735a3045b9b3900e27a4a467b (patch)
tree23a965c832163d7dff79b60850355ceb83f8928f /src
parent2118f6baaf6432811125901f5986e51fa55b4374 (diff)
parenta0c3edbbe3d6cbb160049716cec66bf2673784e4 (diff)
downloadayatana-indicator-sound-26d4014fcf17ab3735a3045b9b3900e27a4a467b.tar.gz
ayatana-indicator-sound-26d4014fcf17ab3735a3045b9b3900e27a4a467b.tar.bz2
ayatana-indicator-sound-26d4014fcf17ab3735a3045b9b3900e27a4a467b.zip
Import upstream version 0.3.4
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in5
-rw-r--r--src/metadata-widget.c84
-rw-r--r--src/sound-service.c4
3 files changed, 74 insertions, 19 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 3af9677..e3ddfd3 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -39,10 +39,7 @@ libexec_PROGRAMS = indicator-sound-service$(EXEEXT)
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/src/metadata-widget.c b/src/metadata-widget.c
index 66e8cac..ce3bcd1 100644
--- a/src/metadata-widget.c
+++ b/src/metadata-widget.c
@@ -57,6 +57,9 @@ static void metadata_widget_property_update(DbusmenuMenuitem* item, gchar* prope
GValue* value, gpointer userdata);
static void update_album_art(MetadataWidget* self);
+static void style_artist_text(MetadataWidget* self);
+static void style_title_text(MetadataWidget* self);
+static void style_album_text(MetadataWidget* self);
G_DEFINE_TYPE (MetadataWidget, metadata_widget, GTK_TYPE_MENU_ITEM);
@@ -88,32 +91,52 @@ metadata_widget_init (MetadataWidget *self)
GtkWidget *hbox;
- hbox = gtk_hbox_new(TRUE, 0);
+ hbox = gtk_hbox_new(FALSE, 0);
priv->hbox = hbox;
-
+
// image
priv->album_art = gtk_image_new();
priv->image_path = g_strdup(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_ARTURL));
update_album_art(self);
+
gtk_box_pack_start (GTK_BOX (priv->hbox), priv->album_art, FALSE, FALSE, 0);
- GtkWidget* vbox = gtk_vbox_new(TRUE, 0);
+
+ GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
// artist
GtkWidget* artist;
- artist = gtk_label_new(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST));
- priv->artist_label = artist;
+ artist = gtk_label_new(dbusmenu_menuitem_property_get(twin_item,
+ DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST));
+ gtk_misc_set_alignment(GTK_MISC(artist), (gfloat)0, (gfloat)0);
+ gtk_label_set_width_chars(GTK_LABEL(artist), 20);
+ gtk_label_set_ellipsize(GTK_LABEL(artist), PANGO_ELLIPSIZE_END);
+ priv->artist_label = artist;
+ // Style it up.
+ style_artist_text(self);
// piece
GtkWidget* piece;
- piece = gtk_label_new(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_TEXT_TITLE));
+ piece = gtk_label_new(dbusmenu_menuitem_property_get(twin_item,
+ DBUSMENU_METADATA_MENUITEM_TEXT_TITLE));
+ gtk_misc_set_alignment(GTK_MISC(piece), (gfloat)0, (gfloat)0);
+ gtk_label_set_width_chars(GTK_LABEL(piece), 16);
+ gtk_label_set_ellipsize(GTK_LABEL(piece), PANGO_ELLIPSIZE_END);
priv->piece_label = piece;
-
+ // Style it up.
+ style_title_text(self);
// container
GtkWidget* container;
- container = gtk_label_new(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM));
+ container = gtk_label_new(dbusmenu_menuitem_property_get(twin_item,
+ DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM));
+ gtk_misc_set_alignment(GTK_MISC(container), (gfloat)0, (gfloat)0);
+ gtk_label_set_width_chars(GTK_LABEL(container), 20);
+ gtk_label_set_ellipsize(GTK_LABEL(container), PANGO_ELLIPSIZE_END);
priv->container_label = container;
+ // Style it up.
+ style_album_text(self);
// Pack in the right order
gtk_box_pack_start (GTK_BOX (vbox), priv->piece_label, FALSE, FALSE, 0);
@@ -170,27 +193,29 @@ metadata_widget_property_update(DbusmenuMenuitem* item, gchar* property,
if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, property) == 0){
gtk_label_set_text(GTK_LABEL(priv->artist_label), g_value_get_string(value));
+ style_artist_text(mitem);
}
else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_TEXT_TITLE, property) == 0){
- gtk_label_set_text(GTK_LABEL(priv->piece_label), g_value_get_string(value));
+ gtk_label_set_text(GTK_LABEL(priv->piece_label), g_value_get_string(value));
+ style_title_text(mitem);
}
else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM, property) == 0){
gtk_label_set_text(GTK_LABEL(priv->container_label), g_value_get_string(value));
+ style_album_text(mitem);
}
else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTURL, property) == 0){
if(priv->image_path != NULL){
g_free(priv->image_path);
}
-
priv->image_path = g_value_dup_string(value);
-
if(priv->image_path != NULL){
update_album_art(mitem);
}
}
}
-static void update_album_art(MetadataWidget* self){
+static void
+update_album_art(MetadataWidget* self){
MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self);
GdkPixbuf* pixbuf;
pixbuf = gdk_pixbuf_new_from_file(priv->image_path, NULL);
@@ -200,6 +225,41 @@ static void update_album_art(MetadataWidget* self){
g_object_unref(pixbuf);
}
+// TODO refactor next 3 methods into one once the style has been
+// "signed off" by design
+static void
+style_artist_text(MetadataWidget* self)
+{
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self);
+ char* markup;
+ markup = g_markup_printf_escaped ("<span size=\"small\">%s</span>",
+ gtk_label_get_text(GTK_LABEL(priv->artist_label)));
+ gtk_label_set_markup (GTK_LABEL (priv->artist_label), markup);
+ g_free(markup);
+}
+
+static void
+style_title_text(MetadataWidget* self)
+{
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self);
+
+ char* markup;
+ markup = g_markup_printf_escaped ("<span weight=\"bold\">%s</span>",
+ gtk_label_get_text(GTK_LABEL(priv->piece_label)));
+ gtk_label_set_markup (GTK_LABEL (priv->piece_label), markup);
+ g_free(markup);
+}
+
+static void
+style_album_text(MetadataWidget* self)
+{
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self);
+ char* markup;
+ markup = g_markup_printf_escaped ("<span size=\"small\">%s</span>",
+ gtk_label_get_text(GTK_LABEL(priv->container_label)));
+ gtk_label_set_markup (GTK_LABEL (priv->container_label), markup);
+ g_free(markup);
+}
/**
* transport_new:
diff --git a/src/sound-service.c b/src/sound-service.c
index bcdac07..8f4e941 100644
--- a/src/sound-service.c
+++ b/src/sound-service.c
@@ -4,9 +4,7 @@ Copyright 2010 Canonical Ltd.
Authors:
Conor Curran <conor.curran@canonical.com>
- Ted Gould <ted@canonical.com>
- Cody Russell <crussell@canonical.com>
-
+
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License version 3, as published
by the Free Software Foundation.