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.
This commit is contained in:
parent
25be82715a
commit
476ea8f550
2 changed files with 46 additions and 48 deletions
|
@ -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*
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue