aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/add_conversation/add_conference_dialog.vala14
-rw-r--r--main/src/ui/add_conversation/conference_details_fragment.vala11
-rw-r--r--main/src/ui/application.vala7
3 files changed, 17 insertions, 15 deletions
diff --git a/main/src/ui/add_conversation/add_conference_dialog.vala b/main/src/ui/add_conversation/add_conference_dialog.vala
index 9639eed3..ce88faec 100644
--- a/main/src/ui/add_conversation/add_conference_dialog.vala
+++ b/main/src/ui/add_conversation/add_conference_dialog.vala
@@ -37,8 +37,6 @@ public class AddConferenceDialog : Gtk.Dialog {
setup_jid_add_view();
setup_conference_details_view();
show_jid_add_view();
-
- stream_interactor.get_module(MucManager.IDENTITY).joined.connect(on_joined);
}
private void show_jid_add_view() {
@@ -51,6 +49,7 @@ public class AddConferenceDialog : Gtk.Dialog {
ok_button.label = _("Next");
ok_button.sensitive = select_fragment.done;
ok_button.clicked.connect(on_next_button_clicked);
+ details_fragment.fragment_active = false;
details_fragment.notify["done"].disconnect(set_ok_sensitive_from_details);
select_fragment.notify["done"].connect(set_ok_sensitive_from_select);
}
@@ -69,6 +68,7 @@ public class AddConferenceDialog : Gtk.Dialog {
ok_button.label = _("Join");
ok_button.sensitive = details_fragment.done;
ok_button.clicked.disconnect(on_next_button_clicked);
+ details_fragment.fragment_active = true;
select_fragment.notify["done"].disconnect(set_ok_sensitive_from_select);
details_fragment.notify["done"].connect(set_ok_sensitive_from_details);
}
@@ -133,6 +133,7 @@ public class AddConferenceDialog : Gtk.Dialog {
private void setup_conference_details_view() {
details_fragment = new ConferenceDetailsFragment(stream_interactor) { ok_button=ok_button };
+ details_fragment.joined.connect(() => this.close());
Box wrap_box = new Box(Orientation.VERTICAL, 0) { visible=true };
wrap_box.add(details_fragment);
@@ -180,15 +181,6 @@ public class AddConferenceDialog : Gtk.Dialog {
show_conference_details_view();
}
- private void on_joined(Account account, Jid jid, string nick) {
- if (account.equals(details_fragment.account) && jid.equals_bare(new Jid(details_fragment.jid))) {
- Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(jid, account, Conversation.Type.GROUPCHAT);
- stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation);
- conversation_opened(conversation);
- close();
- }
- }
-
private void on_cancel() {
close();
}
diff --git a/main/src/ui/add_conversation/conference_details_fragment.vala b/main/src/ui/add_conversation/conference_details_fragment.vala
index 47cf228f..4fd1e608 100644
--- a/main/src/ui/add_conversation/conference_details_fragment.vala
+++ b/main/src/ui/add_conversation/conference_details_fragment.vala
@@ -10,6 +10,8 @@ namespace Dino.Ui {
[GtkTemplate (ui = "/im/dino/Dino/add_conversation/conference_details_fragment.ui")]
protected class ConferenceDetailsFragment : Box {
+ public signal void joined();
+
public bool done {
get {
Jid? parsed_jid = Jid.parse(jid);
@@ -55,6 +57,8 @@ protected class ConferenceDetailsFragment : Box {
}
}
+ public bool fragment_active { get; set; default=true; }
+
[GtkChild] private Stack accounts_stack;
[GtkChild] private Button accounts_button;
[GtkChild] private Label accounts_label;
@@ -137,6 +141,8 @@ protected class ConferenceDetailsFragment : Box {
}
private async void on_ok_button_clicked() {
+ if (!fragment_active) return;
+
ok_button.label = _("Joining…");
ok_button.sensitive = false;
@@ -144,7 +150,10 @@ protected class ConferenceDetailsFragment : Box {
ok_button.label = _("Join");
ok_button.sensitive = true;
- if (join_result == null || join_result.nick != null) return;
+ if (join_result == null || join_result.nick != null) {
+ joined();
+ return;
+ }
string label_text = "";
if (join_result.muc_error != null) {
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala
index 138411a0..bff25696 100644
--- a/main/src/ui/application.vala
+++ b/main/src/ui/application.vala
@@ -167,10 +167,11 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
}
Box content_area = dialog.get_content_area();
content_area.add(conference_fragment);
+ conference_fragment.joined.connect(() => {
+ dialog.destroy();
+ });
dialog.response.connect((response_id) => {
- if (response_id == ResponseType.OK) {
- dialog.destroy();
- } else if (response_id == ResponseType.CANCEL) {
+ if (response_id == ResponseType.CANCEL) {
dialog.destroy();
}
});