This commit is contained in:
parent
15eafd8b5d
commit
7bd35bd455
|
@ -44,10 +44,48 @@ template $BavarderWindow : Adw.ApplicationWindow {
|
|||
}
|
||||
content: Gtk.ScrolledWindow {
|
||||
hscrollbar-policy: never;
|
||||
child: Gtk.ListBox threads_list {
|
||||
selection-mode: browse;
|
||||
row-activated => $threads_row_activated_cb();
|
||||
styles ["navigation-sidebar"]
|
||||
child: Stack thread_stack {
|
||||
Gtk.ListBox threads_list {
|
||||
selection-mode: browse;
|
||||
row-activated => $threads_row_activated_cb();
|
||||
styles ["navigation-sidebar"]
|
||||
}
|
||||
|
||||
Adw.StatusPage status_no_chat_thread {
|
||||
title: _("No Chat");
|
||||
icon-name: "chat-message-new-symbolic";
|
||||
}
|
||||
|
||||
Adw.StatusPage status_no_thread {
|
||||
icon-name: "io.github.Bavarder.Bavarder";
|
||||
title: _("Bavarder");
|
||||
description: _("Get started by creating a new chat");
|
||||
hexpand: true;
|
||||
vexpand: true;
|
||||
|
||||
child: Gtk.Box {
|
||||
orientation: vertical;
|
||||
spacing: 12;
|
||||
|
||||
Gtk.Button {
|
||||
valign: center;
|
||||
halign: center;
|
||||
clicked => $on_new_chat_action();
|
||||
|
||||
Adw.ButtonContent {
|
||||
icon-name: "chat-message-new-symbolic";
|
||||
tooltip-text: _("New Chat");
|
||||
label: _("New Chat");
|
||||
use-underline: true;
|
||||
}
|
||||
|
||||
styles [
|
||||
"suggested-action",
|
||||
"pill"
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -121,6 +159,37 @@ template $BavarderWindow : Adw.ApplicationWindow {
|
|||
icon-name: "network-disconnect-symbolic";
|
||||
}
|
||||
|
||||
Adw.StatusPage status_no_thread_main {
|
||||
icon-name: "io.github.Bavarder.Bavarder";
|
||||
title: _("Bavarder");
|
||||
description: _("Get started by creating a new chat");
|
||||
hexpand: true;
|
||||
vexpand: true;
|
||||
|
||||
child: Gtk.Box {
|
||||
orientation: vertical;
|
||||
spacing: 12;
|
||||
|
||||
Gtk.Button {
|
||||
valign: center;
|
||||
halign: center;
|
||||
clicked => $on_new_chat_action();
|
||||
|
||||
Adw.ButtonContent {
|
||||
icon-name: "chat-message-new-symbolic";
|
||||
tooltip-text: _("New Chat");
|
||||
label: _("New Chat");
|
||||
use-underline: true;
|
||||
}
|
||||
|
||||
styles [
|
||||
"suggested-action",
|
||||
"pill"
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Message List
|
||||
ScrolledWindow main {
|
||||
//vexpand: true;
|
||||
|
|
|
@ -40,6 +40,9 @@ class BavarderWindow(Adw.ApplicationWindow):
|
|||
|
||||
main_list = Gtk.Template.Child()
|
||||
status_no_chat = Gtk.Template.Child()
|
||||
status_no_chat_thread = Gtk.Template.Child()
|
||||
status_no_thread = Gtk.Template.Child()
|
||||
status_no_thread_main = Gtk.Template.Child()
|
||||
status_no_internet = Gtk.Template.Child()
|
||||
scrolled_window = Gtk.Template.Child()
|
||||
local_mode_toggle = Gtk.Template.Child()
|
||||
|
@ -49,6 +52,7 @@ class BavarderWindow(Adw.ApplicationWindow):
|
|||
banner = Gtk.Template.Child()
|
||||
toast_overlay = Gtk.Template.Child()
|
||||
stack = Gtk.Template.Child()
|
||||
thread_stack = Gtk.Template.Child()
|
||||
main = Gtk.Template.Child()
|
||||
|
||||
threads = []
|
||||
|
@ -112,13 +116,24 @@ class BavarderWindow(Adw.ApplicationWindow):
|
|||
def load_threads(self):
|
||||
self.threads_list.remove_all()
|
||||
if self.app.data["chats"]:
|
||||
self.thread_stack.set_visible_child(self.threads_list)
|
||||
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:
|
||||
self.stack.set_visible_child(self.status_no_chat)
|
||||
if self.props.default_width < 500:
|
||||
self.thread_stack.set_visible_child(self.status_no_thread)
|
||||
self.stack.set_visible_child(self.status_no_chat)
|
||||
else:
|
||||
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()
|
||||
|
||||
Adw.ApplicationWindow.do_size_allocate(self, width, height, baseline)
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
def threads_row_activated_cb(self, *args):
|
||||
|
|
Loading…
Reference in New Issue
Block a user