diff options
author | fiaxh <git@mx.ax.lt> | 2017-03-15 22:01:32 +0100 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-03-16 17:56:38 +0100 |
commit | af49a47cf6c5933a9bcc21f2b7bb20d85be37483 (patch) | |
tree | 6f1c993fea5f238a1131d23586d9b8095553dc5b | |
parent | f277db6cb459c6e7456fb75722b9d57f734c4db6 (diff) | |
download | dino-af49a47cf6c5933a9bcc21f2b7bb20d85be37483.tar.gz dino-af49a47cf6c5933a9bcc21f2b7bb20d85be37483.zip |
Fix ChatInput for many lines + small UI changes
-rw-r--r-- | main/data/chat_input.ui | 12 | ||||
-rw-r--r-- | main/data/conversation_selector/conversation_row.ui | 3 | ||||
-rw-r--r-- | main/data/conversation_selector/view.ui | 1 | ||||
-rw-r--r-- | main/data/occupant_list.ui | 1 | ||||
-rw-r--r-- | main/data/occupant_list_item.ui | 5 | ||||
-rw-r--r-- | main/src/ui/chat_input.vala | 13 | ||||
-rw-r--r-- | main/src/ui/conversation_selector/view.vala | 2 | ||||
-rw-r--r-- | main/src/ui/conversation_summary/message_textview.vala | 2 | ||||
-rw-r--r-- | plugins/openpgp/src/account_settings_widget.vala | 2 |
9 files changed, 25 insertions, 16 deletions
diff --git a/main/data/chat_input.ui b/main/data/chat_input.ui index dac75feb..18583d07 100644 --- a/main/data/chat_input.ui +++ b/main/data/chat_input.ui @@ -1,17 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> - <template class="DinoUiChatInput" parent="GtkGrid"> <!-- TODO --> + <requires lib="gtk+" version="3.22"/> + <template class="DinoUiChatInput"> <property name="hexpand">True</property> <property name="orientation">horizontal</property> - <property name="visible">True</property> <property name="margin">5</property> - <property name="column-spacing">5</property> + <property name="visible">True</property> <child> - <object class="GtkFrame"> + <object class="GtkScrolledWindow" id="scrolled"> + <property name="max_content_height">300</property> + <property name="propagate_natural_height">True</property> <child> <object class="GtkTextView" id="text_input"> - <property name="border-width">5</property> <property name="wrap-mode">GTK_WRAP_WORD_CHAR</property> + <property name="border-width">5</property> <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="visible">True</property> diff --git a/main/data/conversation_selector/conversation_row.ui b/main/data/conversation_selector/conversation_row.ui index a932ed85..d37d8d4e 100644 --- a/main/data/conversation_selector/conversation_row.ui +++ b/main/data/conversation_selector/conversation_row.ui @@ -2,9 +2,6 @@ <interface> <template class="DinoUiConversationSelectorConversationRow"> <property name="visible">True</property> - <style> - <class name="no_padding"/> - </style> <child> <object class="GtkRevealer" id="main_revealer"> <property name="transition-type">slide-down</property> diff --git a/main/data/conversation_selector/view.ui b/main/data/conversation_selector/view.ui index 0dd2d00f..72ef268b 100644 --- a/main/data/conversation_selector/view.ui +++ b/main/data/conversation_selector/view.ui @@ -2,7 +2,6 @@ <interface> <template class="DinoUiConversationSelectorView"> <property name="can_focus">True</property> - <property name="width_request">40</property> <property name="expand">True</property> <property name="orientation">vertical</property> <property name="visible">True</property> diff --git a/main/data/occupant_list.ui b/main/data/occupant_list.ui index 60fb2dac..384d9033 100644 --- a/main/data/occupant_list.ui +++ b/main/data/occupant_list.ui @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> + <requires lib="gtk+" version="3.22"/> <template class="DinoUiOccupantList"> <property name="visible">True</property> <child> diff --git a/main/data/occupant_list_item.ui b/main/data/occupant_list_item.ui index 34f4107f..7a37f73b 100644 --- a/main/data/occupant_list_item.ui +++ b/main/data/occupant_list_item.ui @@ -21,12 +21,11 @@ <property name="visible">True</property> <child> <object class="GtkLabel" id="name_label"> + <property name="max_width_chars">1</property> + <property name="ellipsize">end</property> <property name="expand">True</property> <property name="xalign">0</property> <property name="visible">True</property> - <style> - <class name="name"/> - </style> </object> <packing> <property name="left_attach">0</property> diff --git a/main/src/ui/chat_input.vala b/main/src/ui/chat_input.vala index 5030fcea..209869a8 100644 --- a/main/src/ui/chat_input.vala +++ b/main/src/ui/chat_input.vala @@ -8,14 +8,16 @@ using Xmpp; namespace Dino.Ui { [GtkTemplate (ui = "/org/dino-im/chat_input.ui")] -public class ChatInput : Grid { +public class ChatInput : Box { + [GtkChild] private ScrolledWindow scrolled; [GtkChild] private TextView text_input; private Conversation? conversation; private StreamInteractor stream_interactor; private HashMap<Conversation, string> entry_cache = new HashMap<Conversation, string>(Conversation.hash_func, Conversation.equals_func); private static HashMap<string, string> smiley_translations = new HashMap<string, string>(); + private int vscrollbar_min_height; static construct { smiley_translations[":)"] = "๐"; @@ -34,6 +36,8 @@ public class ChatInput : Grid { public ChatInput(StreamInteractor stream_interactor) { this.stream_interactor = stream_interactor; + scrolled.get_vscrollbar().get_preferred_height(out vscrollbar_min_height, null); + scrolled.vadjustment.notify["upper"].connect_after(on_upper_notify); } public void initialize_for_conversation(Conversation conversation) { @@ -93,6 +97,13 @@ public class ChatInput : Grid { return false; } + private void on_upper_notify() { + scrolled.vadjustment.value = scrolled.vadjustment.upper - scrolled.vadjustment.page_size; + + // hack for vscrollbar not requiring space and making textview higher //TODO doesn't resize immediately + scrolled.get_vscrollbar().visible = (scrolled.vadjustment.upper > scrolled.max_content_height - 2 * vscrollbar_min_height); + } + private void check_convert_smiley() { if (Dino.Settings.instance().convert_utf8_smileys) { foreach (string smiley in smiley_translations.keys) { diff --git a/main/src/ui/conversation_selector/view.vala b/main/src/ui/conversation_selector/view.vala index ae641664..5c1b4dfd 100644 --- a/main/src/ui/conversation_selector/view.vala +++ b/main/src/ui/conversation_selector/view.vala @@ -7,7 +7,7 @@ using Dino.Entities; namespace Dino.Ui.ConversationSelector { [GtkTemplate (ui = "/org/dino-im/conversation_selector/view.ui")] -public class View : Grid { +public class View : Box { public List conversation_list; [GtkChild] public SearchEntry search_entry; diff --git a/main/src/ui/conversation_summary/message_textview.vala b/main/src/ui/conversation_summary/message_textview.vala index 6474a1a3..28df9a53 100644 --- a/main/src/ui/conversation_summary/message_textview.vala +++ b/main/src/ui/conversation_summary/message_textview.vala @@ -35,7 +35,7 @@ public class MessageTextView : TextView { } private void format_suffix_urls(string text) { - int absolute_start = buffer.text.length - text.length; + int absolute_start = buffer.text.char_count() - text.char_count(); Regex url_regex = new Regex("""(?i)\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?ยซยปโโโโ]))"""); MatchInfo match_info; diff --git a/plugins/openpgp/src/account_settings_widget.vala b/plugins/openpgp/src/account_settings_widget.vala index e4077c42..5eb0ba16 100644 --- a/plugins/openpgp/src/account_settings_widget.vala +++ b/plugins/openpgp/src/account_settings_widget.vala @@ -80,7 +80,7 @@ private class AccountSettingsWidget : Stack, Plugins.AccountSettingsWidget { list_store.set(iter, 0, build_markup_string("Key publishing disabled", "Select key"), 1, ""); for (int i = 0; i < keys.size; i++) { list_store.append(out iter); - list_store.set(iter, 0, build_markup_string(keys[i].uids[0].uid, keys[i].fpr[0:16])); + list_store.set(iter, 0, build_markup_string(keys[i].uids[0].uid, "0x" + keys[i].fpr[0:16])); list_store.set(iter, 1, keys[i].fpr); if (keys[i].fpr == plugin.db.get_account_key(current_account)) { set_label_active(iter, i + 1); |