From 83cea47bb1ef554e14c097063b1f658b75c4da4c Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 14 Sep 2019 15:48:07 +0200 Subject: Deactivate emoji button for gtk < 3.24 --- main/src/ui/chat_input/view.vala | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'main') diff --git a/main/src/ui/chat_input/view.vala b/main/src/ui/chat_input/view.vala index b1f37e90..74fa044e 100644 --- a/main/src/ui/chat_input/view.vala +++ b/main/src/ui/chat_input/view.vala @@ -58,18 +58,22 @@ public class View : Box { 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); + // Emoji button for emoji picker (recents don't work < 3.22.19, category icons don't work <3.23.2) + if (Gtk.get_major_version() >= 3 && Gtk.get_minor_version() >= 24) { + 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(emoji_button); outer_box.add(encryption_widget); text_input.key_press_event.connect(on_text_input_key_press); -- cgit v1.2.3-70-g09d2