[gnome-control-center/gbsneto/search-applications: 10/10] panel-list: Simplify placeholder widget setup
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gbsneto/search-applications: 10/10] panel-list: Simplify placeholder widget setup
- Date: Mon, 1 Apr 2019 22:28:33 +0000 (UTC)
commit 476ea8f55094eac8d21656188a13c3f3c723a461
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Mar 29 20:02:22 2019 -0300
panel-list: Simplify placeholder widget setup
I just learned that we can use <child type="placeholder"> and
avoid C code to do that. Simplify CcPanelList as well.
shell/cc-panel-list.c | 5 ---
shell/cc-panel-list.ui | 89 ++++++++++++++++++++++++++------------------------
2 files changed, 46 insertions(+), 48 deletions(-)
---
diff --git a/shell/cc-panel-list.c b/shell/cc-panel-list.c
index 5bdc4c899..67a0ac77f 100644
--- a/shell/cc-panel-list.c
+++ b/shell/cc-panel-list.c
@@ -55,8 +55,6 @@ struct _CcPanelList
GtkListBoxRow *details_row;
GtkListBoxRow *devices_row;
- GtkWidget *empty_search_placeholder;
-
gchar *current_panel_id;
gchar *search_query;
@@ -827,7 +825,6 @@ cc_panel_list_class_init (CcPanelListClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcPanelList, details_row);
gtk_widget_class_bind_template_child (widget_class, CcPanelList, devices_listbox);
gtk_widget_class_bind_template_child (widget_class, CcPanelList, devices_row);
- gtk_widget_class_bind_template_child (widget_class, CcPanelList, empty_search_placeholder);
gtk_widget_class_bind_template_child (widget_class, CcPanelList, main_listbox);
gtk_widget_class_bind_template_child (widget_class, CcPanelList, search_listbox);
@@ -874,8 +871,6 @@ cc_panel_list_init (CcPanelList *self)
filter_func,
self,
NULL);
-
- gtk_list_box_set_placeholder (GTK_LIST_BOX (self->search_listbox), self->empty_search_placeholder);
}
GtkWidget*
diff --git a/shell/cc-panel-list.ui b/shell/cc-panel-list.ui
index 3064a179e..32066fb93 100644
--- a/shell/cc-panel-list.ui
+++ b/shell/cc-panel-list.ui
@@ -160,6 +160,52 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="row-activated" handler="search_row_activated_cb" object="CcPanelList" swapped="no" />
+
+ <!-- Placeholder -->
+ <child type="placeholder">
+ <object class="GtkBox" id="empty_search_placeholder">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="expand">True</property>
+ <property name="border_width">18</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="pixel_size">64</property>
+ <property name="icon_name">edit-find-symbolic</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">No results found</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="scale" value="1.44"/>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Try a different search</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
<packing>
<property name="name">search</property>
@@ -167,47 +213,4 @@
</packing>
</child>
</template>
- <object class="GtkBox" id="empty_search_placeholder">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="border_width">18</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="pixel_size">64</property>
- <property name="icon_name">edit-find-symbolic</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">No results found</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- <attribute name="scale" value="1.44"/>
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Try a different search</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- </object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]