mirror of
https://github.com/TakeV-Lambda/dino.git
synced 2024-11-21 14:34:30 +00:00
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.
This commit is contained in:
parent
2741bf21ae
commit
ba9462503c
4 changed files with 7 additions and 4 deletions
|
@ -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"/>
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 };
|
||||
|
||||
|
|
|
@ -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 };
|
||||
|
|
Loading…
Reference in a new issue