[gnome-control-center] printers: Make printers-list a GtkListBox
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] printers: Make printers-list a GtkListBox
- Date: Wed, 10 May 2017 09:05:43 +0000 (UTC)
commit e26756d7e3f21c7998f56ea0df4bedc38ff209e9
Author: Felipe Borges <felipeborges gnome org>
Date: Mon Mar 6 14:18:41 2017 +0100
printers: Make printers-list a GtkListBox
By making the printers list a GtkListBox instead of a GtkBox, we
can use listbox's capabilities for sorting and filter.
https://bugzilla.gnome.org/show_bug.cgi?id=779656
panels/printers/cc-printers-panel.c | 2 +-
panels/printers/pp-printer-entry.c | 6 +++---
panels/printers/printer-entry.ui | 6 +++++-
panels/printers/printers.ui | 11 +++++------
4 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index 182ff0a..5113280 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -600,7 +600,7 @@ add_printer_entry (CcPrintersPanel *self,
G_CALLBACK (on_printer_changed),
self);
- gtk_box_pack_start (GTK_BOX (content), GTK_WIDGET (printer_entry), FALSE, TRUE, 5);
+ gtk_list_box_insert (GTK_LIST_BOX (content), GTK_WIDGET (printer_entry), -1);
gtk_widget_show_all (content);
g_hash_table_insert (priv->printer_entries, g_strdup (printer.name), printer_entry);
diff --git a/panels/printers/pp-printer-entry.c b/panels/printers/pp-printer-entry.c
index 6fd705c..6f952b8 100644
--- a/panels/printers/pp-printer-entry.c
+++ b/panels/printers/pp-printer-entry.c
@@ -35,7 +35,7 @@
struct _PpPrinterEntry
{
- GtkBox parent;
+ GtkListBoxRow parent;
gchar *printer_uri;
gchar *printer_name;
@@ -78,12 +78,12 @@ struct _PpPrinterEntry
struct _PpPrinterEntryClass
{
- GtkBoxClass parent_class;
+ GtkListBoxRowClass parent_class;
void (*printer_changed) (PpPrinterEntry *printer_entry);
};
-G_DEFINE_TYPE (PpPrinterEntry, pp_printer_entry, GTK_TYPE_BOX)
+G_DEFINE_TYPE (PpPrinterEntry, pp_printer_entry, GTK_TYPE_LIST_BOX_ROW)
enum {
IS_DEFAULT_PRINTER,
diff --git a/panels/printers/printer-entry.ui b/panels/printers/printer-entry.ui
index b898df1..f8d0359 100644
--- a/panels/printers/printer-entry.ui
+++ b/panels/printers/printer-entry.ui
@@ -70,8 +70,12 @@
</child>
</object>
- <template class="PpPrinterEntry" parent="GtkBox">
+ <template class="PpPrinterEntry" parent="GtkListBoxRow">
<property name="valign">center</property>
+ <property name="margin">10</property>
+ <property name="margin-start">60</property>
+ <property name="margin-end">60</property>
+ <property name="activatable">False</property>
<child>
<object class="GtkFrame" id="content_area">
diff --git a/panels/printers/printers.ui b/panels/printers/printers.ui
index b07b591..bd1a882 100644
--- a/panels/printers/printers.ui
+++ b/panels/printers/printers.ui
@@ -49,14 +49,13 @@
<property name="hscrollbar-policy">GTK_POLICY_NEVER</property>
<property name="min-content-height">490</property>
<child>
- <object class="GtkBox" id="content">
+ <object class="GtkListBox" id="content">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="border-width">30</property>
- <property name="margin-start">30</property>
- <property name="margin-end">30</property>
- <property name="spacing">20</property>
+ <property name="selection-mode">GTK_SELECTION_NONE</property>
+ <style>
+ <class name="background"/>
+ </style>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]