aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/conversation_titlebar/conversation_titlebar.vala
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/ui/conversation_titlebar/conversation_titlebar.vala')
-rw-r--r--main/src/ui/conversation_titlebar/conversation_titlebar.vala69
1 files changed, 42 insertions, 27 deletions
diff --git a/main/src/ui/conversation_titlebar/conversation_titlebar.vala b/main/src/ui/conversation_titlebar/conversation_titlebar.vala
index 60d8286b..0d13e48b 100644
--- a/main/src/ui/conversation_titlebar/conversation_titlebar.vala
+++ b/main/src/ui/conversation_titlebar/conversation_titlebar.vala
@@ -6,14 +6,17 @@ using Dino.Entities;
namespace Dino.Ui {
-public interface ConversationTitlebar : Widget {
+public interface ConversationTitlebar : Object {
public abstract string? subtitle { get; set; }
public abstract string? title { get; set; }
- public abstract void insert_entry(Plugins.ConversationTitlebarEntry entry);
+ public abstract void insert_button(Widget button);
+ public abstract Widget get_widget();
}
-public class ConversationTitlebarNoCsd : ConversationTitlebar, Gtk.Box {
+public class ConversationTitlebarNoCsd : ConversationTitlebar, Object {
+
+ public Box main = new Box(Orientation.HORIZONTAL, 0);
public string? title {
get { return title_label.label; }
@@ -33,49 +36,61 @@ public class ConversationTitlebarNoCsd : ConversationTitlebar, Gtk.Box {
private Label subtitle_label = new Label("") { use_markup=true, ellipsize=EllipsizeMode.END, visible=false };
construct {
- Box content_box = new Box(Orientation.HORIZONTAL, 0) { margin=5, margin_start=15, margin_end=10, hexpand=true, visible=true };
- this.add(content_box);
+ Box content_box = new Box(Orientation.HORIZONTAL, 0) { margin_start=15, margin_end=10, hexpand=true, visible=true };
+ main.append(content_box);
Box titles_box = new Box(Orientation.VERTICAL, 0) { valign=Align.CENTER, hexpand=true, visible=true };
- content_box.add(titles_box);
+ content_box.append(titles_box);
- titles_box.add(title_label);
+ titles_box.append(title_label);
subtitle_label.attributes = new AttrList();
subtitle_label.get_style_context().add_class("dim-label");
- titles_box.add(subtitle_label);
+ titles_box.append(subtitle_label);
- content_box.add(widgets_box);
+ content_box.append(widgets_box);
}
public ConversationTitlebarNoCsd() {
- this.get_style_context().add_class("dino-header-right");
+ main.get_style_context().add_class("dino-header-right");
}
- public void insert_entry(Plugins.ConversationTitlebarEntry entry) {
- Plugins.ConversationTitlebarWidget widget = entry.get_widget(Plugins.WidgetType.GTK);
- if (widget != null) {
- Button gtk_widget = (Gtk.Button) widget;
- gtk_widget.relief = ReliefStyle.NONE;
- widgets_box.pack_end(gtk_widget);
- }
+ public void insert_button(Widget button) {
+ widgets_box.prepend(button);
+ }
+
+ public Widget get_widget() {
+ return main;
}
}
-public class ConversationTitlebarCsd : ConversationTitlebar, Gtk.HeaderBar {
+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 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); } }
+ public HeaderBar header_bar = new HeaderBar();
+ private Label title_label = new Label("") { ellipsize=EllipsizeMode.END };
+ private Label subtitle_label = new Label("") { ellipsize=EllipsizeMode.END, visible=false };
public ConversationTitlebarCsd() {
- this.get_style_context().add_class("dino-right");
- show_close_button = true;
- hexpand = true;
+ Box titles_box = new Box(Orientation.VERTICAL, 0) { valign=Align.CENTER };
+ title_label.attributes = new AttrList();
+ title_label.attributes.insert(Pango.attr_weight_new(Weight.BOLD));
+ titles_box.append(title_label);
+ subtitle_label.attributes = new AttrList();
+ subtitle_label.attributes.insert(Pango.attr_scale_new(Pango.Scale.SMALL));
+ subtitle_label.get_style_context().add_class("dim-label");
+ titles_box.append(subtitle_label);
+
+ header_bar.set_title_widget(titles_box);
+ }
+
+ public void insert_button(Widget button) {
+ header_bar.pack_end(button);
}
- public void insert_entry(Plugins.ConversationTitlebarEntry entry) {
- Plugins.ConversationTitlebarWidget widget = entry.get_widget(Plugins.WidgetType.GTK);
- Button gtk_widget = (Gtk.Button)widget;
- this.pack_end(gtk_widget);
+ public Widget get_widget() {
+ return header_bar;
}
}