Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits:
9ebc1826 by wurstsalat at 2021-09-13T23:42:05+02:00
Interface: (Re)Introduce start_chat_from_jid
- - - - -
5 changed files:
- gajim/app_actions.py
- gajim/application.py
- gajim/common/helpers.py
- gajim/gui_interface.py
- gajim/remote_control.py
Changes:
=====================================
gajim/app_actions.py
=====================================
@@ -283,7 +283,7 @@ def copy_text(_action, param):
def start_chat(_action, param):
account, jid = param.get_strv()
- app.interface.new_chat_from_jid(account, jid)
+ app.interface.start_chat_from_jid(account, jid)
def on_groupchat_join(_action, param):
=====================================
gajim/application.py
=====================================
@@ -293,10 +293,7 @@ def _open_uris(self, uris):
except Exception:
app.log('uri_handler').error('Invalid URI: %s', cmd)
- if len(accounts) == 1:
- app.interface.new_chat_from_jid(accounts[0], jid, message)
- else:
- self.activate_action('start-chat', GLib.Variant('s', jid))
+ app.interface.start_chat_from_jid(accounts[0], jid, message)
def do_shutdown(self, *args):
Gtk.Application.do_shutdown(self)
=====================================
gajim/common/helpers.py
=====================================
@@ -1017,7 +1017,7 @@ def open_uri(uri, account=None):
Gio.AppInfo.launch_default_for_uri(uri.data)
elif uri.type == URIType.AT:
- app.interface.new_chat_from_jid(account, uri.data)
+ app.interface.start_chat_from_jid(account, uri.data)
elif uri.type == URIType.XMPP:
if account is None:
@@ -1029,8 +1029,8 @@ def open_uri(uri, account=None):
'groupchat-join',
GLib.Variant('as', [account, uri.data['jid']]))
elif uri.action == URIAction.MESSAGE:
- app.interface.new_chat_from_jid(account, uri.data['jid'],
- message=uri.data.get('body'))
+ app.interface.start_chat_from_jid(account, uri.data['jid'],
+ message=uri.data.get('body'))
else:
log.warning('Cant open URI: %s', uri)
=====================================
gajim/gui_interface.py
=====================================
@@ -1088,6 +1088,16 @@ def show_add_join_groupchat(self, account, jid,
nickname=None,
app.window.add_group_chat(account, str(jid), select=True)
+ def start_chat_from_jid(self, account, jid, message=None):
+ if app.window.chat_exists(account, jid):
+ app.window.select_chat(account, jid)
+ control = app.window.get_control(account, jid)
+ control.msg_textview.insert_text(message)
+ return
+
+ # TODO: handle message arg in StartChat
+ app.app.activate_action('start-chat', GLib.Variant('s', jid))
+
@staticmethod
def _on_muc_added(event):
if app.window.chat_exists(event.account, event.jid):
=====================================
gajim/remote_control.py
=====================================
@@ -596,12 +596,10 @@ def open_chat(self, jid, account, message):
connected_account = first_connected_acct
if connected_account:
- app.interface.new_chat_from_jid(connected_account, jid, message)
+ app.interface.start_chat_from_jid(connected_account, jid, message)
# preserve the 'steal focus preservation'
- win = app.interface.msg_win_mgr.get_window(
- jid, connected_account).window
- if win.get_property('visible'):
- win.window.present()
+ if app.window.get_property('visible'):
+ app.window.present()
return True
return False
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/9ebc18265fceafe948cb9dccb33ef397506aa55f
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/9ebc18265fceafe948cb9dccb33ef397506aa55f
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits