fix: add conditions for empty window
All checks were successful
ci/woodpecker/push/<no value> Pipeline was successful
All checks were successful
ci/woodpecker/push/<no value> Pipeline was successful
This commit is contained in:
parent
7bd35bd455
commit
7ec8b82189
|
@ -272,7 +272,8 @@ template $BavarderWindow : Adw.ApplicationWindow {
|
|||
|
||||
Adw.Breakpoint {
|
||||
condition ("max-width: 500sp")
|
||||
//unapply => $one_pane_unapply_cb();
|
||||
apply => $mobile_mode_apply();
|
||||
unapply => $mobile_mode_unapply();
|
||||
setters {
|
||||
split_view.sidebar-width-fraction: 0.33;
|
||||
split_view.collapsed: true;
|
||||
|
|
|
@ -114,14 +114,15 @@ class BavarderWindow(Adw.ApplicationWindow):
|
|||
return self.chat["content"]
|
||||
|
||||
def load_threads(self):
|
||||
print("LOADING")
|
||||
self.threads_list.remove_all()
|
||||
if self.app.data["chats"]:
|
||||
self.thread_stack.set_visible_child(self.threads_list)
|
||||
self.stack.set_visible_child(self.main)
|
||||
for chat in self.app.data["chats"]:
|
||||
thread = ThreadItem(self, chat)
|
||||
self.threads_list.append(thread)
|
||||
self.threads.append(thread)
|
||||
self.stack.set_visible_child(self.main)
|
||||
else:
|
||||
if self.props.default_width < 500:
|
||||
self.thread_stack.set_visible_child(self.status_no_thread)
|
||||
|
@ -130,8 +131,24 @@ class BavarderWindow(Adw.ApplicationWindow):
|
|||
self.stack.set_visible_child(self.status_no_thread_main)
|
||||
self.thread_stack.set_visible_child(self.status_no_chat_thread)
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
def mobile_mode_apply(self, *args):
|
||||
if not self.app.data["chats"]:
|
||||
self.thread_stack.set_visible_child(self.status_no_thread)
|
||||
self.stack.set_visible_child(self.status_no_chat)
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
def mobile_mode_unapply(self, *args):
|
||||
if not self.app.data["chats"]:
|
||||
self.stack.set_visible_child(self.status_no_thread_main)
|
||||
self.thread_stack.set_visible_child(self.status_no_chat_thread)
|
||||
|
||||
def do_size_allocate(self, width, height, baseline):
|
||||
self.load_threads()
|
||||
try:
|
||||
self.has_been_allocated
|
||||
except Exception:
|
||||
self.has_been_allocated = True
|
||||
self.load_threads()
|
||||
|
||||
Adw.ApplicationWindow.do_size_allocate(self, width, height, baseline)
|
||||
|
||||
|
|
Loading…
Reference in a new issue