parent
130965f322
commit
a99c3ff16d
|
@ -70,12 +70,14 @@ public class AddAccountDialog : Gtk.Dialog {
|
||||||
};
|
};
|
||||||
|
|
||||||
private StreamInteractor stream_interactor;
|
private StreamInteractor stream_interactor;
|
||||||
|
private Database db;
|
||||||
private HashMap<ListBoxRow, string> list_box_jids = new HashMap<ListBoxRow, string>();
|
private HashMap<ListBoxRow, string> list_box_jids = new HashMap<ListBoxRow, string>();
|
||||||
private Jid? server_jid = null;
|
private Jid? server_jid = null;
|
||||||
private Xep.InBandRegistration.Form? form = null;
|
private Xep.InBandRegistration.Form? form = null;
|
||||||
|
|
||||||
public AddAccountDialog(StreamInteractor stream_interactor) {
|
public AddAccountDialog(StreamInteractor stream_interactor, Database db) {
|
||||||
this.stream_interactor = stream_interactor;
|
this.stream_interactor = stream_interactor;
|
||||||
|
this.db = db;
|
||||||
this.title = _("Add Account");
|
this.title = _("Add Account");
|
||||||
|
|
||||||
// Sign in - Jid
|
// Sign in - Jid
|
||||||
|
@ -258,8 +260,8 @@ public class AddAccountDialog : Gtk.Dialog {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
add_activate_account(account);
|
||||||
show_success();
|
show_success();
|
||||||
added(account);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,9 +345,9 @@ public class AddAccountDialog : Gtk.Dialog {
|
||||||
case "password": password = field.get_value_string(); break;
|
case "password": password = field.get_value_string(); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Account account = new Account(new Jid(username + "@" + server_jid.domainpart), null, password, null);
|
Account account = new Account(new Jid.components(username, server_jid.domainpart, null), null, password, null);
|
||||||
|
add_activate_account(account);
|
||||||
show_success();
|
show_success();
|
||||||
added(account);
|
|
||||||
} else {
|
} else {
|
||||||
display_notification(error);
|
display_notification(error);
|
||||||
}
|
}
|
||||||
|
@ -360,6 +362,13 @@ public class AddAccountDialog : Gtk.Dialog {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void add_activate_account(Account account) {
|
||||||
|
account.enabled = true;
|
||||||
|
account.persist(db);
|
||||||
|
stream_interactor.connect_account(account);
|
||||||
|
added(account);
|
||||||
|
}
|
||||||
|
|
||||||
private void animate_window_resize(Widget widget) { // TODO code duplication
|
private void animate_window_resize(Widget widget) { // TODO code duplication
|
||||||
int def_height, curr_width, curr_height;
|
int def_height, curr_width, curr_height;
|
||||||
get_size(out curr_width, out curr_height);
|
get_size(out curr_width, out curr_height);
|
||||||
|
|
|
@ -108,10 +108,9 @@ public class Dialog : Gtk.Dialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void show_add_account_dialog() {
|
private void show_add_account_dialog() {
|
||||||
AddAccountDialog add_account_dialog = new AddAccountDialog(stream_interactor);
|
AddAccountDialog add_account_dialog = new AddAccountDialog(stream_interactor, db);
|
||||||
add_account_dialog.set_transient_for(this);
|
add_account_dialog.set_transient_for(this);
|
||||||
add_account_dialog.added.connect((account) => {
|
add_account_dialog.added.connect((account) => {
|
||||||
account.persist(db);
|
|
||||||
AccountRow account_item = add_account(account);
|
AccountRow account_item = add_account(account);
|
||||||
account_list.select_row(account_item);
|
account_list.select_row(account_item);
|
||||||
account_list.queue_draw();
|
account_list.queue_draw();
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class UnifiedWindowController : Object {
|
||||||
});
|
});
|
||||||
|
|
||||||
window.welcome_placeholder.primary_button.clicked.connect(() => {
|
window.welcome_placeholder.primary_button.clicked.connect(() => {
|
||||||
ManageAccounts.AddAccountDialog dialog = new ManageAccounts.AddAccountDialog(stream_interactor);
|
ManageAccounts.AddAccountDialog dialog = new ManageAccounts.AddAccountDialog(stream_interactor, db);
|
||||||
dialog.set_transient_for(app.get_active_window());
|
dialog.set_transient_for(app.get_active_window());
|
||||||
dialog.present();
|
dialog.present();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue