aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/idoplaybackmenuitem.c29
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],