diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-07-15 17:08:36 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-07-15 17:08:36 +0100 |
commit | 4643e1d7c2569e28f50cabe6262b61fff98e595b (patch) | |
tree | 1eca723221d7b76312924e647403b551c638bd13 /src/transport-widget.c | |
parent | 0358622a18d0dbf2d1b413a708e248db974f97a8 (diff) | |
parent | 05b905d4712ed4064d82401621eacbdfbcb54312 (diff) | |
download | ayatana-indicator-sound-4643e1d7c2569e28f50cabe6262b61fff98e595b.tar.gz ayatana-indicator-sound-4643e1d7c2569e28f50cabe6262b61fff98e595b.tar.bz2 ayatana-indicator-sound-4643e1d7c2569e28f50cabe6262b61fff98e595b.zip |
merged the button press effect branch plus changes for the ido and bumped release version for 0.3.7
Diffstat (limited to 'src/transport-widget.c')
-rw-r--r-- | src/transport-widget.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/src/transport-widget.c b/src/transport-widget.c index f02200e..3174afe 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -137,9 +137,7 @@ static gboolean transport_widget_button_press_event (GtkWidget *menuitem, GdkEventButton *event) { - if(IS_TRANSPORT_WIDGET(menuitem) == FALSE){ - return FALSE; - } + g_return_val_if_fail(IS_TRANSPORT_WIDGET(menuitem), FALSE); TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE(TRANSPORT_WIDGET(menuitem)); @@ -147,14 +145,16 @@ transport_widget_button_press_event (GtkWidget *menuitem, parent = gtk_widget_get_parent (GTK_WIDGET (menuitem)); - gint result = determine_button_event(priv->play_button, event); + PlayButtonEvent result = determine_button_event(priv->play_button, event); - GValue value = {0}; - g_value_init(&value, G_TYPE_INT); - g_debug("TransportWidget::menu_press_event - going to send value %i", result); - g_value_set_int(&value, result); - dbusmenu_menuitem_handle_event (priv->twin_item, "Transport state change", &value, 0); - + if(result != TRANSPORT_NADA){ + GValue value = {0}; + g_value_init(&value, G_TYPE_INT); + g_debug("TransportWidget::menu_press_event - going to send value %i", (int)result); + g_value_set_int(&value, (int)result); + dbusmenu_menuitem_handle_event (priv->twin_item, "Transport state change", &value, 0); + play_button_react_to_button_press(priv->play_button, result); + } return TRUE; } @@ -164,9 +164,9 @@ transport_widget_button_release_event (GtkWidget *menuitem, GdkEventButton *event) { g_debug("TransportWidget::menu_release_event"); - if(IS_TRANSPORT_WIDGET(menuitem) == FALSE){ - return FALSE; - } + g_return_val_if_fail(IS_TRANSPORT_WIDGET(menuitem), FALSE); + TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE(TRANSPORT_WIDGET(menuitem)); + play_button_react_to_button_release(priv->play_button); return TRUE; } @@ -180,12 +180,13 @@ transport_widget_property_update(DbusmenuMenuitem* item, gchar* property, GValue* value, gpointer userdata) { g_debug("transport_widget_update_state - with property %s", property); - //int update_value = g_value_get_int(value); - //g_debug("transport_widget_update_state - with value %i", update_value); - - //TransportWidget* bar = (TransportWidget*)userdata; - //TransportWidgetPrivate *priv = TRANSPORT_WIDGET_GET_PRIVATE(bar); + TransportWidget* bar = (TransportWidget*)userdata; + g_return_if_fail(IS_TRANSPORT_WIDGET(bar)); + TransportWidgetPrivate *priv = TRANSPORT_WIDGET_GET_PRIVATE(bar); + int update_value = g_value_get_int(value); + g_debug("transport_widget_update_state - with value %i", update_value); + play_button_toggle_play_pause(priv->play_button, update_value); } /** |