[geary/mjog/user-plugins: 2/26] Components.PreferencesWindow: Make application prop nullable
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/user-plugins: 2/26] Components.PreferencesWindow: Make application prop nullable
- Date: Tue, 17 Mar 2020 08:24:24 +0000 (UTC)
commit 655f1dcf831ea6c47c4b5f0f307376f570538b58
Author: Michael Gratton <mike vee net>
Date: Mon Mar 2 10:38:08 2020 +1100
Components.PreferencesWindow: Make application prop nullable
It should be nullable because it can be null, update call sites to
reflect this.
.../components/components-preferences-window.vala | 62 ++++++++++++----------
1 file changed, 34 insertions(+), 28 deletions(-)
---
diff --git a/src/client/components/components-preferences-window.vala
b/src/client/components/components-preferences-window.vala
index 0a159446..794f3650 100644
--- a/src/client/components/components-preferences-window.vala
+++ b/src/client/components/components-preferences-window.vala
@@ -23,7 +23,7 @@ public class Components.PreferencesWindow : Hdy.PreferencesWindow {
/** Returns the window's associated client application instance. */
- public new Application.Client application {
+ public new Application.Client? application {
get { return (Application.Client) base.get_application(); }
set { base.set_application(value); }
}
@@ -115,32 +115,35 @@ public class Components.PreferencesWindow : Hdy.PreferencesWindow {
window_actions.add_action_entries(WINDOW_ACTIONS, this);
insert_action_group(Action.Window.GROUP_NAME, window_actions);
- Application.Configuration config = this.application.config;
- config.bind(
- Application.Configuration.AUTOSELECT_KEY,
- autoselect,
- "state"
- );
- config.bind(
- Application.Configuration.DISPLAY_PREVIEW_KEY,
- display_preview,
- "state"
- );
- config.bind(
- Application.Configuration.FOLDER_LIST_PANE_HORIZONTAL_KEY,
- three_pane_view,
- "state"
- );
- config.bind(
- Application.Configuration.SINGLE_KEY_SHORTCUTS,
- single_key_shortucts,
- "state"
- );
- config.bind(
- Application.Configuration.STARTUP_NOTIFICATIONS_KEY,
- startup_notifications,
- "state"
- );
+ Application.Client? application = this.application;
+ if (application != null) {
+ Application.Configuration config = application.config;
+ config.bind(
+ Application.Configuration.AUTOSELECT_KEY,
+ autoselect,
+ "state"
+ );
+ config.bind(
+ Application.Configuration.DISPLAY_PREVIEW_KEY,
+ display_preview,
+ "state"
+ );
+ config.bind(
+ Application.Configuration.FOLDER_LIST_PANE_HORIZONTAL_KEY,
+ three_pane_view,
+ "state"
+ );
+ config.bind(
+ Application.Configuration.SINGLE_KEY_SHORTCUTS,
+ single_key_shortucts,
+ "state"
+ );
+ config.bind(
+ Application.Configuration.STARTUP_NOTIFICATIONS_KEY,
+ startup_notifications,
+ "state"
+ );
+ }
this.delete_event.connect(on_delete);
}
@@ -151,7 +154,10 @@ public class Components.PreferencesWindow : Hdy.PreferencesWindow {
private bool on_delete() {
// Sync startup notification option with file state
- this.application.autostart.sync_with_config();
+ Application.Client? application = this.application;
+ if (application != null) {
+ application.autostart.sync_with_config();
+ }
return Gdk.EVENT_PROPAGATE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]