diff --git a/src/application/kordophone-application.vala b/src/application/kordophone-application.vala index 942bcb2..986b003 100644 --- a/src/application/kordophone-application.vala +++ b/src/application/kordophone-application.vala @@ -32,7 +32,6 @@ public class KordophoneApp : Adw.Application add_action(quit_action); // Warm up dbus connections - Settings.get_instance(); Repository.get_instance(); } diff --git a/src/application/preferences-window.vala b/src/application/preferences-window.vala index 76969fa..4f11f82 100644 --- a/src/application/preferences-window.vala +++ b/src/application/preferences-window.vala @@ -37,9 +37,14 @@ public class PreferencesWindow : Adw.PreferencesDialog { password_row.title = "Password"; connection_group.add (password_row); - settings = Settings.get_instance(); + settings = new Settings(); settings.settings_ready.connect(load_settings); load_settings(); + + unowned var self = this; + closed.connect(() => { + self.save_settings(); + }); } private void load_settings() { @@ -50,21 +55,15 @@ public class PreferencesWindow : Adw.PreferencesDialog { } catch (Error e) { warning("Failed to load settings: %s", e.message); } - - setup_change_callbacks(); } - private void setup_change_callbacks() { - server_url_row.changed.connect(() => { + private void save_settings() { + try { settings.set_server_url(server_url_row.text); - }); - - username_row.changed.connect(() => { settings.set_username(username_row.text); - }); - - password_row.changed.connect(() => { settings.set_password(password_row.text); - }); + } catch (Error e) { + warning("Failed to save settings: %s", e.message); + } } } \ No newline at end of file diff --git a/src/service/settings.vala b/src/service/settings.vala index a8d5674..7016e2a 100644 --- a/src/service/settings.vala +++ b/src/service/settings.vala @@ -5,18 +5,10 @@ public class Settings : DBusServiceProxy public signal void config_changed(); public signal void settings_ready(); - public static Settings get_instance() { - if (instance == null) { - instance = new Settings(); - } - return instance; - } - - private static Settings instance = null; private DBusService.Settings? dbus_settings; private Secret.Service secret_service; - private Settings() { + public Settings() { base(); try { diff --git a/src/transcript/transcript-container-view.vala b/src/transcript/transcript-container-view.vala index 1253122..be9e08a 100644 --- a/src/transcript/transcript-container-view.vala +++ b/src/transcript/transcript-container-view.vala @@ -202,6 +202,8 @@ class TranscriptContainerView : Adw.Bin return true; }); + + pending_uploads.remove(upload_guid); update_attachment_row_visibility(); update_send_button_sensitivity();