aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2012-02-22 20:04:37 +0000
committerConor Curran <conor.curran@canonical.com>2012-02-22 20:04:37 +0000
commitb7038fe83944c2dc6a8d00222fd8db228d191c40 (patch)
tree8fc5be64f80a0da462972b72e74c175c55b1525a
parent78837fe1befbc45df6fe4e92ae299ada83ea6c0e (diff)
downloadayatana-indicator-sound-b7038fe83944c2dc6a8d00222fd8db228d191c40.tar.gz
ayatana-indicator-sound-b7038fe83944c2dc6a8d00222fd8db228d191c40.tar.bz2
ayatana-indicator-sound-b7038fe83944c2dc6a8d00222fd8db228d191c40.zip
putting in place more checks for transport-widget and the slider, also fixed some more ui glitches
-rw-r--r--src/metadata-widget.c14
-rw-r--r--src/slider-menu-item.c7
-rw-r--r--src/transport-widget.c1
3 files changed, 16 insertions, 6 deletions
diff --git a/src/metadata-widget.c b/src/metadata-widget.c
index 5f4e1a1..36b48f8 100644
--- a/src/metadata-widget.c
+++ b/src/metadata-widget.c
@@ -168,8 +168,8 @@ metadata_widget_init (MetadataWidget *self)
#endif
gtk_box_pack_start (GTK_BOX (priv->meta_data_h_box),
priv->album_art,
- TRUE,
- TRUE,
+ FALSE,
+ FALSE,
1);
priv->theme_change_occured = FALSE;
@@ -281,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,
@@ -298,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){
@@ -310,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;
}
@@ -319,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);
@@ -327,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;
}
@@ -499,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/slider-menu-item.c b/src/slider-menu-item.c
index 7efdf74..dc0671c 100644
--- a/src/slider-menu-item.c
+++ b/src/slider-menu-item.c
@@ -77,6 +77,7 @@ slider_menu_item_init (SliderMenuItem *self)
priv->index = NOT_ACTIVE;
priv->name = NULL;
+
return;
}
@@ -152,6 +153,12 @@ slider_menu_item_update_volume (SliderMenuItem* self, gdouble percent)
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);
+
+ 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);
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;
}