Application menu fallback button
This commit is contained in:
parent
cb3c896bdb
commit
d6e742eb61
|
@ -24,7 +24,7 @@ public class Message : Object {
|
||||||
UNKNOWN
|
UNKNOWN
|
||||||
}
|
}
|
||||||
|
|
||||||
public int? id { get; set; }
|
public int id { get; set; default = -1; }
|
||||||
public Account account { get; set; }
|
public Account account { get; set; }
|
||||||
public Jid? counterpart { get; set; }
|
public Jid? counterpart { get; set; }
|
||||||
public Jid? ourpart { get; set; }
|
public Jid? ourpart { get; set; }
|
||||||
|
@ -49,7 +49,6 @@ public class Message : Object {
|
||||||
private Database? db;
|
private Database? db;
|
||||||
|
|
||||||
public Message(string? body) {
|
public Message(string? body) {
|
||||||
this.id = -1;
|
|
||||||
this.body = body;
|
this.body = body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +74,8 @@ public class Message : Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void persist(Database db) {
|
public void persist(Database db) {
|
||||||
|
if (id != -1) return;
|
||||||
|
|
||||||
this.db = db;
|
this.db = db;
|
||||||
Qlite.InsertBuilder builder = db.message.insert()
|
Qlite.InsertBuilder builder = db.message.insert()
|
||||||
.value(db.message.account_id, account.id)
|
.value(db.message.account_id, account.id)
|
||||||
|
|
|
@ -36,7 +36,6 @@ public class MessageProcessor : StreamInteractionModule, Object {
|
||||||
public void send_message(string text, Conversation conversation) {
|
public void send_message(string text, Conversation conversation) {
|
||||||
Entities.Message message = create_out_message(text, conversation);
|
Entities.Message message = create_out_message(text, conversation);
|
||||||
stream_interactor.get_module(MessageStorage.IDENTITY).add_message(message, conversation);
|
stream_interactor.get_module(MessageStorage.IDENTITY).add_message(message, conversation);
|
||||||
message.persist(db);
|
|
||||||
send_xmpp_message(message, conversation);
|
send_xmpp_message(message, conversation);
|
||||||
message_sent(message, conversation);
|
message_sent(message, conversation);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<interface>
|
<interface>
|
||||||
<template class="DinoUiConversationListTitlebar" parent="GtkHeaderBar">
|
<template class="DinoUiConversationListTitlebar" parent="GtkHeaderBar">
|
||||||
<property name="hexpand">False</property>
|
<property name="hexpand">False</property>
|
||||||
|
<property name="show_close_button">True</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<style>
|
<style>
|
||||||
<class name="left_toolbar"/>
|
<class name="left_toolbar"/>
|
||||||
|
|
|
@ -12,6 +12,7 @@ public class Dino.Ui.Application : Dino.Application {
|
||||||
notifications = new Notifications(stream_interaction);
|
notifications = new Notifications(stream_interaction);
|
||||||
notifications.start();
|
notifications.start();
|
||||||
Environment.set_application_name("Dino");
|
Environment.set_application_name("Dino");
|
||||||
|
Gtk.Window.set_default_icon_name("dino");
|
||||||
IconTheme.get_default().add_resource_path("/org/dino-im/icons");
|
IconTheme.get_default().add_resource_path("/org/dino-im/icons");
|
||||||
|
|
||||||
activate.connect(() => {
|
activate.connect(() => {
|
||||||
|
|
|
@ -14,9 +14,9 @@ public class UnifiedWindow : Window {
|
||||||
private ConversationSelector.View filterable_conversation_list;
|
private ConversationSelector.View filterable_conversation_list;
|
||||||
private ConversationSummary.View conversation_frame;
|
private ConversationSummary.View conversation_frame;
|
||||||
private ConversationTitlebar conversation_titlebar;
|
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 headerbar_paned = new Paned(Orientation.HORIZONTAL) { visible=true };
|
||||||
private Paned 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 Stack stack = new Stack() { visible=true };
|
||||||
|
|
||||||
private StreamInteractor stream_interactor;
|
private StreamInteractor stream_interactor;
|
||||||
|
@ -83,6 +83,19 @@ public class UnifiedWindow : Window {
|
||||||
conversation_list_titlebar = new ConversationListTitlebar(this, stream_interactor) { visible=true };
|
conversation_list_titlebar = new ConversationListTitlebar(this, stream_interactor) { visible=true };
|
||||||
headerbar_paned.add1(conversation_list_titlebar);
|
headerbar_paned.add1(conversation_list_titlebar);
|
||||||
headerbar_paned.add2(conversation_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() {
|
private void setup_stack() {
|
||||||
|
@ -90,23 +103,19 @@ public class UnifiedWindow : Window {
|
||||||
stack.add_named(accounts_placeholder, "accounts_placeholder");
|
stack.add_named(accounts_placeholder, "accounts_placeholder");
|
||||||
stack.add_named(conversations_placeholder, "conversations_placeholder");
|
stack.add_named(conversations_placeholder, "conversations_placeholder");
|
||||||
add(stack);
|
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) {
|
private void check_stack(bool know_exists = false) {
|
||||||
ArrayList<Account> accounts = stream_interactor.get_accounts();
|
ArrayList<Account> accounts = stream_interactor.get_accounts();
|
||||||
if (!know_exists && accounts.size == 0) {
|
if (!know_exists && accounts.size == 0) {
|
||||||
stack.set_visible_child_name("accounts_placeholder");
|
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) {
|
} else if (stream_interactor.get_module(ConversationManager.IDENTITY).get_active_conversations().size == 0) {
|
||||||
stack.set_visible_child_name("conversations_placeholder");
|
stack.set_visible_child_name("conversations_placeholder");
|
||||||
headerbar_stack.set_visible_child_name("placeholder");
|
set_titlebar(placeholder_headerbar);
|
||||||
} else {
|
} else {
|
||||||
stack.set_visible_child_name("main");
|
stack.set_visible_child_name("main");
|
||||||
headerbar_stack.set_visible_child_name("main");
|
set_titlebar(headerbar_paned);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue