[gnome-software/bilelmoussaoui/no-frame] ui: stop using GtkFrame
- From: Phaedrus Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/bilelmoussaoui/no-frame] ui: stop using GtkFrame
- Date: Mon, 5 Apr 2021 18:55:06 +0000 (UTC)
commit 6a18c3f4edc52a05e851abe12969969a0aea3eb3
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date: Tue Mar 2 12:28:08 2021 +0100
ui: stop using GtkFrame
This replace GtkFrame with a css class from libhandy
which also removes the double border you can see sometimes
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, 81 insertions(+), 191 deletions(-)
---
diff --git a/src/gs-app-version-history-dialog.ui b/src/gs-app-version-history-dialog.ui
index 062b4d6f5..ede850ad2 100644
--- a/src/gs-app-version-history-dialog.ui
+++ b/src/gs-app-version-history-dialog.ui
@@ -25,23 +25,17 @@
<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="GtkFrame">
+ <object class="GtkListBox" id="listbox">
<property name="visible">True</property>
- <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>
+ <property name="selection-mode">none</property>
+ <style>
+ <class name="content"/>
+ </style>
</object>
</child>
</object>
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 74126d693..00b0030b0 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -120,7 +120,6 @@ 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;
@@ -1317,7 +1316,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->box_version_history_frame, FALSE);
+ gtk_widget_set_visible (self->list_box_version_history, 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);
@@ -3044,7 +3043,6 @@ 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 31b6f4dba..f440535c2 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,69 +424,56 @@
</child>
</object>
</child>
-
<child>
- <object class="GtkFrame" id="box_addons_frame">
+ <object class="GtkListBox" id="list_box_addons">
<property name="visible">True</property>
- <property name="shadow_type">none</property>
+ <property name="selection_mode">none</property>
<property name="halign">fill</property>
<property name="valign">start</property>
- <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>
+ <style>
+ <class name="content"/>
+ </style>
</object>
</child>
</object>
</child>
<child>
- <object class="GtkFrame" id="box_version_history_frame">
+ <object class="GtkListBox" id="list_box_version_history">
<property name="visible">True</property>
- <property name="shadow_type">none</property>
+ <property name="selection_mode">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="GtkListBox" id="list_box_version_history">
+ <object class="GtkListBoxRow" id="version_history_button">
<property name="visible">True</property>
- <property name="selection_mode">none</property>
- <style>
- <class name="content"/>
- </style>
- <child>
- <object class="GsAppVersionHistoryRow" id="row_latest_version">
- </object>
- </child>
+ <property name="can_focus">True</property>
<child>
- <object class="GtkListBoxRow" id="version_history_button">
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="can_focus">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>
<child>
- <object class="GtkBox">
+ <object class="GtkImage">
<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>
- <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>
+ <property name="icon-name">go-next-symbolic</property>
+ <property name="margin_start">6</property>
</object>
</child>
</object>
diff --git a/src/gs-history-dialog.c b/src/gs-history-dialog.c
index 4b1ae57aa..eb202bdc5 100644
--- a/src/gs-history-dialog.c
+++ b/src/gs-history-dialog.c
@@ -145,29 +145,6 @@ 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)
{
@@ -206,11 +183,6 @@ 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 942e2a55c..b8b585b51 100644
--- a/src/gs-history-dialog.ui
+++ b/src/gs-history-dialog.ui
@@ -23,22 +23,14 @@
<property name="vscrollbar_policy">automatic</property>
<property name="vexpand">True</property>
<child>
- <object class="GtkFrame" id="frame">
+ <object class="GtkListBox" id="list_box">
<property name="visible">True</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>
+ <property name="can_focus">True</property>
+ <property name="selection_mode">none</property>
</object>
+ <style>
+ <class name="content" />
+ </style>
</child>
</object>
</child>
diff --git a/src/gs-removal-dialog.c b/src/gs-removal-dialog.c
index 0d946c71c..a3f88fa98 100644
--- a/src/gs-removal-dialog.c
+++ b/src/gs-removal-dialog.c
@@ -23,17 +23,6 @@ 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,
@@ -141,10 +130,6 @@ 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 3d03c755f..cbba2c893 100644
--- a/src/gs-removal-dialog.ui
+++ b/src/gs-removal-dialog.ui
@@ -8,17 +8,14 @@
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">none</property>
<child>
- <object class="GtkFrame" id="frame">
- <property name="visible">True</property>
- <property name="shadow_type">in</property>
+ <object class="GtkListBox" id="listbox">
<property name="halign">fill</property>
<property name="valign">start</property>
- <child>
- <object class="GtkListBox" id="listbox">
- <property name="visible">True</property>
- <property name="selection_mode">none</property>
- </object>
- </child>
+ <property name="visible">True</property>
+ <property name="selection_mode">none</property>
+ <style>
+ <class name="content" />
+ </style>
</object>
</child>
</object>
diff --git a/src/gs-repos-dialog.c b/src/gs-repos-dialog.c
index 2389313d4..3d00b2510 100644
--- a/src/gs-repos-dialog.c
+++ b/src/gs-repos-dialog.c
@@ -28,8 +28,6 @@ struct _GsReposDialog
GCancellable *cancellable;
GsPluginLoader *plugin_loader;
- GtkWidget *frame;
- GtkWidget *frame_third_party;
GtkWidget *label_description;
GtkWidget *label_empty;
GtkWidget *label_header;
@@ -498,11 +496,11 @@ static void
refresh_third_party_repo (GsReposDialog *dialog)
{
if (dialog->third_party_repo == NULL) {
- gtk_widget_hide (dialog->frame_third_party);
+ gtk_widget_hide (dialog->listbox_third_party);
return;
}
- gtk_widget_show (dialog->frame_third_party);
+ gtk_widget_show (dialog->listbox_third_party);
}
static void
@@ -571,7 +569,7 @@ get_sources_cb (GsPluginLoader *plugin_loader,
add_repo (dialog, app);
}
- gtk_widget_set_visible (dialog->frame,
+ gtk_widget_set_visible (dialog->listbox,
gtk_list_box_get_row_at_index (GTK_LIST_BOX (dialog->listbox), 0) != NULL);
}
@@ -665,17 +663,6 @@ 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)
{
@@ -800,10 +787,6 @@ 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);
@@ -817,10 +800,6 @@ 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);
@@ -863,8 +842,6 @@ 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 b53b574af..246fa477c 100644
--- a/src/gs-repos-dialog.ui
+++ b/src/gs-repos-dialog.ui
@@ -120,40 +120,34 @@
</object>
</child>
<child>
- <object class="GtkFrame" id="frame_third_party">
+ <object class="GtkListBox" id="listbox_third_party">
<property name="visible">True</property>
- <property name="shadow_type">in</property>
+ <property name="selection_mode">none</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="GtkListBox" id="listbox_third_party">
+ <object class="GsThirdPartyRepoRow" id="row_third_party">
<property name="visible">True</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>
+ <property name="activatable">False</property>
</object>
</child>
</object>
</child>
<child>
- <object class="GtkFrame" id="frame">
- <property name="visible">True</property>
- <property name="shadow_type">in</property>
+ <object class="GtkListBox" id="listbox">
<property name="halign">fill</property>
<property name="valign">start</property>
<property name="vexpand">True</property>
<property name="margin_top">9</property>
- <child>
- <object class="GtkListBox" id="listbox">
- <property name="visible">True</property>
- <property name="selection_mode">none</property>
- </object>
- </child>
+ <property name="visible">True</property>
+ <property name="selection_mode">none</property>
+ <style>
+ <class name="content" />
+ </style>
</object>
</child>
</object>
diff --git a/src/gs-update-dialog.ui b/src/gs-update-dialog.ui
index 1c89be29e..cbf4102ce 100644
--- a/src/gs-update-dialog.ui
+++ b/src/gs-update-dialog.ui
@@ -273,21 +273,15 @@
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">none</property>
<child>
- <object class="GtkFrame" id="frame_installed_updates">
+ <object class="GsUpdateList" id="list_box_installed_updates">
<property name="visible">True</property>
- <property name="shadow_type">none</property>
+ <property name="can_focus">True</property>
+ <property name="selection_mode">none</property>
<property name="halign">fill</property>
<property name="valign">start</property>
<style>
- <class name="view"/>
+ <class name="content" />
</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]