[gnome-software] Tweak button colors



commit 2ca9fec46558f2585d13c8694a7c7cbe51303855
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Aug 30 12:10:27 2013 -0400

    Tweak button colors
    
    Don't make install buttons blue, the mockups don't have that.
    And add a way to remove the redness from the remove buttons,
    since a wall of red is jarring.

 src/gs-app-widget.c |   16 ++++++++++++----
 src/gs-app-widget.h |    2 ++
 2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-app-widget.c b/src/gs-app-widget.c
index 4929e8f..3950984 100644
--- a/src/gs-app-widget.c
+++ b/src/gs-app-widget.c
@@ -37,6 +37,7 @@ struct _GsAppWidgetPrivate
        GtkWidget       *widget_name;
        GtkWidget       *widget_spinner;
        GtkWidget       *widget_version;
+        gboolean         colorful;
 };
 
 
@@ -131,26 +132,24 @@ gs_app_widget_refresh (GsAppWidget *app_widget)
        /* show / hide widgets depending on kind */
        context = gtk_widget_get_style_context (priv->widget_button);
        gtk_style_context_remove_class (context, "destructive-action");
-       gtk_style_context_remove_class (context, "suggested-action");
 
        switch (gs_app_get_state (app_widget->priv->app)) {
        case GS_APP_STATE_AVAILABLE:
                gtk_widget_set_visible (priv->widget_spinner, FALSE);
                gtk_widget_set_visible (priv->widget_button, TRUE);
                gtk_button_set_label (GTK_BUTTON (priv->widget_button), _("Install"));
-               gtk_style_context_add_class (context, "suggested-action");
                break;
        case GS_APP_STATE_INSTALLED:
                gtk_widget_set_visible (priv->widget_spinner, FALSE);
                gtk_widget_set_visible (priv->widget_button, TRUE);
                gtk_button_set_label (GTK_BUTTON (priv->widget_button), _("Remove"));
-               gtk_style_context_add_class (context, "destructive-action");
+                if (priv->colorful)
+                       gtk_style_context_add_class (context, "destructive-action");
                break;
        case GS_APP_STATE_UPDATABLE:
                gtk_widget_set_visible (priv->widget_spinner, FALSE);
                gtk_widget_set_visible (priv->widget_button, FALSE);
                gtk_button_set_label (GTK_BUTTON (priv->widget_button), _("Update"));
-               gtk_style_context_add_class (context, "suggested-action");
                break;
        case GS_APP_STATE_INSTALLING:
                gtk_spinner_start (GTK_SPINNER (priv->widget_spinner));
@@ -270,6 +269,8 @@ gs_app_widget_init (GsAppWidget *app_widget)
        priv = app_widget->priv;
        priv->markdown = ch_markdown_new ();
 
+        priv->colorful = TRUE;
+
        /* set defaults */
        gtk_box_set_spacing (GTK_BOX (app_widget), 3);
        g_object_set (app_widget, "margin", 9, NULL);
@@ -360,6 +361,13 @@ gs_app_widget_set_size_groups (GsAppWidget  *app_widget,
        gtk_size_group_add_widget (name, box);
 }
 
+void
+gs_app_widget_set_colorful (GsAppWidget *app_widget,
+                            gboolean     colorful)
+{
+        app_widget->priv->colorful = colorful;
+}
+
 /**
  * gs_app_widget_new:
  **/
diff --git a/src/gs-app-widget.h b/src/gs-app-widget.h
index 0235f55..9bb7bfa 100644
--- a/src/gs-app-widget.h
+++ b/src/gs-app-widget.h
@@ -56,6 +56,8 @@ struct _GsAppWidgetClass
 
 GType           gs_app_widget_get_type                 (void);
 GtkWidget      *gs_app_widget_new                      (void);
+void             gs_app_widget_set_colorful             (GsAppWidget    *app_widget,
+                                                         gboolean        colorful);
 GsApp          *gs_app_widget_get_app                  (GsAppWidget    *app_widget);
 void            gs_app_widget_set_app                  (GsAppWidget    *app_widget,
                                                         GsApp          *app);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]