aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormimi89999 <michel@lebihan.pl>2021-01-17 19:50:32 +0100
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-05 14:32:08 +0200
commit7edf7303cbd1b6c4dcea7c87573eb9c99a2d5988 (patch)
tree43db10a5162fd1872a8123da875aabfa3ba79f22
parent1b4cc3a6aafa23e6bc8308e7784b06cfe7fd5cb3 (diff)
Add separators and back button to non csd header
-rw-r--r--main/src/ui/conversation_titlebar/conversation_titlebar.vala18
-rw-r--r--main/src/ui/main_window.vala17
2 files changed, 29 insertions, 6 deletions
diff --git a/main/src/ui/conversation_titlebar/conversation_titlebar.vala b/main/src/ui/conversation_titlebar/conversation_titlebar.vala
index e1e5cda1..3afdbfce 100644
--- a/main/src/ui/conversation_titlebar/conversation_titlebar.vala
+++ b/main/src/ui/conversation_titlebar/conversation_titlebar.vala
@@ -10,6 +10,10 @@ public interface ConversationTitlebar : Widget {
public abstract string? subtitle { get; set; }
public abstract string? title { get; set; }
+ public abstract bool back_button { get; set; }
+
+ public signal void back_pressed();
+
public abstract void insert_entry(Plugins.ConversationTitlebarEntry entry);
}
@@ -28,6 +32,12 @@ public class ConversationTitlebarNoCsd : ConversationTitlebar, Gtk.Box {
}
}
+ private Revealer back_revealer;
+ public bool back_button {
+ get { return back_revealer.reveal_child; }
+ set { back_revealer.reveal_child = value; }
+ }
+
private Box widgets_box = new Box(Orientation.HORIZONTAL, 0) { margin_start=15, valign=Align.END, visible=true };
private Label title_label = new Label("") { ellipsize=EllipsizeMode.END, visible=true };
private Label subtitle_label = new Label("") { use_markup=true, ellipsize=EllipsizeMode.END, visible=false };
@@ -36,6 +46,13 @@ public class ConversationTitlebarNoCsd : ConversationTitlebar, Gtk.Box {
Box content_box = new Box(Orientation.HORIZONTAL, 0) { margin=5, margin_start=15, margin_end=10, hexpand=true, visible=true };
this.add(content_box);
+ 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, relief = ReliefStyle.NONE };
+ back_button.get_style_context().add_class("image-button");
+ back_button.clicked.connect(() => back_pressed());
+ back_revealer.add(back_button);
+ content_box.add(back_revealer);
+
Box titles_box = new Box(Orientation.VERTICAL, 0) { valign=Align.CENTER, hexpand=true, visible=true };
content_box.add(titles_box);
@@ -70,7 +87,6 @@ public class ConversationTitlebarCsd : ConversationTitlebar, Gtk.HeaderBar {
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");
diff --git a/main/src/ui/main_window.vala b/main/src/ui/main_window.vala
index 1f78bcc1..14563c28 100644
--- a/main/src/ui/main_window.vala
+++ b/main/src/ui/main_window.vala
@@ -50,6 +50,12 @@ public class MainWindow : Gtk.Window {
setup_headerbar();
setup_stack();
+ if (!Util.use_csd()) {
+ box.add(headerbar_paned);
+ box.add(new Separator(Orientation.VERTICAL) { visible = true });
+ }
+ box.add(paned);
+
paned.bind_property("transition-type", headerbar_paned, "transition-type", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
paned.bind_property("mode-transition-duration", headerbar_paned, "mode-transition-duration", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
paned.bind_property("child-transition-duration", headerbar_paned, "child-transition-duration", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
@@ -62,7 +68,6 @@ public class MainWindow : Gtk.Window {
Builder builder = new Builder.from_resource("/im/dino/Dino/unified_main_content.ui");
paned = (Hdy.Leaflet) builder.get_object("paned");
paned.notify["folded"].connect_after(() => update_headerbar());
- box.add(paned);
left_stack = (Stack) builder.get_object("left_stack");
right_stack = (Stack) builder.get_object("right_stack");
conversation_view = (ConversationView) builder.get_object("conversation_view");
@@ -76,8 +81,7 @@ public class MainWindow : Gtk.Window {
}
private void update_headerbar() {
- if (!Util.use_csd()) return;
- conversation_titlebar_csd.back_button = paned.folded;
+ conversation_titlebar.back_button = paned.folded;
}
private void show_list_pane() {
@@ -119,11 +123,14 @@ public class MainWindow : Gtk.Window {
headerbar_paned.add_with_properties(conversation_list_titlebar, "name", "list-pane");
conversation_list_group.add_widget(conversation_list_titlebar);
+ Separator sep = new Separator(Orientation.HORIZONTAL) { visible = true };
+ sep.get_style_context().add_class("sidebar");
+ headerbar_paned.add(sep);
+
conversation_titlebar = new ConversationTitlebarNoCsd() { visible=true };
+ conversation_titlebar.back_pressed.connect(() => show_list_pane());
headerbar_paned.add_with_properties(conversation_titlebar, "name", "view-pane");
conversation_view_group.add_widget(conversation_titlebar);
-
- box.add(headerbar_paned);
}
}