Philipp Hörist pushed to branch master at gajim / gajim

Commits:

3 changed files:

Changes:

  • gajim/chat_control_base.py
    ... ... @@ -24,6 +24,7 @@
    24 24
     # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
    
    25 25
     
    
    26 26
     import os
    
    27
    +import sys
    
    27 28
     import time
    
    28 29
     import uuid
    
    29 30
     import tempfile
    
    ... ... @@ -504,7 +505,10 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper):
    504 505
                 return Gdk.EVENT_STOP
    
    505 506
     
    
    506 507
             if action == 'show-emoji-chooser':
    
    507
    -            self.xml.emoticons_button.get_popover().show()
    
    508
    +            if sys.platform in ('win32', 'darwin'):
    
    509
    +                self.xml.emoticons_button.get_popover().show()
    
    510
    +                return Gdk.EVENT_STOP
    
    511
    +            self.msg_textview.emit('insert-emoji')
    
    508 512
                 return Gdk.EVENT_STOP
    
    509 513
     
    
    510 514
             if action == 'copy-text':
    
    ... ... @@ -1207,8 +1211,20 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper):
    1207 1211
             if not self.parent_win:
    
    1208 1212
                 return
    
    1209 1213
     
    
    1210
    -        emoji_chooser.text_widget = self.msg_textview
    
    1211
    -        self.xml.emoticons_button.set_popover(emoji_chooser)
    
    1214
    +        if sys.platform in ('win32', 'darwin'):
    
    1215
    +            emoji_chooser.text_widget = self.msg_textview
    
    1216
    +            self.xml.emoticons_button.set_popover(emoji_chooser)
    
    1217
    +            return
    
    1218
    +
    
    1219
    +        self.xml.emoticons_button.set_sensitive(True)
    
    1220
    +        self.xml.emoticons_button.connect('clicked',
    
    1221
    +                                          self._on_emoticon_button_clicked)
    
    1222
    +
    
    1223
    +    def _on_emoticon_button_clicked(self, _widget):
    
    1224
    +        self.msg_textview.remove_placeholder()
    
    1225
    +        # Present GTK emoji chooser (not cross platform compatible)
    
    1226
    +        self.msg_textview.emit('insert-emoji')
    
    1227
    +        self.xml.emoticons_button.set_property('active', False)
    
    1212 1228
     
    
    1213 1229
         def on_color_menuitem_activate(self, _widget):
    
    1214 1230
             color_dialog = Gtk.ColorChooserDialog(None, self.parent_win.window)
    

  • gajim/gtk/emoji_chooser.py
    ... ... @@ -12,7 +12,6 @@
    12 12
     # You should have received a copy of the GNU General Public License
    
    13 13
     # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
    
    14 14
     
    
    15
    -import sys
    
    16 15
     import logging
    
    17 16
     import weakref
    
    18 17
     from pathlib import Path
    
    ... ... @@ -304,13 +303,8 @@ class EmojiChooser(Gtk.Popover):
    304 303
             theme = app.settings.get('emoticons_theme')
    
    305 304
             themes = helpers.get_available_emoticon_themes()
    
    306 305
             if theme not in themes:
    
    307
    -            if sys.platform not in ('win32', 'darwin'):
    
    308
    -                app.settings.set('emoticons_theme', 'font')
    
    309
    -                theme = 'font'
    
    310
    -            else:
    
    311
    -                # Win/Mac fallback to noto
    
    312
    -                app.settings.set('emoticons_theme', 'noto')
    
    313
    -                theme = 'noto'
    
    306
    +            app.settings.set('emoticons_theme', 'noto')
    
    307
    +            theme = 'noto'
    
    314 308
             return theme
    
    315 309
     
    
    316 310
         @staticmethod
    

  • gajim/gui_interface.py
    ... ... @@ -2088,9 +2088,10 @@ class Interface:
    2088 2088
                 from gajim.gtk import statusicon
    
    2089 2089
                 self.systray = statusicon.StatusIcon()
    
    2090 2090
     
    
    2091
    -        # Init emoji_chooser
    
    2092
    -        from gajim.gtk.emoji_chooser import emoji_chooser
    
    2093
    -        emoji_chooser.load()
    
    2091
    +        if sys.platform in ('win32', 'darwin'):
    
    2092
    +            from gajim.gtk.emoji_chooser import emoji_chooser
    
    2093
    +            emoji_chooser.load()
    
    2094
    +
    
    2094 2095
             self.make_regexps()
    
    2095 2096
     
    
    2096 2097
             # get transports type from DB