Daniel Brötzmann pushed to branch master at gajim / gajim
Commits: b6f66995 by wurstsalat at 2022-01-27T20:05:32+01:00 Groupchat: Remove subject page
- - - - -
2 changed files:
- gajim/data/gui/groupchat_control.ui - gajim/gtk/controls/groupchat.py
Changes:
===================================== gajim/data/gui/groupchat_control.ui ===================================== @@ -85,30 +85,6 @@ <property name="visible">True</property> <property name="can-focus">False</property> <property name="orientation">vertical</property> - <child> - <object class="GtkButton" id="manage_change_subject_button"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <signal name="clicked" handler="_on_change_subject" swapped="no"/> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="halign">start</property> - <property name="label" translatable="yes">Change Subject…</property> - </object> - </child> - <style> - <class name="flat"/> - </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="manage_advanced_button"> <property name="visible">True</property> @@ -771,121 +747,7 @@ </packing> </child> <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can-focus">False</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="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">Change Subject</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_page_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="subject_change_button"> - <property name="label" translatable="yes">Ch_ange</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_subject_change_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="GtkScrolledWindow"> - <property name="width-request">450</property> - <property name="height-request">250</property> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="hscrollbar-policy">never</property> - <property name="shadow-type">in</property> - <child> - <object class="GtkTextView" id="subject_textview"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="wrap-mode">word-char</property> - <property name="left-margin">3</property> - <property name="right-margin">3</property> - <property name="top-margin">3</property> - <property name="bottom-margin">3</property> - </object> - </child> - </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> - </child> - </object> - <packing> - <property name="name">subject</property> - <property name="position">2</property> - </packing> + <placeholder/> </child> <child> <object class="GtkBox"> @@ -1747,9 +1609,6 @@ <property name="position">9</property> </packing> </child> - <child> - <placeholder/> - </child> <child> <object class="GtkBox"> <property name="visible">True</property> @@ -1826,7 +1685,7 @@ </object> <packing> <property name="name">invite</property> - <property name="position">11</property> + <property name="position">10</property> </packing> </child> <child> @@ -2040,7 +1899,7 @@ </object> <packing> <property name="name">muc-manage</property> - <property name="position">12</property> + <property name="position">11</property> </packing> </child> <child> @@ -2149,7 +2008,7 @@ </object> <packing> <property name="name">avatar-selector</property> - <property name="position">13</property> + <property name="position">12</property> </packing> </child> </object>
===================================== gajim/gtk/controls/groupchat.py ===================================== @@ -362,9 +362,6 @@ def update_actions(self, *args: Any) -> None: contact.affiliation.is_owner): self.xml.avatar_select_button.show()
- self.xml.manage_change_subject_button.set_sensitive( - joined and self._is_subject_change_allowed()) - self.xml.manage_advanced_button.set_sensitive( joined and contact.affiliation in (Affiliation.ADMIN, Affiliation.OWNER)) @@ -406,18 +403,6 @@ def is_irc(self) -> bool: return False return self.disco_info.is_irc
- def _is_subject_change_allowed(self) -> Optional[Any]: - contact = self.contact.get_self() - if contact is None: - return False - - if contact.affiliation in (Affiliation.OWNER, Affiliation.ADMIN): - return True - - if self.disco_info is None: - return False - return self.disco_info.muc_subjectmod or False - def _show_page(self, name: str) -> None: transition = Gtk.StackTransitionType.SLIDE_DOWN if name == 'groupchat': @@ -1559,8 +1544,10 @@ def delegate_action(self, action: str) -> int: return Gdk.EVENT_STOP
if action == 'change-subject': - control_action = f'{action}-{self.control_id}' - app.window.lookup_action(control_action).activate() + open_window('GroupchatDetails', + contact=self.contact, + subject=self._subject_text, + page='subject') return Gdk.EVENT_STOP
if action == 'show-contact-info': @@ -1578,8 +1565,6 @@ def focus(self) -> None: self.xml.password_entry.grab_focus_without_selecting() elif page_name == 'nickname': self.xml.nickname_entry.grab_focus_without_selecting() - elif page_name == 'subject': - self.xml.subject_textview.grab_focus() elif page_name == 'captcha': self._captcha_request.focus_first_entry() elif page_name == 'invite': @@ -1662,21 +1647,6 @@ def _on_manage_save_clicked(self, _button: Gtk.Button) -> None:
self._show_page('groupchat')
- def _on_change_subject(self, _button: Gtk.Button) -> None: - if self._get_current_page() not in ('groupchat', 'muc-manage'): - return - self.xml.subject_textview.get_buffer().set_text(self._subject_text) - self.xml.subject_textview.grab_focus() - self._show_page('subject') - - def _on_subject_change_clicked(self, _button: Gtk.Button) -> None: - buffer_ = self.xml.subject_textview.get_buffer() - subject = buffer_.get_text(buffer_.get_start_iter(), - buffer_.get_end_iter(), - False) - self._client.get_module('MUC').set_subject(self.room_jid, subject) - self._show_page('groupchat') - 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)
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/b6f66995b3036725392c8dadd9398d526...