aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/conversation_titlebar
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2020-03-14 00:53:50 +0100
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-05 14:32:07 +0200
commit41ae615fa7d714c2a16647a476cb2ae60338c3ab (patch)
treeb499b95c767506d03d7f63e7acf64e6513520078 /main/src/ui/conversation_titlebar
parent302e770a98c8fc024bf3dae4266dc034a8e14d09 (diff)
downloaddino-41ae615fa7d714c2a16647a476cb2ae60338c3ab.tar.gz
Use libhandy for main window
Diffstat (limited to 'main/src/ui/conversation_titlebar')
-rw-r--r--main/src/ui/conversation_titlebar/conversation_titlebar.vala22
1 files changed, 22 insertions, 0 deletions
diff --git a/main/src/ui/conversation_titlebar/conversation_titlebar.vala b/main/src/ui/conversation_titlebar/conversation_titlebar.vala
index 60d8286b..e1e5cda1 100644
--- a/main/src/ui/conversation_titlebar/conversation_titlebar.vala
+++ b/main/src/ui/conversation_titlebar/conversation_titlebar.vala
@@ -65,11 +65,23 @@ public class ConversationTitlebarCsd : ConversationTitlebar, Gtk.HeaderBar {
public new string? title { get { return this.get_title(); } set { base.set_title(value); } }
public new string? subtitle { get { return this.get_subtitle(); } set { base.set_subtitle(value); } }
+ private Revealer back_revealer;
+ public bool back_button {
+ get { return back_revealer.reveal_child; }
+ set { back_revealer.reveal_child = value; }
+ }
+ public signal void back_pressed();
public ConversationTitlebarCsd() {
this.get_style_context().add_class("dino-right");
show_close_button = true;
hexpand = true;
+ back_revealer = new Revealer() { visible = true, transition_type = RevealerTransitionType.SLIDE_RIGHT, transition_duration = 200, can_focus = false, reveal_child = false };
+ Button back_button = new Button.from_icon_name("go-previous-symbolic") { visible = true, valign = Align.CENTER, use_underline = true };
+ back_button.get_style_context().add_class("image-button");
+ back_button.clicked.connect(() => back_pressed());
+ back_revealer.add(back_button);
+ this.pack_start(back_revealer);
}
public void insert_entry(Plugins.ConversationTitlebarEntry entry) {
@@ -77,6 +89,16 @@ public class ConversationTitlebarCsd : ConversationTitlebar, Gtk.HeaderBar {
Button gtk_widget = (Gtk.Button)widget;
this.pack_end(gtk_widget);
}
+
+ /*
+ * HdyLeaflet collapses based on natural_width, but labels set natural_width to the width required to have the full
+ * text in a single line, thus if the label gets longer, HdyLeaflet would collapse. Work around is to just use the
+ * minimum_width as natural_width.
+ */
+ public override void get_preferred_width(out int minimum_width, out int natural_width) {
+ base.get_preferred_width(out minimum_width, out natural_width);
+ natural_width = minimum_width;
+ }
}
}