Philipp Hörist pushed to branch gajim_1.1 at gajim / gajim
Commits: efcb6235 by Philipp Hörist at 2018-12-18T14:02:37Z Fix disabled join groupchat menu
When there are no bookmarks on the server the join groupchat menu was disabled, preventing the user to open the join groupchat dialog
- - - - - c25e3756 by Philipp Hörist at 2018-12-18T14:02:57Z Fix start chat menu action
Fixes #8275
- - - - - c2f2ba97 by Philipp Hörist at 2018-12-18T14:03:07Z Dont draw contact after selection change
This seems to be an old codepath, currently there is no need to redraw a contact on selection change
Fixes #9496
- - - - - e9068f08 by Philipp Hörist at 2018-12-18T14:05:05Z DBus: Show correct unread message number
Fixes #8362
- - - - - 9eed0338 by Philipp Hörist at 2018-12-18T14:13:08Z Fix error on key press
Fixes #9471
- - - - - 50435ba8 by Philipp Hörist at 2018-12-18T14:14:57Z Make copying text work with different layouts
This makes it possible so text can be copied from the conversation textview with other keyboard layouts than english
- - - - - ac9bec3e by Philipp Hörist at 2018-12-18T14:15:32Z Fix error when opening sign-in/out notification
- - - - - d7bc9270 by Philipp Hörist at 2018-12-18T14:15:33Z Allow handlers list to be modifed while iterating
- - - - - 0f340547 by Philipp Hörist at 2018-12-18T14:15:33Z Roster: Register our-show with lower priority
This event is used to shutdown the roster if we quit, it destroys all windows.
This should be run last because other objects like the ChatControl need a reference to the window to shutdown properly
- - - - - a5e6f434 by Philipp Hörist at 2018-12-18T14:36:03Z MUC: Fix invisible event icon on private message
- - - - - 436eb2df by Philipp Hörist at 2018-12-18T14:43:32Z Update ChangeLog
- - - - -
9 changed files:
- ChangeLog - gajim/chat_control_base.py - gajim/common/ged.py - gajim/groupchat_control.py - gajim/gtk/util.py - gajim/gui_interface.py - gajim/gui_menu_builder.py - gajim/remote_control.py - gajim/roster_window.py
Changes:
===================================== ChangeLog ===================================== @@ -1,15 +1,18 @@ -Gajim 1.1.1 (10 December 2018) +Gajim 1.1.1 (19 December 2018)
Bug fixes
+ * 8362 DBus: Incorrect unread message count * 9427 Placeholder not cleared if pasting text into message input * 9444 Determine the delay timestamp correctly when using mam:1 * 9453 Fix opening links inside the group chat subject (MacOS/Windows) * 9465 Allow the full range of possible nicknames in group chats * 9067 Gajim crashes when receiving xhtml messages + * 9471 Conversation Textview: Error on key press * 9472 Handle presences without from attr correctly * 9473 Error when creating a new group chat * 9491 Identify group chat subject changes correctly + * 9496 Error on MUC roster selection change * Determine soundplayer correctly on unix systems * In some circumstances plugins could not be deleted * Show correct contact status on tabs @@ -18,6 +21,10 @@ Gajim 1.1.1 (10 December 2018) * Pressing the back button in the Accounts window leads to an error * Better handle not available keyring backends * Dont show incorrect contact on private messages + * Join group chat menu is disabled when there are no bookmarks + * Error on start chat menu action + * Error when opening sign-in/out notification + * Copying text does not work with different keyboard layouts
Gajim 1.1.0 (06 November 2018)
===================================== gajim/chat_control_base.py ===================================== @@ -54,6 +54,9 @@ from gajim.message_textview import MessageTextView
from gajim.gtk.dialogs import NonModalConfirmationDialog from gajim.gtk.util import convert_rgb_to_hex +from gajim.gtk.util import get_primary_accel_mod +from gajim.gtk.util import get_hardware_key_codes + from gajim.gtk.emoji_chooser import emoji_chooser
from gajim.command_system.implementation.middleware import ChatCommandProcessor @@ -78,23 +81,12 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): A base class containing a banner, ConversationTextview, MessageTextView """
- keymap = Gdk.Keymap.get_for_display(Gdk.Display.get_default()) - try: - keycode_c = keymap.get_entries_for_keyval(Gdk.KEY_c)[1][0].keycode - except TypeError: - keycode_c = 54 - except IndexError: - # FIXME - # On some keyboard layouts there is no keyval for KEY_c - keycode_c = None - - try: - keycode_ins = keymap.get_entries_for_keyval(Gdk.KEY_Insert)[1][0].keycode - except TypeError: - keycode_ins = 118 - except IndexError: - # There is no KEY_Insert (MacOS) - keycode_ins = None + # This is needed so copying text from the conversation textview + # works with different language layouts. Pressing the key c on a russian + # layout yields another keyval than with the english layout. + # So we match hardware keycodes instead of keyvals. + # Multiple hardware keycodes can trigger a keyval like Gdk.KEY_c. + keycodes_c = get_hardware_key_codes(Gdk.KEY_c)
def make_href(self, match): url_color = app.css_config.get_value('.gajim-url', StyleAttr.COLOR) @@ -584,20 +576,18 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): if event.button == 3: # right click self.parent_win.popup_menu(event)
- def _conv_textview_key_press_event(self, widget, event): - # translate any layout to latin_layout - _valid, entries = self.keymap.get_entries_for_keyval(event.keyval) - keycode = entries[0].keycode - if (event.get_state() & Gdk.ModifierType.CONTROL_MASK and keycode in ( - self.keycode_c, self.keycode_ins)): - return False + def _conv_textview_key_press_event(self, _widget, event): + if (event.get_state() & get_primary_accel_mod() and + event.hardware_keycode in self.keycodes_c): + return Gdk.EVENT_PROPAGATE
- if event.get_state() & Gdk.ModifierType.SHIFT_MASK and \ - event.keyval in (Gdk.KEY_Page_Down, Gdk.KEY_Page_Up): + if (event.get_state() & Gdk.ModifierType.SHIFT_MASK and + event.keyval in (Gdk.KEY_Page_Down, Gdk.KEY_Page_Up)): self._on_scroll(None, event.keyval) - return False + return Gdk.EVENT_PROPAGATE + self.parent_win.notebook.event(event) - return True + return Gdk.EVENT_STOP
def _on_message_textview_key_press_event(self, widget, event): if event.keyval == Gdk.KEY_space:
===================================== gajim/common/ged.py ===================================== @@ -87,7 +87,9 @@ class GlobalEventsDispatcher: log.debug('%s Args: %s', event_name, str(args)) if event_name in self.handlers: node_processed = False - for _priority, handler in self.handlers[event_name]: + # Iterate over a copy of the handlers list, so while iterating + # the original handlers list can be modified + for _priority, handler in list(self.handlers[event_name]): try: if handler(*args, **kwargs): return True
===================================== gajim/groupchat_control.py ===================================== @@ -366,8 +366,6 @@ class GroupchatControl(ChatControlBase): self.widget_set_visible(self.xml.get_object('banner_eventbox'), app.config.get('hide_groupchat_banner'))
- self._last_selected_contact = None # None or holds jid, account tuple - # muc attention flag (when we are mentioned in a muc) # if True, the room has mentioned us self.attention_flag = False @@ -389,12 +387,8 @@ class GroupchatControl(ChatControlBase): self.event_box = self.xml.get_object('banner_eventbox')
self.list_treeview = self.xml.get_object('list_treeview') - selection = self.list_treeview.get_selection() - id_ = selection.connect('changed', - self.on_list_treeview_selection_changed) - self.handlers[id_] = selection id_ = self.list_treeview.connect('style-set', - self.on_list_treeview_style_set) + self.on_list_treeview_style_set) self.handlers[id_] = self.list_treeview
# flag that stops hpaned position event @@ -1038,21 +1032,6 @@ class GroupchatControl(ChatControlBase): nick = contact[Column.NICK] self.draw_contact(nick)
- def on_list_treeview_selection_changed(self, selection): - model, selected_iter = selection.get_selected() - self.draw_contact(self.nick) - if self._last_selected_contact is not None: - self.draw_contact(self._last_selected_contact) - if selected_iter is None: - self._last_selected_contact = None - return - contact = model[selected_iter] - nick = contact[Column.NICK] - self._last_selected_contact = nick - if contact[Column.TYPE] != 'contact': - return - self.draw_contact(nick, selected=True, focus=True) - def get_tab_label(self, chatstate): """ Markup the label if necessary. Returns a tuple such as: (new_label_str, @@ -1318,10 +1297,10 @@ class GroupchatControl(ChatControlBase): if not autopopup or (not autopopupaway and \ app.connections[self.account].connected > 2): if no_queue: # We didn't have a queue: we change icons - state_images = \ - app.interface.roster.get_appropriate_state_images( - self.room_jid, icon_name='event') - image = state_images['event'] + icon_name = gtkgui_helpers.get_iconset_name_for('event') + surface = Gtk.IconTheme.get_default().load_surface( + icon_name, 16, self.scale_factor, None, 0) + image = Gtk.Image.new_from_surface(surface) self.model[iter_][Column.IMG] = image if self.parent_win: self.parent_win.show_title() @@ -1755,7 +1734,7 @@ class GroupchatControl(ChatControlBase): if ctrl and msg: ctrl.send_message(msg)
- def draw_contact(self, nick, selected=False, focus=False): + def draw_contact(self, nick): iter_ = self.get_contact_iter(nick) if not iter_: return
===================================== gajim/gtk/util.py ===================================== @@ -247,3 +247,20 @@ def convert_rgb_to_hex(rgb_string: str) -> str: green = int(rgb.green * 255) blue = int(rgb.blue * 255) return '#%02x%02x%02x' % (red, green, blue) + + +def get_primary_accel_mod(): + """ + Returns the primary Gdk.ModifierType modifier. + cmd on osx, ctrl everywhere else. + """ + return Gtk.accelerator_parse("<Primary>")[1] + + +def get_hardware_key_codes(keyval): + keymap = Gdk.Keymap.get_for_display(Gdk.Display.get_default()) + + valid, key_map_keys = keymap.get_entries_for_keyval(keyval) + if not valid: + return [] + return [key.keycode for key in key_map_keys]
===================================== gajim/gui_interface.py ===================================== @@ -1647,9 +1647,10 @@ class Interface: fjid = jid contact = None if resource: - contact = app.contacts.get_contact(account, jid, resource) - if not contact: - contact = highest_contact + contact = app.contacts.get_contact(account, jid, resource) or highest_contact + if contact is None: + # Maybe we deleted the contact from the roster + return
ctrl = self.new_chat(contact, account, resource=resource)
===================================== gajim/gui_menu_builder.py ===================================== @@ -686,10 +686,8 @@ def get_groupchat_menu(control_id):
def get_bookmarks_menu(account, rebuild=False): con = app.connections[account] - boomarks = con.get_module('Bookmarks').get_sorted_bookmarks( - short_name=True) - if not boomarks: - return None + boomarks = con.get_module('Bookmarks').get_sorted_bookmarks(short_name=True) + menu = Gio.Menu()
# Build Join Groupchat @@ -907,19 +905,13 @@ def get_conv_context_menu(account, kind, text): menuitem.set_label(label)
if action.startswith('-'): + text = text.replace('xmpp:', '') + text = text.split('?')[0] action = 'app.%s%s' % (account, action) else: action = 'app.%s' % action menuitem.set_action_name(action)
- if 'join-groupchat' in action: - text = text.replace('xmpp:', '') - text = text.split('?')[0] - - if 'add-contact' in action: - text = text.replace('xmpp:', '') - text = text.split('?')[0] - if action == 'app.open-link': value = GLib.Variant.new_strv([kind, text]) elif action == 'app.copy-link':
===================================== gajim/remote_control.py ===================================== @@ -901,7 +901,11 @@ class GajimRemote(Server): return contact_dict
def get_unread_msgs_number(self): - return str(app.events.get_nb_events()) + unread = app.events.get_nb_events() + for event in app.events.get_all_events(['printed_gc_msg']): + if not app.config.notify_for_muc(event.jid): + unread -= 1 + return str(unread)
def start_chat(self, account): if not account:
===================================== gajim/roster_window.py ===================================== @@ -5908,7 +5908,7 @@ class RosterWindow: self._nec_roster_received) app.ged.register_event_handler('anonymous-auth', ged.GUI1, self._nec_anonymous_auth) - app.ged.register_event_handler('our-show', ged.GUI1, + app.ged.register_event_handler('our-show', ged.GUI2, self._nec_our_show) app.ged.register_event_handler('connection-type', ged.GUI1, self._nec_connection_type)
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/c90339383c5276df677407e63af3dbad05...