Remove Unity-specific workarounds. Bug 738899.
This commit is contained in:
parent
19dde8912b
commit
7b37e264c9
6 changed files with 24 additions and 79 deletions
|
|
@ -78,28 +78,21 @@ public class GearyApplication : Gtk.Application {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Configuration config { get; private set; }
|
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 static GearyApplication _instance = null;
|
||||||
|
|
||||||
private string bin;
|
private string bin;
|
||||||
private File exec_dir;
|
private File exec_dir;
|
||||||
private bool exiting_fired = false;
|
private bool exiting_fired = false;
|
||||||
private int exitcode = 0;
|
private int exitcode = 0;
|
||||||
private bool is_destroyed = false;
|
private bool is_destroyed = false;
|
||||||
|
|
||||||
public GearyApplication() {
|
public GearyApplication() {
|
||||||
Object(application_id: APP_ID);
|
Object(application_id: APP_ID);
|
||||||
|
|
||||||
_instance = this;
|
_instance = this;
|
||||||
|
|
||||||
is_running_unity = Geary.String.stri_equal(Environment.get_variable("XDG_CURRENT_DESKTOP"), "Unity");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Application.run() calls this as an entry point.
|
// Application.run() calls this as an entry point.
|
||||||
public override bool local_command_line(ref unowned string[] args, out int exit_status) {
|
public override bool local_command_line(ref unowned string[] args, out int exit_status) {
|
||||||
bin = args[0];
|
bin = args[0];
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,10 @@ public class Configuration {
|
||||||
public const string STARTUP_NOTIFICATIONS_KEY = "startup-notifications";
|
public const string STARTUP_NOTIFICATIONS_KEY = "startup-notifications";
|
||||||
public const string ASK_OPEN_ATTACHMENT_KEY = "ask-open-attachment";
|
public const string ASK_OPEN_ATTACHMENT_KEY = "ask-open-attachment";
|
||||||
public const string COMPOSE_AS_HTML_KEY = "compose-as-html";
|
public const string COMPOSE_AS_HTML_KEY = "compose-as-html";
|
||||||
|
|
||||||
public Settings settings { get; private set; }
|
public Settings settings { get; private set; }
|
||||||
|
|
||||||
public Settings gnome_interface;
|
public Settings gnome_interface;
|
||||||
private Settings? indicator_datetime;
|
|
||||||
|
|
||||||
public int window_width {
|
public int window_width {
|
||||||
get { return settings.get_int(WINDOW_WIDTH_KEY); }
|
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 CLOCK_FORMAT_KEY = "clock-format";
|
||||||
private const string TIME_FORMAT_KEY = "time-format";
|
|
||||||
public Date.ClockFormat clock_format {
|
public Date.ClockFormat clock_format {
|
||||||
get {
|
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")
|
if (gnome_interface.get_string(CLOCK_FORMAT_KEY) == "12h")
|
||||||
return Date.ClockFormat.TWELVE_HOURS;
|
return Date.ClockFormat.TWELVE_HOURS;
|
||||||
else
|
else
|
||||||
|
|
@ -123,20 +109,14 @@ public class Configuration {
|
||||||
get { return settings.get_boolean(COMPOSE_AS_HTML_KEY); }
|
get { return settings.get_boolean(COMPOSE_AS_HTML_KEY); }
|
||||||
set { set_boolean(COMPOSE_AS_HTML_KEY, value); }
|
set { set_boolean(COMPOSE_AS_HTML_KEY, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a configuration object.
|
// Creates a configuration object.
|
||||||
public Configuration(string schema_id) {
|
public Configuration(string schema_id) {
|
||||||
// Start GSettings.
|
// Start GSettings.
|
||||||
settings = new Settings(schema_id);
|
settings = new Settings(schema_id);
|
||||||
gnome_interface = new Settings("org.gnome.desktop.interface");
|
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.
|
// is_installed: set to true if installed, else false.
|
||||||
// schema_dir: MUST be set if not installed. Directory where GSettings schema is located.
|
// 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) {
|
public static void init(bool is_installed, string? schema_dir = null) {
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,9 @@ public class MainToolbar : Gtk.Box {
|
||||||
target_value = left_pane_width + 6;
|
target_value = left_pane_width + 6;
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!GearyApplication.instance.is_running_unity) {
|
this.bind_property("account", folder_header, "title", 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("folder", folder_header, "subtitle", BindingFlags.SYNC_CREATE);
|
|
||||||
}
|
|
||||||
this.bind_property("show-close-button-left", folder_header, "show-close-button",
|
this.bind_property("show-close-button-left", folder_header, "show-close-button",
|
||||||
BindingFlags.SYNC_CREATE);
|
BindingFlags.SYNC_CREATE);
|
||||||
this.bind_property("show-close-button-right", conversation_header, "show-close-button",
|
this.bind_property("show-close-button-right", conversation_header, "show-close-button",
|
||||||
|
|
|
||||||
|
|
@ -81,23 +81,9 @@ public class MainWindow : Gtk.ApplicationWindow {
|
||||||
main_toolbar = new MainToolbar();
|
main_toolbar = new MainToolbar();
|
||||||
main_toolbar.bind_property("search-open", search_bar, "search-mode-enabled",
|
main_toolbar.bind_property("search-open", search_bar, "search-mode-enabled",
|
||||||
BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
|
BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
|
||||||
if (!GearyApplication.instance.is_running_unity) {
|
main_toolbar.show_close_button = true;
|
||||||
main_toolbar.show_close_button = true;
|
set_titlebar(main_toolbar);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
set_styling();
|
set_styling();
|
||||||
create_layout();
|
create_layout();
|
||||||
on_change_orientation();
|
on_change_orientation();
|
||||||
|
|
@ -253,10 +239,7 @@ public class MainWindow : Gtk.ApplicationWindow {
|
||||||
// Message list left of message viewer.
|
// Message list left of message viewer.
|
||||||
conversations_paned.pack1(search_bar_box, false, false);
|
conversations_paned.pack1(search_bar_box, false, false);
|
||||||
conversations_paned.pack2(viewer_frame, true, true);
|
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);
|
main_layout.pack_end(conversations_paned, true, true, 0);
|
||||||
|
|
||||||
add(main_layout);
|
add(main_layout);
|
||||||
|
|
|
||||||
|
|
@ -54,11 +54,7 @@ public interface PillBar : Gtk.Container {
|
||||||
image.set_pixel_size(16);
|
image.set_pixel_size(16);
|
||||||
b.image = image;
|
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;
|
b.always_show_image = true;
|
||||||
|
|
||||||
if (!show_label)
|
if (!show_label)
|
||||||
|
|
|
||||||
|
|
@ -13,18 +13,13 @@ public class ComposerWindow : Gtk.Window, ComposerContainer {
|
||||||
Object(type: Gtk.WindowType.TOPLEVEL);
|
Object(type: Gtk.WindowType.TOPLEVEL);
|
||||||
|
|
||||||
add(composer);
|
add(composer);
|
||||||
|
|
||||||
if (!GearyApplication.instance.is_running_unity) {
|
composer.header.show_close_button = true;
|
||||||
composer.header.show_close_button = true;
|
composer.free_header();
|
||||||
composer.free_header();
|
set_titlebar(composer.header);
|
||||||
set_titlebar(composer.header);
|
composer.bind_property("window-title", composer.header, "title",
|
||||||
composer.bind_property("window-title", composer.header, "title",
|
BindingFlags.SYNC_CREATE);
|
||||||
BindingFlags.SYNC_CREATE);
|
|
||||||
} else {
|
|
||||||
composer.embed_header();
|
|
||||||
composer.bind_property("window-title", this, "title", BindingFlags.SYNC_CREATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
add_accel_group(composer.ui.get_accel_group());
|
add_accel_group(composer.ui.get_accel_group());
|
||||||
show();
|
show();
|
||||||
set_position(Gtk.WindowPosition.CENTER);
|
set_position(Gtk.WindowPosition.CENTER);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue