Commit 056c06ee authored by Philipp Hörist's avatar Philipp Hörist

Groupchat: Use progress page when joining

parent 6c2271ce
......@@ -458,12 +458,48 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkSpinner" id="spinner">
<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="vexpand">True</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkSpinner" id="progress_spinner">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Joining...</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="abort_button">
<property name="label" translatable="yes">_Abort</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_abort_button_clicked" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
......
......@@ -311,7 +311,7 @@ class GroupchatControl(ChatControlBase):
settings_menu.set_menu_model(self.control_menu)
self._event_handlers = [
('muc-joined', ged.GUI1, self._on_joined),
('muc-joined', ged.GUI1, self._on_muc_joined),
('muc-join-failed', ged.GUI1, self._on_muc_join_failed),
('muc-user-joined', ged.GUI1, self._on_user_joined),
('muc-user-left', ged.GUI1, self._on_user_left),
......@@ -346,13 +346,13 @@ class GroupchatControl(ChatControlBase):
# disable win, we are not connected yet
ChatControlBase.got_disconnected(self)
# Stack
self.xml.stack.show_all()
self.xml.stack.set_visible_child_name('groupchat')
self.update_ui()
self.widget.show_all()
# Stack
self.xml.stack.show_all()
self.xml.stack.set_visible_child_name('progress')
self.xml.progress_spinner.start()
if app.config.get('hide_groupchat_occupants_list'):
# Roster is shown by default, so toggle the roster button to hide it
......@@ -1898,8 +1898,9 @@ class GroupchatControl(ChatControlBase):
self.draw_all_roles()
@event_filter(['account', 'room_jid'])
def _on_joined(self, _event):
def _on_muc_joined(self, _event):
self.got_connected()
self._show_page('groupchat')
@event_filter(['account', 'room_jid'])
def _on_user_joined(self, event):
......@@ -2874,7 +2875,12 @@ class GroupchatControl(ChatControlBase):
def _on_page_change(self, stack, _param):
page_name = stack.get_visible_child_name()
if page_name == 'password':
if page_name == 'groupchat':
self.xml.progress_spinner.stop()
elif page_name == 'progress':
print('start')
self.xml.progress_spinner.start()
elif page_name == 'password':
self.xml.password_entry.set_text('')
self.xml.password_entry.grab_focus()
self.xml.password_set_button.grab_default()
......@@ -2929,7 +2935,7 @@ class GroupchatControl(ChatControlBase):
password = self.xml.password_entry.get_text()
self._muc_data.password = password
app.connections[self.account].get_module('MUC').join(self._muc_data)
self._show_page('groupchat')
self._show_page('progress')
def _on_password_changed(self, entry, _param):
self.xml.password_set_button.set_sensitive(bool(entry.get_text()))
......@@ -2975,7 +2981,7 @@ class GroupchatControl(ChatControlBase):
con = app.connections[self.account]
con.get_module('MUC').send_captcha(self.room_jid, form_node)
self._remove_captcha_request()
self._show_page('groupchat')
self._show_page('progress')
def _on_captcha_cancel_clicked(self, _button=None):
self._remove_captcha_request()
......@@ -2991,6 +2997,9 @@ class GroupchatControl(ChatControlBase):
self.parent_win.remove_tab(self, self.parent_win.CLOSE_COMMAND)
self.force_non_minimizable = False
def _on_abort_button_clicked(self, _button):
self.parent_win.window.lookup_action('disconnect-%s' % self.control_id).activate()
class SubjectPopover(Gtk.Popover):
def __init__(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment