[gnome-software] trivial: Use a sizegroup for the button size



commit df2a8366f91b87302d9514f40c8f5ed11cb5cf4e
Author: Richard Hughes <richard hughsie com>
Date:   Thu Jan 12 15:40:16 2017 +0000

    trivial: Use a sizegroup for the button size
    
    If we go over the 100px minimum size then the buttons are different sizes.

 src/gs-app-row.c         |    4 +++-
 src/gs-app-row.h         |    3 ++-
 src/gs-shell-extras.c    |    6 +++++-
 src/gs-shell-installed.c |    6 +++++-
 src/gs-shell-moderate.c  |    6 +++++-
 src/gs-shell-search.c    |    6 +++++-
 src/gs-update-list.c     |   10 +++++++---
 7 files changed, 32 insertions(+), 9 deletions(-)
---
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index 0e70c7e..1fd0409 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -709,12 +709,14 @@ gs_app_row_init (GsAppRow *app_row)
 void
 gs_app_row_set_size_groups (GsAppRow *app_row,
                            GtkSizeGroup *image,
-                           GtkSizeGroup *name)
+                           GtkSizeGroup *name,
+                           GtkSizeGroup *button)
 {
        GsAppRowPrivate *priv = gs_app_row_get_instance_private (app_row);
 
        gtk_size_group_add_widget (image, priv->image);
        gtk_size_group_add_widget (name, priv->name_box);
+       gtk_size_group_add_widget (button, priv->button);
 }
 
 void
diff --git a/src/gs-app-row.h b/src/gs-app-row.h
index ed649ff..e705ce5 100644
--- a/src/gs-app-row.h
+++ b/src/gs-app-row.h
@@ -64,7 +64,8 @@ gboolean       gs_app_row_get_selected                (GsAppRow       *app_row);
 GsApp          *gs_app_row_get_app                     (GsAppRow       *app_row);
 void            gs_app_row_set_size_groups             (GsAppRow       *app_row,
                                                         GtkSizeGroup   *image,
-                                                        GtkSizeGroup   *name);
+                                                        GtkSizeGroup   *name,
+                                                        GtkSizeGroup   *button);
 void            gs_app_row_set_show_installed_size     (GsAppRow       *app_row,
                                                         gboolean        show_size);
 
diff --git a/src/gs-shell-extras.c b/src/gs-shell-extras.c
index 1d796b4..f36bb3c 100644
--- a/src/gs-shell-extras.c
+++ b/src/gs-shell-extras.c
@@ -59,6 +59,7 @@ struct _GsShellExtras
        GsShellExtrasState        state;
        GtkSizeGroup             *sizegroup_image;
        GtkSizeGroup             *sizegroup_name;
+       GtkSizeGroup             *sizegroup_button;
        GPtrArray                *array_search_data;
        GsShellExtrasMode         mode;
        GsLanguage               *language;
@@ -302,7 +303,8 @@ gs_shell_extras_add_app (GsShellExtras *self, GsApp *app, SearchData *search_dat
        gtk_container_add (GTK_CONTAINER (self->list_box_results), app_row);
        gs_app_row_set_size_groups (GS_APP_ROW (app_row),
                                    self->sizegroup_image,
-                                   self->sizegroup_name);
+                                   self->sizegroup_name,
+                                   self->sizegroup_button);
        gtk_widget_show (app_row);
 }
 
@@ -1160,6 +1162,7 @@ gs_shell_extras_dispose (GObject *object)
 
        g_clear_object (&self->sizegroup_image);
        g_clear_object (&self->sizegroup_name);
+       g_clear_object (&self->sizegroup_button);
        g_clear_object (&self->language);
        g_clear_object (&self->vendor);
        g_clear_object (&self->builder);
@@ -1180,6 +1183,7 @@ gs_shell_extras_init (GsShellExtras *self)
        self->state = GS_SHELL_EXTRAS_STATE_LOADING;
        self->sizegroup_image = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        self->sizegroup_name = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+       self->sizegroup_button = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        self->vendor = gs_vendor_new ();
 
        /* map ISO639 to language names */
diff --git a/src/gs-shell-installed.c b/src/gs-shell-installed.c
index 21a459d..7a49f08 100644
--- a/src/gs-shell-installed.c
+++ b/src/gs-shell-installed.c
@@ -43,6 +43,7 @@ struct _GsShellInstalled
        GCancellable            *cancellable;
        GtkSizeGroup            *sizegroup_image;
        GtkSizeGroup            *sizegroup_name;
+       GtkSizeGroup            *sizegroup_button;
        gboolean                 cache_valid;
        gboolean                 waiting;
        GsShell                 *shell;
@@ -188,7 +189,8 @@ gs_shell_installed_add_app (GsShellInstalled *self, GsAppList *list, GsApp *app)
        gtk_container_add (GTK_CONTAINER (self->list_box_install), app_row);
        gs_app_row_set_size_groups (GS_APP_ROW (app_row),
                                    self->sizegroup_image,
-                                   self->sizegroup_name);
+                                   self->sizegroup_name,
+                                   self->sizegroup_button);
 
        if (!gs_app_has_quirk (app, AS_APP_QUIRK_COMPULSORY)) {
                gs_app_row_set_show_installed_size (GS_APP_ROW (app_row),
@@ -783,6 +785,7 @@ gs_shell_installed_dispose (GObject *object)
 
        g_clear_object (&self->sizegroup_image);
        g_clear_object (&self->sizegroup_name);
+       g_clear_object (&self->sizegroup_button);
 
        g_clear_object (&self->builder);
        g_clear_object (&self->plugin_loader);
@@ -823,6 +826,7 @@ gs_shell_installed_init (GsShellInstalled *self)
 
        self->sizegroup_image = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        self->sizegroup_name = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+       self->sizegroup_button = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
        self->settings = g_settings_new ("org.gnome.software");
        g_signal_connect_swapped (self->settings, "changed",
diff --git a/src/gs-shell-moderate.c b/src/gs-shell-moderate.c
index 1f9e27c..def33bb 100644
--- a/src/gs-shell-moderate.c
+++ b/src/gs-shell-moderate.c
@@ -41,6 +41,7 @@ struct _GsShellModerate
        GCancellable            *cancellable;
        GtkSizeGroup            *sizegroup_image;
        GtkSizeGroup            *sizegroup_name;
+       GtkSizeGroup            *sizegroup_button;
        GsShell                 *shell;
 
        GtkWidget               *list_box_install;
@@ -111,7 +112,8 @@ gs_shell_moderate_add_app (GsShellModerate *self, GsApp *app)
        gtk_container_add (GTK_CONTAINER (self->list_box_install), app_row);
        gs_app_row_set_size_groups (GS_APP_ROW (app_row),
                                    self->sizegroup_image,
-                                   self->sizegroup_name);
+                                   self->sizegroup_name,
+                                   self->sizegroup_button);
 
        /* add reviews */
        reviews = gs_app_get_reviews (app);
@@ -264,6 +266,7 @@ gs_shell_moderate_dispose (GObject *object)
 
        g_clear_object (&self->sizegroup_image);
        g_clear_object (&self->sizegroup_name);
+       g_clear_object (&self->sizegroup_button);
 
        g_clear_object (&self->builder);
        g_clear_object (&self->plugin_loader);
@@ -301,6 +304,7 @@ gs_shell_moderate_init (GsShellModerate *self)
 
        self->sizegroup_image = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        self->sizegroup_name = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+       self->sizegroup_button = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 }
 
 GsShellModerate *
diff --git a/src/gs-shell-search.c b/src/gs-shell-search.c
index 0820ebd..b9c9a2d 100644
--- a/src/gs-shell-search.c
+++ b/src/gs-shell-search.c
@@ -40,6 +40,7 @@ struct _GsShellSearch
        GCancellable            *search_cancellable;
        GtkSizeGroup            *sizegroup_image;
        GtkSizeGroup            *sizegroup_name;
+       GtkSizeGroup            *sizegroup_button;
        GsShell                 *shell;
        gchar                   *appid_to_show;
        gchar                   *value;
@@ -145,7 +146,8 @@ gs_shell_search_get_search_cb (GObject *source_object,
                gtk_container_add (GTK_CONTAINER (self->list_box_search), app_row);
                gs_app_row_set_size_groups (GS_APP_ROW (app_row),
                                            self->sizegroup_image,
-                                           self->sizegroup_name);
+                                           self->sizegroup_name,
+                                           self->sizegroup_button);
                gtk_widget_show (app_row);
        }
 
@@ -430,6 +432,7 @@ gs_shell_search_dispose (GObject *object)
 
        g_clear_object (&self->sizegroup_image);
        g_clear_object (&self->sizegroup_name);
+       g_clear_object (&self->sizegroup_button);
 
        g_clear_object (&self->builder);
        g_clear_object (&self->plugin_loader);
@@ -479,6 +482,7 @@ gs_shell_search_init (GsShellSearch *self)
 
        self->sizegroup_image = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        self->sizegroup_name = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+       self->sizegroup_button = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 }
 
 GsShellSearch *
diff --git a/src/gs-update-list.c b/src/gs-update-list.c
index 43a084a..eb37717 100644
--- a/src/gs-update-list.c
+++ b/src/gs-update-list.c
@@ -32,8 +32,9 @@
 
 typedef struct
 {
-       GtkSizeGroup    *sizegroup_image;
-       GtkSizeGroup    *sizegroup_name;
+       GtkSizeGroup            *sizegroup_image;
+       GtkSizeGroup            *sizegroup_name;
+       GtkSizeGroup            *sizegroup_button;
 } GsUpdateListPrivate;
 
 enum {
@@ -69,7 +70,8 @@ gs_update_list_add_app (GsUpdateList *update_list,
        gtk_container_add (GTK_CONTAINER (update_list), app_row);
        gs_app_row_set_size_groups (GS_APP_ROW (app_row),
                                    priv->sizegroup_image,
-                                   priv->sizegroup_name);
+                                   priv->sizegroup_name,
+                                   priv->sizegroup_button);
        gtk_widget_show (app_row);
 }
 
@@ -196,6 +198,7 @@ gs_update_list_dispose (GObject *object)
 
        g_clear_object (&priv->sizegroup_image);
        g_clear_object (&priv->sizegroup_name);
+       g_clear_object (&priv->sizegroup_button);
 
        G_OBJECT_CLASS (gs_update_list_parent_class)->dispose (object);
 }
@@ -206,6 +209,7 @@ gs_update_list_init (GsUpdateList *update_list)
        GsUpdateListPrivate *priv = gs_update_list_get_instance_private (update_list);
        priv->sizegroup_image = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        priv->sizegroup_name = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+       priv->sizegroup_button = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
        gtk_list_box_set_header_func (GTK_LIST_BOX (update_list),
                                      list_header_func,


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