From 7b37e264c9138878a658962f3ca9dc697c2f4abe Mon Sep 17 00:00:00 2001 From: Michael James Gratton Date: Fri, 20 May 2016 18:04:59 +1000 Subject: [PATCH] Remove Unity-specific workarounds. Bug 738899. --- src/client/application/geary-application.vala | 17 ++++------- src/client/application/geary-config.vala | 28 +++---------------- src/client/components/main-toolbar.vala | 8 ++---- src/client/components/main-window.vala | 25 +++-------------- src/client/components/pill-toolbar.vala | 6 +--- src/client/composer/composer-window.vala | 19 +++++-------- 6 files changed, 24 insertions(+), 79 deletions(-) diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala index 3d04f966..64038bb2 100644 --- a/src/client/application/geary-application.vala +++ b/src/client/application/geary-application.vala @@ -78,28 +78,21 @@ public class GearyApplication : Gtk.Application { } public Configuration config { get; private set; } - - /** - * Indicates application is running under Ubuntu's Unity shell. - */ - public bool is_running_unity { get; private set; } - + private static GearyApplication _instance = null; - + private string bin; private File exec_dir; private bool exiting_fired = false; private int exitcode = 0; private bool is_destroyed = false; - + public GearyApplication() { Object(application_id: APP_ID); - + _instance = this; - - is_running_unity = Geary.String.stri_equal(Environment.get_variable("XDG_CURRENT_DESKTOP"), "Unity"); } - + // Application.run() calls this as an entry point. public override bool local_command_line(ref unowned string[] args, out int exit_status) { bin = args[0]; diff --git a/src/client/application/geary-config.vala b/src/client/application/geary-config.vala index dec799ed..e79fe268 100644 --- a/src/client/application/geary-config.vala +++ b/src/client/application/geary-config.vala @@ -23,12 +23,10 @@ public class Configuration { public const string STARTUP_NOTIFICATIONS_KEY = "startup-notifications"; public const string ASK_OPEN_ATTACHMENT_KEY = "ask-open-attachment"; public const string COMPOSE_AS_HTML_KEY = "compose-as-html"; - + public Settings settings { get; private set; } - public Settings gnome_interface; - private Settings? indicator_datetime; - + public int window_width { get { return settings.get_int(WINDOW_WIDTH_KEY); } } @@ -93,20 +91,8 @@ public class Configuration { } private const string CLOCK_FORMAT_KEY = "clock-format"; - private const string TIME_FORMAT_KEY = "time-format"; public Date.ClockFormat clock_format { get { - if (GearyApplication.instance.is_running_unity && indicator_datetime != null) { - string format = indicator_datetime.get_string(TIME_FORMAT_KEY); - if (format == "12-hour") - return Date.ClockFormat.TWELVE_HOURS; - else if (format == "24-hour") - return Date.ClockFormat.TWENTY_FOUR_HOURS; - else { - // locale-default or custom - return Date.ClockFormat.LOCALE_DEFAULT; - } - } if (gnome_interface.get_string(CLOCK_FORMAT_KEY) == "12h") return Date.ClockFormat.TWELVE_HOURS; else @@ -123,20 +109,14 @@ public class Configuration { get { return settings.get_boolean(COMPOSE_AS_HTML_KEY); } set { set_boolean(COMPOSE_AS_HTML_KEY, value); } } - + // Creates a configuration object. public Configuration(string schema_id) { // Start GSettings. settings = new Settings(schema_id); gnome_interface = new Settings("org.gnome.desktop.interface"); - foreach(unowned string schema in GLib.Settings.list_schemas()) { - if (schema == "com.canonical.indicator.datetime") { - indicator_datetime = new Settings("com.canonical.indicator.datetime"); - break; - } - } } - + // is_installed: set to true if installed, else false. // schema_dir: MUST be set if not installed. Directory where GSettings schema is located. public static void init(bool is_installed, string? schema_dir = null) { diff --git a/src/client/components/main-toolbar.vala b/src/client/components/main-toolbar.vala index af6415e3..42b7ef47 100644 --- a/src/client/components/main-toolbar.vala +++ b/src/client/components/main-toolbar.vala @@ -44,11 +44,9 @@ public class MainToolbar : Gtk.Box { target_value = left_pane_width + 6; return true; }); - - if (!GearyApplication.instance.is_running_unity) { - this.bind_property("account", folder_header, "title", BindingFlags.SYNC_CREATE); - this.bind_property("folder", folder_header, "subtitle", BindingFlags.SYNC_CREATE); - } + + this.bind_property("account", folder_header, "title", BindingFlags.SYNC_CREATE); + this.bind_property("folder", folder_header, "subtitle", BindingFlags.SYNC_CREATE); this.bind_property("show-close-button-left", folder_header, "show-close-button", BindingFlags.SYNC_CREATE); this.bind_property("show-close-button-right", conversation_header, "show-close-button", diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala index 88713090..7f5755cb 100644 --- a/src/client/components/main-window.vala +++ b/src/client/components/main-window.vala @@ -81,23 +81,9 @@ public class MainWindow : Gtk.ApplicationWindow { main_toolbar = new MainToolbar(); main_toolbar.bind_property("search-open", search_bar, "search-mode-enabled", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - if (!GearyApplication.instance.is_running_unity) { - main_toolbar.show_close_button = true; - set_titlebar(main_toolbar); - title = GearyApplication.NAME; - } else { - BindingTransformFunc title_func = (binding, source, ref target) => { - string folder = current_folder != null ? current_folder.get_display_name() + " " : ""; - string account = main_toolbar.account != null ? "(%s)".printf(main_toolbar.account) : ""; - - target = "%s%s - %s".printf(folder, account, GearyApplication.NAME); - - return true; - }; - bind_property("current-folder", this, "title", BindingFlags.SYNC_CREATE, title_func); - main_toolbar.bind_property("account", this, "title", BindingFlags.SYNC_CREATE, title_func); - } - + main_toolbar.show_close_button = true; + set_titlebar(main_toolbar); + set_styling(); create_layout(); on_change_orientation(); @@ -253,10 +239,7 @@ public class MainWindow : Gtk.ApplicationWindow { // Message list left of message viewer. conversations_paned.pack1(search_bar_box, false, false); conversations_paned.pack2(viewer_frame, true, true); - - if (GearyApplication.instance.is_running_unity) - main_layout.pack_start(main_toolbar, false, true, 0); - + main_layout.pack_end(conversations_paned, true, true, 0); add(main_layout); diff --git a/src/client/components/pill-toolbar.vala b/src/client/components/pill-toolbar.vala index 34c2988e..0bde8c25 100644 --- a/src/client/components/pill-toolbar.vala +++ b/src/client/components/pill-toolbar.vala @@ -54,11 +54,7 @@ public interface PillBar : Gtk.Container { image.set_pixel_size(16); b.image = image; } - - // Unity buttons are a bit tight - if (GearyApplication.instance.is_running_unity && b.image != null) - b.image.margin = b.image.margin + 4; - + b.always_show_image = true; if (!show_label) diff --git a/src/client/composer/composer-window.vala b/src/client/composer/composer-window.vala index 93f89cc5..1fd03967 100644 --- a/src/client/composer/composer-window.vala +++ b/src/client/composer/composer-window.vala @@ -13,18 +13,13 @@ public class ComposerWindow : Gtk.Window, ComposerContainer { Object(type: Gtk.WindowType.TOPLEVEL); add(composer); - - if (!GearyApplication.instance.is_running_unity) { - composer.header.show_close_button = true; - composer.free_header(); - set_titlebar(composer.header); - composer.bind_property("window-title", composer.header, "title", - BindingFlags.SYNC_CREATE); - } else { - composer.embed_header(); - composer.bind_property("window-title", this, "title", BindingFlags.SYNC_CREATE); - } - + + composer.header.show_close_button = true; + composer.free_header(); + set_titlebar(composer.header); + composer.bind_property("window-title", composer.header, "title", + BindingFlags.SYNC_CREATE); + add_accel_group(composer.ui.get_accel_group()); show(); set_position(Gtk.WindowPosition.CENTER);