aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorbobufa <bobufa@users.noreply.github.com>2018-03-26 20:23:04 +0000
committerfiaxh <fiaxh@users.noreply.github.com>2018-03-27 15:04:33 -0600
commitfefa28c4ef90eadb473d787a9c24d7ed890dbc4d (patch)
tree853584f530a4ee6404061b9dc59c21066d109c57 /main/src
parent7ecb0e614b8496e68a84ecff4b0107b417157326 (diff)
downloaddino-fefa28c4ef90eadb473d787a9c24d7ed890dbc4d.tar.gz
dino-fefa28c4ef90eadb473d787a9c24d7ed890dbc4d.zip
Prefill nick with local alias when joining a non-bookmarked MUC
fixes #223
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/add_conversation/add_conference_dialog.vala1
-rw-r--r--main/src/ui/add_conversation/conference_details_fragment.vala31
-rw-r--r--main/src/ui/application.vala1
3 files changed, 15 insertions, 18 deletions
diff --git a/main/src/ui/add_conversation/add_conference_dialog.vala b/main/src/ui/add_conversation/add_conference_dialog.vala
index f6597505..5c5b458c 100644
--- a/main/src/ui/add_conversation/add_conference_dialog.vala
+++ b/main/src/ui/add_conversation/add_conference_dialog.vala
@@ -130,7 +130,6 @@ public class AddConferenceDialog : Gtk.Dialog {
} else if (row != null) {
details_fragment.account = row.account;
details_fragment.jid = row.jid.to_string();
- details_fragment.set_editable();
}
show_conference_details_view();
}
diff --git a/main/src/ui/add_conversation/conference_details_fragment.vala b/main/src/ui/add_conversation/conference_details_fragment.vala
index 964bb059..945f743a 100644
--- a/main/src/ui/add_conversation/conference_details_fragment.vala
+++ b/main/src/ui/add_conversation/conference_details_fragment.vala
@@ -23,6 +23,10 @@ protected class ConferenceDetailsFragment : Box {
set {
accounts_label.label = value.bare_jid.to_string();
account_combobox.selected = value;
+ if (nick == null && value.alias != null) {
+ nick = value.alias;
+ }
+ accounts_stack.set_visible_child_name("label");
}
}
public string jid {
@@ -30,6 +34,7 @@ protected class ConferenceDetailsFragment : Box {
set {
jid_label.label = value;
jid_entry.text = value;
+ jid_stack.set_visible_child_name("label");
}
}
public string? nick {
@@ -37,6 +42,7 @@ protected class ConferenceDetailsFragment : Box {
set {
nick_label.label = value ?? "";
nick_entry.text = value ?? "";
+ nick_stack.set_visible_child_name("label");
}
}
public string? password {
@@ -44,6 +50,7 @@ protected class ConferenceDetailsFragment : Box {
set {
password_label.label = value;
password_entry.text = value;
+ nick_stack.set_visible_child_name("label");
}
}
@@ -81,11 +88,6 @@ protected class ConferenceDetailsFragment : Box {
account_combobox.initialize(stream_interactor);
- accounts_stack.set_visible_child_name("label");
- jid_stack.set_visible_child_name("label");
- nick_stack.set_visible_child_name("label");
- password_stack.set_visible_child_name("label");
-
accounts_button.clicked.connect(() => { set_active_stack(accounts_stack); });
jid_button.clicked.connect(() => { set_active_stack(jid_stack); });
nick_button.clicked.connect(() => { set_active_stack(nick_stack); });
@@ -106,18 +108,8 @@ protected class ConferenceDetailsFragment : Box {
ok_button.label = _("Joining…");
ok_button.sensitive = false;
});
- }
-
- public void set_editable() {
- nick_stack.set_visible_child_name("entry");
- password_stack.set_visible_child_name("entry");
- }
- public void reset_editable() {
- jid_stack.set_visible_child_name("label");
- accounts_stack.set_visible_child_name("label");
- nick_stack.set_visible_child_name("label");
- password_stack.set_visible_child_name("label");
+ clear();
}
public void clear() {
@@ -130,6 +122,13 @@ protected class ConferenceDetailsFragment : Box {
reset_editable();
}
+ public void reset_editable() {
+ jid_stack.set_visible_child_name("entry");
+ accounts_stack.set_visible_child_name("entry");
+ nick_stack.set_visible_child_name("entry");
+ password_stack.set_visible_child_name("entry");
+ }
+
private void on_enter_error(Account account, Jid jid, Xmpp.Xep.Muc.MucEnterError error) {
ok_button.label = _("Join");
ok_button.sensitive = true;
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala
index 81cb184a..22d6d93d 100644
--- a/main/src/ui/application.vala
+++ b/main/src/ui/application.vala
@@ -47,7 +47,6 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
ok_button.get_style_context().add_class("suggested-action");
ConferenceDetailsFragment conference_fragment = new ConferenceDetailsFragment(stream_interactor, ok_button);
conference_fragment.jid = jid;
- conference_fragment.set_editable();
Box content_area = dialog.get_content_area();
content_area.add(conference_fragment);
dialog.response.connect((response_id) => {