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
This commit is contained in:
parent
bd2ca67678
commit
e26756d7e3
4 changed files with 14 additions and 11 deletions
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Reference in a new issue