[gnome-software/bilelmoussaoui/no-frame] Revert "ui: stop using GtkFrame"



commit 9cc76755281c2b0054eb0e04715f2f9a267a7837
Author: Phaedrus Leeds <mwleeds protonmail com>
Date:   Fri Apr 9 15:31:37 2021 -0700

    Revert "ui: stop using GtkFrame"
    
    This reverts commit 6a18c3f4edc52a05e851abe12969969a0aea3eb3.

 src/gs-app-version-history-dialog.ui | 24 ++++++----
 src/gs-details-page.c                |  4 +-
 src/gs-details-page.ui               | 91 ++++++++++++++++++++----------------
 src/gs-history-dialog.c              | 28 +++++++++++
 src/gs-history-dialog.ui             | 20 +++++---
 src/gs-removal-dialog.c              | 15 ++++++
 src/gs-removal-dialog.ui             | 15 +++---
 src/gs-repos-dialog.c                | 29 ++++++++++--
 src/gs-repos-dialog.ui               | 32 +++++++------
 src/gs-update-dialog.ui              | 14 ++++--
 10 files changed, 191 insertions(+), 81 deletions(-)
---
diff --git a/src/gs-app-version-history-dialog.ui b/src/gs-app-version-history-dialog.ui
index ede850ad2..062b4d6f5 100644
--- a/src/gs-app-version-history-dialog.ui
+++ b/src/gs-app-version-history-dialog.ui
@@ -25,17 +25,23 @@
                 <property name="visible">True</property>
                 <property name="vexpand">True</property>
                 <property name="hexpand">False</property>
-                <property name="margin-start">12</property>
-                <property name="margin-end">12</property>
-                <property name="margin-bottom">18</property>
-                <property name="margin-top">18</property>
                 <child>
-                  <object class="GtkListBox" id="listbox">
+                  <object class="GtkFrame">
                     <property name="visible">True</property>
-                    <property name="selection-mode">none</property>
-                    <style>
-                      <class name="content"/>
-                    </style>
+                    <property name="shadow_type">none</property>
+                    <property name="margin-start">12</property>
+                    <property name="margin-end">12</property>
+                    <property name="margin-bottom">18</property>
+                    <property name="margin-top">18</property>
+                    <child>
+                      <object class="GtkListBox" id="listbox">
+                        <property name="visible">True</property>
+                        <property name="selection-mode">none</property>
+                        <style>
+                          <class name="content"/>
+                        </style>
+                      </object>
+                    </child>
                   </object>
                 </child>
               </object>
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 00b0030b0..74126d693 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -120,6 +120,7 @@ struct _GsDetailsPage
        GtkWidget               *label_licenses_intro;
        GtkWidget               *list_box_addons;
        GtkWidget               *list_box_version_history;
+       GtkWidget               *box_version_history_frame;
        GtkWidget               *row_latest_version;
        GtkWidget               *version_history_button;
        GtkWidget               *box_reviews;
@@ -1316,7 +1317,7 @@ gs_details_page_refresh_all (GsDetailsPage *self)
        if (version_history == NULL) {
                const char *version = gs_app_get_version (self->app);
                if (version == NULL || *version == '\0')
-                       gtk_widget_set_visible (self->list_box_version_history, FALSE);
+                       gtk_widget_set_visible (self->box_version_history_frame, FALSE);
                else
                        gs_app_version_history_row_set_info (GS_APP_VERSION_HISTORY_ROW 
(self->row_latest_version),
                                                             version, gs_app_get_release_date (self->app), 
NULL);
@@ -3043,6 +3044,7 @@ gs_details_page_class_init (GsDetailsPageClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, label_failed);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, list_box_addons);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, list_box_version_history);
+       gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, box_version_history_frame);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, row_latest_version);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, version_history_button);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, box_reviews);
diff --git a/src/gs-details-page.ui b/src/gs-details-page.ui
index f440535c2..31b6f4dba 100644
--- a/src/gs-details-page.ui
+++ b/src/gs-details-page.ui
@@ -139,13 +139,13 @@
                                 <child>
                                   <object class="GtkEventBox" id="star_eventbox">
                                     <property name="visible">True</property>
-                                    <child>
-                                      <object class="GsStarWidget" id="star">
-                                        <property name="visible">True</property>
-                                        <property name="halign">start</property>
-                                        <property name="valign">center</property>
-                                      </object>
-                                    </child>
+                                      <child>
+                                  <object class="GsStarWidget" id="star">
+                                    <property name="visible">True</property>
+                                    <property name="halign">start</property>
+                                    <property name="valign">center</property>
+                                  </object>
+                                </child>
                                   </object>
                                 </child>
                                 <child>
@@ -424,56 +424,69 @@
                                 </child>
                               </object>
                             </child>
+
                             <child>
-                              <object class="GtkListBox" id="list_box_addons">
+                              <object class="GtkFrame" id="box_addons_frame">
                                 <property name="visible">True</property>
-                                <property name="selection_mode">none</property>
+                                <property name="shadow_type">none</property>
                                 <property name="halign">fill</property>
                                 <property name="valign">start</property>
-                                <style>
-                                  <class name="content"/>
-                                </style>
+                                <child>
+                                  <object class="GtkListBox" id="list_box_addons">
+                                    <property name="visible">True</property>
+                                    <property name="selection_mode">none</property>
+                                    <style>
+                                      <class name="content"/>
+                                    </style>
+                                  </object>
+                                </child>
                               </object>
                             </child>
                           </object>
                         </child>
                         <child>
-                          <object class="GtkListBox" id="list_box_version_history">
+                          <object class="GtkFrame" id="box_version_history_frame">
                             <property name="visible">True</property>
-                            <property name="selection_mode">none</property>
+                            <property name="shadow_type">none</property>
                             <property name="halign">fill</property>
                             <property name="valign">start</property>
-                            <style>
-                              <class name="content"/>
-                            </style>
-                            <child>
-                              <object class="GsAppVersionHistoryRow" id="row_latest_version">
-                              </object>
-                            </child>
                             <child>
-                              <object class="GtkListBoxRow" id="version_history_button">
+                              <object class="GtkListBox" id="list_box_version_history">
                                 <property name="visible">True</property>
-                                <property name="can_focus">True</property>
+                                <property name="selection_mode">none</property>
+                                <style>
+                                  <class name="content"/>
+                                </style>
                                 <child>
-                                  <object class="GtkBox">
+                                  <object class="GsAppVersionHistoryRow" id="row_latest_version">
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkListBoxRow" id="version_history_button">
                                     <property name="visible">True</property>
-                                    <property name="orientation">horizontal</property>
-                                    <property name="halign">center</property>
-                                    <property name="margin_top">12</property>
-                                    <property name="margin_bottom">12</property>
-                                    <child>
-                                      <object class="GtkLabel">
-                                        <property name="visible">True</property>
-                                        <property name="xalign">0</property>
-                                        <property name="yalign">0.5</property>
-                                        <property name="label" translatable="yes">Version History</property>
-                                      </object>
-                                    </child>
+                                    <property name="can_focus">True</property>
                                     <child>
-                                      <object class="GtkImage">
+                                      <object class="GtkBox">
                                         <property name="visible">True</property>
-                                        <property name="icon-name">go-next-symbolic</property>
-                                        <property name="margin_start">6</property>
+                                        <property name="orientation">horizontal</property>
+                                        <property name="halign">center</property>
+                                        <property name="margin_top">12</property>
+                                        <property name="margin_bottom">12</property>
+                                        <child>
+                                          <object class="GtkLabel">
+                                            <property name="visible">True</property>
+                                            <property name="xalign">0</property>
+                                            <property name="yalign">0.5</property>
+                                            <property name="label" translatable="yes">Version 
History</property>
+                                          </object>
+                                        </child>
+                                        <child>
+                                          <object class="GtkImage">
+                                            <property name="visible">True</property>
+                                            <property name="icon-name">go-next-symbolic</property>
+                                            <property name="margin_start">6</property>
+                                          </object>
+                                        </child>
                                       </object>
                                     </child>
                                   </object>
diff --git a/src/gs-history-dialog.c b/src/gs-history-dialog.c
index eb202bdc5..4b1ae57aa 100644
--- a/src/gs-history-dialog.c
+++ b/src/gs-history-dialog.c
@@ -145,6 +145,29 @@ gs_history_dialog_set_app (GsHistoryDialog *dialog, GsApp *app)
        }
 }
 
+static void
+update_header_func (GtkListBoxRow *row,
+                   GtkListBoxRow *before,
+                   gpointer user_data)
+{
+       GtkWidget *header;
+
+       /* first entry */
+       header = gtk_list_box_row_get_header (row);
+       if (before == NULL) {
+               gtk_list_box_row_set_header (row, NULL);
+               return;
+       }
+
+       /* already set */
+       if (header != NULL)
+               return;
+
+       /* set new */
+       header = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+       gtk_list_box_row_set_header (row, header);
+}
+
 static void
 scrollbar_mapped_cb (GtkWidget *sb, GtkScrolledWindow *swin)
 {
@@ -183,6 +206,11 @@ gs_history_dialog_init (GsHistoryDialog *dialog)
        dialog->sizegroup_timestamp = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        dialog->sizegroup_version = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
+       gtk_list_box_set_header_func (GTK_LIST_BOX (dialog->list_box),
+                                     update_header_func,
+                                     dialog,
+                                     NULL);
+
        scrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (dialog->scrolledwindow));
        g_signal_connect (scrollbar, "map", G_CALLBACK (scrollbar_mapped_cb), dialog->scrolledwindow);
        g_signal_connect (scrollbar, "unmap", G_CALLBACK (scrollbar_mapped_cb), dialog->scrolledwindow);
diff --git a/src/gs-history-dialog.ui b/src/gs-history-dialog.ui
index b8b585b51..942e2a55c 100644
--- a/src/gs-history-dialog.ui
+++ b/src/gs-history-dialog.ui
@@ -23,14 +23,22 @@
             <property name="vscrollbar_policy">automatic</property>
             <property name="vexpand">True</property>
             <child>
-              <object class="GtkListBox" id="list_box">
+              <object class="GtkFrame" id="frame">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="selection_mode">none</property>
+                <property name="shadow_type">none</property>
+                <property name="halign">fill</property>
+                <property name="valign">start</property>
+                <style>
+                  <class name="view"/>
+                </style>
+                <child>
+                  <object class="GtkListBox" id="list_box">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="selection_mode">none</property>
+                  </object>
+                </child>
               </object>
-              <style>
-                <class name="content" />
-              </style>
             </child>
           </object>
         </child>
diff --git a/src/gs-removal-dialog.c b/src/gs-removal-dialog.c
index a3f88fa98..0d946c71c 100644
--- a/src/gs-removal-dialog.c
+++ b/src/gs-removal-dialog.c
@@ -23,6 +23,17 @@ struct _GsRemovalDialog
 
 G_DEFINE_TYPE (GsRemovalDialog, gs_removal_dialog, GTK_TYPE_MESSAGE_DIALOG)
 
+static void
+list_header_func (GtkListBoxRow *row,
+                  GtkListBoxRow *before,
+                  gpointer user_data)
+{
+       GtkWidget *header = NULL;
+       if (before != NULL)
+               header = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+       gtk_list_box_row_set_header (row, header);
+}
+
 static gint
 list_sort_func (GtkListBoxRow *a,
                 GtkListBoxRow *b,
@@ -130,6 +141,10 @@ gs_removal_dialog_init (GsRemovalDialog *self)
 
        insert_details_widget (GTK_MESSAGE_DIALOG (self), self->scrolledwindow);
 
+       gtk_list_box_set_header_func (GTK_LIST_BOX (self->listbox),
+                                     list_header_func,
+                                     self,
+                                     NULL);
        gtk_list_box_set_sort_func (GTK_LIST_BOX (self->listbox),
                                    list_sort_func,
                                    self, NULL);
diff --git a/src/gs-removal-dialog.ui b/src/gs-removal-dialog.ui
index cbba2c893..3d03c755f 100644
--- a/src/gs-removal-dialog.ui
+++ b/src/gs-removal-dialog.ui
@@ -8,14 +8,17 @@
     <property name="vscrollbar_policy">automatic</property>
     <property name="shadow_type">none</property>
     <child>
-      <object class="GtkListBox" id="listbox">
+      <object class="GtkFrame" id="frame">
+        <property name="visible">True</property>
+        <property name="shadow_type">in</property>
         <property name="halign">fill</property>
         <property name="valign">start</property>
-        <property name="visible">True</property>
-        <property name="selection_mode">none</property>
-        <style>
-          <class name="content" />
-        </style>
+        <child>
+          <object class="GtkListBox" id="listbox">
+            <property name="visible">True</property>
+            <property name="selection_mode">none</property>
+          </object>
+        </child>
       </object>
     </child>
   </object>
diff --git a/src/gs-repos-dialog.c b/src/gs-repos-dialog.c
index 3d00b2510..2389313d4 100644
--- a/src/gs-repos-dialog.c
+++ b/src/gs-repos-dialog.c
@@ -28,6 +28,8 @@ struct _GsReposDialog
 
        GCancellable    *cancellable;
        GsPluginLoader  *plugin_loader;
+       GtkWidget       *frame;
+       GtkWidget       *frame_third_party;
        GtkWidget       *label_description;
        GtkWidget       *label_empty;
        GtkWidget       *label_header;
@@ -496,11 +498,11 @@ static void
 refresh_third_party_repo (GsReposDialog *dialog)
 {
        if (dialog->third_party_repo == NULL) {
-               gtk_widget_hide (dialog->listbox_third_party);
+               gtk_widget_hide (dialog->frame_third_party);
                return;
        }
 
-       gtk_widget_show (dialog->listbox_third_party);
+       gtk_widget_show (dialog->frame_third_party);
 }
 
 static void
@@ -569,7 +571,7 @@ get_sources_cb (GsPluginLoader *plugin_loader,
                add_repo (dialog, app);
        }
 
-       gtk_widget_set_visible (dialog->listbox,
+       gtk_widget_set_visible (dialog->frame,
                gtk_list_box_get_row_at_index (GTK_LIST_BOX (dialog->listbox), 0) != NULL);
 }
 
@@ -663,6 +665,17 @@ reload_third_party_repo (GsReposDialog *dialog)
                                            dialog);
 }
 
+static void
+list_header_func (GtkListBoxRow *row,
+                 GtkListBoxRow *before,
+                 gpointer user_data)
+{
+       GtkWidget *header = NULL;
+       if (before != NULL)
+               header = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+       gtk_list_box_row_set_header (row, header);
+}
+
 static gchar *
 get_row_sort_key (GtkListBoxRow *row)
 {
@@ -787,6 +800,10 @@ gs_repos_dialog_init (GsReposDialog *dialog)
 
        os_name = get_os_name ();
 
+       gtk_list_box_set_header_func (GTK_LIST_BOX (dialog->listbox),
+                                     list_header_func,
+                                     dialog,
+                                     NULL);
        gtk_list_box_set_sort_func (GTK_LIST_BOX (dialog->listbox),
                                    list_sort_func,
                                    dialog, NULL);
@@ -800,6 +817,10 @@ gs_repos_dialog_init (GsReposDialog *dialog)
        gtk_label_set_text (GTK_LABEL (dialog->label_description), label_description_text);
 
        /* set up third party repository row */
+       gtk_list_box_set_header_func (GTK_LIST_BOX (dialog->listbox_third_party),
+                                     list_header_func,
+                                     dialog,
+                                     NULL);
        gtk_list_box_set_sort_func (GTK_LIST_BOX (dialog->listbox_third_party),
                                    list_sort_func,
                                    dialog, NULL);
@@ -842,6 +863,8 @@ gs_repos_dialog_class_init (GsReposDialogClass *klass)
 
        gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Software/gs-repos-dialog.ui");
 
+       gtk_widget_class_bind_template_child (widget_class, GsReposDialog, frame);
+       gtk_widget_class_bind_template_child (widget_class, GsReposDialog, frame_third_party);
        gtk_widget_class_bind_template_child (widget_class, GsReposDialog, label_description);
        gtk_widget_class_bind_template_child (widget_class, GsReposDialog, label_empty);
        gtk_widget_class_bind_template_child (widget_class, GsReposDialog, label_header);
diff --git a/src/gs-repos-dialog.ui b/src/gs-repos-dialog.ui
index 246fa477c..b53b574af 100644
--- a/src/gs-repos-dialog.ui
+++ b/src/gs-repos-dialog.ui
@@ -120,34 +120,40 @@
                       </object>
                     </child>
                     <child>
-                      <object class="GtkListBox" id="listbox_third_party">
+                      <object class="GtkFrame" id="frame_third_party">
                         <property name="visible">True</property>
-                        <property name="selection_mode">none</property>
+                        <property name="shadow_type">in</property>
                         <property name="halign">fill</property>
                         <property name="valign">start</property>
                         <property name="margin_bottom">16</property>
-                        <style>
-                          <class name="content" />
-                        </style>
                         <child>
-                          <object class="GsThirdPartyRepoRow" id="row_third_party">
+                          <object class="GtkListBox" id="listbox_third_party">
                             <property name="visible">True</property>
-                            <property name="activatable">False</property>
+                            <property name="selection_mode">none</property>
+                            <child>
+                              <object class="GsThirdPartyRepoRow" id="row_third_party">
+                                <property name="visible">True</property>
+                                <property name="activatable">False</property>
+                              </object>
+                            </child>
                           </object>
                         </child>
                       </object>
                     </child>
                     <child>
-                      <object class="GtkListBox" id="listbox">
+                      <object class="GtkFrame" id="frame">
+                        <property name="visible">True</property>
+                        <property name="shadow_type">in</property>
                         <property name="halign">fill</property>
                         <property name="valign">start</property>
                         <property name="vexpand">True</property>
                         <property name="margin_top">9</property>
-                        <property name="visible">True</property>
-                        <property name="selection_mode">none</property>
-                        <style>
-                          <class name="content" />
-                        </style>
+                        <child>
+                          <object class="GtkListBox" id="listbox">
+                            <property name="visible">True</property>
+                            <property name="selection_mode">none</property>
+                          </object>
+                        </child>
                       </object>
                     </child>
                   </object>
diff --git a/src/gs-update-dialog.ui b/src/gs-update-dialog.ui
index cbf4102ce..1c89be29e 100644
--- a/src/gs-update-dialog.ui
+++ b/src/gs-update-dialog.ui
@@ -273,15 +273,21 @@
                 <property name="vscrollbar_policy">automatic</property>
                 <property name="shadow_type">none</property>
                 <child>
-                  <object class="GsUpdateList" id="list_box_installed_updates">
+                  <object class="GtkFrame" id="frame_installed_updates">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="selection_mode">none</property>
+                    <property name="shadow_type">none</property>
                     <property name="halign">fill</property>
                     <property name="valign">start</property>
                     <style>
-                      <class name="content" />
+                      <class name="view"/>
                     </style>
+                    <child>
+                      <object class="GsUpdateList" id="list_box_installed_updates">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="selection_mode">none</property>
+                      </object>
+                    </child>
                   </object>
                 </child>
               </object>


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