[gnome-software/bilelmoussaoui/no-frame: 6/7] gs-repos-dialog: Stop using GtkFrame
- From: Phaedrus Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/bilelmoussaoui/no-frame: 6/7] gs-repos-dialog: Stop using GtkFrame
- Date: Sun, 11 Apr 2021 05:22:28 +0000 (UTC)
commit 92baaac9e6fd3a5b9dc23af857f2ff776e7d3487
Author: Phaedrus Leeds <mwleeds protonmail com>
Date: Sat Apr 10 22:16:15 2021 -0700
gs-repos-dialog: Stop using GtkFrame
Use a libhandy css class instead which is cleaner.
src/gs-repos-dialog.c | 29 +++--------------------------
src/gs-repos-dialog.ui | 32 +++++++++++++-------------------
2 files changed, 16 insertions(+), 45 deletions(-)
---
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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]