From c6ff3387fa7b23678bbfe644c9e1b668ac92a731 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Mon, 17 Apr 2017 22:46:12 +0200 Subject: Handle conference bookmarks w/o nick --- .../ui/add_conversation/conference/add_groupchat_dialog.vala | 7 +++---- .../conference/conference_details_fragment.vala | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'main/src/ui/add_conversation') diff --git a/main/src/ui/add_conversation/conference/add_groupchat_dialog.vala b/main/src/ui/add_conversation/conference/add_groupchat_dialog.vala index 10c91c70..821360a9 100644 --- a/main/src/ui/add_conversation/conference/add_groupchat_dialog.vala +++ b/main/src/ui/add_conversation/conference/add_groupchat_dialog.vala @@ -44,7 +44,7 @@ protected class AddGroupchatDialog : Gtk.Dialog { accounts_stack.set_visible_child_name("label"); account_label.label = account.bare_jid.to_string(); jid_entry.text = conference.jid; - nick_entry.text = conference.nick; + nick_entry.text = conference.nick ?? ""; autojoin_checkbutton.active = conference.autojoin; alias_entry.text = conference.name; } @@ -60,14 +60,13 @@ protected class AddGroupchatDialog : Gtk.Dialog { private bool check_ok() { Jid? parsed_jid = Jid.parse(jid_entry.text); - ok_button.sensitive = parsed_jid != null && parsed_jid.localpart != null && parsed_jid.resourcepart == null && - nick_entry.text != "" && alias_entry.text != null; + ok_button.sensitive = parsed_jid != null && parsed_jid.localpart != null && parsed_jid.resourcepart == null; return false; } private void on_ok_button_clicked() { Xmpp.Xep.Bookmarks.Conference conference = new Xmpp.Xep.Bookmarks.Conference(jid_entry.text); - conference.nick = nick_entry.text; + conference.nick = nick_entry.text != "" ? nick_entry.text : null; conference.name = alias_entry.text; conference.autojoin = autojoin_checkbutton.active; if (edit_confrence == null) { diff --git a/main/src/ui/add_conversation/conference/conference_details_fragment.vala b/main/src/ui/add_conversation/conference/conference_details_fragment.vala index fe57e6da..dcb69cff 100644 --- a/main/src/ui/add_conversation/conference/conference_details_fragment.vala +++ b/main/src/ui/add_conversation/conference/conference_details_fragment.vala @@ -31,14 +31,14 @@ protected class ConferenceDetailsFragment : Box { jid_entry.text = value; } } - public string nick { - get { return nick_entry.text; } + public string? nick { + get { return nick_entry.text != "" ? nick_entry.text : null; } set { - nick_label.label = value; - nick_entry.text = value; + nick_label.label = value ?? ""; + nick_entry.text = value ?? ""; } } - public string password { + public string? password { get { return password_entry.text == "" ? null : password_entry.text; } set { password_label.label = value; -- cgit v1.2.3-70-g09d2