mirror of
https://github.com/TakeV-Lambda/dino.git
synced 2024-11-25 00:14:40 +00:00
Change Gtk.Paned to Adw.Leaflet in MainWindow
This commit is contained in:
parent
e934a76a11
commit
0d7c8bb6e1
2 changed files with 12 additions and 10 deletions
|
@ -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>
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue