From ec99e93a7cf54c22984ca2640c4d40d80542797c Mon Sep 17 00:00:00 2001 From: lovetox Date: Fri, 18 Nov 2016 03:41:37 +0100 Subject: [PATCH] Create GCTooltip window only when parent is available --- src/groupchat_control.py | 22 ++++++++++++++++------ src/roster_window.py | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/groupchat_control.py b/src/groupchat_control.py index aab9912c1..1dd535172 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -359,13 +359,14 @@ class GroupchatControl(ChatControlBase): if gtkgui_helpers.gtk_icon_theme.has_icon('document-open-recent'): img = self.xml.get_object('history_image') img.set_from_icon_name('document-open-recent', Gtk.IconSize.MENU) - widget = self.xml.get_object('list_treeview') - widget.set_has_tooltip(True) - widget.set_tooltip_window(tooltips.GCTooltip(self.parent_win.window)) - self.current_tooltip = None - id_ = widget.connect('query-tooltip', self.query_tooltip) - self.handlers[id_] = widget + self.current_tooltip = None + if parent_win: + # On AutoJoin with minimize Groupchats are created without parent + # Tooltip Window has to be created with parent + self.set_tooltip() + + widget = self.xml.get_object('list_treeview') id_ = widget.connect('row_expanded', self.on_list_treeview_row_expanded) self.handlers[id_] = widget @@ -526,6 +527,15 @@ class GroupchatControl(ChatControlBase): # instance object gajim.plugin_manager.gui_extension_point('groupchat_control', self) + def set_tooltip(self): + widget = self.xml.get_object('list_treeview') + if widget.get_tooltip_window(): + return + widget.set_has_tooltip(True) + widget.set_tooltip_window(tooltips.GCTooltip(self.parent_win.window)) + id_ = widget.connect('query-tooltip', self.query_tooltip) + self.handlers[id_] = widget + def query_tooltip(self, widget, x_pos, y_pos, keyboard_mode, tooltip): try: row = self.list_treeview.get_path_at_pos(x_pos, y_pos)[0] diff --git a/src/roster_window.py b/src/roster_window.py index e53f809a4..10d3baa7b 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -3419,6 +3419,7 @@ class RosterWindow: mw = gajim.interface.msg_win_mgr.create_window(ctrl.contact, ctrl.account, ctrl.type_id) ctrl.parent_win = mw + ctrl.set_tooltip() mw.new_tab(ctrl) mw.set_active_tab(ctrl) mw.window.get_window().focus(Gtk.get_current_event_time())