aboutsummaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorTeemu Ikonen <tpikonen@mailbox.org>2022-09-12 23:10:35 +0300
committerMarvin W <git@larma.de>2023-01-24 19:20:42 +0100
commitba9462503c0561dbe8306e3bf6aa49392bfc8078 (patch)
tree13f58e9df81b2729cde489f014a4c73005b2005b /main
parent2741bf21ae6d53324a512dacef65d540be840fe4 (diff)
downloaddino-ba9462503c0561dbe8306e3bf6aa49392bfc8078.tar.gz
dino-ba9462503c0561dbe8306e3bf6aa49392bfc8078.zip
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.
Diffstat (limited to 'main')
-rw-r--r--main/data/conversation_list_titlebar_csd.ui3
-rw-r--r--main/src/ui/conversation_list_titlebar.vala4
-rw-r--r--main/src/ui/conversation_titlebar/conversation_titlebar.vala2
-rw-r--r--main/src/ui/main_window.vala2
4 files changed, 7 insertions, 4 deletions
diff --git a/main/data/conversation_list_titlebar_csd.ui b/main/data/conversation_list_titlebar_csd.ui
index f0e887dd..c793c2cc 100644
--- a/main/data/conversation_list_titlebar_csd.ui
+++ b/main/data/conversation_list_titlebar_csd.ui
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
- <object class="GtkHeaderBar" id="header_bar">
+ <requires lib="adw" version="1.0"/>
+ <object class="AdwHeaderBar" id="header_bar">
<property name="hexpand">False</property>
<style>
<class name="dino-left"/>
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 };