diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2014-03-24 17:45:04 +0000 |
---|---|---|
committer | CI bot <ps-jenkins@lists.canonical.com> | 2014-03-24 17:45:04 +0000 |
commit | f59210392b23cf72553876e10f6912feb76104c9 (patch) | |
tree | 44a584628f2a8d8e5af535a31d0a9aa831674fc7 | |
parent | bfd8fefa2dfc2a7805e2b2df4e0da33608f02486 (diff) | |
parent | 5a777027b99d31c7a56237631dcaacab43c65089 (diff) | |
download | ayatana-ido-f59210392b23cf72553876e10f6912feb76104c9.tar.gz ayatana-ido-f59210392b23cf72553876e10f6912feb76104c9.tar.bz2 ayatana-ido-f59210392b23cf72553876e10f6912feb76104c9.zip |
idoplaybackmenuitem: set active flag when player is launching
The active flag is used to signal the theme that the spinner should animate. Using that flag is a bit weird, but it's consistent with GtkSpinner and thus doesn't require special handling in the theme. Fixes: 1231796
-rw-r--r-- | src/idoplaybackmenuitem.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/idoplaybackmenuitem.c b/src/idoplaybackmenuitem.c index 662ceaf..0e6460f 100644 --- a/src/idoplaybackmenuitem.c +++ b/src/idoplaybackmenuitem.c @@ -330,19 +330,31 @@ ido_playback_menu_item_init (IdoPlaybackMenuItem *self) } static void +ido_playback_menu_item_set_state (IdoPlaybackMenuItem *self, + State state) +{ + self->current_state = state; + + if (self->current_state == STATE_LAUNCHING) + gtk_widget_set_state_flags (GTK_WIDGET (self), GTK_STATE_FLAG_ACTIVE, FALSE); + else + gtk_widget_unset_state_flags (GTK_WIDGET (self), GTK_STATE_FLAG_ACTIVE); + + gtk_widget_queue_draw (GTK_WIDGET (self)); +} + +static void ido_playback_menu_item_set_state_from_string (IdoPlaybackMenuItem *self, const gchar *state) { g_return_if_fail (state != NULL); if (g_str_equal (state, "Playing")) - self->current_state = STATE_PLAYING; + ido_playback_menu_item_set_state (self, STATE_PLAYING); else if (g_str_equal (state, "Launching")) - self->current_state = STATE_LAUNCHING; + ido_playback_menu_item_set_state (self, STATE_LAUNCHING); else /* "Paused" and fallback */ - self->current_state = STATE_PAUSED; - - gtk_widget_queue_draw (GTK_WIDGET (self)); + ido_playback_menu_item_set_state (self, STATE_PAUSED); } static void @@ -372,10 +384,7 @@ ido_playback_menu_item_action_removed (GActionGroup *action_group, IdoPlaybackMenuItem *self = user_data; if (self->play_action && g_str_equal (action_name, self->play_action)) - { - self->current_state = STATE_PAUSED; - gtk_widget_queue_draw (GTK_WIDGET (self)); - } + ido_playback_menu_item_set_state (self, STATE_PAUSED); } static void @@ -1151,8 +1160,6 @@ ido_playback_menu_item_draw (GtkWidget* button, cairo_t *cr) GtkStyle *style; - gtk_style_context_add_class (gtk_widget_get_style_context (button), - GTK_STYLE_CLASS_MENU); CairoColorRGB bg_color, fg_color, bg_selected, bg_prelight; CairoColorRGB color_middle[2], color_middle_prelight[2], color_outer[2], color_outer_prelight[2], color_play_outer[2], color_play_outer_prelight[2], |