aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2012-02-22 20:15:17 +0000
committerConor Curran <conor.curran@canonical.com>2012-02-22 20:15:17 +0000
commitdae2c851253dc74a92b50a2464340a80fdf26a20 (patch)
tree8fc5be64f80a0da462972b72e74c175c55b1525a
parentbd74119fe73c955a458b414b12ac92d580a15344 (diff)
parentb7038fe83944c2dc6a8d00222fd8db228d191c40 (diff)
downloadayatana-indicator-sound-dae2c851253dc74a92b50a2464340a80fdf26a20.tar.gz
ayatana-indicator-sound-dae2c851253dc74a92b50a2464340a80fdf26a20.tar.bz2
ayatana-indicator-sound-dae2c851253dc74a92b50a2464340a80fdf26a20.zip
merge the ui fixes on the indicator side
-rw-r--r--src/metadata-widget.c27
-rw-r--r--src/pulseaudio-mgr.c1
-rw-r--r--src/slider-menu-item.c30
-rw-r--r--src/transport-widget.c1
4 files changed, 35 insertions, 24 deletions
diff --git a/src/metadata-widget.c b/src/metadata-widget.c
index a3383df..36b48f8 100644
--- a/src/metadata-widget.c
+++ b/src/metadata-widget.c
@@ -129,13 +129,13 @@ metadata_widget_init (MetadataWidget *self)
priv->icon_buf = NULL;
#if GTK_CHECK_VERSION(3, 0, 0)
- outer_v_box = gtk_box_new (FALSE, 0);
+ outer_v_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
#else
outer_v_box = gtk_vbox_new (FALSE, 0);
#endif
#if GTK_CHECK_VERSION(3, 0, 0)
- hbox = gtk_box_new(FALSE, 0);
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
#else
hbox = gtk_hbox_new(FALSE, 0);
#endif
@@ -174,7 +174,7 @@ metadata_widget_init (MetadataWidget *self)
priv->theme_change_occured = FALSE;
#if GTK_CHECK_VERSION(3, 0, 0)
- GtkWidget* vbox = gtk_box_new(FALSE, 0);
+ GtkWidget* vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
#else
GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
#endif
@@ -227,16 +227,15 @@ 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.5);
- gtk_misc_set_padding (GTK_MISC(player_label), (gfloat)1, (gfloat)0);
- gtk_widget_set_size_request (player_label, 200, 24);
+ 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)0);
+ gtk_widget_set_size_request (player_label, 150, 24);
priv->player_label = player_label;
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_container_add (GTK_CONTAINER (self), outer_v_box);
gtk_widget_show_all (priv->meta_data_h_box);
@@ -282,7 +281,7 @@ metadata_widget_get_preferred_width (GtkWidget* self,
}
/**
* We override the expose method to enable primitive drawing of the
- * empty album art image and rounded rectangles on the album art.
+ * empty album art image.
*/
static gboolean
metadata_image_expose_gtk_3 (GtkWidget *metadata,
@@ -299,8 +298,6 @@ metadata_image_expose_gtk_3 (GtkWidget *metadata,
return FALSE;
}
- draw_album_border (metadata, FALSE);
-
if(priv->image_path->len > 0){
if(g_string_equal(priv->image_path, priv->old_image_path) == FALSE ||
priv->theme_change_occured == TRUE){
@@ -311,6 +308,7 @@ metadata_image_expose_gtk_3 (GtkWidget *metadata,
if(GDK_IS_PIXBUF(pixbuf) == FALSE){
gtk_image_clear ( GTK_IMAGE(priv->album_art));
gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60);
+ draw_album_border (metadata, FALSE);
draw_album_art_placeholder(metadata);
return FALSE;
}
@@ -320,6 +318,7 @@ metadata_image_expose_gtk_3 (GtkWidget *metadata,
gdk_pixbuf_get_width(pixbuf),
gdk_pixbuf_get_height(pixbuf));
+ draw_album_border (metadata, FALSE);
g_string_erase (priv->old_image_path, 0, -1);
g_string_overwrite (priv->old_image_path, 0, priv->image_path->str);
g_object_unref(pixbuf);
@@ -328,6 +327,7 @@ metadata_image_expose_gtk_3 (GtkWidget *metadata,
}
gtk_image_clear (GTK_IMAGE(priv->album_art));
gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60);
+ draw_album_border (metadata, FALSE);
draw_album_art_placeholder(metadata);
return FALSE;
}
@@ -500,7 +500,8 @@ metadata_widget_icon_triangle_draw_cb (GtkWidget *widget,
#endif
static void
-draw_album_border(GtkWidget *metadata, gboolean selected)
+draw_album_border(GtkWidget *metadata,
+ gboolean selected)
{
cairo_t *cr;
cr = gdk_cairo_create (gtk_widget_get_window (metadata));
diff --git a/src/pulseaudio-mgr.c b/src/pulseaudio-mgr.c
index ba83c71..3a80cbd 100644
--- a/src/pulseaudio-mgr.c
+++ b/src/pulseaudio-mgr.c
@@ -174,7 +174,6 @@ reconnect_to_pulse (gpointer user_data)
void
pm_update_volume (gint sink_index, pa_cvolume new_volume)
{
- // LP: #850662
if (sink_index < 0 || pulse_context == NULL){
return;
}
diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c
index 165c3d5..dc0671c 100644
--- a/src/slider-menu-item.c
+++ b/src/slider-menu-item.c
@@ -147,21 +147,31 @@ slider_menu_item_populate (SliderMenuItem* self, const pa_sink_info* update)
static void
slider_menu_item_update_volume (SliderMenuItem* self, gdouble percent)
{
+ g_return_if_fail (IS_SLIDER_MENU_ITEM (self));
-/*
- g_debug ("slider menu item update volume - about to set the volume to %f", percent);
-*/
-
- pa_cvolume new_volume;
- pa_cvolume_init(&new_volume);
- new_volume.channels = 1;
+ pa_cvolume mono_new_volume;
+ pa_cvolume_init(&mono_new_volume);
+ mono_new_volume.channels = 1;
pa_volume_t new_volume_value = (pa_volume_t) ((percent * PA_VOLUME_NORM) / 100);
- pa_cvolume_set(&new_volume, 1, new_volume_value);
+
+ if (new_volume_value == PA_VOLUME_INVALID || new_volume_value >= PA_VOLUME_MAX){
+ g_warning ("slider_menu_item_update_volume - volume is out of range !");
+ return;
+ }
+
+ pa_cvolume_set(&mono_new_volume, 1, new_volume_value);
SliderMenuItemPrivate* priv = SLIDER_MENU_ITEM_GET_PRIVATE (self);
-
+ if (!pa_cvolume_valid (&mono_new_volume)){
+ g_warning ("Invalid volume - ignore it!");
+ return;
+ }
+ if (!pa_channel_map_valid(&priv->channel_map)){
+ g_warning ("Invalid channel map - ignore update volume!");
+ return;
+ }
pa_cvolume_set(&priv->volume, priv->channel_map.channels, new_volume_value);
- pm_update_volume (priv->index, new_volume);
+ pm_update_volume (priv->index, mono_new_volume);
}
// To the UI
diff --git a/src/transport-widget.c b/src/transport-widget.c
index 08e4ba9..09bb302 100644
--- a/src/transport-widget.c
+++ b/src/transport-widget.c
@@ -309,6 +309,7 @@ transport_widget_expose (GtkWidget *button, GdkEventExpose *event)
gboolean
transport_widget_is_selected ( TransportWidget* widget )
{
+ g_return_val_if_fail (IS_TRANSPORT_WIDGET (widget), FALSE);
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(widget);
return priv->has_focus;
}