parent
10402f7b04
commit
7624f349de
|
@ -37,8 +37,6 @@ public class AddConferenceDialog : Gtk.Dialog {
|
||||||
setup_jid_add_view();
|
setup_jid_add_view();
|
||||||
setup_conference_details_view();
|
setup_conference_details_view();
|
||||||
show_jid_add_view();
|
show_jid_add_view();
|
||||||
|
|
||||||
stream_interactor.get_module(MucManager.IDENTITY).joined.connect(on_joined);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void show_jid_add_view() {
|
private void show_jid_add_view() {
|
||||||
|
@ -51,6 +49,7 @@ public class AddConferenceDialog : Gtk.Dialog {
|
||||||
ok_button.label = _("Next");
|
ok_button.label = _("Next");
|
||||||
ok_button.sensitive = select_fragment.done;
|
ok_button.sensitive = select_fragment.done;
|
||||||
ok_button.clicked.connect(on_next_button_clicked);
|
ok_button.clicked.connect(on_next_button_clicked);
|
||||||
|
details_fragment.fragment_active = false;
|
||||||
details_fragment.notify["done"].disconnect(set_ok_sensitive_from_details);
|
details_fragment.notify["done"].disconnect(set_ok_sensitive_from_details);
|
||||||
select_fragment.notify["done"].connect(set_ok_sensitive_from_select);
|
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.label = _("Join");
|
||||||
ok_button.sensitive = details_fragment.done;
|
ok_button.sensitive = details_fragment.done;
|
||||||
ok_button.clicked.disconnect(on_next_button_clicked);
|
ok_button.clicked.disconnect(on_next_button_clicked);
|
||||||
|
details_fragment.fragment_active = true;
|
||||||
select_fragment.notify["done"].disconnect(set_ok_sensitive_from_select);
|
select_fragment.notify["done"].disconnect(set_ok_sensitive_from_select);
|
||||||
details_fragment.notify["done"].connect(set_ok_sensitive_from_details);
|
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() {
|
private void setup_conference_details_view() {
|
||||||
details_fragment = new ConferenceDetailsFragment(stream_interactor) { ok_button=ok_button };
|
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 };
|
Box wrap_box = new Box(Orientation.VERTICAL, 0) { visible=true };
|
||||||
wrap_box.add(details_fragment);
|
wrap_box.add(details_fragment);
|
||||||
|
@ -180,15 +181,6 @@ public class AddConferenceDialog : Gtk.Dialog {
|
||||||
show_conference_details_view();
|
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() {
|
private void on_cancel() {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ namespace Dino.Ui {
|
||||||
[GtkTemplate (ui = "/im/dino/Dino/add_conversation/conference_details_fragment.ui")]
|
[GtkTemplate (ui = "/im/dino/Dino/add_conversation/conference_details_fragment.ui")]
|
||||||
protected class ConferenceDetailsFragment : Box {
|
protected class ConferenceDetailsFragment : Box {
|
||||||
|
|
||||||
|
public signal void joined();
|
||||||
|
|
||||||
public bool done {
|
public bool done {
|
||||||
get {
|
get {
|
||||||
Jid? parsed_jid = Jid.parse(jid);
|
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 Stack accounts_stack;
|
||||||
[GtkChild] private Button accounts_button;
|
[GtkChild] private Button accounts_button;
|
||||||
[GtkChild] private Label accounts_label;
|
[GtkChild] private Label accounts_label;
|
||||||
|
@ -137,6 +141,8 @@ protected class ConferenceDetailsFragment : Box {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void on_ok_button_clicked() {
|
private async void on_ok_button_clicked() {
|
||||||
|
if (!fragment_active) return;
|
||||||
|
|
||||||
ok_button.label = _("Joining…");
|
ok_button.label = _("Joining…");
|
||||||
ok_button.sensitive = false;
|
ok_button.sensitive = false;
|
||||||
|
|
||||||
|
@ -144,7 +150,10 @@ protected class ConferenceDetailsFragment : Box {
|
||||||
|
|
||||||
ok_button.label = _("Join");
|
ok_button.label = _("Join");
|
||||||
ok_button.sensitive = true;
|
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 = "";
|
string label_text = "";
|
||||||
if (join_result.muc_error != null) {
|
if (join_result.muc_error != null) {
|
||||||
|
|
|
@ -167,10 +167,11 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
|
||||||
}
|
}
|
||||||
Box content_area = dialog.get_content_area();
|
Box content_area = dialog.get_content_area();
|
||||||
content_area.add(conference_fragment);
|
content_area.add(conference_fragment);
|
||||||
dialog.response.connect((response_id) => {
|
conference_fragment.joined.connect(() => {
|
||||||
if (response_id == ResponseType.OK) {
|
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
} else if (response_id == ResponseType.CANCEL) {
|
});
|
||||||
|
dialog.response.connect((response_id) => {
|
||||||
|
if (response_id == ResponseType.CANCEL) {
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue