diff options
author | fiaxh <git@mx.ax.lt> | 2017-03-22 17:15:06 +0100 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-03-23 14:36:53 +0100 |
commit | fa78573b052693b29350bdd0f7eaf74dc6571e4a (patch) | |
tree | 7efcb3eb96e5c3d17c6a1c0604eff533e1244a20 /main/src | |
parent | ec06d5f9ebd7142f4be422e73b46d6702671927d (diff) | |
download | dino-fa78573b052693b29350bdd0f7eaf74dc6571e4a.tar.gz dino-fa78573b052693b29350bdd0f7eaf74dc6571e4a.zip |
Move some database interaction into entities
fixes #2
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/ui/manage_accounts/add_account_dialog.vala | 9 | ||||
-rw-r--r-- | main/src/ui/manage_accounts/dialog.vala | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/main/src/ui/manage_accounts/add_account_dialog.vala b/main/src/ui/manage_accounts/add_account_dialog.vala index f6ad40a2..8501f476 100644 --- a/main/src/ui/manage_accounts/add_account_dialog.vala +++ b/main/src/ui/manage_accounts/add_account_dialog.vala @@ -49,11 +49,10 @@ public class AddAccountDialog : Gtk.Dialog { } private void on_ok_button_clicked() { - Account account = new Account.from_bare_jid(jid_entry.get_text()); - account.resourcepart = "dino"; - account.alias = alias_entry.get_text(); - account.enabled = false; - account.password = password_entry.get_text(); + Jid jid = new Jid(jid_entry.get_text()); + string password = password_entry.get_text(); + string alias = alias_entry.get_text(); + Account account = new Account(jid, null, password, alias); added(account); close(); } diff --git a/main/src/ui/manage_accounts/dialog.vala b/main/src/ui/manage_accounts/dialog.vala index db40761d..c0689474 100644 --- a/main/src/ui/manage_accounts/dialog.vala +++ b/main/src/ui/manage_accounts/dialog.vala @@ -98,7 +98,7 @@ public class Dialog : Gtk.Window { AddAccountDialog add_account_dialog = new AddAccountDialog(stream_interactor); add_account_dialog.set_transient_for(this); add_account_dialog.added.connect((account) => { - db.add_account(account); + account.persist(db); AccountRow account_item = add_account(account); account_list.select_row(account_item); account_list.queue_draw(); @@ -112,7 +112,7 @@ public class Dialog : Gtk.Window { account_list.remove(account_item); account_list.queue_draw(); if (account_item.account.enabled) account_disabled(account_item.account); - db.remove_account(account_item.account); + account_item.account.remove(); if (account_list.get_row_at_index(0) != null) { account_list.select_row(account_list.get_row_at_index(0)); } else { |