diff --git a/libxfce4panel/libxfce4panel.symbols b/libxfce4panel/libxfce4panel.symbols index d690e5ed..205de844 100644 --- a/libxfce4panel/libxfce4panel.symbols +++ b/libxfce4panel/libxfce4panel.symbols @@ -56,6 +56,8 @@ xfce_arrow_button_get_type G_GNUC_CONST xfce_arrow_button_new G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT xfce_arrow_button_get_arrow_type xfce_arrow_button_set_arrow_type +xfce4_arrow_button_get_suggested_action +xfce4_arrow_button_set_suggested_action xfce_arrow_button_get_blinking xfce_arrow_button_set_blinking #endif diff --git a/libxfce4panel/xfce-arrow-button.c b/libxfce4panel/xfce-arrow-button.c index 36d8b293..0b15513b 100644 --- a/libxfce4panel/xfce-arrow-button.c +++ b/libxfce4panel/xfce-arrow-button.c @@ -474,16 +474,13 @@ xfce_arrow_button_blinking_timeout (gpointer user_data) { XfceArrowButton *button = XFCE_ARROW_BUTTON (user_data); - GtkStateFlags flags = gtk_widget_get_state_flags (GTK_WIDGET (button)); - - if ((flags & GTK_STATE_FLAG_ACTIVE) == GTK_STATE_FLAG_ACTIVE - || button->priv->blinking_timeout_id == 0) + if (xfce_arrow_button_get_suggested_action(GTK_WIDGET (button)) || button->priv->blinking_timeout_id == 0) { - gtk_widget_unset_state_flags (GTK_WIDGET (button), GTK_STATE_FLAG_ACTIVE); + xfce_arrow_button_set_suggested_action(GTK_WIDGET (button), FALSE); } else { - gtk_widget_set_state_flags (GTK_WIDGET (button), GTK_STATE_FLAG_ACTIVE, FALSE); + xfce_arrow_button_set_suggested_action(GTK_WIDGET (button), TRUE); } return (button->priv->blinking_counter++ < MAX_BLINKING_COUNT); @@ -496,7 +493,7 @@ xfce_arrow_button_blinking_timeout_destroyed (gpointer user_data) { XfceArrowButton *button = XFCE_ARROW_BUTTON (user_data); - gtk_widget_unset_state_flags (GTK_WIDGET (button), GTK_STATE_FLAG_ACTIVE); + xfce_arrow_button_set_suggested_action(GTK_WIDGET (button), FALSE); button->priv->blinking_timeout_id = 0; button->priv->blinking_counter = 0; @@ -570,7 +567,20 @@ xfce_arrow_button_set_arrow_type (XfceArrowButton *button, } } +//weather button has suggested action state set +gboolean xfce_arrow_button_get_suggested_action(GtkWidget* button){ + GtkStyleContext *context=gtk_widget_get_style_context(GTK_WIDGET(button)); + return gtk_style_context_has_class(context,GTK_STYLE_CLASS_SUGGESTED_ACTION); +} +//set suggested action state according to boolean active +void xfce_arrow_button_set_suggested_action(GtkWidget* button, gboolean active){ + GtkStyleContext *context=gtk_widget_get_style_context(GTK_WIDGET(button)); + if(active) + gtk_style_context_add_class(context,GTK_STYLE_CLASS_SUGGESTED_ACTION); + else + gtk_style_context_remove_class(context,GTK_STYLE_CLASS_SUGGESTED_ACTION); +} /** * xfce_arrow_button_get_blinking: diff --git a/libxfce4panel/xfce-arrow-button.h b/libxfce4panel/xfce-arrow-button.h index d267d65f..ad1b43d1 100644 --- a/libxfce4panel/xfce-arrow-button.h +++ b/libxfce4panel/xfce-arrow-button.h @@ -70,6 +70,9 @@ GtkArrowType xfce_arrow_button_get_arrow_type (XfceArrowButton *button); void xfce_arrow_button_set_arrow_type (XfceArrowButton *button, GtkArrowType arrow_type); +gboolean xfce_arrow_button_get_suggested_action(GtkWidget* button); +void xfce_arrow_button_set_suggested_action(GtkWidget* button, gboolean active); + gboolean xfce_arrow_button_get_blinking (XfceArrowButton *button); void xfce_arrow_button_set_blinking (XfceArrowButton *button, gboolean blinking);