Commit 6517aea1 authored by Daniel Brötzmann's avatar Daniel Brötzmann Committed by Philipp Hörist

Start Chat: Add informational placeholders

parent 46a00a6a
Pipeline #4952 passed with stages
in 3 minutes and 12 seconds
......@@ -412,4 +412,47 @@
</packing>
</child>
</object>
<object class="GtkBox" id="placeholder">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">avatar-default-symbolic</property>
<property name="icon_size">6</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">No contacts found
You can also type an XMPP address</property>
<property name="justify">center</property>
<property name="wrap">True</property>
<property name="max_width_chars">35</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</interface>
......@@ -83,6 +83,7 @@ class StartChatDialog(Gtk.ApplicationWindow):
self._ui.search_entry.connect(
'stop-search', lambda *args: self._ui.search_entry.set_text(''))
self._ui.listbox.set_placeholder(self._ui.placeholder)
self._ui.listbox.set_filter_func(self._filter_func, None)
self._ui.listbox.connect('row-activated', self._on_row_activated)
......@@ -683,8 +684,26 @@ class GlobalSearch(Gtk.ListBox):
self.set_has_tooltip(True)
self.set_activate_on_single_click(False)
self._progress = None
self._add_placeholder()
self.show_all()
def _add_placeholder(self):
placeholder = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=12)
placeholder.set_halign(Gtk.Align.CENTER)
placeholder.set_valign(Gtk.Align.CENTER)
icon = Gtk.Image.new_from_icon_name('system-search-symbolic',
Gtk.IconSize.DIALOG)
icon.get_style_context().add_class('dim-label')
label = Gtk.Label(label=_('Search for group chats globally\n'
'(press Return to start search)'))
label.get_style_context().add_class('dim-label')
label.set_justify(Gtk.Justification.CENTER)
label.set_max_width_chars(35)
placeholder.add(icon)
placeholder.add(label)
placeholder.show_all()
self.set_placeholder(placeholder)
def remove_all(self):
def remove(row):
self.remove(row)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment