gajim.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2026
October
September
August
July
June
May
April
March
February
January
2025
December
November
October
September
August
July
June
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
List overview
Download
Commits
----- 2026 -----
October 2026
September 2026
August 2026
July 2026
June 2026
May 2026
April 2026
March 2026
February 2026
January 2026
----- 2025 -----
December 2025
November 2025
October 2025
September 2025
August 2025
July 2025
June 2025
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
commits@gajim.org
17632 discussions
Start a n
N
ew thread
[Git][gajim/gajim][mainwindow] 2 commits: Remove old Roster code
by Philipp Hörist
28 Apr '21
28 Apr '21
Philipp Hörist pushed to branch mainwindow at gajim / gajim Commits: c8f9d29f by lovetox at 2021-04-28T11:46:46+02:00 Remove old Roster code - - - - - ac3006ee by lovetox at 2021-04-28T11:56:15+02:00 Move Controls to GTK folder - - - - - 11 changed files: - gajim/gtk/chat_stack.py - + gajim/gtk/controls/__init__.py - gajim/chat_control_base.py → gajim/gtk/controls/base.py - gajim/chat_control.py → gajim/gtk/controls/chat.py - gajim/groupchat_control.py → gajim/gtk/controls/groupchat.py - gajim/privatechat_control.py → gajim/gtk/controls/private.py - gajim/gtk/htmltextview.py - gajim/gtk/message_input.py - gajim/gtk/preferences.py - gajim/gui_interface.py - − gajim/roster_window.py Changes: ===================================== gajim/gtk/chat_stack.py ===================================== @@ -16,9 +16,9 @@ from gi.repository import Gtk -from gajim.chat_control import ChatControl -from gajim.groupchat_control import GroupchatControl -from gajim.privatechat_control import PrivateChatControl +from gajim.gui.controls.chat import ChatControl +from gajim.gui.controls.groupchat import GroupchatControl +from gajim.gui.controls.private import PrivateChatControl log = logging.getLogger('gajim.gui.chatstack') ===================================== gajim/gtk/controls/__init__.py ===================================== ===================================== gajim/chat_control_base.py → gajim/gtk/controls/base.py ===================================== @@ -91,7 +91,7 @@ ################################################################################ -class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper): +class BaseControl(ChatCommandProcessor, CommandTools, EventHelper): """ A base class containing a banner, ConversationView, MessageInputTextView """ @@ -246,7 +246,7 @@ def __init__(self, widget_name, account, jid): self.encryption = self.get_encryption_state() self.conversation_view.encryption_enabled = self.encryption is not None - # PluginSystem: adding GUI extension point for ChatControlBase + # PluginSystem: adding GUI extension point for BaseControl # instance object (also subclasses, eg. ChatControl or GroupchatControl) app.plugin_manager.gui_extension_point('chat_control_base', self) ===================================== gajim/chat_control.py → gajim/gtk/controls/chat.py ===================================== @@ -70,9 +70,9 @@ from gajim.command_system.implementation.hosts import ChatCommands from gajim.command_system.framework import CommandHost # pylint: disable=unused-import -from gajim.chat_control_base import ChatControlBase +from gajim.gui.controls.base import BaseControl -log = logging.getLogger('gajim.chat_control') +log = logging.getLogger('gajim.gui.controls.chat') class JingleObject: @@ -86,7 +86,7 @@ def __init__(self, state, update): ################################################################################ -class ChatControl(ChatControlBase): +class ChatControl(BaseControl): """ A control for standard 1-1 chat """ @@ -98,7 +98,7 @@ class ChatControl(ChatControlBase): COMMAND_HOST = ChatCommands # type: ClassVar[Type[CommandHost]] def __init__(self, account, jid): - ChatControlBase.__init__(self, + BaseControl.__init__(self, 'chat_control', account, jid) @@ -852,7 +852,7 @@ def on_location_eventbox_enter_notify_event(self, _widget, _event): def update_ui(self): # The name banner is drawn here - ChatControlBase.update_ui(self) + BaseControl.update_ui(self) self.update_toolbar() self._update_avatar() self.update_actions() @@ -916,7 +916,7 @@ def send_message(self, if message in ('', None, '\n'): return - ChatControlBase.send_message(self, + BaseControl.send_message(self, message, type_='chat', xhtml=xhtml, @@ -945,7 +945,7 @@ def add_message(self, else: name = self.get_our_nick() - ChatControlBase.add_message(self, + BaseControl.add_message(self, text, kind, name, ===================================== gajim/groupchat_control.py → gajim/gtk/controls/groupchat.py ===================================== @@ -54,7 +54,7 @@ from gajim.common.const import MUCJoinedState from gajim.common.structs import OutgoingMessage -from gajim.chat_control_base import ChatControlBase +from gajim.gui.controls.base import BaseControl from gajim.command_system.implementation.hosts import GroupChatCommands @@ -75,10 +75,10 @@ from gajim.gui.util import open_window from gajim.gui.const import ControlType -log = logging.getLogger('gajim.groupchat_control') +log = logging.getLogger('gajim.gui.controls.groupchat') -class GroupchatControl(ChatControlBase): +class GroupchatControl(BaseControl): _type = ControlType.GROUPCHAT @@ -87,7 +87,7 @@ class GroupchatControl(ChatControlBase): COMMAND_HOST = GroupChatCommands def __init__(self, account, jid): - ChatControlBase.__init__(self, + BaseControl.__init__(self, 'groupchat_control', account, jid) @@ -719,7 +719,7 @@ def add_message(self, # self.check_focus_out_line() - ChatControlBase.add_message(self, + BaseControl.add_message(self, text, kind, contact, @@ -1334,7 +1334,7 @@ def _close_control(self, reason=None): def set_control_active(self, state): self.attention_flag = False - ChatControlBase.set_control_active(self, state) + BaseControl.set_control_active(self, state) def _on_drag_data_received(self, widget, context, x, y, selection, target_type, timestamp): @@ -1363,7 +1363,7 @@ def _jid_not_blocked(self, bare_jid: str) -> bool: return not helpers.jid_is_blocked(self.account, fjid) def _on_message_textview_key_press_event(self, widget, event): - res = ChatControlBase._on_message_textview_key_press_event( + res = BaseControl._on_message_textview_key_press_event( self, widget, event) if res: return True ===================================== gajim/privatechat_control.py → gajim/gtk/controls/private.py ===================================== @@ -27,7 +27,7 @@ from gajim.common import helpers from gajim.common.i18n import _ -from gajim.chat_control import ChatControl +from gajim.gui.controls.chat import ChatControl from gajim.command_system.implementation.hosts import PrivateChatCommands from gajim.gui.dialogs import ErrorDialog ===================================== gajim/gtk/htmltextview.py ===================================== @@ -727,7 +727,7 @@ def __init__(self, account, standalone=False): def _on_destroy(self, *args): # We restore the TextView’s drag destination to avoid a GTK warning - # when closing the control. ChatControlBase.shutdown() calls destroy() + # when closing the control. BaseControl.shutdown() calls destroy() # on the control’s main box, causing GTK to recursively destroy the # child widgets. GTK then tries to set a target list on the TextView, # resulting in a warning because the Widget has no drag destination. ===================================== gajim/gtk/message_input.py ===================================== @@ -98,7 +98,7 @@ def __init__(self): def _on_destroy(self, *args): # We restore the TextView’s drag destination to avoid a GTK warning - # when closing the control. ChatControlBase.shutdown() calls destroy() + # when closing the control. BaseControl.shutdown() calls destroy() # on the control’s main box, causing GTK to recursively destroy the # child widgets. GTK then tries to set a target list on the TextView, # resulting in a warning because the Widget has no drag destination. ===================================== gajim/gtk/preferences.py ===================================== @@ -29,7 +29,7 @@ from gajim.common.multimedia_helpers import AudioOutputManager from gajim.common.multimedia_helpers import VideoInputManager -from gajim.chat_control_base import ChatControlBase +from gajim.gui.controls.base import BaseControl from .const import Setting from .const import SettingKind @@ -395,7 +395,7 @@ def _on_use_speller(value, *args): gspell_lang = Gspell.language_get_default() app.settings.set('speller_language', gspell_lang.get_code()) for ctrl in get_app_window('Preferences').get_all_controls(): - if isinstance(ctrl, ChatControlBase): + if isinstance(ctrl, BaseControl): ctrl.set_speller() ===================================== gajim/gui_interface.py ===================================== @@ -58,8 +58,8 @@ from gajim import gui_menu_builder from gajim.dialog_messages import get_dialog -from gajim.chat_control_base import ChatControlBase -from gajim.groupchat_control import GroupchatControl +from gajim.gui.controls.base import BaseControl +from gajim.gui.controls.groupchat import GroupchatControl from gajim.common import idle from gajim.common.zeroconf import connection_zeroconf @@ -1255,7 +1255,7 @@ def handle_event(self, account, fjid, type_): w.set_active_tab(ctrl) w.window.present() # Using isinstance here because we want to catch all derived types - if isinstance(ctrl, ChatControlBase): + if isinstance(ctrl, BaseControl): ctrl.scroll_to_end() def show_groupchat(self, account, room_jid): ===================================== gajim/roster_window.py deleted ===================================== The diff for this file was not included because it is too large. View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/c16fbd33734f5955430cad87a89b377…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/c16fbd33734f5955430cad87a89b377…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][mainwindow] 254 commits: Flatpak: Update dependencies
by Philipp Hörist
28 Apr '21
28 Apr '21
Philipp Hörist pushed to branch mainwindow at gajim / gajim Commits: b8690214 by André Apitzsch at 2021-03-29T12:50:51+02:00 Flatpak: Update dependencies - - - - - 15f73dad by Daniel Brötzmann at 2021-03-30T09:05:46+02:00 Accounts: Add account switch description - - - - - f08f3f0c by lovetox at 2021-04-02T18:51:01+02:00 Fix HtmlTextView test - - - - - 1691af57 by lovetox at 2021-04-09T20:00:19+02:00 Windows: Fix appveyor build - - - - - 2c7f95b5 by Philipp Hörist at 2021-04-21T20:34:11+02:00 Revert "Windows: Add Workaround for #10342" This reverts commit 3334790a15ff4664894f5f19bd60e01760d3f120 - - - - - 5c2b0f53 by lovetox at 2021-04-24T12:23:10+02:00 Remove unused path - - - - - 72f489b4 by lovetox at 2021-04-28T08:15:35+02:00 Windows: Add gssapi dependency Fixes #10540 - - - - - b8a08ebc by lovetox at 2021-04-28T11:40:57+02:00 Start - - - - - d6249a53 by lovetox at 2021-04-28T11:40:57+02:00 Disable CI - - - - - 682ee915 by lovetox at 2021-04-28T11:40:57+02:00 Really disable CI - - - - - f70341f3 by lovetox at 2021-04-28T11:40:58+02:00 Add Workspace settings API - - - - - 3707ff04 by lovetox at 2021-04-28T11:40:58+02:00 Store and Open chats - - - - - ee389c95 by lovetox at 2021-04-28T11:40:58+02:00 Add remove_chat() - - - - - eb9f1880 by lovetox at 2021-04-28T11:40:58+02:00 Account Side Bar - - - - - 30336a77 by lovetox at 2021-04-28T11:40:58+02:00 Add Workspace Side Bar - - - - - b8f82b08 by wurstsalat at 2021-04-28T11:40:58+02:00 ChatList: Add basic elements - - - - - 6134f5dc by wurstsalat at 2021-04-28T11:40:58+02:00 ChatListStack: Add Start Chat - - - - - ea2a293c by wurstsalat at 2021-04-28T11:40:58+02:00 Add basic Sidebar styling - - - - - 918e035e by wurstsalat at 2021-04-28T11:40:58+02:00 Improve styling for Sidebar and ChatList - - - - - a9825932 by lovetox at 2021-04-28T11:40:58+02:00 Store chatlist on remove - - - - - 1e875d11 by lovetox at 2021-04-28T11:40:58+02:00 Add/Remove Workspaces - - - - - a1efb07c by lovetox at 2021-04-28T11:40:58+02:00 Allow to add chats to different workspaces - - - - - 042a00d8 by lovetox at 2021-04-28T11:40:58+02:00 Add transparent backgrounds - - - - - 3084f6b8 by wurstsalat at 2021-04-28T11:40:58+02:00 AccountSideBar: Improve styling - - - - - a3b839d9 by wurstsalat at 2021-04-28T11:40:58+02:00 WorkspaceSidebar: Improve styling - - - - - 270c7cdf by lovetox at 2021-04-28T11:40:58+02:00 Improve left sidebar - - - - - 72174392 by lovetox at 2021-04-28T11:40:58+02:00 css - - - - - ae925e42 by lovetox at 2021-04-28T11:40:58+02:00 Dont fail when account is disabled - - - - - d28dcc38 by lovetox at 2021-04-28T11:40:58+02:00 CSS - - - - - bfe9dc61 by wurstsalat at 2021-04-28T11:40:58+02:00 AvatarSelector: Add Load Image button - - - - - 45d83e93 by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 Workspace: Add Workspace edit dialog - - - - - c9f21788 by wurstsalat at 2021-04-28T11:40:58+02:00 Workspace: Add title and editing functionality - - - - - 6c98e1cc by wurstsalat at 2021-04-28T11:40:58+02:00 MainWindow: Add Paned for chat list and chat controls - - - - - e1ccfe01 by lovetox at 2021-04-28T11:40:58+02:00 Store type for open chats - - - - - fd18e7c8 by lovetox at 2021-04-28T11:40:58+02:00 Store workspace dialog settings - - - - - 5a8820c9 by lovetox at 2021-04-28T11:40:58+02:00 Fix adding new Workspace - - - - - ef42cdb2 by lovetox at 2021-04-28T11:40:58+02:00 Fix some selection bugs - - - - - f9f8d860 by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 ChatListStack: Wrap in ScrolledWindow - - - - - cce5e35e by lovetox at 2021-04-28T11:40:58+02:00 Move scrolled window into gui xml - - - - - 8705d081 by lovetox at 2021-04-28T11:40:58+02:00 sytle chatlist - - - - - 0c257a78 by wurstsalat at 2021-04-28T11:40:58+02:00 ChatList: Styling - - - - - d730788b by wurstsalat at 2021-04-28T11:40:58+02:00 MainWindow: Styling - - - - - 1fb4fb34 by wurstsalat at 2021-04-28T11:40:58+02:00 Accounts: Add basic account page - - - - - 66a69204 by lovetox at 2021-04-28T11:40:58+02:00 Refactor Groupchats - - - - - e70b3f48 by lovetox at 2021-04-28T11:40:58+02:00 Start Chat: Destroy after joining MUC - - - - - fd050a49 by lovetox at 2021-04-28T11:40:58+02:00 Disable Roster - - - - - db9f4191 by lovetox at 2021-04-28T11:40:58+02:00 Make quit work - - - - - ad256b66 by lovetox at 2021-04-28T11:40:58+02:00 Stuff - - - - - bb6d0944 by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 ChatList: Add friendly timestamps - - - - - a0ecc0ba by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 ChatList: Unread counter styling - - - - - 30ed5029 by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 ChatList: Group chat avatars and message lines - - - - - 3ca5acda by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 Paned: Improve ChatList resizing - - - - - 3b032d6b by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 ChatList: Use groupchat name, improve ellipsizing - - - - - 1b8f4a8f by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 ChatList: Add group chat nicks - - - - - a46903a3 by lovetox at 2021-04-28T11:40:58+02:00 Remove unread_messages table - - - - - 1a386f31 by lovetox at 2021-04-28T11:40:58+02:00 add unread cache - - - - - 34681ce6 by lovetox at 2021-04-28T11:40:58+02:00 Add notifications - - - - - 7b72145e by lovetox at 2021-04-28T11:40:58+02:00 Fix notifications - - - - - ba67f382 by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 ChatList: Move ui to glade file - - - - - 8e6b8ca6 by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 ChatList: Add RosterTooltip - - - - - af9d1b80 by lovetox at 2021-04-28T11:40:58+02:00 Move event handling to main - - - - - 1fd482b0 by lovetox at 2021-04-28T11:40:58+02:00 Fix some events - - - - - 766fa420 by lovetox at 2021-04-28T11:40:58+02:00 Reset unread counter - - - - - bca47cf4 by lovetox at 2021-04-28T11:40:58+02:00 Fix more events - - - - - bbb342ce by wurstsalat at 2021-04-28T11:40:58+02:00 WorkspaceSidebar: Add unread counter - - - - - 434a873e by lovetox at 2021-04-28T11:40:58+02:00 Unread count improv - - - - - 555dee5b by lovetox at 2021-04-28T11:40:58+02:00 Add unread count to workspace - - - - - 5c229ebf by lovetox at 2021-04-28T11:40:58+02:00 Dont allow chats to be opened multiple times - - - - - 5c60ee35 by lovetox at 2021-04-28T11:40:58+02:00 Don’t notify on messages from ourself - - - - - f1629cce by lovetox at 2021-04-28T11:40:58+02:00 Use consistent jid attribute - - - - - 0b03e2d5 by lovetox at 2021-04-28T11:40:58+02:00 Fix some events - - - - - 7b26b48b by lovetox at 2021-04-28T11:40:58+02:00 Handle presence - - - - - 1b2fa9e0 by lovetox at 2021-04-28T11:40:58+02:00 Sort with activity - - - - - 707451b9 by lovetox at 2021-04-28T11:40:58+02:00 Save handle position - - - - - b7112359 by lovetox at 2021-04-28T11:40:58+02:00 Connect Menu actions - - - - - 0f111922 by lovetox at 2021-04-28T11:40:58+02:00 Bring back more actions - - - - - fa599e4f by lovetox at 2021-04-28T11:40:58+02:00 Fix transients - - - - - 681ff31d by lovetox at 2021-04-28T11:40:58+02:00 Make Private Chat work - - - - - 01e21872 by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 ChatList: Add avatar and name for PMs - - - - - a48d8ea0 by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 ChatList: Show indicator for group chats - - - - - 4810c78f by lovetox at 2021-04-28T11:40:58+02:00 New Contacts - - - - - d44baaa8 by wurstsalat at 2021-04-28T11:40:58+02:00 Add Workspace menu - - - - - e91d171f by wurstsalat at 2021-04-28T11:40:58+02:00 WorkspaceSidebar: Add drag and drop - - - - - bbc124e1 by wurstsalat at 2021-04-28T11:40:58+02:00 Add update_workspace method - - - - - aa419467 by wurstsalat at 2021-04-28T11:40:58+02:00 ChatList: Set message nick, process message-sent event - - - - - 4874cfda by wurstsalat at 2021-04-28T11:40:58+02:00 ChatList: Update time, improve close button - - - - - 5ba66327 by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 ChatList: Add chatstate icon - - - - - 39804775 by wurstsalat at 2021-04-28T11:40:58+02:00 ChatList: Improve chatstate icon - - - - - 56e94f15 by wurstsalat at 2021-04-28T11:40:58+02:00 ChatList: Add context menu and pinning - - - - - e85b4dae by wurstsalat at 2021-04-28T11:40:58+02:00 ChatList: Add basic list headers - - - - - 76ddf488 by wurstsalat at 2021-04-28T11:40:58+02:00 WorkspaceSidebar: Improve item highlighting - - - - - b402cd8f by wurstsalat at 2021-04-28T11:40:58+02:00 ChatList: Add move to workspace feature - - - - - 0cb4387e by wurstsalat at 2021-04-28T11:40:58+02:00 ChatList: Add placeholder - - - - - cd9db8f0 by wurstsalat at 2021-04-28T11:40:58+02:00 Various improvements - - - - - 82a5688a by wurstsalat at 2021-04-28T11:40:58+02:00 ChatListStack: Fix moving group chats - - - - - 298e62c5 by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 Store pinned chats - - - - - 6d4941b0 by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 ChatList: Improve sorting - - - - - ea07f8e1 by wurstsalat at 2021-04-28T11:40:58+02:00 WorkspaceDialog: Improvements - - - - - 833769cd by lovetox at 2021-04-28T11:40:58+02:00 Make contacts module work - - - - - 5130b54e by lovetox at 2021-04-28T11:40:58+02:00 further contacts - - - - - d28202c4 by lovetox at 2021-04-28T11:40:58+02:00 Roster: add iter_contacts() - - - - - 8efd45ad by lovetox at 2021-04-28T11:40:58+02:00 Fix receipt processing - - - - - c1ab3ac4 by lovetox at 2021-04-28T11:40:58+02:00 Fix subscription check - - - - - adfaa396 by lovetox at 2021-04-28T11:40:58+02:00 Chatlist: Remove tooltip - - - - - 6abf5005 by lovetox at 2021-04-28T11:40:58+02:00 Destroy roster correctly - - - - - 5e5a3735 by lovetox at 2021-04-28T11:40:58+02:00 Move finalize check to app module - - - - - 23a8512d by lovetox at 2021-04-28T11:40:58+02:00 Settings: Add json encoder/decoder - - - - - 3ad72f44 by lovetox at 2021-04-28T11:40:58+02:00 Fix MUC rejoins - - - - - 1b2650ec by lovetox at 2021-04-28T11:40:58+02:00 Refactor roster request code - - - - - a0420a14 by lovetox at 2021-04-28T11:40:58+02:00 Contacts: Fix access to roster attr - - - - - 31de08be by lovetox at 2021-04-28T11:40:58+02:00 Add room-left signal - - - - - 9e2a17b1 by lovetox at 2021-04-28T11:40:58+02:00 Fix muc user avatar update - - - - - 24bef3d5 by lovetox at 2021-04-28T11:40:58+02:00 Fix private chat - - - - - 97dc2ccb by lovetox at 2021-04-28T11:40:58+02:00 Remove unused imports - - - - - 34315372 by lovetox at 2021-04-28T11:40:58+02:00 Remove unused events and methods - - - - - d8108b5e by lovetox at 2021-04-28T11:40:58+02:00 Fix status selector - - - - - 7f08ae4a by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 Profile: Fix missing client - - - - - 62cc62c2 by lovetox at 2021-04-28T11:40:58+02:00 Refactor Avatar clipping - - - - - 379ef61b by lovetox at 2021-04-28T11:40:58+02:00 Groupchat: Restore got_disconnected() - - - - - efd4c994 by wurstsalat at 2021-04-28T11:40:58+02:00 Workspaces: Fix menu, store moved chats - - - - - da51aecd by wurstsalat at 2021-04-28T11:40:58+02:00 AccountPage: Add basic roster - - - - - 1a59a65b by wurstsalat at 2021-04-28T11:40:58+02:00 Roster: Improvements - - - - - 11b44529 by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 Improve AccountPage and Roster - - - - - 4aa95028 by Daniel Brötzmann at 2021-04-28T11:40:58+02:00 ChatList: Improve popover menu - - - - - 332ec086 by lovetox at 2021-04-28T11:40:58+02:00 Fix Filter - - - - - 1e4b91b7 by wurstsalat at 2021-04-28T11:40:58+02:00 Roster: Add actions - - - - - 99d3ba20 by lovetox at 2021-04-28T11:40:58+02:00 AddContact: Refactor - - - - - 5ffb0681 by wurstsalat at 2021-04-28T11:40:58+02:00 Roster: Add filter menu, connect search - - - - - 8239d863 by lovetox at 2021-04-28T11:40:58+02:00 Work on Roster - - - - - 9cd01591 by lovetox at 2021-04-28T11:40:58+02:00 Roster: Add events - - - - - ac368662 by lovetox at 2021-04-28T11:40:58+02:00 Roster: Refactor - - - - - 65e51099 by wurstsalat at 2021-04-28T11:40:58+02:00 Roster: Implement filtering - - - - - df60515d by wurstsalat at 2021-04-28T11:40:58+02:00 Roster: Rename menu handlers - - - - - ac9d6cfe by wurstsalat at 2021-04-28T11:40:58+02:00 Roster: Implement middle mouse click - - - - - 10ccf43f by wurstsalat at 2021-04-28T11:40:58+02:00 Roster: Open chat when activating row - - - - - a039faf8 by lovetox at 2021-04-28T11:40:58+02:00 Dont show empty groups when filtering - - - - - fcb2e5bc by wurstsalat at 2021-04-28T11:40:58+02:00 Roster: Implement drag and drop - - - - - e6599a52 by lovetox at 2021-04-28T11:40:59+02:00 Add high performance option for big rosters - - - - - dce17b5c by lovetox at 2021-04-28T11:40:59+02:00 JSONEncoder/Decoder: handle set - - - - - 87dfc944 by lovetox at 2021-04-28T11:40:59+02:00 Roster: add group methods - - - - - 0b540437 by lovetox at 2021-04-28T11:40:59+02:00 Make dnd functional - - - - - 0441988e by lovetox at 2021-04-28T11:40:59+02:00 Roster: Fix removing contact - - - - - 2cb92d38 by lovetox at 2021-04-28T11:40:59+02:00 Refactor Blocking - - - - - 11625371 by lovetox at 2021-04-28T11:40:59+02:00 Roster: Refactor - - - - - 8abc84ed by lovetox at 2021-04-28T11:40:59+02:00 Roster: Fix reset - - - - - 2a135326 by lovetox at 2021-04-28T11:40:59+02:00 Remove unused import - - - - - 4b84db40 by lovetox at 2021-04-28T11:40:59+02:00 Fix leaving muc - - - - - 01129f2a by lovetox at 2021-04-28T11:40:59+02:00 Add more leak checks - - - - - f9f25c1d by lovetox at 2021-04-28T11:40:59+02:00 Save workspace order - - - - - b03c35ce by lovetox at 2021-04-28T11:40:59+02:00 Fix saving MUC avatar - - - - - bbcc47c3 by lovetox at 2021-04-28T11:40:59+02:00 MUC refactor Get rid of manager - - - - - f01e62dc by lovetox at 2021-04-28T11:40:59+02:00 Add methods for accessing resources - - - - - d8ce24e5 by lovetox at 2021-04-28T11:40:59+02:00 Add get_show_circle() - - - - - 9531c628 by lovetox at 2021-04-28T11:40:59+02:00 Raise cache size - - - - - 74de7068 by wurstsalat at 2021-04-28T11:40:59+02:00 Tooltips: Remove NotificationAreaTooltip - - - - - 704cd49e by wurstsalat at 2021-04-28T11:40:59+02:00 Tooltips: Refactor - - - - - c45f1b10 by wurstsalat at 2021-04-28T11:40:59+02:00 RosterTooltip: Add idle time - - - - - 999055f5 by wurstsalat at 2021-04-28T11:40:59+02:00 RosterTooltip: Remove old idle time remnant - - - - - 2185c56b by wurstsalat at 2021-04-28T11:40:59+02:00 ChatList: Add Start Chat placeholder - - - - - 0f32ff59 by wurstsalat at 2021-04-28T11:40:59+02:00 Tooltips: Reduce icon sizes - - - - - d33d4019 by wurstsalat at 2021-04-28T11:40:59+02:00 ChatList: Increase list header spacing - - - - - 3918c6e1 by Daniel Brötzmann at 2021-04-28T11:40:59+02:00 Main: Use popover menu - - - - - 0f565e95 by Daniel Brötzmann at 2021-04-28T11:40:59+02:00 WorkspaceSidebar: Improve Add button styling - - - - - 58b02bd8 by Daniel Brötzmann at 2021-04-28T11:40:59+02:00 AccountSidebar: Improve icons - - - - - 2a7318f5 by Daniel Brötzmann at 2021-04-28T11:40:59+02:00 Improve style for account identifier bar - - - - - 34953fd3 by Daniel Brötzmann at 2021-04-28T11:40:59+02:00 WorkspaceSidebar: Add name to tooltip - - - - - 5961d1f2 by Daniel Brötzmann at 2021-04-28T11:40:59+02:00 ChatList: Improve headers - - - - - 96dd60af by Daniel Brötzmann at 2021-04-28T11:40:59+02:00 AccountPage: Add avatar and profile button - - - - - 7d9fef2c by Daniel Brötzmann at 2021-04-28T11:40:59+02:00 ChatList: Implement Add to roster menu entry - - - - - 67665d8c by wurstsalat at 2021-04-28T11:40:59+02:00 StatusSelector: Use 'show circles' for icons - - - - - e4a13629 by lovetox at 2021-04-28T11:40:59+02:00 Fix add to contact list - - - - - 10a9e589 by lovetox at 2021-04-28T11:40:59+02:00 Remove module mock - - - - - 6440c7bd by wurstsalat at 2021-04-28T11:40:59+02:00 WorkspaceSidebar: Attempt to fix icon position - - - - - 8ca49175 by lovetox at 2021-04-28T11:40:59+02:00 Fix GC menu - - - - - e9a9f65a by lovetox at 2021-04-28T11:40:59+02:00 add get_groups() - - - - - e47f4ae7 by lovetox at 2021-04-28T11:40:59+02:00 more group functions - - - - - 195212a4 by lovetox at 2021-04-28T11:40:59+02:00 fix rename group - - - - - 8a3b6c4e by Daniel Brötzmann at 2021-04-28T11:40:59+02:00 Rework ContactInfo dialog - - - - - ea9a22f2 by wurstsalat at 2021-04-28T11:40:59+02:00 Fix sending files from ChatControl menu - - - - - c1c1f907 by wurstsalat at 2021-04-28T11:40:59+02:00 ContactInfo: Handle timeout correctly - - - - - 2565f975 by wurstsalat at 2021-04-28T11:40:59+02:00 Chat Controls: Simplify usage of client - - - - - 7e01f701 by wurstsalat at 2021-04-28T11:40:59+02:00 GroupChatInvite: Adapt to new contacts API - - - - - 6b5f8f5b by lovetox at 2021-04-28T11:40:59+02:00 Simplify code - - - - - 53f711ba by lovetox at 2021-04-28T11:40:59+02:00 Get correct path - - - - - 008b9e6e by lovetox at 2021-04-28T11:40:59+02:00 App: Force GC before checking if object is finalized - - - - - 58bac45b by lovetox at 2021-04-28T11:40:59+02:00 Refactor EntityTime - - - - - f87d7f8b by lovetox at 2021-04-28T11:40:59+02:00 Refactor ContactInfo - - - - - 869f02b6 by lovetox at 2021-04-28T11:40:59+02:00 show chat stack page on select=True - - - - - d80cbbb9 by wurstsalat at 2021-04-28T11:40:59+02:00 Add SubscriptionManager - - - - - dbc5c299 by lovetox at 2021-04-28T11:40:59+02:00 Remove obsolete methods - - - - - cd9b5f51 by lovetox at 2021-04-28T11:40:59+02:00 Fix PresenceShow comparison - - - - - 9229d8af by wurstsalat at 2021-04-28T11:40:59+02:00 ContactInfo: Adapt to contacts who are not in roster - - - - - 7a35150c by wurstsalat at 2021-04-28T11:40:59+02:00 NotificationManager: Show unsubscribed event - - - - - 4ce6062c by lovetox at 2021-04-28T11:40:59+02:00 Set allow_reply_func - - - - - 852ed306 by lovetox at 2021-04-28T11:40:59+02:00 Convert JID - - - - - 2eeeb210 by wurstsalat at 2021-04-28T11:40:59+02:00 GroupChatInvitation: Fix accepting invitation - - - - - adee1103 by wurstsalat at 2021-04-28T11:40:59+02:00 AccountPage: Handle muc invite/decline - - - - - c13b7be5 by lovetox at 2021-04-28T11:40:59+02:00 Refactor Presence module - - - - - 0c272c6a by wurstsalat at 2021-04-28T11:40:59+02:00 NotificationManager: Improve display - - - - - 9ba52ea4 by Daniel Brötzmann at 2021-04-28T11:40:59+02:00 CSS: Remove obsolete style - - - - - f41e94bf by wurstsalat at 2021-04-28T11:40:59+02:00 New ConversationView - - - - - 77525283 by wurstsalat at 2021-04-28T11:40:59+02:00 ConversationTextview: Fix vertical size allocation - - - - - 91934ffd by wurstsalat at 2021-04-28T11:40:59+02:00 ConversationView: Remove additional nickname characters - - - - - 6c027aa8 by lovetox at 2021-04-28T11:40:59+02:00 Lower hight of conversation rows - - - - - d93698e5 by wurstsalat at 2021-04-28T11:40:59+02:00 Add new feather-more-horizontal-symbolic icons - - - - - 8321e55c by lovetox at 2021-04-28T11:40:59+02:00 Better padding - - - - - 48e21b38 by wurstsalat at 2021-04-28T11:40:59+02:00 SingleMessageWindow: Rewrite - - - - - d03b1c44 by lovetox at 2021-04-28T11:40:59+02:00 Wrap menu button in eventbox - - - - - 356b8595 by lovetox at 2021-04-28T11:40:59+02:00 add new timestamp setting - - - - - 2dcad988 by lovetox at 2021-04-28T11:40:59+02:00 Group conversation code into own module - - - - - 8874535f by Daniel Brötzmann at 2021-04-28T11:40:59+02:00 SingleMessageWindow: Remove obsolete config values - - - - - bfc6235b by wurstsalat at 2021-04-28T11:40:59+02:00 HistoryWindow: Use ConversationView - - - - - 535d2ccc by lovetox at 2021-04-28T11:40:59+02:00 Refactor scrolling - - - - - 2fa5c991 by lovetox at 2021-04-28T11:40:59+02:00 Add ScrolledView - - - - - 021161bd by lovetox at 2021-04-28T11:40:59+02:00 Fix history mode - - - - - fae69f16 by lovetox at 2021-04-28T11:40:59+02:00 Fix completion state - - - - - b72e6fb6 by lovetox at 2021-04-28T11:40:59+02:00 Improve View sorting - - - - - e9b53cc4 by lovetox at 2021-04-28T11:40:59+02:00 Make read recipes work - - - - - f9a25515 by lovetox at 2021-04-28T11:40:59+02:00 Remove unused imports - - - - - bc061321 by lovetox at 2021-04-28T11:40:59+02:00 Improve read marker - - - - - 0867d7be by lovetox at 2021-04-28T11:40:59+02:00 show info messages - - - - - 15c1823a by lovetox at 2021-04-28T11:40:59+02:00 Fix readmarker breaking merge - - - - - da3c78a1 by wurstsalat at 2021-04-28T11:44:04+02:00 GTK Tests: Use ConversationView for XHTML test - - - - - 035ade7a by wurstsalat at 2021-04-28T11:44:08+02:00 Remove obsolete conversation_textview.py - - - - - e9b93d16 by lovetox at 2021-04-28T11:44:08+02:00 Prevent readmarker from showing until called - - - - - c5e08fe5 by lovetox at 2021-04-28T11:44:08+02:00 Rework Message Row - Add Styling - - - - - 047346c8 by lovetox at 2021-04-28T11:44:08+02:00 Fix Info message - - - - - 1a69e978 by wurstsalat at 2021-04-28T11:44:08+02:00 QuoteWidget: Add styling - - - - - d9c48396 by wurstsalat at 2021-04-28T11:44:08+02:00 PlainWidget: Strip text - - - - - 73dc096d by wurstsalat at 2021-04-28T11:44:08+02:00 Add SearchView - - - - - d788c654 by lovetox at 2021-04-28T11:44:08+02:00 Change Shortcut - - - - - 2fe7b207 by lovetox at 2021-04-28T11:44:08+02:00 Remove MessageWindow - - - - - 9e0a6aa8 by lovetox at 2021-04-28T11:44:08+02:00 Remove Session Code - - - - - 53df35fe by wurstsalat at 2021-04-28T11:44:08+02:00 CodeWidget: Add header and styling - - - - - f65ef447 by lovetox at 2021-04-28T11:44:08+02:00 Refactor Observable - - - - - 50fbc3cb by lovetox at 2021-04-28T11:44:08+02:00 Add SimpleClientState - - - - - 2b34e4db by lovetox at 2021-04-28T11:44:08+02:00 Refactor active/inactive Control state - - - - - f1809dc3 by lovetox at 2021-04-28T11:44:08+02:00 Fix some things - - - - - 091f17b6 by lovetox at 2021-04-28T11:44:08+02:00 Make Correction Work again - - - - - a8c6b685 by lovetox at 2021-04-28T11:44:08+02:00 Handle disconnect and resume-failed inside modules - - - - - 5a3d14fe by wurstsalat at 2021-04-28T11:44:08+02:00 Add Jump to bottom button - - - - - 5f74ed9c by lovetox at 2021-04-28T11:44:08+02:00 Fix Search - - - - - 4f78daa7 by lovetox at 2021-04-28T11:44:08+02:00 Move overlay to glade - - - - - 76ff5342 by lovetox at 2021-04-28T11:44:08+02:00 Add GroupchatState widget - - - - - 01238d57 by lovetox at 2021-04-28T11:44:08+02:00 Fix bugs when joining mucs - - - - - a07f6c1b by wurstsalat at 2021-04-28T11:44:08+02:00 GroupchatState: Add styling - - - - - 180a53e9 by lovetox at 2021-04-28T11:44:08+02:00 Refactor accessing muc data in controls - - - - - 1eb82682 by lovetox at 2021-04-28T11:44:08+02:00 More ChatControl changes - - - - - 4cd373d1 by lovetox at 2021-04-28T11:44:08+02:00 Refactor Add Message - - - - - 6388b4f8 by lovetox at 2021-04-28T11:44:08+02:00 More Control work - - - - - a34ef40d by lovetox at 2021-04-28T11:44:08+02:00 Refactor Main - - - - - a1a80978 by lovetox at 2021-04-28T11:44:08+02:00 Refactor ChatList - - - - - 59a1b6a2 by lovetox at 2021-04-28T11:44:08+02:00 Simplify init - - - - - c16fbd33 by lovetox at 2021-04-28T11:44:08+02:00 Remove unused methods - - - - - 25 changed files: - − .gitlab-ci.yml - appveyor.yml - flatpak/org.gajim.Gajim.yaml - gajim/app_actions.py - gajim/application.py - gajim/chat_control.py - gajim/chat_control_base.py - gajim/command_system/implementation/middleware.py - gajim/common/app.py - gajim/common/client.py - gajim/common/config.py - gajim/common/configpaths.py - − gajim/common/connection_handlers.py - gajim/common/connection_handlers_events.py - gajim/common/const.py - gajim/common/contacts.py - gajim/common/helpers.py - gajim/common/i18n.py - gajim/common/modules/__init__.py - gajim/common/modules/base.py - gajim/common/modules/blocking.py - gajim/common/modules/bookmarks.py - gajim/common/modules/caps.py - gajim/common/modules/chat_markers.py - gajim/common/modules/chatstates.py The diff was not included because it is too large. View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/ca8620e0bd57b7575976619b169e0b3…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/ca8620e0bd57b7575976619b169e0b3…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][mainwindow] Remove unused methods
by Philipp Hörist
28 Apr '21
28 Apr '21
Philipp Hörist pushed to branch mainwindow at gajim / gajim Commits: ca8620e0 by lovetox at 2021-04-28T11:40:14+02:00 Remove unused methods - - - - - 2 changed files: - gajim/gtk/main.py - gajim/gui_interface.py Changes: ===================================== gajim/gtk/main.py ===================================== @@ -34,8 +34,6 @@ def __init__(self): self.set_title('Gajim') self.set_default_size(1000, 500) - # Compatibility with ChatControl - self.window = self app.window = self self._startup_finished = False @@ -230,21 +228,6 @@ def _set_startup_finished(self): self._startup_finished = True self._chat_page.set_startup_finished() - def get_widget(self, name): - return getattr(self._ui, name) - - def redraw_tab(self, *args): - pass - - def remove_tab(self, *args): - pass - - def show_title(self, *args): - pass - - def get_active_jid(self, *args): - pass - def show_account_page(self, account): self._account_side_bar.activate_account_page(account) self._main_stack.show_account(account) ===================================== gajim/gui_interface.py ===================================== @@ -59,9 +59,7 @@ from gajim.dialog_messages import get_dialog from gajim.chat_control_base import ChatControlBase -from gajim.chat_control import ChatControl from gajim.groupchat_control import GroupchatControl -from gajim.privatechat_control import PrivateChatControl from gajim.common import idle from gajim.common.zeroconf import connection_zeroconf @@ -74,6 +72,7 @@ from gajim.common.structs import MUCData from gajim.common.structs import OutgoingMessage from gajim.common.nec import NetworkEvent +from gajim.common.nec import NetworkEventsController from gajim.common.i18n import _ from gajim.common.client import Client from gajim.common.const import Display @@ -82,7 +81,6 @@ from gajim.common.file_props import FilesProp from gajim.common.connection_handlers_events import InformationEvent -from gajim import roster_window from gajim.common import ged from gajim.common.exceptions import FileError @@ -113,19 +111,94 @@ log = logging.getLogger('gajim.interface') class Interface: + def __init__(self): + app.interface = self + app.thread_interface = ThreadInterface -################################################################################ -### Methods handling events from connection -################################################################################ + self.pass_dialog = {} - def handle_event_db_error(self, unused, error): - #('DB_ERROR', account, error) - if self.db_error_dialog: - return - self.db_error_dialog = ErrorDialog(_('Database Error'), error) - def destroyed(win): - self.db_error_dialog = None - self.db_error_dialog.connect('destroy', destroyed) + self.handlers = {} + self.roster = None + + self.avatar_storage = AvatarStorage() + + # Load CSS files + app.load_css_config() + + for account in app.settings.get_accounts(): + if app.settings.get_account_setting(account, 'is_zeroconf'): + app.ZEROCONF_ACC_NAME = account + break + + app.idlequeue = idlequeue.get_idlequeue() + # resolve and keep current record of resolved hosts + app.socks5queue = socks5.SocksQueue( + app.idlequeue, + self.handle_event_file_rcv_completed, + self.handle_event_file_progress, + self.handle_event_file_error) + app.proxy65_manager = proxy65_manager.Proxy65Manager(app.idlequeue) + + app.nec = NetworkEventsController() + app.notification = Notification() + + self.create_core_handlers_list() + self.register_core_handlers() + + # self.create_zeroconf_default_config() + # if app.settings.get_account_setting(app.ZEROCONF_ACC_NAME, 'active') \ + # and app.is_installed('ZEROCONF'): + # app.connections[app.ZEROCONF_ACC_NAME] = \ + # connection_zeroconf.ConnectionZeroconf(app.ZEROCONF_ACC_NAME) + + for account in app.settings.get_accounts(): + if (not app.settings.get_account_setting(account, 'is_zeroconf') and + app.settings.get_account_setting(account, 'active')): + client = Client(account) + app.connections[account] = client + app.ged.register_event_handler( + 'muc-added', ged.CORE, self._on_muc_added) + + self.instances = {} + + for a in app.connections: + self.instances[a] = {'infos': {}, 'disco': {}, 'gc_config': {}, + 'search': {}, 'sub_request': {}} + app.contacts.add_account(a) + app.groups[a] = {} + app.gc_connected[a] = {} + app.automatic_rooms[a] = {} + app.newly_added[a] = [] + app.to_be_removed[a] = [] + app.nicks[a] = app.settings.get_account_setting(a, 'name') + app.block_signed_in_notifications[a] = True + app.last_message_time[a] = {} + + if sys.platform not in ('win32', 'darwin'): + logind.enable() + music_track.enable() + else: + GLib.timeout_add_seconds(20, self.check_for_updates) + + idle.Monitor.set_interval(app.settings.get('autoawaytime') * 60, + app.settings.get('autoxatime') * 60) + + self.systray_enabled = False + + if not app.is_display(Display.WAYLAND): + from gajim.gui import statusicon + self.systray = statusicon.StatusIcon() + + if sys.platform in ('win32', 'darwin'): + from gajim.gui.emoji_chooser import emoji_chooser + emoji_chooser.load() + + self.last_ftwindow_update = 0 + + self._network_monitor = Gio.NetworkMonitor.get_default() + self._network_monitor.connect('notify::network-available', + self._network_status_changed) + self.network_state = self._network_monitor.get_network_available() @staticmethod def handle_event_information(obj): @@ -992,7 +1065,6 @@ def handle_event_plain_connection(self, event): def create_core_handlers_list(self): self.handlers = { - 'DB_ERROR': [self.handle_event_db_error], 'file-send-error': [self.handle_event_file_send_error], 'client-cert-passphrase': [ self.handle_event_client_cert_passphrase], @@ -1040,10 +1112,6 @@ def register_core_handlers(self): app.ged.register_event_handler(event_name, prio, event_handler) -################################################################################ -### Methods dealing with app.events -################################################################################ - def add_event(self, account, jid, event): """ Add an event to the app.events var @@ -1190,10 +1258,6 @@ def handle_event(self, account, fjid, type_): if isinstance(ctrl, ChatControlBase): ctrl.scroll_to_end() -################################################################################ -### Methods for opening new messages controls -################################################################################ - def show_groupchat(self, account, room_jid): return False minimized_control = self.minimized_controls[account].get(room_jid) @@ -1267,131 +1331,6 @@ def _on_muc_added(event): app.window.add_group_chat(event.account, str(event.jid)) - def new_private_chat(self, gc_contact, account, session=None): - conn = app.connections[account] - if not session and gc_contact.get_full_jid() in conn.sessions: - sessions = [s for s in conn.sessions[gc_contact.get_full_jid()].\ - values() if isinstance(s, ChatControlSession)] - - # look for an existing session with a chat control - for s in sessions: - if s.control: - session = s - break - if not session and sessions: - # there are no sessions with chat controls, just take the first - # one - session = sessions[0] - if not session: - # couldn't find an existing ChatControlSession, just make a new one - session = conn.make_new_session(gc_contact.get_full_jid(), None, - 'pm') - - contact = gc_contact.as_contact() - if not session.control: - message_window = self.msg_win_mgr.get_window( - gc_contact.get_full_jid(), account) - if not message_window: - message_window = self.msg_win_mgr.create_window( - contact, account, ControlType.PRIVATECHAT) - - session.control = PrivateChatControl(message_window, gc_contact, - contact, account, session) - message_window.new_tab(session.control) - - if app.events.get_events(account, gc_contact.get_full_jid()): - # We call this here to avoid race conditions with widget validation - session.control.read_queue() - - return session.control - - def new_chat(self, contact, account, resource=None, session=None): - # Get target window, create a control, and associate it with the window - fjid = contact.jid - if resource: - fjid += '/' + resource - - mw = self.msg_win_mgr.get_window(fjid, account) - if not mw: - mw = self.msg_win_mgr.create_window( - contact, account, ControlType.CHAT, resource) - - chat_control = ChatControl(mw, contact, account, session, resource) - - mw.new_tab(chat_control) - - if app.events.get_events(account, fjid): - # We call this here to avoid race conditions with widget validation - chat_control.read_queue() - - return chat_control - - def new_chat_from_jid(self, account, fjid, message=None): - jid, resource = app.get_room_and_nick_from_fjid(fjid) - contact = app.contacts.get_contact(account, jid, resource) - added_to_roster = False - if not contact: - added_to_roster = True - contact = self.roster.add_to_not_in_the_roster(account, jid, - resource=resource) - - ctrl = self.msg_win_mgr.get_control(fjid, account) - - if not ctrl: - ctrl = self.new_chat(contact, account, - resource=resource) - if app.events.get_events(account, fjid): - ctrl.read_queue() - - if message: - buffer_ = ctrl.msg_textview.get_buffer() - buffer_.set_text(message) - mw = ctrl.parent_win - mw.set_active_tab(ctrl) - # For JEP-0172 - if added_to_roster: - ctrl.user_nick = app.nicks[account] - - return ctrl - - def on_open_chat_window(self, widget, contact, account, resource=None, - session=None): - # Get the window containing the chat - fjid = contact.jid - - if resource: - fjid += '/' + resource - - ctrl = None - - if session: - ctrl = session.control - if not ctrl: - win = self.msg_win_mgr.get_window(fjid, account) - - if win: - ctrl = win.get_control(fjid, account) - - if not ctrl: - ctrl = self.new_chat(contact, account, resource=resource, - session=session) - # last message is long time ago - app.last_message_time[account][ctrl.get_full_jid()] = 0 - - win = ctrl.parent_win - - win.set_active_tab(ctrl) - - if app.connections[account].is_zeroconf and \ - app.connections[account].status == 'offline': - ctrl = win.get_control(fjid, account) - if ctrl: - ctrl.got_disconnected() - -################################################################################ -### Other Methods -################################################################################ - @staticmethod def create_account(account, username, @@ -1875,100 +1814,6 @@ def remote_init(): GLib.timeout_add_seconds(5, remote_init) MainWindow() - def __init__(self): - app.interface = self - app.thread_interface = ThreadInterface - # This is the manager and factory of message windows set by the module - self.msg_win_mgr = None - self.minimized_controls = {} - self.pass_dialog = {} - self.db_error_dialog = None - - self.handlers = {} - self.roster = None - - self.avatar_storage = AvatarStorage() - - # Load CSS files - app.load_css_config() - - for account in app.settings.get_accounts(): - if app.settings.get_account_setting(account, 'is_zeroconf'): - app.ZEROCONF_ACC_NAME = account - break - - app.idlequeue = idlequeue.get_idlequeue() - # resolve and keep current record of resolved hosts - app.socks5queue = socks5.SocksQueue(app.idlequeue, - self.handle_event_file_rcv_completed, - self.handle_event_file_progress, - self.handle_event_file_error) - app.proxy65_manager = proxy65_manager.Proxy65Manager(app.idlequeue) - - # Creating Network Events Controller - from gajim.common import nec - app.nec = nec.NetworkEventsController() - app.notification = Notification() - - self.create_core_handlers_list() - self.register_core_handlers() - - # self.create_zeroconf_default_config() - # if app.settings.get_account_setting(app.ZEROCONF_ACC_NAME, 'active') \ - # and app.is_installed('ZEROCONF'): - # app.connections[app.ZEROCONF_ACC_NAME] = \ - # connection_zeroconf.ConnectionZeroconf(app.ZEROCONF_ACC_NAME) - - for account in app.settings.get_accounts(): - if (not app.settings.get_account_setting(account, 'is_zeroconf') and - app.settings.get_account_setting(account, 'active')): - client = Client(account) - app.connections[account] = client - app.ged.register_event_handler( - 'muc-added', ged.CORE, self._on_muc_added) - - self.instances = {} - - for a in app.connections: - self.instances[a] = {'infos': {}, 'disco': {}, 'gc_config': {}, - 'search': {}, 'sub_request': {}} - self.minimized_controls[a] = {} - app.contacts.add_account(a) - app.groups[a] = {} - app.gc_connected[a] = {} - app.automatic_rooms[a] = {} - app.newly_added[a] = [] - app.to_be_removed[a] = [] - app.nicks[a] = app.settings.get_account_setting(a, 'name') - app.block_signed_in_notifications[a] = True - app.last_message_time[a] = {} - - if sys.platform not in ('win32', 'darwin'): - logind.enable() - music_track.enable() - else: - GLib.timeout_add_seconds(20, self.check_for_updates) - - idle.Monitor.set_interval(app.settings.get('autoawaytime') * 60, - app.settings.get('autoxatime') * 60) - - self.systray_enabled = False - - if not app.is_display(Display.WAYLAND): - from gajim.gui import statusicon - self.systray = statusicon.StatusIcon() - - if sys.platform in ('win32', 'darwin'): - from gajim.gui.emoji_chooser import emoji_chooser - emoji_chooser.load() - - self.last_ftwindow_update = 0 - - self._network_monitor = Gio.NetworkMonitor.get_default() - self._network_monitor.connect('notify::network-available', - self._network_status_changed) - self.network_state = self._network_monitor.get_network_available() - class ThreadInterface: def __init__(self, func, func_args=(), callback=None, callback_args=()): View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/ca8620e0bd57b7575976619b169e0b35…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/ca8620e0bd57b7575976619b169e0b35…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][mainwindow] Simplify init
by Philipp Hörist
28 Apr '21
28 Apr '21
Philipp Hörist pushed to branch mainwindow at gajim / gajim Commits: 9c66534e by lovetox at 2021-04-28T10:39:02+02:00 Simplify init - - - - - 2 changed files: - gajim/gtk/chat_list_stack.py - gajim/gtk/chat_page.py Changes: ===================================== gajim/gtk/chat_list_stack.py ===================================== @@ -49,7 +49,7 @@ class ChatListStack(Gtk.Stack): (str, str, str)), } - def __init__(self, main_window, search_entry): + def __init__(self, search_entry): Gtk.Stack.__init__(self) self.set_hexpand(True) self.set_vexpand(True) @@ -63,7 +63,7 @@ def __init__(self, main_window, search_entry): self.connect('notify::visible-child-name', self._on_visible_child_name) search_entry.connect('search-changed', self._on_search_changed) - main_window.connect('notify::is-active', self._on_window_active) + app.window.connect('notify::is-active', self._on_window_active) self._add_actions() self.show_all() ===================================== gajim/gtk/chat_page.py ===================================== @@ -59,7 +59,7 @@ def __init__(self): self._search_revealer.add(self._search_view) self._ui.right_grid_overlay.add_overlay(self._search_revealer) - self._chat_list_stack = ChatListStack(app.window, self._ui.search_entry) + self._chat_list_stack = ChatListStack(self._ui.search_entry) self._chat_list_stack.connect('chat-selected', self._on_chat_selected) self._chat_list_stack.connect('chat-unselected', self._on_chat_unselected) View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/9c66534ef6dea56b1dca03264f71bc17…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/9c66534ef6dea56b1dca03264f71bc17…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][mainwindow] Refactor ChatList
by Philipp Hörist
28 Apr '21
28 Apr '21
Philipp Hörist pushed to branch mainwindow at gajim / gajim Commits: d71682a0 by lovetox at 2021-04-28T10:38:06+02:00 Refactor ChatList - - - - - 3 changed files: - gajim/gtk/chat_list_stack.py - gajim/gtk/chat_page.py - gajim/gtk/main.py Changes: ===================================== gajim/gtk/chat_list_stack.py ===================================== @@ -44,16 +44,17 @@ class ChatListStack(Gtk.Stack): 'chat-unselected': (GObject.SignalFlags.RUN_LAST, None, ()), + 'chat-removed': (GObject.SignalFlags.RUN_LAST, + None, + (str, str, str)), } - def __init__(self, main_window, ui, chat_stack): + def __init__(self, main_window, search_entry): Gtk.Stack.__init__(self) self.set_hexpand(True) self.set_vexpand(True) self.set_vhomogeneous(False) - self._ui = ui - self._chat_stack = chat_stack self._chat_lists = {} self._last_visible_child_name = 'default' @@ -61,9 +62,7 @@ def __init__(self, main_window, ui, chat_stack): self.add_named(Gtk.Box(), 'default') self.connect('notify::visible-child-name', self._on_visible_child_name) - self._ui.search_entry.connect( - 'search-changed', self._on_search_changed) - + search_entry.connect('search-changed', self._on_search_changed) main_window.connect('notify::is-active', self._on_window_active) self._add_actions() @@ -94,7 +93,6 @@ def _on_visible_child_name(self, _stack, _param): if self._last_visible_child_name == self.get_visible_child_name(): return - self._ui.search_entry.set_text('') if self._last_visible_child_name != 'default': child = self.get_child_by_name(self._last_visible_child_name) child.set_filter_text('') @@ -157,8 +155,6 @@ def show_chat_list(self, workspace_id): if current_workspace_id != 'default': self._chat_lists[current_workspace_id].unselect_all() - self._ui.workspace_label.set_text( - app.settings.get_workspace_setting(workspace_id, 'name')) self.set_visible_child_name(workspace_id) def add_chat(self, workspace_id, account, jid, type_, pinned=False): @@ -204,12 +200,7 @@ def remove_chat(self, workspace_id, account, jid): type_ = chat_list.get_chat_type(account, jid) chat_list.remove_chat(account, jid) self.store_open_chats(workspace_id) - - if not self.contains_chat(account, jid): - self._chat_stack.remove_chat(account, jid) - if type_ == 'groupchat': - client = app.get_client(account) - client.get_module('MUC').leave(jid) + self.emit('chat-removed', account, jid, type_) def _find_chat(self, account, jid): for chat_list in self._chat_lists.values(): ===================================== gajim/gtk/chat_page.py ===================================== @@ -59,10 +59,13 @@ def __init__(self): self._search_revealer.add(self._search_view) self._ui.right_grid_overlay.add_overlay(self._search_revealer) - self._chat_list_stack = ChatListStack(self, self._ui, self._chat_stack) + self._chat_list_stack = ChatListStack(app.window, self._ui.search_entry) self._chat_list_stack.connect('chat-selected', self._on_chat_selected) self._chat_list_stack.connect('chat-unselected', self._on_chat_unselected) + self._chat_list_stack.connect('chat-removed', self._on_chat_removed) + self._chat_list_stack.connect('notify::visible-child-name', + self._on_chat_list_changed) self._ui.chat_list_scrolled.add(self._chat_list_stack) self._ui.start_chat_button.connect('clicked', @@ -120,6 +123,10 @@ def _on_button_release(paned, event): def _on_chat_selected(self, _chat_list_stack, workspace_id, account, jid): self._chat_stack.show_chat(account, jid) self._search_view.set_context(account, jid) + + self._ui.workspace_label.set_text( + app.settings.get_workspace_setting(workspace_id, 'name')) + self.emit('chat-selected', workspace_id, account, jid) def _on_chat_unselected(self, _chat_list_stack): @@ -136,6 +143,9 @@ def _on_search_history(self, _action, _param): def _on_search_hide(self, *args): self._search_revealer.hide() + def _on_chat_list_changed(self, *args): + self._ui.search_entry.set_text('') + def process_event(self, event): self._chat_stack.process_event(event) self._chat_list_stack.process_event(event) @@ -219,6 +229,12 @@ def remove_chat(self, account, jid): self._chat_list_stack.remove_chat(workspace_id, account, jid) return + def _on_chat_removed(self, _chat_list, account, jid, type_): + self._chat_stack.remove_chat(account, jid) + if type_ == 'groupchat': + client = app.get_client(account) + client.get_module('MUC').leave(jid) + def get_control(self, account, jid): return self._chat_stack.get_control(account, jid) @@ -230,3 +246,7 @@ def get_active_control(self): def get_controls(self, account=None): return self._chat_stack.get_controls(account) + + def hide_search(self): + if self._search_revealer.get_reveal_child(): + self._search_revealer.hide() ===================================== gajim/gtk/main.py ===================================== @@ -173,8 +173,7 @@ def _on_action(self, action, _param): return res if action == 'escape': - if self._search_revealer.get_reveal_child(): - self._search_revealer.hide() + self._chat_page.hide_search() # if action == 'escape' and app.settings.get('escape_key_closes'): # self.remove_tab(control, self.CLOSE_ESC) View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/d71682a0e7c4bbf5bb98f5df71a34852…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/d71682a0e7c4bbf5bb98f5df71a34852…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][mainwindow] Refactor Main
by Philipp Hörist
28 Apr '21
28 Apr '21
Philipp Hörist pushed to branch mainwindow at gajim / gajim Commits: c9580464 by lovetox at 2021-04-28T09:54:35+02:00 Refactor Main - - - - - 11 changed files: - + gajim/data/gui/chat_paned.ui - gajim/data/gui/main.ui - gajim/gtk/account_page.py - gajim/gtk/account_side_bar.py - gajim/gtk/chat_list.py - gajim/gtk/chat_list_stack.py - + gajim/gtk/chat_page.py - gajim/gtk/chat_stack.py - gajim/gtk/main.py - + gajim/gtk/main_stack.py - gajim/gtk/workspace_side_bar.py Changes: ===================================== gajim/data/gui/chat_paned.ui ===================================== @@ -0,0 +1,197 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.38.2 --> +<interface> + <requires lib="gtk+" version="3.24"/> + <object class="GtkPaned" id="paned"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="position">250</property> + <property name="position-set">True</property> + <child> + <!-- n-columns=1 n-rows=2 --> + <object class="GtkGrid" id="middle_grid"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <child> + <!-- n-columns=1 n-rows=3 --> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="row-spacing">3</property> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="workspace_label"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label">Workspace Label</property> + <property name="ellipsize">end</property> + <style> + <class name="bold16"/> + </style> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="workspace_menu_button"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="focus-on-click">False</property> + <property name="receives-default">True</property> + <child> + <object class="GtkImage"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="icon-name">open-menu-symbolic</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack-type">end</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-left">6</property> + <property name="margin-right">6</property> + <property name="margin-start">6</property> + <property name="margin-end">6</property> + <property name="margin-top">12</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">2</property> + </packing> + </child> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="spacing">12</property> + <child> + <object class="GtkSearchEntry" id="search_entry"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + <property name="primary-icon-name">edit-find-symbolic</property> + <property name="primary-icon-activatable">False</property> + <property name="primary-icon-sensitive">False</property> + <property name="placeholder-text" translatable="yes">Search…</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="start_chat_button"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="tooltip-text" translatable="yes">Start Chat</property> + <child> + <object class="GtkImage"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="icon-name">list-add-symbolic</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">1</property> + </packing> + </child> + <style> + <class name="chatlist-top-bar"/> + </style> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="chat_list_scrolled"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="shadow-type">in</property> + <child> + <placeholder/> + </child> + <style> + <class name="no-border"/> + </style> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">1</property> + </packing> + </child> + <style> + <class name="middle-grid"/> + </style> + </object> + <packing> + <property name="resize">False</property> + <property name="shrink">False</property> + </packing> + </child> + <child> + <!-- n-columns=1 n-rows=1 --> + <object class="GtkGrid" id="right_grid"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child> + <object class="GtkOverlay" id="right_grid_overlay"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">0</property> + </packing> + </child> + </object> + <packing> + <property name="resize">True</property> + <property name="shrink">True</property> + </packing> + </child> + </object> +</interface> ===================================== gajim/data/gui/main.ui ===================================== @@ -2,7 +2,7 @@ <!-- Generated with glade 3.38.2 --> <interface> <requires lib="gtk+" version="3.22"/> - <!-- n-columns=3 n-rows=3 --> + <!-- n-columns=2 n-rows=1 --> <object class="GtkGrid" id="main_grid"> <property name="visible">True</property> <property name="can-focus">False</property> @@ -130,229 +130,6 @@ <property name="top-attach">0</property> </packing> </child> - <child> - <object class="GtkStack" id="main_stack"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <child> - <object class="GtkPaned" id="paned"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="position">250</property> - <property name="position-set">True</property> - <child> - <!-- n-columns=1 n-rows=2 --> - <object class="GtkGrid" id="middle_grid"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="vexpand">True</property> - <property name="orientation">vertical</property> - <child> - <!-- n-columns=1 n-rows=3 --> - <object class="GtkGrid"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="row-spacing">3</property> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="spacing">12</property> - <child> - <object class="GtkLabel" id="workspace_label"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label">Workspace Label</property> - <property name="ellipsize">end</property> - <style> - <class name="bold16"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkMenuButton" id="workspace_menu_button"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="focus-on-click">False</property> - <property name="receives-default">True</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="icon-name">open-menu-symbolic</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack-type">end</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">0</property> - </packing> - </child> - <child> - <object class="GtkSeparator"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="margin-start">6</property> - <property name="margin-end">6</property> - <property name="margin-top">12</property> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">2</property> - </packing> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="spacing">12</property> - <child> - <object class="GtkSearchEntry" id="search_entry"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="hexpand">True</property> - <property name="primary-icon-name">edit-find-symbolic</property> - <property name="primary-icon-activatable">False</property> - <property name="primary-icon-sensitive">False</property> - <property name="placeholder-text" translatable="yes">Search…</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="start_chat_button"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <property name="tooltip-text" translatable="yes">Start Chat</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="icon-name">list-add-symbolic</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">1</property> - </packing> - </child> - <style> - <class name="chatlist-top-bar"/> - </style> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">0</property> - </packing> - </child> - <child> - <object class="GtkScrolledWindow" id="chat_list_scrolled"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="shadow-type">in</property> - <child> - <placeholder/> - </child> - <style> - <class name="no-border"/> - </style> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">1</property> - </packing> - </child> - <style> - <class name="middle-grid"/> - </style> - </object> - <packing> - <property name="resize">False</property> - <property name="shrink">False</property> - </packing> - </child> - <child> - <!-- n-columns=1 n-rows=1 --> - <object class="GtkGrid" id="right_grid"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <child> - <object class="GtkOverlay" id="right_grid_overlay"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">0</property> - </packing> - </child> - </object> - <packing> - <property name="resize">True</property> - <property name="shrink">True</property> - </packing> - </child> - </object> - <packing> - <property name="name">chats</property> - </packing> - </child> - </object> - <packing> - <property name="left-attach">1</property> - <property name="top-attach">0</property> - </packing> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> <child> <placeholder/> </child> ===================================== gajim/gtk/account_page.py ===================================== @@ -64,7 +64,6 @@ def __init__(self, account): self._ui.roster_menu_button.set_menu_model(roster_menu) self._ui.connect_signals(self) - self.show_all() # pylint: disable=line-too-long self.register_events([ @@ -76,6 +75,7 @@ def __init__(self, account): # pylint: enable=line-too-long self.update() + self.show_all() def _on_edit_profile(self, _button): open_window('ProfileWindow', account=self._account) ===================================== gajim/gtk/account_side_bar.py ===================================== @@ -1,5 +1,17 @@ +# This file is part of Gajim. +# +# Gajim is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; version 3 only. +# +# Gajim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. -from gi.repository import GLib from gi.repository import Gtk from gajim.common.const import AvatarSize ===================================== gajim/gtk/chat_list.py ===================================== @@ -1,3 +1,17 @@ +# This file is part of Gajim. +# +# Gajim is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; version 3 only. +# +# Gajim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. + import logging from gi.repository import Gdk ===================================== gajim/gtk/chat_list_stack.py ===================================== @@ -1,6 +1,21 @@ +# This file is part of Gajim. +# +# Gajim is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; version 3 only. +# +# Gajim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. from gi.repository import Gtk from gi.repository import GObject +from gi.repository import Gio +from gi.repository import GLib from gajim.common import app @@ -26,6 +41,9 @@ class ChatListStack(Gtk.Stack): 'chat-selected': (GObject.SignalFlags.RUN_LAST, None, (str, str, str)), + 'chat-unselected': (GObject.SignalFlags.RUN_LAST, + None, + ()), } def __init__(self, main_window, ui, chat_stack): @@ -42,13 +60,29 @@ def __init__(self, main_window, ui, chat_stack): self.add_named(Gtk.Box(), 'default') - self.show_all() self.connect('notify::visible-child-name', self._on_visible_child_name) self._ui.search_entry.connect( 'search-changed', self._on_search_changed) main_window.connect('notify::is-active', self._on_window_active) + self._add_actions() + self.show_all() + + def _add_actions(self): + actions = [ + ('toggle-chat-pinned', 'as', self._toggle_chat_pinned), + ('move-chat-to-workspace', 'as', self._move_chat_to_workspace), + ] + + for action in actions: + action_name, variant, func = action + if variant is not None: + variant = GLib.VariantType.new(variant) + act = Gio.SimpleAction.new(action_name, variant) + act.connect('activate', func) + app.window.add_action(act) + def _on_window_active(self, window, _param): is_active = window.get_property('is-active') if is_active: @@ -108,10 +142,9 @@ def remove_chat_list(self, workspace_id): def _on_row_selected(self, _chat_list, row): if row is None: - self._chat_stack.clear() + self.emit('chat-unselected') return - self._chat_stack.show_chat(row.account, row.jid) if row.is_active: row.reset_unread() self.emit('chat-selected', row.workspace_id, row.account, row.jid) @@ -148,11 +181,24 @@ def store_open_chats(self, workspace_id): app.settings.set_workspace_setting( workspace_id, 'open_chats', open_chats) - def toggle_chat_pinned(self, workspace_id, account, jid): + def _toggle_chat_pinned(self, _action, param): + workspace_id, account, jid = param.unpack() chat_list = self._chat_lists[workspace_id] chat_list.toggle_chat_pinned(account, jid) self.store_open_chats(workspace_id) + def _move_chat_to_workspace(self, _action, param): + new_workspace_id, account, jid = param.unpack() + + current_chatlist = self.get_visible_child() + type_ = current_chatlist.get_chat_type(account, jid) + current_chatlist.remove_chat(account, jid) + + new_chatlist = self.get_chatlist(new_workspace_id) + new_chatlist.add_chat(account, jid, type_) + self.store_open_chats(current_chatlist.workspace_id) + self.store_open_chats(new_workspace_id) + def remove_chat(self, workspace_id, account, jid): chat_list = self._chat_lists[workspace_id] type_ = chat_list.get_chat_type(account, jid) ===================================== gajim/gtk/chat_page.py ===================================== @@ -0,0 +1,232 @@ +# This file is part of Gajim. +# +# Gajim is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; version 3 only. +# +# Gajim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. + + +from gi.repository import Gtk +from gi.repository import GLib +from gi.repository import Gio +from gi.repository import GObject + +from gajim.common import app +from gajim.common.i18n import _ + +from .util import get_builder +from .chat_list_stack import ChatListStack +from .chat_stack import ChatStack +from .search_view import SearchView + + +WORKSPACE_MENU_DICT = { + 'edit': _('Edit…'), + 'remove': _('Remove'), +} + + +class ChatPage(Gtk.Box): + + __gsignals__ = { + 'chat-selected': (GObject.SignalFlags.RUN_LAST, + None, + (str, str, str)), + } + + def __init__(self): + Gtk.Box.__init__(self) + self._ui = get_builder('chat_paned.ui') + self.add(self._ui.paned) + + self._chat_stack = ChatStack() + self._ui.right_grid_overlay.add(self._chat_stack) + + self._search_view = SearchView() + self._search_view.connect('hide-search', self._on_search_hide) + + self._search_revealer = Gtk.Revealer() + self._search_revealer.set_reveal_child(True) + self._search_revealer.set_halign(Gtk.Align.END) + self._search_revealer.set_no_show_all(True) + self._search_revealer.add(self._search_view) + self._ui.right_grid_overlay.add_overlay(self._search_revealer) + + self._chat_list_stack = ChatListStack(self, self._ui, self._chat_stack) + self._chat_list_stack.connect('chat-selected', self._on_chat_selected) + self._chat_list_stack.connect('chat-unselected', + self._on_chat_unselected) + self._ui.chat_list_scrolled.add(self._chat_list_stack) + + self._ui.start_chat_button.connect('clicked', + self._on_start_chat_clicked) + + self._ui.paned.set_position(app.settings.get('chat_handle_position')) + self._ui.paned.connect('button-release-event', self._on_button_release) + + workspace_menu = Gio.Menu() + for action, label in WORKSPACE_MENU_DICT.items(): + workspace_menu.append(label, f'win.{action.lower()}-workspace') + + self._ui.workspace_menu_button.set_menu_model(workspace_menu) + + self._startup_finished = False + + self._add_actions() + + self.show_all() + + def _add_actions(self): + actions = [ + ('remove-chat', 'as', self._remove_chat), + ('search-history', None, self._on_search_history), + ] + + for action in actions: + action_name, variant, func = action + if variant is not None: + variant = GLib.VariantType.new(variant) + act = Gio.SimpleAction.new(action_name, variant) + act.connect('activate', func) + app.window.add_action(act) + + def set_startup_finished(self): + self._startup_finished = True + + def get_chat_list_stack(self): + return self._chat_list_stack + + def get_chat_stack(self): + return self._chat_stack + + @staticmethod + def _on_start_chat_clicked(_button): + app.app.activate_action('start-chat', GLib.Variant('s', '')) + + @staticmethod + def _on_button_release(paned, event): + if event.window != paned.get_handle_window(): + return + position = paned.get_position() + app.settings.set('chat_handle_position', position) + + def _on_chat_selected(self, _chat_list_stack, workspace_id, account, jid): + self._chat_stack.show_chat(account, jid) + self._search_view.set_context(account, jid) + self.emit('chat-selected', workspace_id, account, jid) + + def _on_chat_unselected(self, _chat_list_stack): + self._chat_stack.clear() + + def _on_search_history(self, _action, _param): + control = self.get_active_control() + if control is not None: + self._search_view.set_context(control.account, control.contact.jid) + self._search_view.clear() + self._search_revealer.show() + self._search_view.set_focus() + + def _on_search_hide(self, *args): + self._search_revealer.hide() + + def process_event(self, event): + self._chat_stack.process_event(event) + self._chat_list_stack.process_event(event) + + def add_chat_list(self, workspace_id): + self._chat_list_stack.add_chat_list(workspace_id) + + def show_workspace_chats(self, workspace_id): + self._chat_list_stack.show_chat_list(workspace_id) + + def update_workspace(self, workspace_id): + name = app.settings.get_workspace_setting(workspace_id, 'name') + self._ui.workspace_label.set_text(name) + + def remove_chat_list(self, workspace_id): + self._chat_list_stack.remove_chat_list(workspace_id) + + def chat_exists(self, account, jid): + return self._chat_list_stack.contains_chat(account, jid) + + def chat_exists_for_workspace(self, workspace_id, account, jid): + return self._chat_list_stack.contains_chat( + account, jid, workspace_id=workspace_id) + + def add_chat_for_workspace(self, + workspace_id, + account, + jid, + type_, + pinned=False, + select=False): + + if self.chat_exists(account, jid): + if select: + self._chat_list_stack.select_chat(account, jid) + return + + if type_ == 'groupchat': + self._chat_stack.add_group_chat(account, jid) + elif type_ == 'pm': + if not self._startup_finished: + # TODO: Currently we cant load private chats at start + # because the Contacts dont exist yet + return + self._chat_stack.add_private_chat(account, jid) + else: + self._chat_stack.add_chat(account, jid) + self._chat_list_stack.add_chat(workspace_id, account, jid, type_, + pinned) + + if self._startup_finished: + if select: + self._chat_list_stack.select_chat(account, jid) + self._chat_list_stack.store_open_chats(workspace_id) + + def load_workspace_chats(self, workspace_id): + open_chats = app.settings.get_workspace_setting(workspace_id, + 'open_chats') + + active_accounts = app.settings.get_active_accounts() + for account, jid, type_, pinned in open_chats: + if account not in active_accounts: + continue + + self.add_chat_for_workspace(workspace_id, + account, + jid, + type_, + pinned=pinned) + + def is_chat_active(self, account, jid): + return self._chat_list_stack.is_chat_active(account, jid) + + def _remove_chat(self, _action, param): + account, jid = param.unpack() + self.remove_chat(account, jid) + + def remove_chat(self, account, jid): + for workspace_id in app.settings.get_workspaces(): + if self.chat_exists_for_workspace(workspace_id, account, jid): + self._chat_list_stack.remove_chat(workspace_id, account, jid) + return + + def get_control(self, account, jid): + return self._chat_stack.get_control(account, jid) + + def get_active_control(self): + chat = self._chat_list_stack.get_selected_chat() + if chat is None: + return None + return self.get_control(chat.account, chat.jid) + + def get_controls(self, account=None): + return self._chat_stack.get_controls(account) ===================================== gajim/gtk/chat_stack.py ===================================== @@ -1,15 +1,25 @@ +# This file is part of Gajim. +# +# Gajim is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; version 3 only. +# +# Gajim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. import logging from gi.repository import Gtk -from gajim.common import app from gajim.chat_control import ChatControl from gajim.groupchat_control import GroupchatControl from gajim.privatechat_control import PrivateChatControl -from gajim.common.i18n import _ - log = logging.getLogger('gajim.gui.chatstack') ===================================== gajim/gtk/main.py ===================================== @@ -11,13 +11,10 @@ from gajim.common.i18n import _ from gajim.common.nec import EventHelper -from gajim.gui.account_page import AccountPage from gajim.gui.adhoc import AdHocCommand -from gajim.gui.search_view import SearchView -from gajim.gui.chat_list_stack import ChatListStack -from gajim.gui.chat_stack import ChatStack from gajim.gui.account_side_bar import AccountSideBar from gajim.gui.workspace_side_bar import WorkspaceSideBar +from gajim.gui.main_stack import MainStack from gajim.gui.dialogs import DialogButton from gajim.gui.dialogs import ConfirmationDialog from gajim.gui.util import get_builder @@ -27,11 +24,6 @@ log = logging.getLogger('gajim.gui.main') -WORKSPACE_MENU_DICT = { - 'edit': _('Edit…'), - 'remove': _('Remove'), -} - class MainWindow(Gtk.ApplicationWindow, EventHelper): def __init__(self): @@ -46,8 +38,6 @@ def __init__(self): self.window = self app.window = self - self._active_workspace = None - self._startup_finished = False self._ui = get_builder('main.ui') @@ -57,44 +47,19 @@ def __init__(self): surface = load_icon('org.gajim.Gajim', self, 40) self._ui.app_image.set_from_surface(surface) - self._chat_stack = ChatStack() - self._ui.right_grid_overlay.add(self._chat_stack) - - self._search_view = SearchView() - self._search_view.connect('hide-search', self._on_search_hide) - - self._search_revealer = Gtk.Revealer() - self._search_revealer.set_reveal_child(True) - self._search_revealer.set_halign(Gtk.Align.END) - self._search_revealer.set_no_show_all(True) - self._search_revealer.add(self._search_view) - self._ui.right_grid_overlay.add_overlay(self._search_revealer) + self._main_stack = MainStack() + self._ui.main_grid.add(self._main_stack) - self._chat_list_stack = ChatListStack(self, self._ui, self._chat_stack) - self._chat_list_stack.connect('chat-selected', self._on_chat_selected) - self._ui.chat_list_scrolled.add(self._chat_list_stack) + self._chat_page = self._main_stack.get_chat_page() - self._workspace_side_bar = WorkspaceSideBar(self._chat_list_stack) + self._workspace_side_bar = WorkspaceSideBar(self._chat_page) self._ui.workspace_scrolled.add(self._workspace_side_bar) self._account_side_bar = AccountSideBar() self._ui.account_box.add(self._account_side_bar) - self._account_pages = {} - - workspace_menu = Gio.Menu() - for action, label in WORKSPACE_MENU_DICT.items(): - workspace_menu.append(label, f'win.{action.lower()}-workspace') - - self._ui.workspace_menu_button.set_menu_model(workspace_menu) - - self._ui.start_chat_button.connect( - 'clicked', self._on_start_chat_clicked) self._ui.connect_signals(self) - self._ui.paned.set_position(app.settings.get('chat_handle_position')) - self._ui.paned.connect('button-release-event', self._on_button_release) - self.register_events([ ('presence-received', ged.GUI1, self._on_event), ('caps-update', ged.GUI1, self._on_event), @@ -113,12 +78,10 @@ def __init__(self): ('signed-in', ged.GUI1, self._on_signed_in), ]) - self.show_all() - self._load_chats() - self._add_accounts() self._add_actions() self._add_actions2() + self.show_all() @staticmethod def _on_our_show(event): @@ -131,13 +94,6 @@ def _on_signed_in(event): app.app.set_account_actions_state(event.account, True) app.app.update_app_actions_state() - @staticmethod - def _on_button_release(paned, event): - if event.window != paned.get_handle_window(): - return - position = paned.get_position() - app.settings.set('chat_handle_position', position) - def _add_actions(self): actions = [ ('add-workspace', 's', self._add_workspace), @@ -146,11 +102,7 @@ def _add_actions(self): ('activate-workspace', 's', self._activate_workspace), ('add-chat', 'a{sv}', self._add_chat), ('add-group-chat', 'as', self._add_group_chat), - ('remove-chat', 'as', self._remove_chat), - ('toggle-chat-pinned', 'as', self._toggle_chat_pinned), - ('move-chat-to-workspace', 'as', self._move_chat_to_workspace), ('add-to-roster', 'as', self._add_to_roster), - ('search-history', None, self._on_search_history), ] for action in actions: @@ -275,6 +227,10 @@ def _on_action(self, action, _param): # self.notebook.set_current_page(number - 1) # return + def _set_startup_finished(self): + self._startup_finished = True + self._chat_page.set_startup_finished() + def get_widget(self, name): return getattr(self._ui, name) @@ -290,15 +246,9 @@ def show_title(self, *args): def get_active_jid(self, *args): pass - def get_account_page(self, account): - return self._account_pages[account] - def show_account_page(self, account): self._account_side_bar.activate_account_page(account) - self._ui.main_stack.set_visible_child_name(account) - - def get_workspace_bar(self): - return self._workspace_side_bar + self._main_stack.show_account(account) def get_active_workspace(self): return self._workspace_side_bar.get_active_workspace() @@ -306,10 +256,7 @@ def get_active_workspace(self): def is_chat_active(self, account, jid): if not self.get_property('has-toplevel-focus'): return False - return self._chat_list_stack.is_chat_active(account, jid) - - def show_chats(self): - self._ui.main_stack.set_visible_child_name('chats') + return self._chat_page.is_chat_active(account, jid) def _add_workspace(self, _action, param): workspace_id = param.get_string() @@ -317,20 +264,16 @@ def _add_workspace(self, _action, param): def add_workspace(self, workspace_id): self._workspace_side_bar.add_workspace(workspace_id) - self._chat_list_stack.add_chat_list(workspace_id) - self._workspace_side_bar.activate_workspace(workspace_id) - self._chat_list_stack.show_chat_list(workspace_id) + self._chat_page.add_chat_list(workspace_id) + if self._startup_finished: + self.activate_workspace(workspace_id) self._workspace_side_bar.store_workspace_order() def _edit_workspace(self, _action, _param): workspace_id = self.get_active_workspace() if workspace_id is not None: - self.edit_workspace(workspace_id) - - @staticmethod - def edit_workspace(workspace_id): - open_window('WorkspaceDialog', workspace_id=workspace_id) + open_window('WorkspaceDialog', workspace_id=workspace_id) def _remove_workspace(self, _action, _param): workspace_id = self.get_active_workspace() @@ -346,10 +289,9 @@ def remove_workspace(self, workspace_id): if was_active: new_active_id = self._workspace_side_bar.get_first_workspace() - self._workspace_side_bar.activate_workspace(new_active_id) - self._chat_list_stack.show_chat_list(new_active_id) + self.activate_workspace(new_active_id) - self._chat_list_stack.remove_chat_list(workspace_id) + self._chat_page.remove_chat_list(workspace_id) app.settings.remove_workspace(workspace_id) def _activate_workspace(self, _action, param): @@ -357,138 +299,59 @@ def _activate_workspace(self, _action, param): self.activate_workspace(workspace_id) def activate_workspace(self, workspace_id): - self._ui.main_stack.set_visible_child_name('chats') + self._main_stack.show_chats(workspace_id) self._workspace_side_bar.activate_workspace(workspace_id) - self._chat_list_stack.show_chat_list(workspace_id) def update_workspace(self, workspace_id): - name = app.settings.get_workspace_setting(workspace_id, 'name') - self._ui.workspace_label.set_text(name) - app.interface.avatar_storage.invalidate_cache(workspace_id) + self._chat_page.update_workspace(workspace_id) self._workspace_side_bar.update_avatar(workspace_id) def _add_group_chat(self, _action, param): - account, jid = param.unpack() - self.add_group_chat(account, jid) + self.add_group_chat(**param.unpack()) def add_group_chat(self, account, jid, select=False): - workspace_id = self._workspace_side_bar.get_active_workspace() - self.add_chat_for_workspace(workspace_id, - account, - jid, - 'groupchat', - select=select) + workspace_id = self.get_active_workspace() + self._chat_page.add_chat_for_workspace(workspace_id, + account, + jid, + 'groupchat', + select=select) def _add_chat(self, _action, param): self.add_chat(**param.unpack()) def add_chat(self, account, jid, type_, select=False): - workspace_id = self._workspace_side_bar.get_active_workspace() - self.add_chat_for_workspace(workspace_id, - account, - jid, - type_, - select=select) + workspace_id = self.get_active_workspace() + self._chat_page.add_chat_for_workspace(workspace_id, + account, + jid, + type_, + select=select) def add_private_chat(self, account, jid, select=False): - workspace_id = self._workspace_side_bar.get_active_workspace() - self.add_chat_for_workspace(workspace_id, - account, - jid, - 'pm', - select=select) - - def add_chat_for_workspace(self, - workspace_id, - account, - jid, - type_, - pinned=False, - select=False): - if self.chat_exists(account, jid): - if select: - self._chat_list_stack.select_chat(account, jid) - self.show_chats() - return - - if type_ == 'groupchat': - self._chat_stack.add_group_chat(account, jid) - elif type_ == 'pm': - if not self._startup_finished: - # TODO: Currently we cant load private chats at start - # because the Contacts dont exist yet - return - self._chat_stack.add_private_chat(account, jid) - else: - self._chat_stack.add_chat(account, jid) - self._chat_list_stack.add_chat(workspace_id, account, jid, type_, - pinned) - - if self._startup_finished: - if select: - self._chat_list_stack.select_chat(account, jid) - self.show_chats() - self._chat_list_stack.store_open_chats(workspace_id) - - def _toggle_chat_pinned(self, _action, param): - workspace_id, account, jid = param.unpack() - self.toggle_chat_pinned(workspace_id, account, jid) - - def toggle_chat_pinned(self, workspace_id, account, jid): - self._chat_list_stack.toggle_chat_pinned(workspace_id, account, jid) - - def _move_chat_to_workspace(self, _action, param): - new_workspace_id, account, jid = param.unpack() - self.move_chat_to_workspace(new_workspace_id, account, jid) - - def move_chat_to_workspace(self, new_workspace_id, account, jid): - current_chatlist = self._chat_list_stack.get_visible_child() - type_ = current_chatlist.get_chat_type(account, jid) - current_chatlist.remove_chat(account, jid) - new_chatlist = self._chat_list_stack.get_chatlist(new_workspace_id) - new_chatlist.add_chat(account, jid, type_) - self._chat_list_stack.store_open_chats(current_chatlist.workspace_id) - self._chat_list_stack.store_open_chats(new_workspace_id) - - def _remove_chat(self, _action, param): - account, jid = param.unpack() - self.remove_chat(account, jid) - - def remove_chat(self, account, jid): - for workspace_id in app.settings.get_workspaces(): - if self.chat_exists_for_workspace(workspace_id, account, jid): - self._chat_list_stack.remove_chat(workspace_id, account, jid) - return + workspace_id = self.get_active_workspace() + self._chat_page.add_chat_for_workspace(workspace_id, + account, + jid, + 'pm', + select=select) @staticmethod def _add_to_roster(_action, param): _workspace, account, jid = param.unpack() open_window('AddNewContactWindow', account=account, contact_jid=jid) - def chat_exists(self, account, jid): - return self._chat_list_stack.contains_chat(account, jid) + def get_control(self, *args, **kwargs): + return self._chat_page.get_control(*args, **kwargs) - def chat_exists_for_workspace(self, workspace_id, account, jid): - return self._chat_list_stack.contains_chat( - account, jid, workspace_id=workspace_id) + def get_controls(self, *args, **kwargs): + return self._chat_page.get_controls(*args, **kwargs) - def get_control(self, account, jid): - return self._chat_stack.get_control(account, jid) + def get_active_control(self, *args, **kwargs): + return self._chat_page.get_active_control(*args, **kwargs) - def get_active_control(self): - chat = self._chat_list_stack.get_selected_chat() - if chat is None: - return None - return self.get_control(chat.account, chat.jid) - - def get_controls(self, account=None): - return self._chat_stack.get_controls(account) - - def _add_accounts(self): - for account in list(app.connections.keys()): - account_page = AccountPage(account) - self._account_pages[account] = account_page - self._ui.main_stack.add_named(account_page, account) + def chat_exists(self, *args, **kwargs): + return self._chat_page.chat_exists(*args, **kwargs) @staticmethod def contact_info(account, jid): @@ -512,7 +375,7 @@ def block_contact(self, account, jid): # TODO: Keep "confirm_block" setting? def _block_contact(report=None): client.get_module('Blocking').block([contact.jid], report) - self.remove_chat(account, contact.jid) + self._chat_page.remove_chat(account, contact.jid) ConfirmationDialog( _('Block Contact'), @@ -533,7 +396,7 @@ def remove_contact(self, account, jid): client = app.get_client(account) def _remove_contact(): - self.remove_chat(account, jid) + self._chat_page.remove_chat(account, jid) client.get_module('Roster').delete_item(jid) contact = client.get_module('Contacts').get_contact(jid) @@ -552,45 +415,13 @@ def _remove_contact(): def _load_chats(self): for workspace_id in app.settings.get_workspaces(): - self._workspace_side_bar.add_workspace(workspace_id) - self._chat_list_stack.add_chat_list(workspace_id) - open_chats = app.settings.get_workspace_setting(workspace_id, - 'open_chats') - - active_accounts = app.settings.get_active_accounts() - for account, jid, type_, pinned in open_chats: - if account not in active_accounts: - continue - - self.add_chat_for_workspace(workspace_id, account, jid, type_, - pinned=pinned) - - for workspace_id in app.settings.get_workspaces(): - self._workspace_side_bar.activate_workspace(workspace_id) - self._chat_list_stack.show_chat_list(workspace_id) - break - - self._startup_finished = True - - @staticmethod - def _on_start_chat_clicked(_button): - app.app.activate_action('start-chat', GLib.Variant('s', '')) - - def _on_chat_selected(self, _chat_list_stack, _workspace_id, *args): - control = self.get_active_control() - if control is not None: - self._search_view.set_context(control.account, control.contact.jid) + self.add_workspace(workspace_id) + self._chat_page.load_workspace_chats(workspace_id) - def _on_search_history(self, _action, _param): - control = self.get_active_control() - if control is not None: - self._search_view.set_context(control.account, control.contact.jid) - self._search_view.clear() - self._search_revealer.show() - self._search_view.set_focus() + workspace_id = self._workspace_side_bar.get_first_workspace() + self.activate_workspace(workspace_id) - def _on_search_hide(self, *args): - self._search_revealer.hide() + self._set_startup_finished() def _on_event(self, event): if event.name == 'caps-update': @@ -600,9 +431,6 @@ def _on_event(self, event): if event.name == 'update-roster-avatar': return - for page in self._account_pages.values(): - page.process_event(event) - if not self.chat_exists(event.account, event.jid): if event.name == 'message-received': if event.properties.is_muc_pm: @@ -617,8 +445,7 @@ def _on_event(self, event): # No chat is open, dont handle any gui events return - self._chat_stack.process_event(event) - self._chat_list_stack.process_event(event) + self._main_stack.process_event(event) def quit(self): accounts = list(app.connections.keys()) ===================================== gajim/gtk/main_stack.py ===================================== @@ -0,0 +1,53 @@ +# This file is part of Gajim. +# +# Gajim is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; version 3 only. +# +# Gajim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. + +from gi.repository import Gtk + +from gajim.common import app + +from .chat_page import ChatPage +from .account_page import AccountPage + + +class MainStack(Gtk.Stack): + def __init__(self): + Gtk.Stack.__init__(self) + + self._chat_page = ChatPage() + self._chat_page.connect('chat-selected', self._on_chat_selected) + self.add_named(self._chat_page, 'chats') + + for account in list(app.connections.keys()): + account_page = AccountPage(account) + self.add_named(account_page, account) + + def show_chats(self, workspace_id): + self._chat_page.show_workspace_chats(workspace_id) + self.set_visible_child_name('chats') + + def show_account(self, account): + self.set_visible_child_name(account) + + def get_account_page(self, account): + return self.get_child_by_name(account) + + def get_chat_page(self): + return self.get_child_by_name('chats') + + def process_event(self, event): + for page in self.get_children(): + page.process_event(event) + + def _on_chat_selected(self, *args): + self.set_visible_child_name('chats') ===================================== gajim/gtk/workspace_side_bar.py ===================================== @@ -1,3 +1,16 @@ +# This file is part of Gajim. +# +# Gajim is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; version 3 only. +# +# Gajim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. from gi.repository import Gdk from gi.repository import Gtk @@ -10,7 +23,7 @@ class WorkspaceSideBar(Gtk.ListBox): - def __init__(self, chat_list_stack): + def __init__(self, chat_page): Gtk.ListBox.__init__(self) self.set_vexpand(True) self.set_valign(Gtk.Align.START) @@ -38,6 +51,7 @@ def __init__(self, chat_list_stack): self.add(AddWorkspace('add')) + chat_list_stack = chat_page.get_chat_list_stack() chat_list_stack.connect('unread-count-changed', self._on_unread_count_changed) chat_list_stack.connect('chat-selected', @@ -286,6 +300,7 @@ def __init__(self, workspace_id): self.update() def update(self): + app.interface.avatar_storage.invalidate_cache(self._workspace_id) scale = self.get_scale_factor() surface = app.interface.avatar_storage.get_workspace_surface( self._workspace_id, AvatarSize.WORKSPACE, scale) View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/c9580464022079b9a394c79d5c0dfd0d…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/c9580464022079b9a394c79d5c0dfd0d…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][master] Windows: Add gssapi dependency
by Philipp Hörist
28 Apr '21
28 Apr '21
Philipp Hörist pushed to branch master at gajim / gajim Commits: 72f489b4 by lovetox at 2021-04-28T08:15:35+02:00 Windows: Add gssapi dependency Fixes #10540 - - - - - 1 changed file: - win/_base.sh Changes: ===================================== win/_base.sh ===================================== @@ -92,7 +92,8 @@ function install_deps { mingw-w64-"${ARCH}"-python-pyopenssl \ mingw-w64-"${ARCH}"-python-certifi \ mingw-w64-"${ARCH}"-python-six \ - mingw-w64-"${ARCH}"-python-pygments + mingw-w64-"${ARCH}"-python-pygments \ + mingw-w64-"${ARCH}"-python-gssapi build_pip install precis-i18n View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/72f489b4c27440e5a03d0733cd7291f0…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/72f489b4c27440e5a03d0733cd7291f0…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][mainwindow] More Control work
by Philipp Hörist
27 Apr '21
27 Apr '21
Philipp Hörist pushed to branch mainwindow at gajim / gajim Commits: 16488c20 by lovetox at 2021-04-27T13:11:48+02:00 More Control work - - - - - 8 changed files: - gajim/chat_control.py - gajim/chat_control_base.py - gajim/groupchat_control.py - gajim/gtk/conversation/rows/base.py - gajim/gtk/conversation/rows/info.py - + gajim/gtk/conversation/rows/muc_subject.py - gajim/gtk/conversation/view.py - gajim/privatechat_control.py Changes: ===================================== gajim/chat_control.py ===================================== @@ -478,7 +478,7 @@ def _on_mam_message_received(self, event): if not event.properties.jid.bare_match(self.contact.jid): return - kind = '' # incoming + kind = 'incoming' if event.kind == KindConstant.CHAT_MSG_SENT: kind = 'outgoing' @@ -493,12 +493,12 @@ def _on_message_received(self, event): if not event.msgtxt: return - typ = '' + kind = 'incoming' if event.properties.is_sent_carbon: - typ = 'out' + kind = 'outgoing' self.add_message(event.msgtxt, - typ, + kind, tim=event.properties.timestamp, subject=event.properties.subject, displaymarking=event.displaymarking, @@ -529,7 +529,7 @@ def _on_message_sent(self, event): self.msg_textview, 'gajim-msg-correcting') self.add_message(event.message, - self.contact.jid, + 'outgoing', tim=event.timestamp, displaymarking=displaymarking, message_id=message_id, @@ -928,7 +928,7 @@ def get_our_nick(self): def add_message(self, text, - frm='', + kind, tim=None, subject=None, displaymarking=None, @@ -936,36 +936,14 @@ def add_message(self, correct_id=None, message_id=None, additional_data=None): - """ - Print a line in the conversation - - If frm is set to status: it's a status message. - if frm is set to error: it's an error message. The difference between - status and error is mainly that with error, msg count as a new - message (in systray and in control). - If frm is set to info: it's a information message. - If frm is set to print_queue: it is incoming from queue. - If frm is set to another value: it's an outgoing message. - If frm is not set: it's an incoming message. - """ - contact = self.contact if additional_data is None: additional_data = AdditionalDataDict() - if frm == 'error': - kind = 'error' - name = '' + if kind == 'incoming': + name = self.contact.name else: - if not frm: - kind = 'incoming' - name = contact.name - elif frm == 'print_queue': - kind = 'incoming_queue' - name = contact.name - else: - kind = 'outgoing' - name = self.get_our_nick() + name = self.get_our_nick() ChatControlBase.add_message(self, text, @@ -978,11 +956,6 @@ def add_message(self, correct_id=correct_id, additional_data=additional_data) - if text.startswith('/me ') or text.startswith('/me\n'): - self.old_msg_kind = None - else: - self.old_msg_kind = kind - def prepare_context_menu(self, hide_buttonbar_items=False): """ Set compact view menuitem active state sets active and sensitivity state @@ -1117,7 +1090,7 @@ def _on_presence_received(self, event): status = '- %s' % event.status if event.status else '' status_line = _('%(name)s is now %(show)s %(status)s') % { 'name': name, 'show': uf_show, 'status': status} - self.add_status_message(status_line) + self.add_info_message(status_line) def _info_bar_show_message(self): if self.info_bar.get_visible(): ===================================== gajim/chat_control_base.py ===================================== @@ -1073,13 +1073,8 @@ def save_message(self, message, msg_type): else: self.received_history_pos = pos - def add_info_message(self, text, message_id=None): - self.conversation_view.add_message( - text, 'info', '', None, message_id=message_id) - - def add_status_message(self, text): - self.conversation_view.add_message( - text, 'status', '', None) + def add_info_message(self, text): + self.conversation_view.add_info_message(text) def add_message(self, text, @@ -1108,16 +1103,13 @@ def add_message(self, log_line_id=msg_log_id, additional_data=additional_data) - if restored: - return - if message_id: if self._type.is_groupchat: self.last_msg_id = stanza_id or message_id else: self.last_msg_id = message_id - if kind in ('incoming', 'incoming_queue'): + if kind == 'incoming': # Record the history of received messages self.save_message(text, 'received') @@ -1334,7 +1326,7 @@ def add_messages(self, messages): for msg in messages: if not msg: continue - kind = 'status' + contact_name = msg.contact_name if msg.kind in ( KindConstant.SINGLE_MSG_RECV, KindConstant.CHAT_MSG_RECV): @@ -1346,6 +1338,9 @@ def add_messages(self, messages): KindConstant.SINGLE_MSG_SENT, KindConstant.CHAT_MSG_SENT): kind = 'outgoing' contact_name = self.get_our_nick() + else: + raise ValueError('no kind attribute') + if not msg.message: continue self.conversation_view.add_message( ===================================== gajim/groupchat_control.py ===================================== @@ -691,26 +691,23 @@ def _on_gc_message_received(self, event): additional_data=event.additional_data) event.needs_highlight = self.needs_visual_notification(event.msgtxt) - def add_message(self, text, contact='', tim=None, - displaymarking=None, correct_id=None, message_id=None, - stanza_id=None, additional_data=None): - """ - Add message to the ConversationsTextview - - If contact is set: it's a message from someone - If contact is not set: it's a message from the server or help. - """ - - if not contact: - # Message from the server - kind = 'status' - elif contact == self.contact.nickname: # it's us + def add_message(self, + text, + contact='', + tim=None, + displaymarking=None, + correct_id=None, + message_id=None, + stanza_id=None, + additional_data=None): + + if contact == self.contact.nickname: kind = 'outgoing' else: kind = 'incoming' # muc-specific chatstate - if kind == 'incoming': # it's a message NOT from us + if kind == 'incoming': # highlighting and sounds highlight, _sound = self.highlighting_for_message(text, tim) # other_tags_for_name.append('muc_nickname_color_%s' % contact) @@ -820,7 +817,7 @@ def _on_room_subject(self, _contact, _signal_name, properties): if (app.settings.get('show_subject_on_join') or not self.contact.is_joining): - self.add_info_message(text) + self.conversation_view.add_muc_subject(text) def _on_room_config_changed(self, _contact, _signal_name, properties): #
http://www.xmpp.org/extensions/xep-0045.html#roomconfig-notify
@@ -996,7 +993,7 @@ def _on_user_status_show_changed(self, message = _('{nick} is now {show}{status}').format(nick=nick, show=show, status=status) - self.add_status_message(message) + self.add_info_message(message) def _on_user_affiliation_changed(self, _contact, ===================================== gajim/gtk/conversation/rows/base.py ===================================== @@ -23,7 +23,6 @@ from gajim.common.i18n import _ from gajim.common.helpers import from_one_line -from ...conversation_textview import ConversationTextview from ...util import convert_rgba_to_hex from ...util import text_to_color from ...util import wrap_with_event_box ===================================== gajim/gtk/conversation/rows/info.py ===================================== @@ -12,40 +12,30 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. +import time from datetime import datetime from gi.repository import GLib from gi.repository import Gtk from gajim.common.const import AvatarSize -from gajim.common.i18n import _ from gajim.common.styling import process from .base import BaseRow from ..message_widget import MessageWidget -class InfoMessageRow(BaseRow): - def __init__(self, - account, - timestamp, - text, - kind, - subject, - history_mode=False): - BaseRow.__init__(self, account, history_mode=history_mode) +class InfoMessage(BaseRow): + def __init__(self, account, text): + BaseRow.__init__(self, account) + self.type = 'info' + timestamp = time.time() self.timestamp = datetime.fromtimestamp(timestamp) self.db_timestamp = timestamp - self.kind = kind - - if subject: - subject_title = _('Subject:') - text = (f'{subject_title}\n' - f'{GLib.markup_escape_text(subject)}\n' - f'{GLib.markup_escape_text(text)}') - else: - text = GLib.markup_escape_text(text) + self.kind = 'info' + + text = GLib.markup_escape_text(text) avatar_placeholder = Gtk.Box() avatar_placeholder.set_size_request(AvatarSize.ROSTER, -1) ===================================== gajim/gtk/conversation/rows/muc_subject.py ===================================== @@ -0,0 +1,52 @@ +# This file is part of Gajim. +# +# Gajim is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; version 3 only. +# +# Gajim is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Gajim. If not, see <
http://www.gnu.org/licenses/
>. + +import time +from datetime import datetime + +from gi.repository import GLib +from gi.repository import Gtk + +from gajim.common.styling import process + +from .base import BaseRow +from ..message_widget import MessageWidget + + +class MUCSubject(BaseRow): + + type = 'muc-subject' + + def __init__(self, account, text): + BaseRow.__init__(self, account) + + timestamp = time.time() + self.timestamp = datetime.fromtimestamp(timestamp) + self.db_timestamp = timestamp + + text = GLib.markup_escape_text(text) + + # avatar_placeholder = Gtk.Box() + # avatar_placeholder.set_size_request(AvatarSize.ROSTER, -1) + # self.grid.attach(avatar_placeholder, 0, 0, 1, 2) + timestamp_widget = self.create_timestamp_widget(self.timestamp) + timestamp_widget.set_valign(Gtk.Align.START) + self.grid.attach(timestamp_widget, 2, 0, 1, 1) + + result = process(text) + message_widget = MessageWidget(account) + message_widget.add_content(result) + + self.grid.attach(message_widget, 1, 0, 1, 1) + self.show_all() ===================================== gajim/gtk/conversation/view.py ===================================== @@ -30,8 +30,9 @@ from .conversation.rows.read_marker import ReadMarkerRow from .conversation.rows.scroll_hint import ScrollHintRow from .conversation.rows.message import MessageRow -from .conversation.rows.info import InfoMessageRow +from .conversation.rows.info import InfoMessage from .conversation.rows.date import DateRow +from .conversation.rows.muc_subject import MUCSubject log = logging.getLogger('gajim.gui.conversation_view') @@ -105,6 +106,14 @@ def _sort_func(self, row1, row2): return 0 return -1 if row1.timestamp < row2.timestamp else 1 + def add_muc_subject(self, text): + subject = MUCSubject(self._account, text) + self._insert_message(subject) + + def add_info_message(self, text): + message = InfoMessage(self._account, text) + self._insert_message(message) + def add_message(self, text, kind, @@ -122,43 +131,32 @@ def add_message(self, if not timestamp: timestamp = time.time() - muc_subject = bool(subject and self._contact is not None and - self._contact.is_groupchat) - if kind in ('status', 'info') or muc_subject: - message = InfoMessageRow( - self._account, - timestamp, - text, - kind, - subject, - history_mode=self._history_mode) - else: - if correct_id: - self.correct_message(correct_id, message_id, text) - return + if correct_id: + self.correct_message(correct_id, message_id, text) + return - avatar = self._get_avatar(kind, name) - - is_groupchat = False - if self._contact is not None: - is_groupchat = self._contact.is_groupchat - - message = MessageRow( - self._account, - message_id, - timestamp, - kind, - name, - text, - avatar, - is_groupchat, - additional_data=additional_data, - display_marking=display_marking, - marker=marker, - error=error, - encryption_enabled=self.encryption_enabled, - history_mode=self._history_mode, - log_line_id=log_line_id) + avatar = self._get_avatar(kind, name) + + is_groupchat = False + if self._contact is not None: + is_groupchat = self._contact.is_groupchat + + message = MessageRow( + self._account, + message_id, + timestamp, + kind, + name, + text, + avatar, + is_groupchat, + additional_data=additional_data, + display_marking=display_marking, + marker=marker, + error=error, + encryption_enabled=self.encryption_enabled, + history_mode=self._history_mode, + log_line_id=log_line_id) if message.type == 'chat': self._message_id_row_map[message.message_id] = message ===================================== gajim/privatechat_control.py ===================================== @@ -116,7 +116,7 @@ def _on_user_status_show_changed(self, message = _('{nick} is now {show}{status}').format(nick=nick, show=show, status=status) - self.add_status_message(message) + self.add_info_message(message) self.update_ui() # def _on_disconnected(self, event): View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/16488c203cddb121df156602a4909884…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/16488c203cddb121df156602a4909884…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][mainwindow] 2 commits: More ChatControl changes
by Philipp Hörist
27 Apr '21
27 Apr '21
Philipp Hörist pushed to branch mainwindow at gajim / gajim Commits: 15a0b039 by lovetox at 2021-04-27T11:07:47+02:00 More ChatControl changes - - - - - a35024a6 by lovetox at 2021-04-27T11:34:54+02:00 Refactor Add Message - - - - - 7 changed files: - gajim/chat_control.py - gajim/chat_control_base.py - gajim/groupchat_control.py - gajim/gtk/conversation/rows/info.py - gajim/gtk/conversation/rows/message.py - gajim/gtk/conversation/view.py - gajim/privatechat_control.py Changes: ===================================== gajim/chat_control.py ===================================== @@ -42,7 +42,6 @@ from gajim.common import app from gajim.common import helpers -from gajim.common import i18n from gajim.common.i18n import _ from gajim.common.helpers import AdditionalDataDict from gajim.common.helpers import open_uri @@ -67,7 +66,6 @@ from gajim.gui.util import format_tune from gajim.gui.util import format_location from gajim.gui.util import get_activity_icon_name -from gajim.gui.util import make_href_markup from gajim.gui.const import ControlType from gajim.command_system.implementation.hosts import ChatCommands @@ -187,20 +185,6 @@ def __init__(self, account, jid): # List of waiting infobar messages self.info_bar_queue = [] - self.subscribe_events() - - # if not session: - # # Don't use previous session if we want to a specific resource - # # and it's not the same - # if not resource: - # resource = contact.resource - # session = self._client.find_controlless_session( - # self.contact.jid, resource) - - # if session: - # session.control = self - # self.session = session - self.setup_seclabel() self.add_actions() self.update_ui() @@ -264,24 +248,15 @@ def add_actions(self): app.window.add_action(act) def update_actions(self): - win = app.window online = app.account_is_connected(self.account) - # Add to roster - # TODO - # if not isinstance(self.contact, GC_Contact) \ - # and _('Not in contact list') in self.contact.groups and \ - # self._client.roster_supported and online: - # win.lookup_action( - # 'add-to-roster-' + self.control_id).set_enabled(True) - # else: - # win.lookup_action( - # 'add-to-roster-' + self.control_id).set_enabled(False) + if self.type.is_chat: + self._get_action('add-to-roster-').set_enabled( + not self.contact.is_in_roster) # Block contact - win.lookup_action( - 'block-contact-' + self.control_id).set_enabled( - online and self._client.get_module('Blocking').supported) + self._get_action('block-contact-').set_enabled( + online and self._client.get_module('Blocking').supported) # Jingle AV detection if (self.contact.supports(Namespace.JINGLE_ICE_UDP) and @@ -297,31 +272,28 @@ def update_actions(self): self.jingle['audio'].available = False self.jingle['video'].available = False - win.lookup_action(f'start-call-{self.control_id}').set_enabled( + self._get_action(f'start-call-').set_enabled( online and (self.jingle['audio'].available or self.jingle['video'].available)) # Send message has_text = self.msg_textview.has_text() - win.lookup_action( - f'send-message-{self.control_id}').set_enabled(online and has_text) + self._get_action('send-message-').set_enabled(online and has_text) # Send file (HTTP File Upload) - httpupload = win.lookup_action( - 'send-file-httpupload-' + self.control_id) - httpupload.set_enabled( - online and self._client.get_module('HTTPUpload').available) + httpupload = self._get_action('send-file-httpupload-') + httpupload.set_enabled(online and + self._client.get_module('HTTPUpload').available) # Send file (Jingle) jingle_support = self.contact.supports(Namespace.JINGLE_FILE_TRANSFER_5) jingle_conditions = jingle_support and self.contact.is_available - jingle = win.lookup_action('send-file-jingle-' + self.control_id) + jingle = self._get_action('send-file-jingle-') jingle.set_enabled(online and jingle_conditions) # Send file - win.lookup_action( - 'send-file-' + self.control_id).set_enabled( - jingle.get_enabled() or httpupload.get_enabled()) + self._get_action('send-file-').set_enabled(jingle.get_enabled() or + httpupload.get_enabled()) # Set File Transfer Button tooltip if online and (httpupload.get_enabled() or jingle.get_enabled()): @@ -333,24 +305,17 @@ def update_actions(self): # Chat markers state = GLib.Variant.new_boolean( self.contact.settings.get('send_marker')) - win.lookup_action( - f'send-marker-{self.control_id}').change_state(state) + self._get_action('send-marker-').change_state(state) # Convert to GC if app.settings.get_account_setting(self.account, 'is_zeroconf'): - win.lookup_action( - 'invite-contacts-' + self.control_id).set_enabled(False) + self._get_action('invite-contacts-').set_enabled(False) else: - if self.contact.supports(Namespace.MUC) and online: - win.lookup_action( - 'invite-contacts-' + self.control_id).set_enabled(True) - else: - win.lookup_action( - 'invite-contacts-' + self.control_id).set_enabled(False) + enabled = self.contact.supports(Namespace.MUC) and online + self._get_action('invite-contacts-').set_enabled(enabled) # Information - win.lookup_action( - 'information-' + self.control_id).set_enabled(online) + self._get_action('information-').set_enabled(online) def remove_actions(self): super().remove_actions() @@ -375,8 +340,7 @@ def delegate_action(self, action): return res if action == 'show-contact-info': - app.window.lookup_action( - 'information-%s' % self.control_id).activate() + self._get_action('information-').activate() return Gdk.EVENT_STOP if action == 'send-file': @@ -385,8 +349,7 @@ def delegate_action(self, action): app.interface.roster.tree.grab_focus() return Gdk.EVENT_PROPAGATE - app.window.lookup_action( - 'send-file-%s' % self.control_id).activate() + self._get_action('send-file-').activate() return Gdk.EVENT_STOP return Gdk.EVENT_PROPAGATE @@ -414,20 +377,6 @@ def _on_send_marker(self, action, param): action.set_state(param) self.contact.settings.set('send_marker', param.get_boolean()) - def subscribe_events(self): - """ - Register listeners to the events class - """ - app.events.event_added_subscribe(self.on_event_added) - app.events.event_removed_subscribe(self.on_event_removed) - - def unsubscribe_events(self): - """ - Unregister listeners to the events class - """ - app.events.event_added_unsubscribe(self.on_event_added) - app.events.event_removed_unsubscribe(self.on_event_removed) - def _update_toolbar(self): # Formatting # TODO: find out what encryption allows for xhtml and which not @@ -986,8 +935,7 @@ def add_message(self, msg_log_id=None, correct_id=None, message_id=None, - additional_data=None, - error=None): + additional_data=None): """ Print a line in the conversation @@ -1024,14 +972,12 @@ def add_message(self, kind, name, tim, - subject=subject, - old_kind=self.old_msg_kind, displaymarking=displaymarking, msg_log_id=msg_log_id, message_id=message_id, correct_id=correct_id, - additional_data=additional_data, - error=error) + additional_data=additional_data) + if text.startswith('/me ') or text.startswith('/me\n'): self.old_msg_kind = None else: @@ -1062,8 +1008,6 @@ def shutdown(self): # instance object app.plugin_manager.remove_gui_extension_point('chat_control', self) - self.unsubscribe_events() - self.remove_actions() # Send 'gone' chatstate @@ -1077,12 +1021,6 @@ def shutdown(self): super(ChatControl, self).shutdown() app.check_finalize(self) - def minimizable(self): - return False - - def safe_shutdown(self): - return False - def allow_shutdown(self, method, on_yes, on_no, _on_minimize): time_ = app.last_message_time[self.account][self.contact.jid] # 2 seconds @@ -1395,46 +1333,3 @@ def on_event_added(self, event): _('Connection with peer cannot be established.')) elif event.type_ == 'gc-invitation': self._get_gc_invitation(event) - - def on_event_removed(self, event_list): - """ - Called when one or more events are removed from the event list - """ - for ev in event_list: - if ev.account != self.account: - continue - if ev.jid != self.contact.jid: - continue - if ev.type_ not in ('file-request', - 'file-completed', - 'file-error', - 'file-stopped', - 'file-request-error', - 'file-send-error', - 'gc-invitation', - 'jingle-incoming'): - continue - i = 0 - removed = False - for ib_msg in self.info_bar_queue: - if ev.type_ == 'gc-invitation': - if ev.muc == ib_msg[2][0]: - self.info_bar_queue.remove(ib_msg) - removed = True - elif ev.type_ == 'jingle-incoming': - # TODO: Need to be more specific here? - self.info_bar_queue.remove(ib_msg) - removed = True - else: # file-* - if ib_msg[2] == ev.file_props: - self.info_bar_queue.remove(ib_msg) - removed = True - if removed: - if i == 0: - # We are removing the one currently displayed - self.info_bar.set_no_show_all(True) - self.info_bar.hide() - # show next one? - GLib.idle_add(self._info_bar_show_message) - break - i += 1 ===================================== gajim/chat_control_base.py ===================================== @@ -267,6 +267,9 @@ def __init__(self, widget_name, account, jid): def _connect_contact_signals(self): raise NotImplementedError + def _get_action(self, name): + return app.window.lookup_action(name + self.control_id) + def process_event(self, event): method_name = event.name.replace('-', '_') method_name = f'_on_{method_name}' @@ -1072,7 +1075,7 @@ def save_message(self, message, msg_type): def add_info_message(self, text, message_id=None): self.conversation_view.add_message( - text, 'info', '', None, message_id=message_id, graphics=False) + text, 'info', '', None, message_id=message_id) def add_status_message(self, text): self.conversation_view.add_message( @@ -1083,36 +1086,14 @@ def add_message(self, kind, name, tim, - other_tags_for_name=None, - other_tags_for_time=None, - other_tags_for_text=None, restored=False, - subject=None, - old_kind=None, displaymarking=None, msg_log_id=None, message_id=None, stanza_id=None, correct_id=None, - additional_data=None, - marker=None, - error=None): - """ - Print 'chat' type messages - correct_id = (message_id, correct_id) - """ - jid = self.contact.jid - full_jid = self.contact.jid - end = False - if self.conversation_view.autoscroll or kind == 'outgoing': - end = True - - if other_tags_for_name is None: - other_tags_for_name = [] - if other_tags_for_time is None: - other_tags_for_time = [] - if other_tags_for_text is None: - other_tags_for_text = [] + additional_data=None): + if additional_data is None: additional_data = AdditionalDataDict() @@ -1121,14 +1102,11 @@ def add_message(self, kind, name, tim, - other_text_tags=other_tags_for_text, display_marking=displaymarking, message_id=message_id, correct_id=correct_id, log_line_id=msg_log_id, - additional_data=additional_data, - marker=marker, - error=error) + additional_data=additional_data) if restored: return @@ -1139,15 +1117,6 @@ def add_message(self, else: self.last_msg_id = message_id - if kind == 'incoming': - if (not self._type.is_groupchat or - # self.contact.can_notify() or TODO - 'marked' in other_tags_for_text): - # it's a normal message, or a muc message with want to be - # notified about if quitting just after - # other_tags_for_text == ['marked'] --> highlighted gc message - app.last_message_time[self.account][full_jid] = time.time() - if kind in ('incoming', 'incoming_queue'): # Record the history of received messages self.save_message(text, 'received') @@ -1162,60 +1131,6 @@ def add_message(self, # self.last_msg_id, # self._type) - # TODO old event Code - # if kind in ('incoming', 'incoming_queue', 'error'): - # gc_message = False - # if self._type.is_groupchat: - # gc_message = True - - # if ((self.parent_win and (not self.parent_win.get_active_control() or \ - # self != self.parent_win.get_active_control() or \ - # not self.parent_win.is_active() or not end)) or \ - # (gc_message and \ - # jid in app.interface.minimized_controls[self.account])) and \ - # kind in ('incoming', 'incoming_queue', 'error'): - # # we want to have save this message in events list - # # other_tags_for_text == ['marked'] --> highlighted gc message - # if gc_message: - # if 'marked' in other_tags_for_text: - # event_type = events.PrintedMarkedGcMsgEvent - # else: - # event_type = events.PrintedGcMsgEvent - # event = 'gc_message_received' - # else: - # if self._type.is_chat: - # event_type = events.PrintedChatEvent - # else: - # event_type = events.PrintedPmEvent - # event = 'message_received' - # show_in_roster = get_show_in_roster(event, self.session) - # show_in_systray = get_show_in_systray( - # event_type.type_, self.account, self.contact.jid) - - # event = event_type(text, - # subject, - # self, - # msg_log_id, - # message_id=message_id, - # stanza_id=stanza_id, - # show_in_roster=show_in_roster, - # show_in_systray=show_in_systray) - # app.events.add_event(self.account, full_jid, event) - # # We need to redraw contact if we show in roster - # if show_in_roster: - # app.interface.roster.draw_contact(self.contact.jid, - # self.account) - - # if (not self.parent_win.get_active_control() or \ - # self != self.parent_win.get_active_control() or \ - # not self.parent_win.is_active() or not end) and \ - # kind in ('incoming', 'incoming_queue', 'error'): - # self.parent_win.redraw_tab(self) - # if not self.parent_win.is_active(): - # self.parent_win.show_title(True, self) # Enabled Urgent hint - # else: - # self.parent_win.show_title(False, self) # Disabled Urgent hint - def toggle_emoticons(self): """ Hide show emoticons_button @@ -1438,13 +1353,11 @@ def add_messages(self, messages): kind, contact_name, msg.time, - subject=msg.subject, additional_data=msg.additional_data, message_id=msg.message_id, log_line_id=msg.log_line_id, marker=msg.marker, - error=msg.error, - history=True) + error=msg.error) def has_focus(self): if app.window.get_property('has-toplevel-focus'): ===================================== gajim/groupchat_control.py ===================================== @@ -408,10 +408,6 @@ def _is_subject_change_allowed(self): return False return self.disco_info.muc_subjectmod or False - def _get_action(self, name): - win = app.window - return win.lookup_action(name + self.control_id) - def _show_page(self, name): transition = Gtk.StackTransitionType.SLIDE_DOWN if name == 'groupchat': @@ -705,9 +701,6 @@ def add_message(self, text, contact='', tim=None, If contact is not set: it's a message from the server or help. """ - other_tags_for_name = [] - other_tags_for_text = [] - if not contact: # Message from the server kind = 'status' @@ -720,10 +713,10 @@ def add_message(self, text, contact='', tim=None, if kind == 'incoming': # it's a message NOT from us # highlighting and sounds highlight, _sound = self.highlighting_for_message(text, tim) - other_tags_for_name.append('muc_nickname_color_%s' % contact) - if highlight: - other_tags_for_name.append('bold') - other_tags_for_text.append('marked') + # other_tags_for_name.append('muc_nickname_color_%s' % contact) + # if highlight: + # other_tags_for_name.append('bold') + # other_tags_for_text.append('marked') self._nick_completion.record_message(contact, highlight) @@ -734,9 +727,6 @@ def add_message(self, text, contact='', tim=None, kind, contact, tim, - other_tags_for_name, - [], - other_tags_for_text, displaymarking=displaymarking, correct_id=correct_id, message_id=message_id, ===================================== gajim/gtk/conversation/rows/info.py ===================================== @@ -30,10 +30,8 @@ def __init__(self, account, timestamp, text, - other_text_tags, kind, subject, - graphics, history_mode=False): BaseRow.__init__(self, account, history_mode=history_mode) self.type = 'info' @@ -49,8 +47,6 @@ def __init__(self, else: text = GLib.markup_escape_text(text) - other_text_tags.append('status') - avatar_placeholder = Gtk.Box() avatar_placeholder.set_size_request(AvatarSize.ROSTER, -1) self.grid.attach(avatar_placeholder, 0, 0, 1, 2) ===================================== gajim/gtk/conversation/rows/message.py ===================================== @@ -45,7 +45,6 @@ def __init__(self, kind, name, text, - other_text_tags, avatar, is_groupchat, additional_data=None, @@ -56,12 +55,6 @@ def __init__(self, history_mode=False, log_line_id=None): - # other_tags_for_name contained 'marked', 'bold' and - # 'muc_nickname_color_', which are now derived from - # other_text_tags ('marked') - - # other_tags_for_time were always empty? - BaseRow.__init__(self, account, history_mode=history_mode) self.type = 'chat' self.timestamp = datetime.fromtimestamp(timestamp) @@ -76,10 +69,10 @@ def __init__(self, self._has_receipt = marker == 'received' self._has_displayed = marker == 'displayed' - if is_groupchat: - if other_text_tags and 'marked' in other_text_tags: - self.get_style_context().add_class( - 'conversation-mention-highlight') + # if is_groupchat: + # if other_text_tags and 'marked' in other_text_tags: + # self.get_style_context().add_class( + # 'conversation-mention-highlight') result = process(text) self._message_widget = MessageWidget(account) ===================================== gajim/gtk/conversation/view.py ===================================== @@ -110,7 +110,6 @@ def add_message(self, kind, name, timestamp, - other_text_tags=None, log_line_id=None, message_id=None, correct_id=None, @@ -118,24 +117,11 @@ def add_message(self, additional_data=None, subject=None, marker=None, - error=None, - history=False, - graphics=True): - - log.debug( - 'Adding message: %s, %s, %s, %s, message_id: %s, correct_id: %s, ' - 'other_text_tags: %s, display_marking: %s, additional_data: %s, ' - 'subject: %s, marker: %s, error: %s, history: %s, graphics: %s', - text, kind, name, timestamp, message_id, correct_id, - other_text_tags, display_marking, additional_data, subject, - marker, error, history, graphics) + error=None): if not timestamp: timestamp = time.time() - if other_text_tags is None: - other_text_tags = [] - muc_subject = bool(subject and self._contact is not None and self._contact.is_groupchat) if kind in ('status', 'info') or muc_subject: @@ -143,10 +129,8 @@ def add_message(self, self._account, timestamp, text, - other_text_tags, kind, subject, - graphics, history_mode=self._history_mode) else: if correct_id: @@ -166,7 +150,6 @@ def add_message(self, kind, name, text, - other_text_tags, avatar, is_groupchat, additional_data=additional_data, ===================================== gajim/privatechat_control.py ===================================== @@ -161,18 +161,7 @@ def send_message(self, message, xhtml=None, process_commands=True, attention=attention) def update_ui(self): - if not self.contact.is_available: - self.got_disconnected() - else: - self.got_connected() + ChatControl.update_ui(self) def _on_user_avatar_update(self, *args): self._update_avatar() - - def got_disconnected(self): - ChatControl.got_disconnected(self) - ChatControl.update_ui(self) - - def got_connected(self): - ChatControl.got_connected(self) - ChatControl.update_ui(self) View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/5c59b8d637b7eee8df583595801a064…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/5c59b8d637b7eee8df583595801a064…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
[Git][gajim/gajim][mainwindow] Refactor accessing muc data in controls
by Philipp Hörist
27 Apr '21
27 Apr '21
Philipp Hörist pushed to branch mainwindow at gajim / gajim Commits: 5c59b8d6 by lovetox at 2021-04-27T09:47:12+02:00 Refactor accessing muc data in controls - - - - - 9 changed files: - gajim/chat_control.py - gajim/chat_control_base.py - gajim/common/modules/caps.py - gajim/common/modules/chat_markers.py - gajim/common/modules/contacts.py - gajim/common/modules/muc.py - gajim/groupchat_control.py - gajim/gtk/chat_stack.py - gajim/privatechat_control.py Changes: ===================================== gajim/chat_control.py ===================================== @@ -99,13 +99,11 @@ class ChatControl(ChatControlBase): # processed with this command host. COMMAND_HOST = ChatCommands # type: ClassVar[Type[CommandHost]] - def __init__(self, parent_win, jid, acct, session, resource=None): + def __init__(self, account, jid): ChatControlBase.__init__(self, - parent_win, 'chat_control', - jid, - acct, - resource) + account, + jid) self.last_recv_message_id = None self.last_recv_message_marks = None @@ -245,7 +243,7 @@ def add_actions(self): action_name, func = action act = Gio.SimpleAction.new(action_name + self.control_id, None) act.connect('activate', func) - self.parent_win.window.add_action(act) + app.window.add_action(act) chatstate = self.contact.settings.get('send_chatstate') @@ -254,7 +252,7 @@ def add_actions(self): GLib.VariantType.new("s"), GLib.Variant("s", chatstate)) act.connect('change-state', self._on_send_chatstate) - self.parent_win.window.add_action(act) + app.window.add_action(act) marker = self.contact.settings.get('send_marker') @@ -263,10 +261,10 @@ def add_actions(self): None, GLib.Variant.new_boolean(marker)) act.connect('change-state', self._on_send_marker) - self.parent_win.window.add_action(act) + app.window.add_action(act) def update_actions(self): - win = self.parent_win.window + win = app.window online = app.account_is_connected(self.account) # Add to roster @@ -366,7 +364,7 @@ def remove_actions(self): 'send-marker-', ] for action in actions: - self.parent_win.window.remove_action(f'{action}{self.control_id}') + app.window.remove_action(f'{action}{self.control_id}') def focus(self): self.msg_textview.grab_focus() @@ -377,7 +375,7 @@ def delegate_action(self, action): return res if action == 'show-contact-info': - self.parent_win.window.lookup_action( + app.window.lookup_action( 'information-%s' % self.control_id).activate() return Gdk.EVENT_STOP @@ -387,7 +385,7 @@ def delegate_action(self, action): app.interface.roster.tree.grab_focus() return Gdk.EVENT_PROPAGATE - self.parent_win.window.lookup_action( + app.window.lookup_action( 'send-file-%s' % self.control_id).activate() return Gdk.EVENT_STOP @@ -499,8 +497,6 @@ def _on_location_received(self, _event): def _on_nickname_received(self, _event): self.update_ui() - self.parent_win.redraw_tab(self) - self.parent_win.show_title() def _on_update_client_info(self, event): contact = app.contacts.get_contact( @@ -527,7 +523,7 @@ def _on_caps_update(self, event): def _on_mam_message_received(self, event): if event.properties.is_muc_pm: - if not event.properties.jid == self.contact.get_full_jid(): + if not event.properties.jid == self.contact.jid: return else: if not event.properties.jid.bare_match(self.contact.jid): @@ -608,19 +604,6 @@ def _nec_ping(self, event): elif event.name == 'ping-error': self.add_info_message(event.error) - def change_resource(self, resource): - old_full_jid = self.get_full_jid() - self.resource = resource - new_full_jid = self.get_full_jid() - # update app.last_message_time - if old_full_jid in app.last_message_time[self.account]: - app.last_message_time[self.account][new_full_jid] = \ - app.last_message_time[self.account][old_full_jid] - # update events - app.events.change_jid(self.account, old_full_jid, new_full_jid) - # update MessageWindow._controls - self.parent_win.change_jid(self.account, old_full_jid, new_full_jid) - # Jingle AV def _on_start_call(self, *args): audio_state = self.jingle['audio'].state @@ -771,7 +754,7 @@ def update_video(self): self.xml.outgoing_viewport.add(self._video_widget_self) session = self._client.get_module('Jingle').get_jingle_session( - self.contact.get_full_jid(), self.jingle['video'].sid) + self.contact.jid, self.jingle['video'].sid) content = session.get_content('video') content.do_setup(sink_self, sink_other) @@ -834,7 +817,7 @@ def close_jingle_content(self, jingle_type: str, return session = self._client.get_module('Jingle').get_jingle_session( - self.contact.get_full_jid(), jingle.sid) + self.contact.jid, jingle.sid) if session: content = session.get_content(jingle_type) if content: @@ -857,7 +840,7 @@ def _on_jingle_button_toggled(self, jingle_types): if all(item in jingle_types for item in ['audio', 'video']): # Both 'audio' and 'video' in jingle_types sid = self._client.get_module('Jingle').start_audio_video( - self.contact.get_full_jid()) + self.contact.jid) self.set_jingle_state('audio', JingleState.CONNECTING, sid) self.set_jingle_state('video', JingleState.CONNECTING, sid) return @@ -867,7 +850,7 @@ def _on_jingle_button_toggled(self, jingle_types): self.close_jingle_content('audio') else: sid = self._client.get_module('Jingle').start_audio( - self.contact.get_full_jid()) + self.contact.jid) self.set_jingle_state('audio', JingleState.CONNECTING, sid) if 'video' in jingle_types: @@ -875,12 +858,12 @@ def _on_jingle_button_toggled(self, jingle_types): self.close_jingle_content('video') else: sid = self._client.get_module('Jingle').start_video( - self.contact.get_full_jid()) + self.contact.jid) self.set_jingle_state('video', JingleState.CONNECTING, sid) def _get_audio_content(self): session = self._client.get_module('Jingle').get_jingle_session( - self.contact.get_full_jid(), self.jingle['audio'].sid) + self.contact.jid, self.jingle['audio'].sid) return session.get_content('audio') def on_num_button_pressed(self, _widget, num): @@ -912,11 +895,11 @@ def on_location_eventbox_leave_notify_event(self, _widget, _event): Just moved the mouse so show the cursor """ cursor = get_cursor('default') - self.parent_win.window.get_window().set_cursor(cursor) + app.window.get_window().set_cursor(cursor) def on_location_eventbox_enter_notify_event(self, _widget, _event): cursor = get_cursor('pointer') - self.parent_win.window.get_window().set_cursor(cursor) + app.window.get_window().set_cursor(cursor) def update_ui(self): # The name banner is drawn here @@ -932,14 +915,14 @@ def draw_banner_text(self): """ contact = self.contact name = contact.name - if self.resource: - name += '/' + self.resource - if self._type.is_privatechat: - name = i18n.direction_mark + _( - '%(nickname)s from group chat %(room_name)s') % \ - {'nickname': name, 'room_name': self.room_name} + # if self.resource: + # name += '/' + self.resource + # if self._type.is_privatechat: + # name = i18n.direction_mark + _( + # '%(nickname)s from group chat %(room_name)s') % \ + # {'nickname': name, 'room_name': self.room_name} - name = i18n.direction_mark + GLib.markup_escape_text(name) + # name = i18n.direction_mark + GLib.markup_escape_text(name) cs = self.contact.chatstate if cs is not None: @@ -1091,17 +1074,6 @@ def shutdown(self): self.close_jingle_content(jingle_type, shutdown=True) self.jingle.clear() - # disconnect self from session - if self.session: - self.session.control = None - - # Clean events - app.events.remove_events( - self.account, - self.get_full_jid(), - types=['printed_%s' % self._type, str(self._type)]) - # Remove contact instance if contact has been removed - super(ChatControl, self).shutdown() app.check_finalize(self) @@ -1112,7 +1084,7 @@ def safe_shutdown(self): return False def allow_shutdown(self, method, on_yes, on_no, _on_minimize): - time_ = app.last_message_time[self.account][self.get_full_jid()] + time_ = app.last_message_time[self.account][self.contact.jid] # 2 seconds if time.time() - time_ < 2: no_log_for = app.settings.get_account_setting( @@ -1136,7 +1108,7 @@ def allow_shutdown(self, method, on_yes, on_no, _on_minimize): DialogButton.make('Remove', text=_('_Close'), callback=lambda: on_yes(self))], - transient_for=self.parent_win.window).show() + transient_for=app.window).show() return on_yes(self) @@ -1144,7 +1116,7 @@ def _on_avatar_update(self, _contact, _signal_name): self._update_avatar() def _update_avatar(self): - scale = self.parent_win.window.get_scale_factor() + scale = app.window.get_scale_factor() surface = self.contact.get_avatar(AvatarSize.CHAT, scale) self.xml.avatar_image.set_from_surface(surface) @@ -1200,7 +1172,6 @@ def _on_presence_received(self, event): name = self.contact.name self.update_ui() - self.parent_win.redraw_tab(self) if not app.settings.get('print_status_in_chats'): return ===================================== gajim/chat_control_base.py ===================================== @@ -98,20 +98,17 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper): _type = None # type: ControlType - def __init__(self, parent_win, widget_name, jid, acct, - resource=None): + def __init__(self, widget_name, account, jid): EventHelper.__init__(self) # Undo needs this variable to know if space has been pressed. # Initialize it to True so empty textview is saved in undo list self.space_pressed = True self.handlers = {} - self.parent_win = parent_win - self.account = acct - self.resource = resource + self.account = account - self._client = app.get_client(acct) + self._client = app.get_client(account) groupchat = self._type != ControlType.CHAT self.contact = self._client.get_module('Contacts').get_contact( @@ -123,7 +120,7 @@ def __init__(self, parent_win, widget_name, jid, acct, self.control_id = str(uuid.uuid4()) self.session = None - app.last_message_time[self.account][self.get_full_jid()] = 0 + app.last_message_time[self.account][self.contact.jid] = 0 self.xml = get_builder('%s.ui' % widget_name) self.xml.connect_signals(self) @@ -241,10 +238,10 @@ def __init__(self, parent_win, widget_name, jid, acct, self._client.get_module('Chatstate').set_active(self.contact) - if parent_win is not None: - id_ = parent_win.window.connect('motion-notify-event', - self._on_window_motion_notify) - self.handlers[id_] = parent_win.window + # TODO + # id_ = app.window.connect('motion-notify-event', + # self._on_window_motion_notify) + # self.handlers[id_] = app.window self.encryption = self.get_encryption_state() self.conversation_view.encryption_enabled = self.encryption is not None @@ -322,12 +319,6 @@ def is_privatechat(self): def is_groupchat(self): return self._type.is_groupchat - def get_full_jid(self): - fjid = self.contact.jid - if self.resource: - fjid += '/' + self.resource - return fjid - def minimizable(self): """ Called to check if control can be minimized @@ -360,15 +351,6 @@ def allow_shutdown(self, method, on_response_yes, on_response_no, def focus(self): raise NotImplementedError - def get_nb_unread(self): - jid = self.contact.jid - if self.resource: - jid += '/' + self.resource - return len(app.events.get_events( - self.account, - jid, - ['printed_%s' % self._type, str(self._type)])) - def draw_banner(self): """ Draw the fat line at the top of the window @@ -522,7 +504,7 @@ def add_actions(self): GLib.VariantType.new('s'), GLib.Variant('s', self.encryption or 'disabled')) action.connect('change-state', self.change_encryption) - self.parent_win.window.add_action(action) + app.window.add_action(action) actions = { 'send-message-%s': self._on_send_message, @@ -535,7 +517,7 @@ def add_actions(self): action = Gio.SimpleAction.new(name % self.control_id, None) action.connect('activate', func) action.set_enabled(False) - self.parent_win.window.add_action(action) + app.window.add_action(action) def remove_actions(self): actions = [ @@ -547,7 +529,7 @@ def remove_actions(self): ] for action in actions: - self.parent_win.window.remove_action(f'{action}{self.control_id}') + app.window.remove_action(f'{action}{self.control_id}') def change_encryption(self, action, param): encryption = param.get_string() @@ -783,9 +765,9 @@ def _paste_event_confirmed(self, is_checked, image): def _get_pref_ft_method(self): ft_pref = app.settings.get_account_setting(self.account, 'filetransfer_preference') - httpupload = self.parent_win.window.lookup_action( + httpupload = app.window.lookup_action( 'send-file-httpupload-%s' % self.control_id) - jingle = self.parent_win.window.lookup_action( + jingle = app.window.lookup_action( 'send-file-jingle-%s' % self.control_id) if self._type.is_groupchat: @@ -1038,9 +1020,6 @@ def _on_window_motion_notify(self, *args): """ It gets called no matter if it is the active window or not """ - if not self.parent_win: - # when a groupchat is minimized there is no parent window - return # TODO return if self.parent_win.get_active_jid() == self.contact.jid: @@ -1050,8 +1029,7 @@ def _on_window_motion_notify(self, *args): def _on_message_tv_buffer_changed(self, textbuffer): has_text = self.msg_textview.has_text() - if self.parent_win is not None: - self.parent_win.window.lookup_action( + app.window.lookup_action( 'send-message-' + self.control_id).set_enabled(has_text) if textbuffer.get_char_count() and self.encryption: @@ -1124,7 +1102,7 @@ def add_message(self, correct_id = (message_id, correct_id) """ jid = self.contact.jid - full_jid = self.get_full_jid() + full_jid = self.contact.jid end = False if self.conversation_view.autoscroll or kind == 'outgoing': end = True @@ -1253,9 +1231,6 @@ def set_emoticon_popover(self): if not app.settings.get('emoticons_theme'): return - if not self.parent_win: - return - if sys.platform in ('win32', 'darwin'): emoji_chooser.text_widget = self.msg_textview self.xml.emoticons_button.set_popover(emoji_chooser) @@ -1271,13 +1246,13 @@ def _on_emoticon_button_clicked(self, _widget): self.xml.emoticons_button.set_property('active', False) def on_color_menuitem_activate(self, _widget): - color_dialog = Gtk.ColorChooserDialog(None, self.parent_win.window) + color_dialog = Gtk.ColorChooserDialog(None, app.window) color_dialog.set_use_alpha(False) color_dialog.connect('response', self.msg_textview.color_set) color_dialog.show_all() def on_font_menuitem_activate(self, _widget): - font_dialog = Gtk.FontChooserDialog(None, self.parent_win.window) + font_dialog = Gtk.FontChooserDialog(None, app.window) start, finish = self.msg_textview.get_active_iters() font_dialog.connect('response', self.msg_textview.font_set, start, finish) font_dialog.show_all() @@ -1370,7 +1345,7 @@ def set_control_active(self, state): if self._type.is_groupchat: type_ = ['printed_gc_msg', 'printed_marked_gc_msg'] if not app.events.remove_events(self.account, - self.get_full_jid(), + self.contact.jid, types=type_): # There were events to remove self.redraw_after_event_removed(jid) @@ -1472,10 +1447,9 @@ def add_messages(self, messages): history=True) def has_focus(self): - if self.parent_win: - if self.parent_win.window.get_property('has-toplevel-focus'): - if self == self.parent_win.get_active_control(): - return True + if app.window.get_property('has-toplevel-focus'): + if self == app.window.get_active_control(): + return True return False def scroll_messages(self, direction, msg_buf, msg_type): ===================================== gajim/common/modules/caps.py ===================================== @@ -212,9 +212,11 @@ def preconditions_met(self): return False if self._from_muc: - muc = client.get_module('MUC').get_muc_data(self.entity.jid.bare) + contact = client.get_module('Contacts').get_contact( + self.entity.jid.bare, + groupchat=True) - if muc is None or not muc.state.is_joined: + if not contact.is_joined: self.set_obsolete() return False ===================================== gajim/common/modules/chat_markers.py ===================================== @@ -45,9 +45,11 @@ def _process_chat_marker(self, _con, _stanza, properties): return if properties.type.is_groupchat: - muc_data = self._con.get_module('MUC').get_muc_data( - properties.muc_jid) - if muc_data is None: + contact = self._con.get_module('Contacts').get_contact( + properties.muc_jid, + groupchat=True) + if not contact.is_joined: + self._log.warning('Received chat marker while not joined') return if properties.muc_nickname != muc_data.nick: ===================================== gajim/common/modules/contacts.py ===================================== @@ -346,11 +346,6 @@ def __init__(self, logger, jid, account): def is_groupchat(self): return True - @property - def state(self): - muc_data = self._module('MUC').get_muc_data(self._jid) - return muc_data.state - def add_resource(self, resource): jid = self._jid.new_with(resource=resource) contact = GroupchatParticipant(self._log, jid, self._account) @@ -392,6 +387,26 @@ def update_avatar(self, *args): app.interface.avatar_storage.invalidate_cache(self._jid) self.notify('avatar-update') + def get_self(self): + nick = self.nickname + if nick is None: + return None + return self.get_resource(nick) + + @property + def nickname(self): + muc_data = self._module('MUC').get_muc_data(self._jid) + if muc_data is None: + return None + return muc_data.nick + + @property + def occupant_jid(self): + muc_data = self._module('MUC').get_muc_data(self._jid) + if muc_data is None: + return None + return muc_data.occupant_jid + @property def is_joined(self): muc_data = self._module('MUC').get_muc_data(self._jid) @@ -399,6 +414,20 @@ def is_joined(self): return False return muc_data.state.is_joined + @property + def is_joining(self): + muc_data = self._module('MUC').get_muc_data(self._jid) + if muc_data is None: + return False + return muc_data.state.is_joining + + @property + def is_not_joined(self): + muc_data = self._module('MUC').get_muc_data(self._jid) + if muc_data is None: + return True + return muc_data.state.is_not_joined + def set_not_joined(self): for contact in self._resources.values(): contact.update_presence(UNKNOWN_MUC_PRESENCE, notify=False) ===================================== gajim/common/modules/muc.py ===================================== @@ -116,7 +116,7 @@ def __init__(self, con): self._muc_service_jid = None self._joined_users = defaultdict(dict) self._mucs = {} - + self._muc_nicknames = {} def _on_resume_failed(self, _client, _signal_name): self._reset_presence() @@ -147,6 +147,10 @@ def pass_disco(self, info): def get_muc_data(self, room_jid): return self._mucs.get(room_jid) + def set_password(self, room_jid, password): + muc_data = self.get_muc_data(room_jid) + muc_data.password = password + def _get_mucs_with_state(self, states): return [muc for muc in self._mucs.values() if muc.state in states] ===================================== gajim/groupchat_control.py ===================================== @@ -86,12 +86,11 @@ class GroupchatControl(ChatControlBase): # will be processed with this command host. COMMAND_HOST = GroupChatCommands - def __init__(self, parent_win, jid, muc_data, acct): + def __init__(self, account, jid): ChatControlBase.__init__(self, - parent_win, 'groupchat_control', - jid, - acct) + account, + jid) self._client.connect_signal('state-changed', self._on_client_state_changed) @@ -119,12 +118,9 @@ def __init__(self, parent_win, jid, muc_data, acct): self.xml.roster_revealer.add(self.roster) self.roster.connect('row-activated', self._on_roster_row_activated) - if parent_win is not None: - self.add_actions() - GLib.idle_add(self.update_actions) - self.scale_factor = parent_win.window.get_scale_factor() - else: - self.scale_factor = app.interface.roster.scale_factor + self.add_actions() + GLib.idle_add(self.update_actions) + self.scale_factor = app.window.get_scale_factor() if not app.settings.get('hide_groupchat_banner'): self.xml.banner_eventbox.set_no_show_all(False) @@ -246,45 +242,33 @@ def _connect_contact_signals(self): }) def _on_muc_state_changed(self, _contact, _signal_name): - state = self.contact.state - if state == MUCJoinedState.JOINING: + if self.contact.is_joining: self._groupchat_state.set_joining() - if state == MUCJoinedState.JOINED: + if self.contact.is_joined: self._set_control_active() self.show_roster() self._groupchat_state.set_joined() - elif state == MUCJoinedState.NOT_JOINED: + elif self.contact.is_not_joined: self._set_control_inactive() def _on_client_state_changed(self, _client, _signal_name, state): pass - @property - def _muc_data(self): - return self._client.get_module('MUC').get_muc_data(self.room_jid) - @property def _nick_completion(self): if self.__nick_completion is None: - self.__nick_completion = NickCompletionGenerator(self._muc_data.nick) + self.__nick_completion = NickCompletionGenerator( + self.contact.nickname) return self.__nick_completion - @property - def nick(self): - return self._muc_data.nick - @property def subject(self): if self._subject_data is None: return '' return self._subject_data.subject - @property - def room_name(self): - return self.contact.get_shown_name() - @property def disco_info(self): return app.storage.cache.get_last_disco_info(self.contact.jid) @@ -316,50 +300,51 @@ def add_actions(self): variant = GLib.VariantType.new(variant) act = Gio.SimpleAction.new(action_name + self.control_id, variant) act.connect("activate", func) - self.parent_win.window.add_action(act) + app.window.add_action(act) def update_actions(self, *args): - if self._muc_data is None: - return - - contact = self.contact.get_resource(self.nick) + joined = self.contact.is_joined + if joined: + contact = self.contact.get_self() # Destroy Room - self._get_action('destroy-').set_enabled(self.is_connected and + self._get_action('destroy-').set_enabled(joined and contact.affiliation.is_owner) # Configure Room self._get_action('configure-').set_enabled( - self.is_connected and contact.affiliation in (Affiliation.ADMIN, - Affiliation.OWNER)) + joined and contact.affiliation in (Affiliation.ADMIN, + Affiliation.OWNER)) - self._get_action('request-voice-').set_enabled(self.is_connected and + self._get_action('request-voice-').set_enabled(joined and contact.role.is_visitor) + self._get_action('rename-groupchat-').set_enabled(joined) + # Change Subject subject_change = self._is_subject_change_allowed() - self._get_action('change-subject-').set_enabled(self.is_connected and + self._get_action('change-subject-').set_enabled(joined and subject_change) # Change Nick - self._get_action('change-nickname-').set_enabled(self.is_connected) + self._get_action('change-nickname-').set_enabled(joined) # Execute command - self._get_action('execute-command-').set_enabled(self.is_connected) + self._get_action('execute-command-').set_enabled(joined) # Send message has_text = self.msg_textview.has_text() self._get_action('send-message-').set_enabled( - self.is_connected and has_text) + joined and has_text) # Send file (HTTP File Upload) httpupload = self._get_action( 'send-file-httpupload-') - httpupload.set_enabled(self.is_connected and + httpupload.set_enabled(joined and self._client.get_module('HTTPUpload').available) self._get_action('send-file-').set_enabled(httpupload.get_enabled()) - if self.is_connected and httpupload.get_enabled(): + if joined and httpupload.get_enabled(): tooltip_text = _('Send File…') max_file_size = self._client.get_module('HTTPUpload').max_file_size if max_file_size is not None: @@ -374,17 +359,17 @@ def update_actions(self, *args): if self.disco_info is not None: vcard_support = self.disco_info.supports(Namespace.VCARD) self._get_action('upload-avatar-').set_enabled( - self.is_connected and + joined and vcard_support and contact.affiliation.is_owner) - self._get_action('contact-information-').set_enabled(self.is_connected) + self._get_action('contact-information-').set_enabled(joined) - self._get_action('execute-command-').set_enabled(self.is_connected) + self._get_action('execute-command-').set_enabled(joined) - self._get_action('ban-').set_enabled(self.is_connected) + self._get_action('ban-').set_enabled(joined) - self._get_action('kick-').set_enabled(self.is_connected) + self._get_action('kick-').set_enabled(joined) def remove_actions(self): super().remove_actions() @@ -409,10 +394,13 @@ def remove_actions(self): ] for action in actions: - self.parent_win.window.remove_action(f'{action}{self.control_id}') + app.window.remove_action(f'{action}{self.control_id}') def _is_subject_change_allowed(self): - contact = self.contact.get_resource(self.nick) + contact = self.contact.get_self() + if contact is None: + return False + if contact.affiliation in (Affiliation.OWNER, Affiliation.ADMIN): return True @@ -421,7 +409,7 @@ def _is_subject_change_allowed(self): return self.disco_info.muc_subjectmod or False def _get_action(self, name): - win = self.parent_win.window + win = app.window return win.lookup_action(name + self.control_id) def _show_page(self, name): @@ -519,7 +507,7 @@ def _on_configure_room(self, _action, _param): win.present() return - contact = self.contact.get_resource(self.nick) + contact = self.contact.get_self() if contact.affiliation.is_owner: self._client.get_module('MUC').request_config( self.room_jid, callback=self._on_configure_form_received) @@ -567,7 +555,7 @@ def _on_accept(filename): callback=self._on_upload_avatar_result) AvatarChooserDialog(_on_accept, - transient_for=self.parent_win.window, + transient_for=app.window, modal=True) def _on_upload_avatar_result(self, task): @@ -623,23 +611,6 @@ def show_roster(self): self.xml.roster_revealer.set_transition_type(transition) self.xml.roster_revealer.set_reveal_child(show) - def on_groupchat_maximize(self): - self.roster.enable_tooltips() - self.add_actions() - self.update_actions() - self.set_lock_image() - self.draw_banner_text() - type_ = ['printed_gc_msg', 'printed_marked_gc_msg'] - if not app.events.remove_events(self.account, - self.get_full_jid(), - types=type_): - # XEP-0333 Send <displayed> marker - self._client.get_module('ChatMarkers').send_displayed_marker( - self.contact, - self.last_msg_id, - self._type) - self.last_msg_id = None - def _on_roster_row_activated(self, _roster, nick): muc_prefer_direct_msg = app.settings.get('muc_prefer_direct_msg') if not self.is_anonymous and muc_prefer_direct_msg: @@ -682,7 +653,7 @@ def on_approve(): _('Voice Request'), _('Voice Request'), _('<b>%(nick)s</b> from <b>%(room_name)s</b> requests voice') % { - 'nick': voice_request.nick, 'room_name': self.room_name}, + 'nick': voice_request.nick, 'room_name': self.contact.name}, [DialogButton.make('Cancel'), DialogButton.make('Accept', text=_('_Approve'), @@ -709,7 +680,7 @@ def _on_gc_message_received(self, event): displaymarking=event.displaymarking, additional_data=event.additional_data) else: - if event.properties.muc_nickname == self.nick: + if event.properties.muc_nickname == self.contact.nickname: self.last_sent_txt = event.msgtxt stanza_id = None if event.properties.stanza_id: @@ -740,24 +711,17 @@ def add_message(self, text, contact='', tim=None, if not contact: # Message from the server kind = 'status' - elif contact == self.nick: # it's us + elif contact == self.contact.nickname: # it's us kind = 'outgoing' else: kind = 'incoming' # muc-specific chatstate - if self.parent_win: - self.parent_win.redraw_tab(self, 'newmsg') if kind == 'incoming': # it's a message NOT from us # highlighting and sounds highlight, _sound = self.highlighting_for_message(text, tim) other_tags_for_name.append('muc_nickname_color_%s' % contact) if highlight: - # muc-specific chatstate - if self.parent_win: - self.parent_win.redraw_tab(self, 'attention') - else: - self.attention_flag = True other_tags_for_name.append('bold') other_tags_for_text.append('marked') @@ -828,7 +792,7 @@ def needs_visual_notification(self, text): nick) appear """ special_words = app.settings.get('muc_highlight_words').split(';') - special_words.append(self.nick) + special_words.append(self.contact.nickname) special_words.append(self._client.get_own_jid().bare) # Strip empties: ''.split(';') == [''] and would highlight everything. # Also lowercase everything for case insensitive compare. @@ -865,7 +829,7 @@ def _on_room_subject(self, _contact, _signal_name, properties): text = '%s - %s' % (text, date) if (app.settings.get('show_subject_on_join') or - self._muc_data.state != MUCJoinedState.JOINING): + not self.contact.is_joining): self.add_info_message(text) def _on_room_config_changed(self, _contact, _signal_name, properties): @@ -926,14 +890,6 @@ def _nec_ping(self, event): elif event.name == 'ping-error': self.add_info_message(event.error) - @property - def is_connected(self) -> bool: - return app.gc_connected[self.account][self.room_jid] - - @is_connected.setter - def is_connected(self, value: bool) -> None: - app.gc_connected[self.account][self.room_jid] = value - def _set_control_active(self): self.xml.formattings_button.set_sensitive(True) self.msg_textview.set_sensitive(True) @@ -941,8 +897,6 @@ def _set_control_active(self): self.roster.initial_draw() - self.is_connected = True - self.xml.formattings_button.set_sensitive(True) self.conversation_view.update_avatars() @@ -957,8 +911,6 @@ def _set_control_inactive(self): self.roster.enable_sort(False) self.roster.clear() - self.is_connected = False - self._client.get_module('Chatstate').remove_delay_timeout(self.contact) self.update_actions() @@ -975,13 +927,14 @@ def _on_user_joined(self, _contact, _signal_name, user_contact, properties): nick = user_contact.name if not properties.is_muc_self_presence: - if self.is_connected and self.contact.settings.get('print_join_left'): + if (self.contact.is_joined and + self.contact.settings.get('print_join_left')): self.add_info_message(_('%s has joined the group chat') % nick) return status_codes = properties.muc_status_codes or [] - if not self.is_connected: + if not self.contact.is_joined: # We just joined the room self.add_info_message(_('You (%s) joined the group chat') % nick) @@ -1347,21 +1300,20 @@ def shutdown(self, reason=None): # Remove unread events from systray app.events.remove_events(self.account, self.room_jid) - if self.parent_win is not None: - self.remove_actions() + self.remove_actions() super(GroupchatControl, self).shutdown() app.check_finalize(self) def safe_shutdown(self): # whether to ask for confirmation before closing muc - if app.settings.get('confirm_close_muc') and self.is_connected: + if app.settings.get('confirm_close_muc') and self.contact.is_joined: return False return True def allow_shutdown(self, method, on_yes, on_no): # whether to ask for confirmation before closing muc - if app.settings.get('confirm_close_muc') and self.is_connected: + if app.settings.get('confirm_close_muc') and self.contact.is_joined: def on_ok(is_checked): if is_checked: # User does not want to be asked again @@ -1378,33 +1330,24 @@ def on_cancel(is_checked): _('Leave Group Chat'), _('Are you sure you want to leave this group chat?'), _('If you close this window, you will leave ' - '\'%s\'.') % self.room_name, + '\'%s\'.') % self.contact.name, _('_Do not ask me again'), [DialogButton.make('Cancel', callback=on_cancel), DialogButton.make('Accept', text=_('_Leave'), callback=on_ok)], - transient_for=self.parent_win.window).show() + transient_for=app.window).show() return on_yes(self) def _close_control(self, reason=None): - # if self.parent_win is None: self.shutdown(reason) - # else: - # self.parent_win.remove_tab(self, None, reason=reason, force=True) def set_control_active(self, state): - # self.conv_textview.allow_focus_out_line = True self.attention_flag = False ChatControlBase.set_control_active(self, state) - # if not state: - # # add the focus-out line to the tab we are leaving - # self.check_focus_out_line() - # Sending active to undo unread state - self.parent_win.redraw_tab(self, 'active') def _on_drag_data_received(self, widget, context, x, y, selection, target_type, timestamp): @@ -1553,7 +1496,7 @@ def delegate_action(self, action): if action == 'change-nickname': control_action = '%s-%s' % (action, self.control_id) - self.parent_win.window.lookup_action(control_action).activate() + app.window.lookup_action(control_action).activate() return Gdk.EVENT_STOP if action == 'escape': @@ -1574,11 +1517,11 @@ def delegate_action(self, action): if action == 'change-subject': control_action = '%s-%s' % (action, self.control_id) - self.parent_win.window.lookup_action(control_action).activate() + app.window.lookup_action(control_action).activate() return Gdk.EVENT_STOP if action == 'show-contact-info': - self.parent_win.window.lookup_action( + app.window.lookup_action( 'information-%s' % self.control_id).activate() return Gdk.EVENT_STOP @@ -1652,14 +1595,14 @@ def _on_page_change(self, stack, _param): def _on_change_nick(self, _action, _param): if self._get_current_page() != 'groupchat': return - self.xml.nickname_entry.set_text(self.nick) + self.xml.nickname_entry.set_text(self.contact.nickname) self.xml.nickname_entry.grab_focus() self.xml.nickname_change_button.grab_default() self._show_page('nickname') def _on_nickname_text_changed(self, entry, _param): text = entry.get_text() - if not text or text == self.nick: + if not text or text == self.contact.nickname: self.xml.nickname_change_button.set_sensitive(False) else: try: @@ -1677,7 +1620,7 @@ def _on_nickname_change_clicked(self, _button): def _on_rename_groupchat(self, _action, _param): if self._get_current_page() != 'groupchat': return - self.xml.name_entry.set_text(self.room_name) + self.xml.name_entry.set_text(self.contact.name) self.xml.name_entry.grab_focus() self.xml.rename_button.grab_default() self._show_page('rename') @@ -1705,7 +1648,7 @@ def _on_subject_change_clicked(self, _button): def _on_password_set_clicked(self, _button): password = self.xml.password_entry.get_text() - self._muc_data.password = password + self._client.get_module('MUC').set_password(self.room_jid, password) self._client.get_module('MUC').join(self.room_jid) self._show_page('groupchat') @@ -1727,11 +1670,6 @@ def _on_room_captcha_challenge(self, _contact, _signal_name, properties): self._captcha_request.show_all() self.xml.captcha_box.add(self._captcha_request) - if self.parent_win: - self.parent_win.redraw_tab(self, 'attention') - else: - self.attention_flag = True - self._show_page('captcha') self._captcha_request.focus_first_entry() ===================================== gajim/gtk/chat_stack.py ===================================== @@ -47,8 +47,7 @@ def add_chat(self, account, jid): # Control is already in the Stack return - mw = self.get_toplevel() - chat_control = ChatControl(mw, jid, account, None, None) + chat_control = ChatControl(account, jid) self._controls[(account, jid)] = chat_control self.add_named(chat_control.widget, f'{account}:{jid}') chat_control.widget.show_all() @@ -57,21 +56,13 @@ def add_group_chat(self, account, jid): if self._controls.get((account, jid)) is not None: return - # muc_data = self._create_muc_data(account, - # room_jid, - # nick, - # password, - # None) - - mw = self.get_toplevel() - control = GroupchatControl(mw, jid, None, account) + control = GroupchatControl(account, jid) self._controls[(account, jid)] = control self.add_named(control.widget, f'{account}:{jid}') control.widget.show_all() def add_private_chat(self, account, jid): - mw = self.get_toplevel() - control = PrivateChatControl(mw, jid, account) + control = PrivateChatControl(account, jid) self._controls[(account, str(jid))] = control self.add_named(control.widget, f'{account}:{jid}') control.widget.show_all() ===================================== gajim/privatechat_control.py ===================================== @@ -42,11 +42,11 @@ class PrivateChatControl(ChatControl): # will be processed with this command host. COMMAND_HOST = PrivateChatCommands - def __init__(self, parent_win, jid, account): + def __init__(self, account, jid): self._room_contact = self._client.get_module('Contacts').get_contact( jid.bare) - ChatControl.__init__(self, parent_win, jid, account, None) + ChatControl.__init__(self, account, jid) # self.register_events([ # ('update-gc-avatar', ged.GUI1, self._on_update_gc_avatar), View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/5c59b8d637b7eee8df583595801a0641…
-- View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/5c59b8d637b7eee8df583595801a0641…
You're receiving this email because of your account on
dev.gajim.org
.
1
0
0
0
← Newer
1
...
262
263
264
265
266
267
268
...
1764
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
Results per page:
10
25
50
100
200