diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2014-03-24 16:09:02 +0100 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2014-03-24 16:09:02 +0100 |
commit | 5a777027b99d31c7a56237631dcaacab43c65089 (patch) | |
tree | 6061bab4ba9499c1af26d7627c0fa5467d38c144 | |
parent | ab0798e703c27e58e2674db9cd77ec8c82e40f7e (diff) | |
download | ayatana-ido-5a777027b99d31c7a56237631dcaacab43c65089.tar.gz ayatana-ido-5a777027b99d31c7a56237631dcaacab43c65089.tar.bz2 ayatana-ido-5a777027b99d31c7a56237631dcaacab43c65089.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.
-rw-r--r-- | src/idoplaybackmenuitem.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/idoplaybackmenuitem.c b/src/idoplaybackmenuitem.c index fd234e3..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 |