From ba9462503c0561dbe8306e3bf6aa49392bfc8078 Mon Sep 17 00:00:00 2001 From: Teemu Ikonen Date: Mon, 12 Sep 2022 23:10:35 +0300 Subject: Use Adw.HeaderBar for CSD header bars This allows showing the correct buttons with 'show-start-title-buttons' and 'show-end-title-buttons' properties when folding. --- main/src/ui/conversation_list_titlebar.vala | 4 ++-- main/src/ui/conversation_titlebar/conversation_titlebar.vala | 2 +- main/src/ui/main_window.vala | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'main/src') diff --git a/main/src/ui/conversation_list_titlebar.vala b/main/src/ui/conversation_list_titlebar.vala index 9cbb6aec..7daab5e5 100644 --- a/main/src/ui/conversation_list_titlebar.vala +++ b/main/src/ui/conversation_list_titlebar.vala @@ -15,12 +15,12 @@ public class ConversationListTitlebar : Gtk.Box { } } -public static HeaderBar get_conversation_list_titlebar_csd() { +public static Adw.HeaderBar get_conversation_list_titlebar_csd() { Builder builder = new Builder.from_resource("/im/dino/Dino/conversation_list_titlebar_csd.ui"); MenuButton add_button = (MenuButton) builder.get_object("add_button"); MenuButton menu_button = (MenuButton) builder.get_object("menu_button"); create_add_menu(add_button, menu_button); - return (HeaderBar) builder.get_object("header_bar"); + return (Adw.HeaderBar) builder.get_object("header_bar"); } private static void create_add_menu(MenuButton add_button, MenuButton menu_button) { diff --git a/main/src/ui/conversation_titlebar/conversation_titlebar.vala b/main/src/ui/conversation_titlebar/conversation_titlebar.vala index 26fd9639..56568ba2 100644 --- a/main/src/ui/conversation_titlebar/conversation_titlebar.vala +++ b/main/src/ui/conversation_titlebar/conversation_titlebar.vala @@ -68,7 +68,7 @@ public class ConversationTitlebarCsd : ConversationTitlebar, Object { public new string? title { get { return title_label.label; } set { title_label.label = value; } } public new string? subtitle { get { return subtitle_label.label; } set { subtitle_label.label = value; subtitle_label.visible = (value != null); } } - public HeaderBar header_bar = new HeaderBar(); + public Adw.HeaderBar header_bar = new Adw.HeaderBar(); private Label title_label = new Label("") { ellipsize=EllipsizeMode.END }; private Label subtitle_label = new Label("") { ellipsize=EllipsizeMode.END, visible=false }; diff --git a/main/src/ui/main_window.vala b/main/src/ui/main_window.vala index 475bd64a..18fd5240 100644 --- a/main/src/ui/main_window.vala +++ b/main/src/ui/main_window.vala @@ -84,6 +84,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); } else { Label title_label = new Label("Dino"); HeaderBar titlebar = new HeaderBar() { title_widget=title_label, show_title_buttons=true }; -- cgit v1.2.3-70-g09d2