aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-04-04 19:55:24 +0200
committerfiaxh <git@mx.ax.lt>2017-04-04 19:55:24 +0200
commitd6e742eb611f28fc2fcfbb67d4246f862df5c1c9 (patch)
tree11c49f20fc171843e8150b3ce545581172e31e87
parentcb3c896bdbd5f8308e250b9714bac3343f959678 (diff)
downloaddino-d6e742eb611f28fc2fcfbb67d4246f862df5c1c9.tar.gz
dino-d6e742eb611f28fc2fcfbb67d4246f862df5c1c9.zip
Application menu fallback button
-rw-r--r--libdino/src/entity/message.vala5
-rw-r--r--libdino/src/service/message_processor.vala1
-rw-r--r--main/data/conversation_list_titlebar.ui1
-rw-r--r--main/src/ui/application.vala1
-rw-r--r--main/src/ui/unified_window.vala25
5 files changed, 22 insertions, 11 deletions
diff --git a/libdino/src/entity/message.vala b/libdino/src/entity/message.vala
index 4624aa87..3092627e 100644
--- a/libdino/src/entity/message.vala
+++ b/libdino/src/entity/message.vala
@@ -24,7 +24,7 @@ public class Message : Object {
UNKNOWN
}
- public int? id { get; set; }
+ public int id { get; set; default = -1; }
public Account account { get; set; }
public Jid? counterpart { get; set; }
public Jid? ourpart { get; set; }
@@ -49,7 +49,6 @@ public class Message : Object {
private Database? db;
public Message(string? body) {
- this.id = -1;
this.body = body;
}
@@ -75,6 +74,8 @@ public class Message : Object {
}
public void persist(Database db) {
+ if (id != -1) return;
+
this.db = db;
Qlite.InsertBuilder builder = db.message.insert()
.value(db.message.account_id, account.id)
diff --git a/libdino/src/service/message_processor.vala b/libdino/src/service/message_processor.vala
index 10954672..e8fa3c03 100644
--- a/libdino/src/service/message_processor.vala
+++ b/libdino/src/service/message_processor.vala
@@ -36,7 +36,6 @@ public class MessageProcessor : StreamInteractionModule, Object {
public void send_message(string text, Conversation conversation) {
Entities.Message message = create_out_message(text, conversation);
stream_interactor.get_module(MessageStorage.IDENTITY).add_message(message, conversation);
- message.persist(db);
send_xmpp_message(message, conversation);
message_sent(message, conversation);
}
diff --git a/main/data/conversation_list_titlebar.ui b/main/data/conversation_list_titlebar.ui
index 6be6ffc7..6c08881c 100644
--- a/main/data/conversation_list_titlebar.ui
+++ b/main/data/conversation_list_titlebar.ui
@@ -2,6 +2,7 @@
<interface>
<template class="DinoUiConversationListTitlebar" parent="GtkHeaderBar">
<property name="hexpand">False</property>
+ <property name="show_close_button">True</property>
<property name="visible">True</property>
<style>
<class name="left_toolbar"/>
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala
index 57b03bb3..c71124c1 100644
--- a/main/src/ui/application.vala
+++ b/main/src/ui/application.vala
@@ -12,6 +12,7 @@ public class Dino.Ui.Application : Dino.Application {
notifications = new Notifications(stream_interaction);
notifications.start();
Environment.set_application_name("Dino");
+ Gtk.Window.set_default_icon_name("dino");
IconTheme.get_default().add_resource_path("/org/dino-im/icons");
activate.connect(() => {
diff --git a/main/src/ui/unified_window.vala b/main/src/ui/unified_window.vala
index 35f97d6e..d4d9055c 100644
--- a/main/src/ui/unified_window.vala
+++ b/main/src/ui/unified_window.vala
@@ -14,9 +14,9 @@ public class UnifiedWindow : Window {
private ConversationSelector.View filterable_conversation_list;
private ConversationSummary.View conversation_frame;
private ConversationTitlebar conversation_titlebar;
+ private HeaderBar placeholder_headerbar = new HeaderBar() { title="Dino", show_close_button=true, visible=true };
private Paned headerbar_paned = new Paned(Orientation.HORIZONTAL) { visible=true };
private Paned paned = new Paned(Orientation.HORIZONTAL) { visible=true };
- private Stack headerbar_stack = new Stack() { visible=true };
private Stack stack = new Stack() { visible=true };
private StreamInteractor stream_interactor;
@@ -83,6 +83,19 @@ public class UnifiedWindow : Window {
conversation_list_titlebar = new ConversationListTitlebar(this, stream_interactor) { visible=true };
headerbar_paned.add1(conversation_list_titlebar);
headerbar_paned.add2(conversation_titlebar);
+
+ // Distribute start/end decoration_layout buttons to left/right headerbar. Ensure app menu fallback.
+ Gtk.Settings? gtk_settings = Gtk.Settings.get_default();
+ if (gtk_settings != null) {
+ if (!gtk_settings.gtk_decoration_layout.contains("menu")) {
+ gtk_settings.gtk_decoration_layout = "menu:" + gtk_settings.gtk_decoration_layout;
+ }
+ string[] decoration_layout = gtk_settings.gtk_decoration_layout.split(":");
+ if (decoration_layout.length == 2) {
+ conversation_list_titlebar.decoration_layout = decoration_layout[0] + ":";
+ conversation_titlebar.decoration_layout = ":" + decoration_layout[1];
+ }
+ }
}
private void setup_stack() {
@@ -90,23 +103,19 @@ public class UnifiedWindow : Window {
stack.add_named(accounts_placeholder, "accounts_placeholder");
stack.add_named(conversations_placeholder, "conversations_placeholder");
add(stack);
-
- headerbar_stack.add_named(headerbar_paned, "main");
- headerbar_stack.add_named(new HeaderBar() { title="Dino", show_close_button=true, visible=true }, "placeholder");
- set_titlebar(headerbar_stack);
}
private void check_stack(bool know_exists = false) {
ArrayList<Account> accounts = stream_interactor.get_accounts();
if (!know_exists && accounts.size == 0) {
stack.set_visible_child_name("accounts_placeholder");
- headerbar_stack.set_visible_child_name("placeholder");
+ set_titlebar(placeholder_headerbar);
} else if (stream_interactor.get_module(ConversationManager.IDENTITY).get_active_conversations().size == 0) {
stack.set_visible_child_name("conversations_placeholder");
- headerbar_stack.set_visible_child_name("placeholder");
+ set_titlebar(placeholder_headerbar);
} else {
stack.set_visible_child_name("main");
- headerbar_stack.set_visible_child_name("main");
+ set_titlebar(headerbar_paned);
}
}