aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2012-03-30 13:20:48 +0100
committerConor Curran <conor.curran@canonical.com>2012-03-30 13:20:48 +0100
commitf1182db17f363783178c191b1e7af328deea0372 (patch)
tree72fc01f118dd26f271fd2335ac34b4d5404298ea
parentd4a652971f9a99ff244b0ec85a027753a3cf220e (diff)
downloadayatana-indicator-sound-f1182db17f363783178c191b1e7af328deea0372.tar.gz
ayatana-indicator-sound-f1182db17f363783178c191b1e7af328deea0372.tar.bz2
ayatana-indicator-sound-f1182db17f363783178c191b1e7af328deea0372.zip
move the app icon in from the gutter
-rw-r--r--src/Makefile.am2
-rw-r--r--src/metadata-widget.c96
2 files changed, 58 insertions, 40 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 5a36822..debaa2f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,7 +31,7 @@ libsoundmenu_la_SOURCES = \
libsoundmenu_la_CFLAGS = \
$(APPLET_CFLAGS) \
$(COVERAGE_CFLAGS) \
- -Wall -Werror -DG_LOG_DOMAIN=\"Indicator-Sound\"
+ -Wall -DG_LOG_DOMAIN=\"Indicator-Sound\"
libsoundmenu_la_LIBADD = $(APPLET_LIBS) -lm
libsoundmenu_la_LDFLAGS = \
$(COVERAGE_LDFLAGS) \
diff --git a/src/metadata-widget.c b/src/metadata-widget.c
index 7c7e750..238c5b1 100644
--- a/src/metadata-widget.c
+++ b/src/metadata-widget.c
@@ -44,7 +44,7 @@ struct _MetadataWidgetPrivate
GtkWidget* piece_label;
GtkWidget* container_label;
GtkWidget* player_label;
- GdkPixbuf* icon_buf;
+ GtkWidget* player_icon;
DbusmenuMenuitem* twin_item;
gint current_height;
};
@@ -126,7 +126,7 @@ metadata_widget_init (MetadataWidget *self)
MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self);
GtkWidget *hbox;
GtkWidget *outer_v_box;
- priv->icon_buf = NULL;
+ //priv->icon_buf = NULL;
#if GTK_CHECK_VERSION(3, 0, 0)
outer_v_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
@@ -178,7 +178,6 @@ metadata_widget_init (MetadataWidget *self)
GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
#endif
-
// artist
GtkWidget* artist;
artist = gtk_label_new("");
@@ -224,16 +223,31 @@ metadata_widget_init (MetadataWidget *self)
G_CALLBACK(metadata_widget_selection_received_event_callback),
GTK_WIDGET(self));
+ gint padding = 4;
+ gtk_widget_style_get(GTK_WIDGET(self), "toggle-spacing", &padding, NULL);
+
+#if GTK_CHECK_VERSION(3, 0, 0)
+ GtkWidget * tophbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, padding);
+#else
+ GtkWidget * tophbox = gtk_hbox_new(FALSE, padding);
+#endif
+
+ GtkWidget *player_icon;
+ player_icon = gtk_image_new();
+ priv->player_icon = player_icon;
+
+ gtk_misc_set_alignment (GTK_MISC(priv->player_icon), 1.0 /* right aligned */, 0.5);
+ gtk_box_pack_start (GTK_BOX (tophbox), priv->player_icon, FALSE, FALSE, 0);
+
// player label
GtkWidget* player_label;
player_label = gtk_label_new ("");
- gtk_misc_set_alignment(GTK_MISC(player_label), (gfloat)0, (gfloat)0);
- gtk_misc_set_padding (GTK_MISC(player_label), (gfloat)1, (gfloat)3);
- gtk_widget_set_size_request (player_label, 150, 24);
+ gtk_misc_set_alignment(GTK_MISC(player_label), (gfloat)0, 0.5);
priv->player_label = player_label;
+ gtk_box_pack_start (GTK_BOX (tophbox), priv->player_label, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX(outer_v_box), priv->player_label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(outer_v_box), priv->meta_data_h_box, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(outer_v_box), tophbox, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(outer_v_box), priv->meta_data_h_box, FALSE, FALSE, 5);
gtk_container_add (GTK_CONTAINER (self), outer_v_box);
@@ -246,16 +260,16 @@ metadata_widget_init (MetadataWidget *self)
static void
metadata_widget_dispose (GObject *object)
{
- MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(METADATA_WIDGET(object));
+ //MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(METADATA_WIDGET(object));
- if (priv->icon_buf != NULL){
+ /*if (priv->icon_buf != NULL){
#if GTK_CHECK_VERSION(3, 0, 0)
g_object_unref(priv->icon_buf);
#else
gdk_pixbuf_unref(priv->icon_buf);
#endif
priv->icon_buf = NULL;
- }
+ }*/
G_OBJECT_CLASS (metadata_widget_parent_class)->dispose (object);
}
@@ -352,7 +366,7 @@ metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget,
cairo_t* cr,
gpointer user_data)
{
- g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE);
+ /*g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE);
MetadataWidget* meta = METADATA_WIDGET(user_data);
MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(meta);
@@ -372,16 +386,16 @@ metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget,
gint offset = gdk_pixbuf_get_height (priv->icon_buf) / 3;
// Draw player icon
- if (priv->icon_buf != NULL){
+ /*if (priv->icon_buf != NULL){
gdk_cairo_set_source_pixbuf (cr,
priv->icon_buf,
x + arrow_width + 1,
y + offset);
cairo_paint (cr);
- }
+ }*/
// Draw triangle but only if the player is running.
- if (dbusmenu_menuitem_property_get_bool (priv->twin_item,
+ /*if (dbusmenu_menuitem_property_get_bool (priv->twin_item,
DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING)){
y += gdk_pixbuf_get_height (priv->icon_buf) / 3 + 3;
cairo_set_line_width (cr, 1.0);
@@ -394,7 +408,7 @@ metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget,
style->fg[gtk_widget_get_state(widget)].green/65535.0,
style->fg[gtk_widget_get_state(widget)].blue/65535.0);
cairo_fill (cr);
- }
+ }*/
return FALSE;
}
@@ -445,7 +459,7 @@ metadata_image_expose (GtkWidget *metadata,
return FALSE;
}
clear_album_art (GTK_IMAGE(priv->album_art));
- g_string_erase (priv->old_image_path, 0, -1);
+ g_string_erase (priv->old_image_path, 0, -1);
gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60);
draw_album_art_placeholder(metadata);
return FALSE;
@@ -458,10 +472,14 @@ metadata_widget_icon_triangle_draw_cb (GtkWidget *widget,
GdkEventExpose *event,
gpointer user_data)
{
- g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE);
+ /*g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE);
+
MetadataWidget* meta = METADATA_WIDGET(user_data);
MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(meta);
+ g_return_val_if_fail (dbusmenu_menuitem_property_get_bool (priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING), FALSE);
+
GtkStyle *style;
cairo_t *cr;
int x, y, arrow_width, arrow_height;
@@ -481,31 +499,28 @@ metadata_widget_icon_triangle_draw_cb (GtkWidget *widget,
gint offset = (allocation.height - gdk_pixbuf_get_height (priv->icon_buf)) / 2;
// Draw player icon
- if (priv->icon_buf != NULL){
+ /*if (priv->icon_buf != NULL){
gdk_cairo_set_source_pixbuf (cr,
priv->icon_buf,
x + arrow_width + 1,
y + offset);
cairo_paint (cr);
- }
+ }*/
// Draw triangle but only if the player is running.
- if (dbusmenu_menuitem_property_get_bool (priv->twin_item,
- DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING)){
- y += allocation.height/2.0 - (double)arrow_height/2.0;
- cairo_set_line_width (cr, 1.0);
+ /*y += allocation.height/2.0 - (double)arrow_height/2.0;
+ cairo_set_line_width (cr, 1.0);
- cairo_move_to (cr, x, y);
- cairo_line_to (cr, x, y + arrow_height);
- cairo_line_to (cr, x + arrow_width, y + (double)arrow_height/2.0);
- cairo_close_path (cr);
- cairo_set_source_rgb (cr, style->fg[gtk_widget_get_state(widget)].red/65535.0,
- style->fg[gtk_widget_get_state(widget)].green/65535.0,
- style->fg[gtk_widget_get_state(widget)].blue/65535.0);
- cairo_fill (cr);
- }
+ cairo_move_to (cr, x, y);
+ cairo_line_to (cr, x, y + arrow_height);
+ cairo_line_to (cr, x + arrow_width, y + (double)arrow_height/2.0);
+ cairo_close_path (cr);
+ cairo_set_source_rgb (cr, style->fg[gtk_widget_get_state(widget)].red/65535.0,
+ style->fg[gtk_widget_get_state(widget)].green/65535.0,
+ style->fg[gtk_widget_get_state(widget)].blue/65535.0);
+ cairo_fill (cr);
- cairo_destroy (cr);
+ cairo_destroy (cr);*/
return FALSE;
}
#endif
@@ -792,7 +807,7 @@ metadata_widget_set_icon (MetadataWidget *self)
{
MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self);
- if (priv->icon_buf != NULL){
+ /*if (priv->icon_buf != NULL){
#if GTK_CHECK_VERSION(3, 0, 0)
g_object_unref(priv->icon_buf);
#else
@@ -804,13 +819,13 @@ metadata_widget_set_icon (MetadataWidget *self)
gint padding = 0;
gtk_widget_style_get(GTK_WIDGET(self), "horizontal-padding", &padding, NULL);
gint width, height;
- gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height);
+ gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height);*/
GString* banshee_string = g_string_new ( "banshee" );
gchar * tmp = g_utf8_strdown (dbusmenu_menuitem_property_get(priv->twin_item, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME), -1);
GString* app_panel = g_string_new (tmp);
g_free (tmp);
- GdkPixbuf* icon_buf;
+ //GdkPixbuf* icon_buf;
// Banshee Special case!
// Not ideal but apparently we want the banshee icon to be the greyscale one
@@ -827,12 +842,15 @@ metadata_widget_set_icon (MetadataWidget *self)
dbusmenu_menuitem_property_get ( priv->twin_item,
DBUSMENU_METADATA_MENUITEM_PLAYER_ICON ));
}
- icon_buf = gtk_icon_theme_load_icon ( gtk_icon_theme_get_default(),
+
+ gtk_image_set_from_icon_name(GTK_IMAGE (priv->player_icon), app_panel->str, GTK_ICON_SIZE_MENU);
+
+ /*icon_buf = gtk_icon_theme_load_icon ( gtk_icon_theme_get_default(),
app_panel->str,
(width > height) ? width : height,
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
NULL );
- priv->icon_buf = icon_buf;
+ priv->icon_buf = icon_buf;*/
g_string_free ( app_panel, TRUE);
g_string_free ( banshee_string, TRUE);
}