Daniel Brötzmann pushed to branch newcontrol at gajim / gajim
Commits: 891674cf by wurstsalat at 2022-07-17T15:30:32+02:00 GroupchatControl: Move password and error pages
- - - - -
9 changed files:
- gajim/common/const.py - gajim/common/modules/muc.py - gajim/data/gui/groupchat_control.ui - gajim/gtk/chat_function_page.py - gajim/gtk/chat_stack.py - gajim/gtk/control_stack.py - gajim/gtk/controls/base.py - gajim/gtk/controls/chat.py - gajim/gtk/controls/groupchat.py
Changes:
===================================== gajim/common/const.py ===================================== @@ -246,7 +246,6 @@ class MUCJoinedState(Enum): CREATING = 'creating' CAPTCHA_REQUEST = 'captcha in progress' CAPTCHA_FAILED = 'captcha failed' - PASSWORD_REQUEST = 'password required'
def __str__(self): return self.name @@ -275,10 +274,6 @@ def is_captcha_request(self): def is_captcha_failed(self): return self == MUCJoinedState.CAPTCHA_FAILED
- @property - def is_password_request(self): - return self == MUCJoinedState.PASSWORD_REQUEST -
class ClientState(IntEnum): DISCONNECTING = 0
===================================== gajim/common/modules/muc.py ===================================== @@ -497,16 +497,24 @@ def _on_error_presence(self,
elif properties.error.condition == 'not-authorized': self._remove_rejoin_timeout(room_jid) + muc_data.error = 'password-request' self._set_muc_state(room_jid, MUCJoinedState.NOT_JOINED) room.notify('room-password-required', properties)
else: self._set_muc_state(room_jid, MUCJoinedState.NOT_JOINED) if room_jid not in self._rejoin_muc: + muc_data.error = 'join-failed' + assert isinstance(properties.error, CommonError) + muc_data.error_text = helpers.to_user_string( + properties.error) room.notify('room-join-failed', properties.error)
elif muc_data.state == MUCJoinedState.CREATING: self._set_muc_state(room_jid, MUCJoinedState.NOT_JOINED) + muc_data.error = 'creation-failed' + assert isinstance(properties.error, CommonError) + muc_data.error_text = helpers.to_user_string(properties.error) room.notify('room-creation-failed', properties)
elif muc_data.state == MUCJoinedState.CAPTCHA_REQUEST:
===================================== gajim/data/gui/groupchat_control.ui ===================================== @@ -54,317 +54,54 @@ <property name="visible">True</property> <property name="can-focus">False</property> <child> - <object class="GtkStack" id="stack"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <signal name="notify::visible-child-name" handler="_on_page_change" swapped="no"/> + <object class="GtkBox" id="groupchat_control_vbox"> + <property name="can-focus">True</property> + <property name="margin-start">7</property> + <property name="margin-end">7</property> + <property name="spacing">3</property> <child> - <object class="GtkBox" id="groupchat_control_vbox"> - <property name="can-focus">True</property> - <property name="margin-start">7</property> - <property name="margin-end">7</property> - <property name="spacing">3</property> - <child> - <object class="GtkBox" id="textview_box"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="margin-end">4</property> - <property name="hexpand">True</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkOverlay" id="conv_view_overlay"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkRevealer" id="roster_revealer"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="transition-type">none</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="name">groupchat</property> - </packing> - </child> - <child> - <object class="GtkBox"> + <object class="GtkBox" id="textview_box"> <property name="visible">True</property> <property name="can-focus">False</property> + <property name="margin-end">4</property> + <property name="hexpand">True</property> <property name="orientation">vertical</property> <child> - <!-- n-columns=1 n-rows=3 --> - <object class="GtkGrid"> + <object class="GtkOverlay" id="conv_view_overlay"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="row-spacing">12</property> <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes">Enter Password</property> - <property name="xalign">0</property> - <style> - <class name="bold16"/> - </style> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">0</property> - </packing> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="homogeneous">True</property> - <child> - <object class="GtkButton"> - <property name="label" translatable="yes">_Cancel</property> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <property name="halign">start</property> - <property name="valign">start</property> - <property name="use-underline">True</property> - <signal name="clicked" handler="_on_password_cancel_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="password_set_button"> - <property name="label" translatable="yes">_Join</property> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can-focus">True</property> - <property name="can-default">True</property> - <property name="receives-default">True</property> - <property name="halign">end</property> - <property name="valign">start</property> - <property name="use-underline">True</property> - <signal name="clicked" handler="_on_password_set_clicked" swapped="no"/> - <style> - <class name="suggested-action"/> - </style> - </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">2</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="password_entry"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="visibility">False</property> - <property name="invisible-char">*</property> - <property name="activates-default">True</property> - <property name="input-purpose">password</property> - <signal name="notify::text" handler="_on_password_changed" swapped="no"/> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">1</property> - </packing> + <placeholder/> </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">2</property> </packing> </child> </object> <packing> - <property name="name">password</property> - <property name="position">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> </packing> </child> <child> - <placeholder/> - </child> - <child> - <object class="GtkBox"> + <object class="GtkRevealer" id="roster_revealer"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="orientation">vertical</property> + <property name="transition-type">none</property> <child> - <!-- n-columns=1 n-rows=4 --> - <object class="GtkGrid"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="row-spacing">12</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="icon-name">dialog-error-symbolic</property> - <property name="icon_size">6</property> - <style> - <class name="error-color"/> - </style> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">0</property> - </packing> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="halign">center</property> - <property name="spacing">6</property> - <child> - <object class="GtkButton" id="remove_bookmark_button"> - <property name="label" translatable="yes">_Forget Group Chat</property> - <property name="can-focus">True</property> - <property name="receives-default">False</property> - <property name="no-show-all">True</property> - <property name="tooltip-text" translatable="yes">Gajim will not try to join this group chat again</property> - <property name="halign">start</property> - <property name="valign">start</property> - <property name="use-underline">True</property> - <signal name="clicked" handler="_on_remove_bookmark_button_clicked" swapped="no"/> - <style> - <class name="destructive-action"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="retry_button"> - <property name="label" translatable="yes">T_ry Again</property> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <property name="use-underline">True</property> - <signal name="clicked" handler="_on_retry_join_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="close_button"> - <property name="label" translatable="yes">_Close</property> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="can-default">True</property> - <property name="receives-default">True</property> - <property name="halign">end</property> - <property name="valign">start</property> - <property name="use-underline">True</property> - <signal name="clicked" handler="_on_page_close_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">3</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="error_label"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="justify">center</property> - <property name="wrap">True</property> - <property name="max-width-chars">40</property> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="error_heading"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes">An Error Occurred</property> - <property name="justify">center</property> - <property name="wrap">True</property> - <property name="max-width-chars">40</property> - <style> - <class name="bold16"/> - </style> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> + <placeholder/> </child> </object> <packing> - <property name="name">error</property> - <property name="position">3</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> </packing> </child> - <child> - <placeholder/> - </child> </object> <packing> <property name="index">-1</property>
===================================== gajim/gtk/chat_function_page.py ===================================== @@ -69,12 +69,19 @@ def __init__(self) -> None: cancel_button = Gtk.Button(label=_('Cancel')) cancel_button.connect('clicked', self._on_cancel_clicked)
+ self._forget_button = Gtk.Button(label=_('Forget Group Chat')) + self._forget_button.set_no_show_all(True) + self._forget_button.get_style_context().add_class( + 'destructive-action') + self._forget_button.connect('clicked', self._on_forget_clicked) + self._confirm_button = Gtk.Button() self._confirm_button.set_can_default(True) self._confirm_button.connect('clicked', self._on_confirm_clicked)
button_box = Gtk.Box(spacing=18) button_box.pack_start(cancel_button, False, True, 0) + button_box.pack_end(self._forget_button, False, True, 0) button_box.pack_end(self._confirm_button, False, True, 0)
self.add(button_box) @@ -82,7 +89,12 @@ def __init__(self) -> None:
def _on_key_press(self, _widget: Gtk.Widget, event: Gdk.EventKey) -> None: if event.keyval == Gdk.KEY_Escape: - self.emit('finish', self._mode in ('error', 'captcha-error')) + close_control = self._mode in ( + 'join-failed', + 'creation-failed', + 'config-failed', + 'captcha-error') + self.emit('finish', close_control)
def _clear(self) -> None: for child in self._content_box.get_children(): @@ -101,6 +113,8 @@ def set_mode(self, self._confirm_button.set_sensitive(False) self._confirm_button.grab_default()
+ self._forget_button.hide() + self._contact = contact self._heading.set_text(self._contact.name) self._client = app.get_client(contact.account) @@ -165,8 +179,18 @@ def set_mode(self, self._confirm_button.set_sensitive(True) self._confirm_button.get_style_context().add_class( 'suggested-action') - assert data is not None - self._widget = ErrorWidget(data) + self._widget = ErrorWidget(error_text=data) + + elif mode in ('join-failed', 'creation-failed', 'config-failed'): + self._confirm_button.set_label(_('Try Again')) + self._confirm_button.set_sensitive(True) + self._confirm_button.get_style_context().add_class( + 'suggested-action') + if mode == 'join-failed': + is_bookmark = self._client.get_module('Bookmarks').is_bookmark( + self._contact.jid) + self._forget_button.set_visible(is_bookmark) + self._widget = ErrorWidget(error_mode=mode, error_text=data)
assert self._widget is not None self._content_box.add(self._widget) @@ -230,7 +254,7 @@ def _on_confirm_clicked(self, _button: Gtk.Button) -> None: self._client.get_module('MUC').send_captcha( self._contact.jid, form_node)
- elif self._mode == 'captcha-error': + elif self._mode in ('join-failed', 'captcha-error'): assert self._client is not None assert self._contact is not None self._client.get_module('MUC').join(self._contact.jid) @@ -246,12 +270,22 @@ def _on_cancel_clicked(self, _button: Gtk.Button) -> None: self.emit('finish', True) return
- if self._mode in ('error', 'captcha-error'): + if self._mode in ( + 'join-failed', + 'creation-failed', + 'config-failed', + 'captcha-error'): self.emit('finish', True) return
self.emit('finish', False)
+ def _on_forget_clicked(self, _button: Gtk.Button) -> None: + assert self._client is not None + assert self._contact is not None + self._client.get_module('Bookmarks').remove(self._contact.jid) + self.emit('finish', True) + def _invite(self, invited_jid: JID) -> None: assert self._contact is not None client = app.get_client(self._contact.account) @@ -346,17 +380,32 @@ def get_text(self) -> str:
class ErrorWidget(Gtk.Box): - def __init__(self, error_text: str) -> None: + def __init__(self, + error_mode: Optional[str] = None, + error_text: Optional[str] = None + ) -> None: Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=12) image = Gtk.Image.new_from_icon_name( 'dialog-error-symbolic', Gtk.IconSize.DIALOG) image.get_style_context().add_class('error-color') - heading = Gtk.Label(label=_('Error')) + + heading = Gtk.Label() heading.get_style_context().add_class('bold16') - label = Gtk.Label(label=error_text) + heading_text = _('An Error Occurred') + if error_mode == 'join-failed': + heading_text = _('Failed to Join Group Chat') + elif error_mode == 'creation-failed': + heading_text = _('Failed to Create Group Chat') + elif error_mode == 'config-failed': + heading_text = _('Failed to Configure Group Chat') + heading.set_text(heading_text) + + label = Gtk.Label() label.set_max_width_chars(40) + if error_text is not None: + label.set_text(error_text)
self.add(image) self.add(heading)
===================================== gajim/gtk/chat_stack.py ===================================== @@ -108,8 +108,12 @@ def show_chat(self, account: str, jid: JID) -> None: 'user-role-changed': self._on_user_role_changed, 'user-affiliation-changed': self._on_user_affiliation_changed, 'state-changed': self._on_muc_state_changed, - 'room-captcha-challenge': self._on_muc_captcha_challenge, - 'room-captcha-error': self._on_muc_captcha_error, + 'room-password-required': self._on_room_password_required, + 'room-captcha-challenge': self._on_room_captcha_challenge, + 'room-captcha-error': self._on_room_captcha_error, + 'room-creation-failed': self._on_room_creation_failed, + 'room-join-failed': self._on_room_join_failed, + 'room-config-failed': self._on_room_config_failed, }) self._update_group_chat_actions(self._current_contact) elif isinstance(self._current_contact, GroupchatParticipant): @@ -125,33 +129,70 @@ def show_chat(self, account: str, jid: JID) -> None: self._show_chat_function_page('captcha-request') return
- if muc_data.error == 'captcha-failed': - self._show_chat_function_page( - 'captcha-error', muc_data.error_text) - return - - if muc_data.state.is_password_request: - self._show_chat_function_page('password-request') - return + if not muc_data.state.is_joined: + if muc_data.error == 'password-request': + self._show_chat_function_page('password-request') + return + if muc_data.error == 'captcha-failed': + self._show_chat_function_page( + 'captcha-error', muc_data.error_text) + return + if muc_data.error in ('join-failed', 'creation-failed'): + self._show_chat_function_page( + muc_data.error, muc_data.error_text) + return
self.set_transition_type(Gtk.StackTransitionType.NONE) self.set_visible_child_name('controls') - - def _on_muc_captcha_challenge(self, - contact: GroupchatContact, - _signal_name: str, - properties: MessageProperties - ) -> None: + GLib.idle_add(self._message_action_box.msg_textview.grab_focus) + + def _on_room_password_required(self, + _contact: GroupchatContact, + _signal_name: str, + _properties: MessageProperties + ) -> None: + self._show_chat_function_page('password-request') + + def _on_room_captcha_challenge(self, + contact: GroupchatContact, + _signal_name: str, + properties: MessageProperties + ) -> None: self._show_chat_function_page('captcha-request')
- def _on_muc_captcha_error(self, - _contact: GroupchatContact, - _signal_name: str, - error: StanzaError - ) -> None: + def _on_room_captcha_error(self, + _contact: GroupchatContact, + _signal_name: str, + error: StanzaError + ) -> None: error_text = helpers.to_user_string(error) self._show_chat_function_page('captcha-error', error_text)
+ def _on_room_creation_failed(self, + _contact: GroupchatContact, + _signal_name: str, + properties: MessageProperties + ) -> None: + assert properties.error is not None + error_text = helpers.to_user_string(properties.error) + self._show_chat_function_page('creation-failed', error_text) + + def _on_room_join_failed(self, + _contact: GroupchatContact, + _signal_name: str, + error: StanzaError + ) -> None: + self._show_chat_function_page( + 'join-failed', helpers.to_user_string(error)) + + def _on_room_config_failed(self, + _contact: GroupchatContact, + _signal_name: str, + error: StanzaError + ) -> None: + self._show_chat_function_page( + 'config-failed', helpers.to_user_string(error)) + def _on_muc_state_changed(self, contact: GroupchatContact, _signal_name: str
===================================== gajim/gtk/control_stack.py ===================================== @@ -115,7 +115,6 @@ def show_chat(self, account: str, jid: JID) -> None: self._current_control = control
self.set_visible_child_name(new_name) - GLib.idle_add(control.focus)
def is_chat_loaded(self, account: str, jid: JID) -> bool: control = self.get_control(account, jid)
===================================== gajim/gtk/controls/base.py ===================================== @@ -306,9 +306,6 @@ def is_privatechat(self) -> bool: def is_groupchat(self) -> bool: return self._type.is_groupchat
- def focus(self) -> None: - raise NotImplementedError - def _nec_ping(self, obj): raise NotImplementedError
===================================== gajim/gtk/controls/chat.py ===================================== @@ -88,15 +88,6 @@ def _connect_contact_signals(self) -> None: def jid(self) -> JID: return self.contact.jid
- def focus(self) -> None: - # TODO does not work anymore - if not hasattr(self, 'msg_textview'): - # focus() is called sometimes with GLib.idle_add() - # This means there is the possibility that shutdown() was called - # before focus is executed. - return - self.msg_textview.grab_focus() - def delegate_action(self, action: str) -> int: return Gdk.EVENT_PROPAGATE
===================================== gajim/gtk/controls/groupchat.py ===================================== @@ -31,7 +31,6 @@
from nbxmpp import JID from nbxmpp.const import StatusCode -from nbxmpp.errors import StanzaError from nbxmpp.modules.security_labels import Displaymarking from nbxmpp.structs import PresenceProperties from nbxmpp.structs import MessageProperties @@ -115,10 +114,6 @@ def __init__(self, account: str, jid: JID) -> None:
self._set_control_inactive()
- # Stack - self.xml.stack.show_all() - self.xml.stack.set_visible_child_name('groupchat') - self.widget.show_all()
# PluginSystem: adding GUI extension point for this GroupchatControl @@ -137,15 +132,10 @@ def _connect_contact_signals(self) -> None: 'room-kicked': self._on_room_kicked, 'room-destroyed': self._on_room_destroyed, 'room-config-finished': self._on_room_config_finished, - 'room-config-failed': self._on_room_config_failed, 'room-config-changed': self._on_room_config_changed, - 'room-password-required': self._on_room_password_required, - 'room-creation-failed': self._on_room_creation_failed, 'room-presence-error': self._on_room_presence_error, 'room-voice-request': self._on_room_voice_request, 'room-subject': self._on_room_subject, - 'room-joined': self._on_room_joined, - 'room-join-failed': self._on_room_join_failed, })
def _on_muc_state_changed(self, @@ -165,19 +155,6 @@ def _on_muc_state_changed(self, def _on_muc_disco_update(self, event: events.MucDiscoUpdate) -> None: pass
- def _show_page(self, name: str) -> None: - transition = Gtk.StackTransitionType.SLIDE_DOWN - if name == 'groupchat': - transition = Gtk.StackTransitionType.SLIDE_UP - active_control = app.window.get_active_control() - if active_control == self: - pass - #self.msg_textview.grab_focus() - self.xml.stack.set_visible_child_full(name, transition) - - def _get_current_page(self) -> str: - return self.xml.stack.get_visible_child_name() - # Actions def invite(self, invited_jid: JID) -> None: # TODO: Remove, used by command system @@ -439,18 +416,8 @@ def _on_room_config_finished(self, _contact: GroupchatContact, _signal_name: str ) -> None: - self._show_page('groupchat') self.add_info_message(_('A new group chat has been created'))
- def _on_room_config_failed(self, - _contact: GroupchatContact, - _signal_name: str, - error: StanzaError - ) -> None: - self.xml.error_heading.set_text(_('Failed to Configure Group Chat')) - self.xml.error_label.set_text(to_user_string(error)) - self._show_page('error') - def _on_user_nickname_changed(self, _contact: GroupchatContact, _signal_name: str, @@ -650,39 +617,6 @@ def _on_user_left(self, self.conversation_view.add_muc_user_left( nick, properties.muc_user.reason)
- def _on_room_joined(self, - _contact: GroupchatContact, - _signal_name: str - ) -> None: - self._show_page('groupchat') - - def _on_room_password_required(self, - _contact: GroupchatContact, - _signal_name: str, - _properties: MessageProperties): - self._show_page('password') - - def _on_room_join_failed(self, - _contact: GroupchatContact, - _signal_name: str, - error: StanzaError - ) -> None: - if self._client.get_module('Bookmarks').is_bookmark(self.room_jid): - self.xml.remove_bookmark_button.show() - - self.xml.error_heading.set_text(_('Failed to Join Group Chat')) - self.xml.error_label.set_text(to_user_string(error)) - self._show_page('error') - - def _on_room_creation_failed(self, - _contact: GroupchatContact, - _signal_name: str, - properties: MessageProperties - ) -> None: - self.xml.error_heading.set_text(_('Failed to Create Group Chat')) - self.xml.error_label.set_text(to_user_string(properties.error)) - self._show_page('error') - def _on_room_presence_error(self, _contact: GroupchatContact, _signal_name: str, @@ -744,11 +678,6 @@ def shutdown(self, reason: Optional[str] = None) -> None: super(GroupchatControl, self).shutdown() app.check_finalize(self)
- def _close_control(self) -> None: - app.window.activate_action( - 'remove-chat', - GLib.Variant('as', [self.account, str(self.room_jid)])) - def set_control_active(self, state: bool) -> None: BaseControl.set_control_active(self, state)
@@ -780,17 +709,11 @@ def delegate_action(self, action: str) -> int: app.window.activate_action('muc-change-nickname', None) return Gdk.EVENT_STOP
- if action == 'escape': - if self._get_current_page() == 'groupchat': - return Gdk.EVENT_PROPAGATE + # if action == 'escape': + # if self._get_current_page() == 'groupchat': + # return Gdk.EVENT_PROPAGATE
- if self._get_current_page() == 'password': - self._on_password_cancel_clicked() - elif self._get_current_page() == 'error': - self._on_page_close_clicked() - else: - self._show_page('groupchat') - return Gdk.EVENT_STOP + # return Gdk.EVENT_STOP
if action == 'change-subject': open_window('GroupchatDetails', @@ -800,51 +723,10 @@ def delegate_action(self, action: str) -> int:
return Gdk.EVENT_PROPAGATE
- def focus(self) -> None: - page_name = self._get_current_page() - if page_name == 'groupchat': - # TODO - # self.msg_textview.grab_focus() - pass - elif page_name == 'password': - self.xml.password_entry.grab_focus_without_selecting() - - def _on_page_change(self, stack: Gtk.Stack, _param: Any) -> None: - page_name = stack.get_visible_child_name() - if page_name == 'groupchat': - pass - elif page_name == 'password': - self.xml.password_entry.set_text('') - self.xml.password_entry.grab_focus() - self.xml.password_set_button.grab_default() - elif page_name == 'error': - self.xml.close_button.grab_default() - - def _on_password_set_clicked(self, _button: Gtk.Button) -> None: - password = self.xml.password_entry.get_text() - self._client.get_module('MUC').set_password(self.room_jid, password) - self._client.get_module('MUC').join(self.room_jid) - self._show_page('groupchat') - - def _on_password_changed(self, entry: Gtk.Entry, *args: Any) -> None: - self.xml.password_set_button.set_sensitive(bool(entry.get_text())) - - def _on_password_cancel_clicked(self, *args: Any) -> None: - self._close_control() - - def _on_remove_bookmark_button_clicked(self, _button: Gtk.Button) -> None: - self._client.get_module('Bookmarks').remove(self.room_jid) - self._close_control() - - def _on_retry_join_clicked(self, _button: Gtk.Button) -> None: - self._client.get_module('MUC').join(self.room_jid) - self._show_page('groupchat') - - def _on_page_close_clicked(self, *args: Any) -> None: - self._close_control() - def _on_groupchat_state_abort_clicked(self, _button: Gtk.Button) -> None: - self._close_control() + app.window.activate_action( + 'remove-chat', + GLib.Variant('as', [self.account, str(self.room_jid)]))
def _on_groupchat_state_join_clicked(self, _groupchat_state: GroupchatState
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/891674cf3242d9e9eba39d8f2690e8580...