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 +++++----- main/src/ui/chat_input/smiley_converter.vala | 4 ++-- main/src/ui/conversation_selector/list.vala | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) (limited to 'main/src') 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; diff --git a/main/src/ui/chat_input/smiley_converter.vala b/main/src/ui/chat_input/smiley_converter.vala index 73413972..849745f9 100644 --- a/main/src/ui/chat_input/smiley_converter.vala +++ b/main/src/ui/chat_input/smiley_converter.vala @@ -13,7 +13,7 @@ class SmileyConverter { private static HashMap smiley_translations = new HashMap(); static construct { - smiley_translations[":)"] = "🙂"; + smiley_translations[":)"] = "☺"; smiley_translations[":D"] = "😀"; smiley_translations[";)"] = "😉"; smiley_translations["O:)"] = "😇"; @@ -22,7 +22,7 @@ class SmileyConverter { smiley_translations[":o"] = "😮"; smiley_translations[":P"] = "😛"; smiley_translations[";P"] = "😜"; - smiley_translations[":("] = "🙁"; + smiley_translations[":("] = "☹"; smiley_translations[":'("] = "😢"; smiley_translations[":/"] = "😕"; } diff --git a/main/src/ui/conversation_selector/list.vala b/main/src/ui/conversation_selector/list.vala index 2e56a305..3d6ee895 100644 --- a/main/src/ui/conversation_selector/list.vala +++ b/main/src/ui/conversation_selector/list.vala @@ -149,7 +149,7 @@ public class List : ListBox { ListBoxRow? index_m1 = get_row_at_index(index - 1); if (index_m1 != null) { select_row(index_m1); - row_activated(index_p1); + row_activated(index_m1); } } } -- cgit v1.2.3-54-g00ecf