aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Cimitan <andrea.cimitan@canonical.com>2011-09-09 14:57:51 +0200
committerAndrea Cimitan <andrea.cimitan@canonical.com>2011-09-09 14:57:51 +0200
commit373abc7256e51c38d6d00a9c4332b41b316a97f3 (patch)
treee26255c786bb0c6d7d9f2610d20b62e12f63ebcc
parent0d51c6ae44ccc759a384a63ebb6ffb05debca5df (diff)
downloadayatana-indicator-sound-373abc7256e51c38d6d00a9c4332b41b316a97f3.tar.gz
ayatana-indicator-sound-373abc7256e51c38d6d00a9c4332b41b316a97f3.tar.bz2
ayatana-indicator-sound-373abc7256e51c38d6d00a9c4332b41b316a97f3.zip
Fixes to the positioning and dimension of the player menuitem, and fix for the spinner widget matching (if some themers need it)
-rw-r--r--src/metadata-widget.c26
-rw-r--r--src/transport-widget.c8
2 files changed, 18 insertions, 16 deletions
diff --git a/src/metadata-widget.c b/src/metadata-widget.c
index d21c10d..8ab7d1d 100644
--- a/src/metadata-widget.c
+++ b/src/metadata-widget.c
@@ -212,9 +212,9 @@ metadata_widget_init (MetadataWidget *self)
// 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_alignment(GTK_MISC(player_label), (gfloat)0, (gfloat)0.5);
gtk_misc_set_padding (GTK_MISC(player_label), (gfloat)1, (gfloat)0);
- gtk_widget_set_size_request (player_label, 200, 25);
+ gtk_widget_set_size_request (player_label, 200, 24);
priv->player_label = player_label;
gtk_box_pack_start (GTK_BOX(outer_v_box), priv->player_label, FALSE, FALSE, 0);
@@ -319,9 +319,8 @@ metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget,
MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(meta);
GtkStyle *style;
- int x, y, arrow_width, arrow_height;
+ int x, y, arrow_width, arrow_height;
- gint offset = 3;
arrow_width = 5;
arrow_height = 9;
@@ -331,7 +330,9 @@ metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget,
gtk_widget_get_allocation (widget, &allocation);
x = allocation.x;
y = 0;
-
+
+ gint offset = (allocation.height - gdk_pixbuf_get_height (priv->icon_buf)) / 2;
+
// Draw player icon
if (priv->icon_buf != NULL){
gdk_cairo_set_source_pixbuf (cr,
@@ -340,11 +341,11 @@ metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget,
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 += (double)arrow_height/2.0 + offset;
+ y += allocation.height/2.0 - (double)arrow_height/2.0;
cairo_set_line_width (cr, 1.0);
//g_debug ("triangle drawing");
@@ -426,9 +427,8 @@ metadata_widget_icon_triangle_draw_cb (GtkWidget *widget,
GtkStyle *style;
cairo_t *cr;
- int x, y, arrow_width, arrow_height;
+ int x, y, arrow_width, arrow_height;
- gint offset = 3;
arrow_width = 5;
arrow_height = 9;
@@ -440,7 +440,9 @@ metadata_widget_icon_triangle_draw_cb (GtkWidget *widget,
gtk_widget_get_allocation (widget, &allocation);
x = allocation.x;
y = allocation.y;
-
+
+ gint offset = (allocation.height - gdk_pixbuf_get_height (priv->icon_buf)) / 2;
+
// Draw player icon
if (priv->icon_buf != NULL){
gdk_cairo_set_source_pixbuf (cr,
@@ -449,11 +451,11 @@ metadata_widget_icon_triangle_draw_cb (GtkWidget *widget,
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 += (double)arrow_height/2.0 + offset;
+ y += allocation.height/2.0 - (double)arrow_height/2.0;
cairo_set_line_width (cr, 1.0);
cairo_move_to (cr, x, y);
diff --git a/src/transport-widget.c b/src/transport-widget.c
index 22e3b2a..c535e00 100644
--- a/src/transport-widget.c
+++ b/src/transport-widget.c
@@ -181,10 +181,10 @@ transport_widget_init (TransportWidget *self)
/* create widget path */
spinner_widget_path = gtk_widget_path_new();
- gtk_widget_path_iter_set_name (spinner_widget_path, -1 , "IndicatorSound");
gtk_widget_path_append_type (spinner_widget_path, GTK_TYPE_MENU);
gtk_widget_path_append_type (spinner_widget_path, GTK_TYPE_MENU_ITEM);
- gtk_widget_path_append_type (spinner_widget_path, GTK_TYPE_SPINNER);
+ gint pos = gtk_widget_path_append_type (spinner_widget_path, GTK_TYPE_SPINNER);
+ gtk_widget_path_iter_set_name (spinner_widget_path, pos, "IndicatorSoundSpinner");
/* create style context and append path */
spinner_style_context = gtk_style_context_new();
@@ -1800,8 +1800,8 @@ draw (GtkWidget* button, cairo_t *cr)
#if GTK_CHECK_VERSION(3, 0, 0)
else if(priv->current_state == TRANSPORT_STATE_LAUNCHING)
{
-
- gtk_render_activity (spinner_style_context, cr, 106, 6 , 30, 30);
+ // the spinner is not aligned, why? because the play button has odd width/height numbers
+ gtk_render_activity (spinner_style_context, cr, 106, 6, 30, 30);
}
#endif
return FALSE;