[gnome-software] details: Move install button to a more prominent place



commit c9decc2f8ba8320dc67f5be71db572fb3f4eebcf
Author: Kalev Lember <kalevlember gmail com>
Date:   Sun Aug 10 20:29:31 2014 +0200

    details: Move install button to a more prominent place
    
    Jimm Hall's usability testing revealed that people often miss the
    install button in the headerbar. This commit moves it to a more
    prominent place in the dialog content area, as per Allan's mockup.
    
    
https://github.com/gnome-design-team/gnome-mockups/blob/master/software/version2/software-app-uninstalled.png

 src/gnome-software.ui   |   28 ---------------------
 src/gs-shell-details.c  |   61 +++++++++++++++++++++++------------------------
 src/gs-shell-details.ui |   49 +++++++++++++++++++++++++++++++++----
 src/gs-shell.c          |    4 ---
 4 files changed, 73 insertions(+), 69 deletions(-)
---
diff --git a/src/gnome-software.ui b/src/gnome-software.ui
index cad296a..09286ed 100644
--- a/src/gnome-software.ui
+++ b/src/gnome-software.ui
@@ -282,34 +282,6 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="button_install">
-                <property name="use_underline">True</property>
-                <property name="label" translatable="yes">_Install</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <style>
-                  <class name="suggested-action"/>
-                </style>
-              </object>
-              <packing>
-                <property name="pack_type">end</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="button_remove">
-                <property name="use_underline">True</property>
-                <property name="label" translatable="yes">_Remove</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <style>
-                  <class name="destructive-action"/>
-                </style>
-              </object>
-              <packing>
-                <property name="pack_type">end</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkButton" id="button_select">
                 <property name="image">button_select_image</property>
                 <property name="can_focus">True</property>
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 8f577b6..ec07807 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -67,6 +67,8 @@ struct GsShellDetailsPrivate
        GtkWidget               *button_details_launch;
        GtkWidget               *button_details_website;
        GtkWidget               *button_history;
+       GtkWidget               *button_install;
+       GtkWidget               *button_remove;
        GtkWidget               *infobar_details_app_norepo;
        GtkWidget               *infobar_details_app_repo;
        GtkWidget               *infobar_details_package_baseos;
@@ -169,34 +171,33 @@ gs_shell_details_refresh (GsShellDetails *shell_details)
        }
 
        /* install button */
-       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_install"));
        switch (state) {
        case AS_APP_STATE_AVAILABLE:
        case AS_APP_STATE_AVAILABLE_LOCAL:
-               gtk_widget_set_visible (widget, gs_app_get_kind (priv->app) != GS_APP_KIND_CORE);
-               gtk_widget_set_sensitive (widget, TRUE);
-               gtk_style_context_add_class (gtk_widget_get_style_context (widget), "suggested-action");
+               gtk_widget_set_visible (priv->button_install, gs_app_get_kind (priv->app) != 
GS_APP_KIND_CORE);
+               gtk_widget_set_sensitive (priv->button_install, TRUE);
+               gtk_style_context_add_class (gtk_widget_get_style_context (priv->button_install), 
"suggested-action");
                /* TRANSLATORS: button text in the header when an application
                 * can be installed */
-               gtk_button_set_label (GTK_BUTTON (widget), _("_Install"));
+               gtk_button_set_label (GTK_BUTTON (priv->button_install), _("_Install"));
                break;
        case AS_APP_STATE_QUEUED_FOR_INSTALL:
-               gtk_widget_set_visible (widget, FALSE);
+               gtk_widget_set_visible (priv->button_install, FALSE);
                break;
        case AS_APP_STATE_INSTALLING:
-               gtk_widget_set_visible (widget, TRUE);
-               gtk_widget_set_sensitive (widget, FALSE);
-               gtk_style_context_remove_class (gtk_widget_get_style_context (widget), "suggested-action");
+               gtk_widget_set_visible (priv->button_install, TRUE);
+               gtk_widget_set_sensitive (priv->button_install, FALSE);
+               gtk_style_context_remove_class (gtk_widget_get_style_context (priv->button_install), 
"suggested-action");
                /* TRANSLATORS: button text in the header when an application
                 * is in the process of being installed */
-               gtk_button_set_label (GTK_BUTTON (widget), _("_Installing"));
+               gtk_button_set_label (GTK_BUTTON (priv->button_install), _("_Installing"));
                break;
        case AS_APP_STATE_UNKNOWN:
        case AS_APP_STATE_INSTALLED:
        case AS_APP_STATE_REMOVING:
        case AS_APP_STATE_UPDATABLE:
        case AS_APP_STATE_UNAVAILABLE:
-               gtk_widget_set_visible (widget, FALSE);
+               gtk_widget_set_visible (priv->button_install, FALSE);
                break;
        default:
                g_warning ("App unexpectedly in state %s",
@@ -205,38 +206,37 @@ gs_shell_details_refresh (GsShellDetails *shell_details)
        }
 
        /* remove button */
-       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_remove"));
        if (kind == GS_APP_KIND_SYSTEM) {
-               gtk_widget_set_visible (widget, FALSE);
+               gtk_widget_set_visible (priv->button_remove, FALSE);
        } else {
                switch (state) {
                case AS_APP_STATE_INSTALLED:
                case AS_APP_STATE_UPDATABLE:
-                       gtk_widget_set_visible (widget, TRUE);
-                       gtk_widget_set_sensitive (widget, TRUE);
-                       gtk_style_context_add_class (gtk_widget_get_style_context (widget), 
"destructive-action");
+                       gtk_widget_set_visible (priv->button_remove, TRUE);
+                       gtk_widget_set_sensitive (priv->button_remove, TRUE);
+                       gtk_style_context_add_class (gtk_widget_get_style_context (priv->button_remove), 
"destructive-action");
                        /* TRANSLATORS: button text in the header when an application can be erased */
-                       gtk_button_set_label (GTK_BUTTON (widget), _("_Remove"));
+                       gtk_button_set_label (GTK_BUTTON (priv->button_remove), _("_Remove"));
                        break;
                case AS_APP_STATE_REMOVING:
-                       gtk_widget_set_visible (widget, TRUE);
-                       gtk_widget_set_sensitive (widget, FALSE);
-                       gtk_style_context_remove_class (gtk_widget_get_style_context (widget), 
"destructive-action");
+                       gtk_widget_set_visible (priv->button_remove, TRUE);
+                       gtk_widget_set_sensitive (priv->button_remove, FALSE);
+                       gtk_style_context_remove_class (gtk_widget_get_style_context (priv->button_remove), 
"destructive-action");
                        /* TRANSLATORS: button text in the header when an application can be installed */
-                       gtk_button_set_label (GTK_BUTTON (widget), _("_Removing"));
+                       gtk_button_set_label (GTK_BUTTON (priv->button_remove), _("_Removing"));
                        break;
                case AS_APP_STATE_QUEUED_FOR_INSTALL:
-                       gtk_widget_set_visible (widget, TRUE);
-                       gtk_widget_set_sensitive (widget, TRUE);
-                       gtk_style_context_remove_class (gtk_widget_get_style_context (widget), 
"destructive-action");
-                       gtk_button_set_label (GTK_BUTTON (widget), _("_Cancel"));
+                       gtk_widget_set_visible (priv->button_remove, TRUE);
+                       gtk_widget_set_sensitive (priv->button_remove, TRUE);
+                       gtk_style_context_remove_class (gtk_widget_get_style_context (priv->button_remove), 
"destructive-action");
+                       gtk_button_set_label (GTK_BUTTON (priv->button_remove), _("_Cancel"));
                        break;
                case AS_APP_STATE_AVAILABLE_LOCAL:
                case AS_APP_STATE_AVAILABLE:
                case AS_APP_STATE_INSTALLING:
                case AS_APP_STATE_UNAVAILABLE:
                case AS_APP_STATE_UNKNOWN:
-                       gtk_widget_set_visible (widget, FALSE);
+                       gtk_widget_set_visible (priv->button_remove, FALSE);
                        break;
                default:
                        g_warning ("App unexpectedly in state %s",
@@ -1321,7 +1321,6 @@ gs_shell_details_setup (GsShellDetails *shell_details,
                        GCancellable *cancellable)
 {
        GsShellDetailsPrivate *priv = shell_details->priv;
-       GtkWidget *widget;
        GtkAdjustment *adj;
 
        g_return_if_fail (GS_IS_SHELL_DETAILS (shell_details));
@@ -1342,12 +1341,10 @@ gs_shell_details_setup (GsShellDetails *shell_details,
        gtk_box_pack_start (GTK_BOX (priv->box_details_header), priv->star, FALSE, FALSE, 0);
 
        /* setup details */
-       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_install"));
-       g_signal_connect (widget, "clicked",
+       g_signal_connect (priv->button_install, "clicked",
                          G_CALLBACK (gs_shell_details_app_install_button_cb),
                          shell_details);
-       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_remove"));
-       g_signal_connect (widget, "clicked",
+       g_signal_connect (priv->button_remove, "clicked",
                          G_CALLBACK (gs_shell_details_app_remove_button_cb),
                          shell_details);
        g_signal_connect (priv->button_history, "clicked",
@@ -1395,6 +1392,8 @@ gs_shell_details_class_init (GsShellDetailsClass *klass)
        gtk_widget_class_bind_template_child_private (widget_class, GsShellDetails, button_details_launch);
        gtk_widget_class_bind_template_child_private (widget_class, GsShellDetails, button_details_website);
        gtk_widget_class_bind_template_child_private (widget_class, GsShellDetails, button_history);
+       gtk_widget_class_bind_template_child_private (widget_class, GsShellDetails, button_install);
+       gtk_widget_class_bind_template_child_private (widget_class, GsShellDetails, button_remove);
        gtk_widget_class_bind_template_child_private (widget_class, GsShellDetails, 
infobar_details_app_norepo);
        gtk_widget_class_bind_template_child_private (widget_class, GsShellDetails, infobar_details_app_repo);
        gtk_widget_class_bind_template_child_private (widget_class, GsShellDetails, 
infobar_details_package_baseos);
diff --git a/src/gs-shell-details.ui b/src/gs-shell-details.ui
index 9e9d4fd..cd2a5fe 100644
--- a/src/gs-shell-details.ui
+++ b/src/gs-shell-details.ui
@@ -88,6 +88,9 @@
                             <property name="can_focus">False</property>
                             <property name="halign">start</property>
                             <property name="valign">start</property>
+                            <property name="margin_start">24</property>
+                            <property name="margin_end">24</property>
+                            <property name="margin_bottom">24</property>
                             <child>
                               <object class="GtkLabel" id="application_details_title">
                                 <property name="visible">True</property>
@@ -95,9 +98,7 @@
                                 <property name="halign">start</property>
                                 <property name="valign">start</property>
                                 <property name="hexpand">True</property>
-                                <property name="margin_start">24</property>
-                                <property name="margin_end">24</property>
-                                <property name="margin_bottom">12</property>
+                                <property name="margin_bottom">4</property>
                                 <property name="xalign">0</property>
                                 <property name="selectable">True</property>
                                 <style>
@@ -117,9 +118,7 @@
                                 <property name="halign">start</property>
                                 <property name="valign">start</property>
                                 <property name="hexpand">True</property>
-                                <property name="margin_start">24</property>
-                                <property name="margin_end">24</property>
-                                <property name="margin_bottom">28</property>
+                                <property name="margin_bottom">16</property>
                                 <property name="xalign">0</property>
                                 <property name="selectable">True</property>
                                 <property name="wrap">True</property>
@@ -134,6 +133,44 @@
                                 <property name="position">1</property>
                               </packing>
                             </child>
+                            <child>
+                              <object class="GtkButton" id="button_install">
+                                <property name="use_underline">True</property>
+                                <property name="label" translatable="yes">_Install</property>
+                                <property name="width_request">105</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="halign">start</property>
+                                <property name="valign">start</property>
+                                <style>
+                                  <class name="suggested-action"/>
+                                </style>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkButton" id="button_remove">
+                                <property name="use_underline">True</property>
+                                <property name="label" translatable="yes">_Remove</property>
+                                <property name="width_request">105</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="halign">start</property>
+                                <property name="valign">start</property>
+                                <style>
+                                  <class name="destructive-action"/>
+                                </style>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">3</property>
+                              </packing>
+                            </child>
                           </object>
                           <packing>
                             <property name="expand">False</property>
diff --git a/src/gs-shell.c b/src/gs-shell.c
index f629697..6414ef5 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -141,10 +141,6 @@ gs_shell_change_mode (GsShell *shell,
        gtk_widget_hide (widget);
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "header_label"));
        gtk_widget_hide (widget);
-       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_install"));
-       gtk_widget_hide (widget);
-       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_remove"));
-       gtk_widget_hide (widget);
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_select"));
        gtk_widget_hide (widget);
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_refresh"));


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