diff options
author | fiaxh <git@mx.ax.lt> | 2017-04-04 19:55:24 +0200 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-04-04 19:55:24 +0200 |
commit | d6e742eb611f28fc2fcfbb67d4246f862df5c1c9 (patch) | |
tree | 11c49f20fc171843e8150b3ce545581172e31e87 /main/src/ui | |
parent | cb3c896bdbd5f8308e250b9714bac3343f959678 (diff) | |
download | dino-d6e742eb611f28fc2fcfbb67d4246f862df5c1c9.tar.gz dino-d6e742eb611f28fc2fcfbb67d4246f862df5c1c9.zip |
Application menu fallback button
Diffstat (limited to 'main/src/ui')
-rw-r--r-- | main/src/ui/application.vala | 1 | ||||
-rw-r--r-- | main/src/ui/unified_window.vala | 25 |
2 files changed, 18 insertions, 8 deletions
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); } } |