diff options
author | Teemu Ikonen <tpikonen@mailbox.org> | 2022-09-12 17:43:30 +0300 |
---|---|---|
committer | Marvin W <git@larma.de> | 2023-01-24 19:20:43 +0100 |
commit | 0d7c8bb6e117f8cdd631730302413aad21632c2d (patch) | |
tree | d404cc81ba6c6605f43db2535857956659e77196 /main | |
parent | e934a76a1139938ae668836b812102cd5d9c9d9f (diff) | |
download | dino-0d7c8bb6e117f8cdd631730302413aad21632c2d.tar.gz dino-0d7c8bb6e117f8cdd631730302413aad21632c2d.zip |
Change Gtk.Paned to Adw.Leaflet in MainWindow
Diffstat (limited to 'main')
-rw-r--r-- | main/data/unified_main_content.ui | 9 | ||||
-rw-r--r-- | main/src/ui/main_window.vala | 13 |
2 files changed, 12 insertions, 10 deletions
diff --git a/main/data/unified_main_content.ui b/main/data/unified_main_content.ui index f1294ab9..83cfc942 100644 --- a/main/data/unified_main_content.ui +++ b/main/data/unified_main_content.ui @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <requires lib="gtk" version="4.0"/> - <object class="GtkPaned" id="paned"> - <property name="shrink-start-child">False</property> - <property name="shrink-end-child">False</property> - <property name="resize-start-child">False</property> - <property name="position">300</property> + <object class="AdwLeaflet" id="leaflet"> + <property name="transition-type">slide</property> + <property name="can-navigate-back">true</property> + <property name="can-navigate-forward">true</property> <child> <object class="GtkBox" id="left_box"> <property name="orientation">vertical</property> diff --git a/main/src/ui/main_window.vala b/main/src/ui/main_window.vala index 4d660f82..9aeb4217 100644 --- a/main/src/ui/main_window.vala +++ b/main/src/ui/main_window.vala @@ -20,7 +20,7 @@ public class MainWindow : Adw.Window { public ConversationTitlebar conversation_titlebar; public Widget conversation_list_titlebar; public Box box = new Box(Orientation.VERTICAL, 0) { orientation=Orientation.VERTICAL }; - public Paned paned; + public Adw.Leaflet leaflet; public Box left_box; public Box right_box; public Revealer search_revealer; @@ -60,8 +60,8 @@ public class MainWindow : Adw.Window { private void setup_unified() { Builder builder = new Builder.from_resource("/im/dino/Dino/unified_main_content.ui"); - paned = (Paned) builder.get_object("paned"); - box.append(paned); + leaflet = (Adw.Leaflet) builder.get_object("leaflet"); + box.append(leaflet); left_box = (Box) builder.get_object("left_box"); right_box = (Box) builder.get_object("right_box"); left_stack = (Stack) builder.get_object("left_stack"); @@ -69,6 +69,7 @@ public class MainWindow : Adw.Window { conversation_view = (ConversationView) builder.get_object("conversation_view"); search_revealer = (Revealer) builder.get_object("search_revealer"); conversation_selector = ((ConversationSelector) builder.get_object("conversation_list")).init(stream_interactor); + conversation_selector.conversation_selected.connect_after(() => leaflet.navigate(Adw.NavigationDirection.FORWARD)); Frame search_frame = (Frame) builder.get_object("search_frame"); global_search = new GlobalSearch(stream_interactor); @@ -82,8 +83,8 @@ public class MainWindow : Adw.Window { if (Util.use_csd()) { conversation_list_titlebar = get_conversation_list_titlebar_csd(); conversation_titlebar = new ConversationTitlebarCsd(); - paned.bind_property("folded", conversation_list_titlebar, "show-end-title-buttons", BindingFlags.SYNC_CREATE); - paned.bind_property("folded", conversation_titlebar.get_widget(), "show-start-title-buttons", BindingFlags.SYNC_CREATE); + leaflet.bind_property("folded", conversation_list_titlebar, "show-end-title-buttons", BindingFlags.SYNC_CREATE); + leaflet.bind_property("folded", conversation_titlebar.get_widget(), "show-start-title-buttons", BindingFlags.SYNC_CREATE); } else { Label title_label = new Label("Dino"); HeaderBar titlebar = new HeaderBar() { title_widget=title_label, show_title_buttons=true }; @@ -94,6 +95,8 @@ public class MainWindow : Adw.Window { } left_box.prepend(conversation_list_titlebar); right_box.prepend(conversation_titlebar.get_widget()); + leaflet.notify["folded"].connect_after(() => conversation_titlebar.back_button_visible = leaflet.folded); + conversation_titlebar.back_pressed.connect(() => leaflet.navigate(Adw.NavigationDirection.BACK)); } private void setup_stack() { |