aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/chat_input
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2019-09-09 19:47:11 +0200
committerfiaxh <git@lightrise.org>2019-09-09 19:47:11 +0200
commit9950742bf1903291c271619aea101b0e2f81d19c (patch)
tree49550030dd678a52adce9a0de81688cf95b4dfcb /main/src/ui/chat_input
parentecb3e783b9fde0fc6164a8058531b0be54eb7ef0 (diff)
downloaddino-9950742bf1903291c271619aea101b0e2f81d19c.tar.gz
dino-9950742bf1903291c271619aea101b0e2f81d19c.zip
Add emoji button to chat input
Diffstat (limited to 'main/src/ui/chat_input')
-rw-r--r--main/src/ui/chat_input/encryption_button.vala1
-rw-r--r--main/src/ui/chat_input/view.vala15
2 files changed, 14 insertions, 2 deletions
diff --git a/main/src/ui/chat_input/encryption_button.vala b/main/src/ui/chat_input/encryption_button.vala
index d80fa18f..3544c252 100644
--- a/main/src/ui/chat_input/encryption_button.vala
+++ b/main/src/ui/chat_input/encryption_button.vala
@@ -18,7 +18,6 @@ public class EncryptionButton : MenuButton {
public EncryptionButton(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
- relief = ReliefStyle.NONE;
use_popover = true;
image = new Image.from_icon_name("changes-allow-symbolic", IconSize.BUTTON);
get_style_context().add_class("flat");
diff --git a/main/src/ui/chat_input/view.vala b/main/src/ui/chat_input/view.vala
index c40152a2..b1f37e90 100644
--- a/main/src/ui/chat_input/view.vala
+++ b/main/src/ui/chat_input/view.vala
@@ -42,7 +42,7 @@ public class View : Box {
occupants_tab_completor = new OccupantsTabCompletor(stream_interactor, text_input);
smiley_converter = new SmileyConverter(text_input);
edit_history = new EditHistory(text_input, GLib.Application.get_default());
- encryption_widget = new EncryptionButton(stream_interactor) { margin_top=3, valign=Align.START, visible=true };
+ encryption_widget = new EncryptionButton(stream_interactor) { relief=ReliefStyle.NONE, margin_top=3, valign=Align.START, visible=true };
file_button.clicked.connect(() => {
PreviewFileChooserNative chooser = new PreviewFileChooserNative("Select file", get_toplevel() as Gtk.Window, FileChooserAction.OPEN, "Select", "Cancel");
@@ -57,6 +57,19 @@ public class View : Box {
scrolled.vadjustment.notify["upper"].connect_after(on_upper_notify);
encryption_widget.get_style_context().add_class("dino-chatinput-button");
+
+ MenuButton emoji_button = new MenuButton() { relief=ReliefStyle.NONE, margin_top=3, valign=Align.START, visible=true };
+ emoji_button.get_style_context().add_class("flat");
+ emoji_button.get_style_context().add_class("dino-chatinput-button");
+ emoji_button.image = new Image.from_icon_name("dino-emoticon-symbolic", IconSize.BUTTON) { visible=true };
+
+ EmojiChooser chooser = new EmojiChooser();
+ chooser.emoji_picked.connect((emoji) => {
+ text_input.buffer.insert_at_cursor(emoji, emoji.data.length);
+ });
+ emoji_button.set_popover(chooser);
+
+ outer_box.add(emoji_button);
outer_box.add(encryption_widget);
text_input.key_press_event.connect(on_text_input_key_press);