Commit d4b25c23 authored by Daniel Brötzmann's avatar Daniel Brötzmann Committed by Philipp Hörist
Browse files

Use GTK emoji chooser on Linux

parent 160d6c8a
......@@ -24,6 +24,7 @@
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
import time
import uuid
import tempfile
......@@ -504,7 +505,10 @@ def delegate_action(self, action):
return Gdk.EVENT_STOP
if action == 'show-emoji-chooser':
self.xml.emoticons_button.get_popover().show()
if sys.platform in ('win32', 'darwin'):
self.xml.emoticons_button.get_popover().show()
return Gdk.EVENT_STOP
self.msg_textview.emit('insert-emoji')
return Gdk.EVENT_STOP
if action == 'copy-text':
......@@ -1207,8 +1211,20 @@ def set_emoticon_popover(self):
if not self.parent_win:
return
emoji_chooser.text_widget = self.msg_textview
self.xml.emoticons_button.set_popover(emoji_chooser)
if sys.platform in ('win32', 'darwin'):
emoji_chooser.text_widget = self.msg_textview
self.xml.emoticons_button.set_popover(emoji_chooser)
return
self.xml.emoticons_button.set_sensitive(True)
self.xml.emoticons_button.connect('clicked',
self._on_emoticon_button_clicked)
def _on_emoticon_button_clicked(self, _widget):
self.msg_textview.remove_placeholder()
# Present GTK emoji chooser (not cross platform compatible)
self.msg_textview.emit('insert-emoji')
self.xml.emoticons_button.set_property('active', False)
def on_color_menuitem_activate(self, _widget):
color_dialog = Gtk.ColorChooserDialog(None, self.parent_win.window)
......
......@@ -12,7 +12,6 @@
# You should have received a copy of the GNU General Public License
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
import sys
import logging
import weakref
from pathlib import Path
......@@ -304,13 +303,8 @@ def _get_current_theme():
theme = app.settings.get('emoticons_theme')
themes = helpers.get_available_emoticon_themes()
if theme not in themes:
if sys.platform not in ('win32', 'darwin'):
app.settings.set('emoticons_theme', 'font')
theme = 'font'
else:
# Win/Mac fallback to noto
app.settings.set('emoticons_theme', 'noto')
theme = 'noto'
app.settings.set('emoticons_theme', 'noto')
theme = 'noto'
return theme
@staticmethod
......
......@@ -2088,9 +2088,10 @@ def __init__(self):
from gajim.gtk import statusicon
self.systray = statusicon.StatusIcon()
# Init emoji_chooser
from gajim.gtk.emoji_chooser import emoji_chooser
emoji_chooser.load()
if sys.platform in ('win32', 'darwin'):
from gajim.gtk.emoji_chooser import emoji_chooser
emoji_chooser.load()
self.make_regexps()
# get transports type from DB
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment