[gnome-software] app-row: Put descriptions in a separate size group



commit d7af05eab373d420fd28ba4855e774379ac72d9f
Author: Kalev Lember <klember redhat com>
Date:   Tue Jan 16 18:57:32 2018 +0100

    app-row: Put descriptions in a separate size group
    
    We already had names, icons, and buttons in size groups; this adds
    another one for descriptions.
    
    This fixes descriptions on the updates page to properly line up again.

 src/gs-app-row.c        |    4 ++++
 src/gs-app-row.h        |    1 +
 src/gs-app-row.ui       |    2 +-
 src/gs-extras-page.c    |    4 ++++
 src/gs-installed-page.c |    4 ++++
 src/gs-moderate-page.c  |    4 ++++
 src/gs-search-page.c    |    4 ++++
 src/gs-update-list.c    |    4 ++++
 src/gs-updates-page.c   |    5 +++++
 9 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index 85e8dc0..a34c552 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -39,6 +39,7 @@ typedef struct
        GtkWidget       *version_label;
        GtkWidget       *star;
        GtkWidget       *folder_label;
+       GtkWidget       *description_box;
        GtkWidget       *description_label;
        GtkWidget       *button_box;
        GtkWidget       *button;
@@ -665,6 +666,7 @@ gs_app_row_class_init (GsAppRowClass *klass)
        gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, version_label);
        gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, star);
        gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, folder_label);
+       gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, description_box);
        gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, description_label);
        gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, button_box);
        gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, button);
@@ -714,12 +716,14 @@ void
 gs_app_row_set_size_groups (GsAppRow *app_row,
                            GtkSizeGroup *image,
                            GtkSizeGroup *name,
+                           GtkSizeGroup *desc,
                            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 (desc, priv->description_box);
        gtk_size_group_add_widget (button, priv->button);
 }
 
diff --git a/src/gs-app-row.h b/src/gs-app-row.h
index 007cf3b..47fa769 100644
--- a/src/gs-app-row.h
+++ b/src/gs-app-row.h
@@ -65,6 +65,7 @@ GsApp         *gs_app_row_get_app                     (GsAppRow       *app_row);
 void            gs_app_row_set_size_groups             (GsAppRow       *app_row,
                                                         GtkSizeGroup   *image,
                                                         GtkSizeGroup   *name,
+                                                        GtkSizeGroup   *desc,
                                                         GtkSizeGroup   *button);
 void            gs_app_row_set_show_installed_size     (GsAppRow       *app_row,
                                                         gboolean        show_size);
diff --git a/src/gs-app-row.ui b/src/gs-app-row.ui
index 5807d28..96376b6 100644
--- a/src/gs-app-row.ui
+++ b/src/gs-app-row.ui
@@ -106,7 +106,7 @@
           </packing>
         </child>
         <child>
-          <object class="GtkBox" id="box_description">
+          <object class="GtkBox" id="description_box">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="margin_top">3</property>
diff --git a/src/gs-extras-page.c b/src/gs-extras-page.c
index 4d0d0ca..def7f3f 100644
--- a/src/gs-extras-page.c
+++ b/src/gs-extras-page.c
@@ -58,6 +58,7 @@ struct _GsExtrasPage
        GsExtrasPageState         state;
        GtkSizeGroup             *sizegroup_image;
        GtkSizeGroup             *sizegroup_name;
+       GtkSizeGroup             *sizegroup_desc;
        GtkSizeGroup             *sizegroup_button;
        GPtrArray                *array_search_data;
        GsExtrasPageMode          mode;
@@ -303,6 +304,7 @@ gs_extras_page_add_app (GsExtrasPage *self, GsApp *app, SearchData *search_data)
        gs_app_row_set_size_groups (GS_APP_ROW (app_row),
                                    self->sizegroup_image,
                                    self->sizegroup_name,
+                                   self->sizegroup_desc,
                                    self->sizegroup_button);
        gtk_widget_show (app_row);
 }
@@ -1168,6 +1170,7 @@ gs_extras_page_dispose (GObject *object)
 
        g_clear_object (&self->sizegroup_image);
        g_clear_object (&self->sizegroup_name);
+       g_clear_object (&self->sizegroup_desc);
        g_clear_object (&self->sizegroup_button);
        g_clear_object (&self->language);
        g_clear_object (&self->vendor);
@@ -1189,6 +1192,7 @@ gs_extras_page_init (GsExtrasPage *self)
        self->state = GS_EXTRAS_PAGE_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_desc = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        self->sizegroup_button = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        self->vendor = gs_vendor_new ();
 
diff --git a/src/gs-installed-page.c b/src/gs-installed-page.c
index 34f2339..6b5d893 100644
--- a/src/gs-installed-page.c
+++ b/src/gs-installed-page.c
@@ -41,6 +41,7 @@ struct _GsInstalledPage
        GCancellable            *cancellable;
        GtkSizeGroup            *sizegroup_image;
        GtkSizeGroup            *sizegroup_name;
+       GtkSizeGroup            *sizegroup_desc;
        GtkSizeGroup            *sizegroup_button;
        gboolean                 cache_valid;
        gboolean                 waiting;
@@ -200,6 +201,7 @@ gs_installed_page_add_app (GsInstalledPage *self, GsAppList *list, GsApp *app)
        gs_app_row_set_size_groups (GS_APP_ROW (app_row),
                                    self->sizegroup_image,
                                    self->sizegroup_name,
+                                   self->sizegroup_desc,
                                    self->sizegroup_button);
 
        if (!gs_app_has_quirk (app, AS_APP_QUIRK_COMPULSORY)) {
@@ -841,6 +843,7 @@ gs_installed_page_dispose (GObject *object)
 
        g_clear_object (&self->sizegroup_image);
        g_clear_object (&self->sizegroup_name);
+       g_clear_object (&self->sizegroup_desc);
        g_clear_object (&self->sizegroup_button);
 
        g_clear_object (&self->builder);
@@ -883,6 +886,7 @@ gs_installed_page_init (GsInstalledPage *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_desc = 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");
diff --git a/src/gs-moderate-page.c b/src/gs-moderate-page.c
index 1ad3540..fdc5c9f 100644
--- a/src/gs-moderate-page.c
+++ b/src/gs-moderate-page.c
@@ -38,6 +38,7 @@ struct _GsModeratePage
        GCancellable            *cancellable;
        GtkSizeGroup            *sizegroup_image;
        GtkSizeGroup            *sizegroup_name;
+       GtkSizeGroup            *sizegroup_desc;
        GtkSizeGroup            *sizegroup_button;
        GsShell                 *shell;
 
@@ -147,6 +148,7 @@ gs_moderate_page_add_app (GsModeratePage *self, GsApp *app)
        gs_app_row_set_size_groups (GS_APP_ROW (app_row),
                                    self->sizegroup_image,
                                    self->sizegroup_name,
+                                   self->sizegroup_desc,
                                    self->sizegroup_button);
 
        /* add reviews */
@@ -304,6 +306,7 @@ gs_moderate_page_dispose (GObject *object)
 
        g_clear_object (&self->sizegroup_image);
        g_clear_object (&self->sizegroup_name);
+       g_clear_object (&self->sizegroup_desc);
        g_clear_object (&self->sizegroup_button);
 
        g_clear_object (&self->plugin_loader);
@@ -342,6 +345,7 @@ gs_moderate_page_init (GsModeratePage *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_desc = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        self->sizegroup_button = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 }
 
diff --git a/src/gs-search-page.c b/src/gs-search-page.c
index 0ed33a6..87d494d 100644
--- a/src/gs-search-page.c
+++ b/src/gs-search-page.c
@@ -41,6 +41,7 @@ struct _GsSearchPage
        GCancellable            *search_cancellable;
        GtkSizeGroup            *sizegroup_image;
        GtkSizeGroup            *sizegroup_name;
+       GtkSizeGroup            *sizegroup_desc;
        GtkSizeGroup            *sizegroup_button;
        GsShell                 *shell;
        gchar                   *appid_to_show;
@@ -140,6 +141,7 @@ gs_search_page_get_search_cb (GObject *source_object,
                gs_app_row_set_size_groups (GS_APP_ROW (app_row),
                                            self->sizegroup_image,
                                            self->sizegroup_name,
+                                           self->sizegroup_desc,
                                            self->sizegroup_button);
                gtk_widget_show (app_row);
        }
@@ -454,6 +456,7 @@ gs_search_page_dispose (GObject *object)
 
        g_clear_object (&self->sizegroup_image);
        g_clear_object (&self->sizegroup_name);
+       g_clear_object (&self->sizegroup_desc);
        g_clear_object (&self->sizegroup_button);
 
        g_clear_object (&self->builder);
@@ -505,6 +508,7 @@ gs_search_page_init (GsSearchPage *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_desc = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        self->sizegroup_button = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
        self->max_results = GS_SEARCH_PAGE_MAX_RESULTS;
diff --git a/src/gs-update-list.c b/src/gs-update-list.c
index fe58c94..b95067b 100644
--- a/src/gs-update-list.c
+++ b/src/gs-update-list.c
@@ -32,6 +32,7 @@ typedef struct
 {
        GtkSizeGroup            *sizegroup_image;
        GtkSizeGroup            *sizegroup_name;
+       GtkSizeGroup            *sizegroup_desc;
 } GsUpdateListPrivate;
 
 G_DEFINE_TYPE_WITH_PRIVATE (GsUpdateList, gs_update_list, GTK_TYPE_LIST_BOX)
@@ -58,6 +59,7 @@ gs_update_list_add_app (GsUpdateList *update_list, GsApp *app)
        gs_app_row_set_size_groups (GS_APP_ROW (app_row),
                                    priv->sizegroup_image,
                                    priv->sizegroup_name,
+                                   priv->sizegroup_desc,
                                    NULL);
        g_signal_connect_object (app, "notify::state",
                                 G_CALLBACK (gs_update_list_app_state_notify_cb),
@@ -93,6 +95,7 @@ gs_update_list_dispose (GObject *object)
 
        g_clear_object (&priv->sizegroup_image);
        g_clear_object (&priv->sizegroup_name);
+       g_clear_object (&priv->sizegroup_desc);
 
        G_OBJECT_CLASS (gs_update_list_parent_class)->dispose (object);
 }
@@ -103,6 +106,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_desc = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
        gtk_list_box_set_header_func (GTK_LIST_BOX (update_list),
                                      list_header_func,
diff --git a/src/gs-updates-page.c b/src/gs-updates-page.c
index 32db736..c6abd31 100644
--- a/src/gs-updates-page.c
+++ b/src/gs-updates-page.c
@@ -108,6 +108,7 @@ struct _GsUpdatesPage
 
        GtkSizeGroup            *sizegroup_image;
        GtkSizeGroup            *sizegroup_name;
+       GtkSizeGroup            *sizegroup_desc;
        GtkSizeGroup            *sizegroup_button;
        GtkSizeGroup            *sizegroup_header;
        GtkListBox              *listboxes[GS_UPDATE_PAGE_SECTION_LAST];
@@ -976,6 +977,7 @@ _add_app_row (GsUpdatesPage *self, GsApp *app)
        gs_app_row_set_size_groups (GS_APP_ROW (app_row),
                                    self->sizegroup_image,
                                    self->sizegroup_name,
+                                   self->sizegroup_desc,
                                    self->sizegroup_button);
        g_signal_connect_object (app, "notify::state",
                                 G_CALLBACK (_app_state_notify_cb),
@@ -1848,6 +1850,7 @@ gs_updates_page_setup (GsPage *page,
        /* visually aligned */
        self->sizegroup_image = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        self->sizegroup_name = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+       self->sizegroup_desc = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        self->sizegroup_button = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        self->sizegroup_header = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
 
@@ -1886,6 +1889,7 @@ gs_updates_page_dispose (GObject *object)
 
        g_clear_object (&self->sizegroup_image);
        g_clear_object (&self->sizegroup_name);
+       g_clear_object (&self->sizegroup_desc);
        g_clear_object (&self->sizegroup_button);
        g_clear_object (&self->sizegroup_header);
 
@@ -1933,6 +1937,7 @@ gs_updates_page_init (GsUpdatesPage *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_desc = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        self->sizegroup_button = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        self->sizegroup_header = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
 


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