Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
854927e0
by Daniel Brötzmann at 2020-09-20T10:34:51+02:00
4 changed files:
- gajim/data/gui/groupchat_control.ui
- gajim/groupchat_control.py
- + gajim/gtk/groupchat_settings.py
- gajim/gui_menu_builder.py
Changes:
| ... | ... | @@ -1940,6 +1940,67 @@ |
| 1940 | 1940 |
<property name="position">13</property>
|
| 1941 | 1941 |
</packing>
|
| 1942 | 1942 |
</child>
|
| 1943 |
+ <child>
|
|
| 1944 |
+ <object class="GtkBox">
|
|
| 1945 |
+ <property name="visible">True</property>
|
|
| 1946 |
+ <property name="can_focus">False</property>
|
|
| 1947 |
+ <property name="orientation">vertical</property>
|
|
| 1948 |
+ <child>
|
|
| 1949 |
+ <object class="GtkGrid" id="settings_grid">
|
|
| 1950 |
+ <property name="name">settings_grid</property>
|
|
| 1951 |
+ <property name="visible">True</property>
|
|
| 1952 |
+ <property name="can_focus">False</property>
|
|
| 1953 |
+ <property name="halign">center</property>
|
|
| 1954 |
+ <property name="valign">center</property>
|
|
| 1955 |
+ <property name="hexpand">True</property>
|
|
| 1956 |
+ <property name="vexpand">True</property>
|
|
| 1957 |
+ <property name="border_width">18</property>
|
|
| 1958 |
+ <property name="row_spacing">6</property>
|
|
| 1959 |
+ <property name="column_spacing">12</property>
|
|
| 1960 |
+ <child>
|
|
| 1961 |
+ <object class="GtkBox">
|
|
| 1962 |
+ <property name="visible">True</property>
|
|
| 1963 |
+ <property name="can_focus">False</property>
|
|
| 1964 |
+ <property name="halign">center</property>
|
|
| 1965 |
+ <property name="margin_top">6</property>
|
|
| 1966 |
+ <property name="spacing">12</property>
|
|
| 1967 |
+ <child>
|
|
| 1968 |
+ <object class="GtkButton">
|
|
| 1969 |
+ <property name="label" translatable="yes">_Close</property>
|
|
| 1970 |
+ <property name="visible">True</property>
|
|
| 1971 |
+ <property name="can_focus">True</property>
|
|
| 1972 |
+ <property name="receives_default">True</property>
|
|
| 1973 |
+ <property name="use_underline">True</property>
|
|
| 1974 |
+ <signal name="clicked" handler="_on_page_cancel_clicked" swapped="no"/>
|
|
| 1975 |
+ </object>
|
|
| 1976 |
+ <packing>
|
|
| 1977 |
+ <property name="expand">False</property>
|
|
| 1978 |
+ <property name="fill">True</property>
|
|
| 1979 |
+ <property name="position">0</property>
|
|
| 1980 |
+ </packing>
|
|
| 1981 |
+ </child>
|
|
| 1982 |
+ </object>
|
|
| 1983 |
+ <packing>
|
|
| 1984 |
+ <property name="left_attach">0</property>
|
|
| 1985 |
+ <property name="top_attach">1</property>
|
|
| 1986 |
+ </packing>
|
|
| 1987 |
+ </child>
|
|
| 1988 |
+ <child>
|
|
| 1989 |
+ <placeholder/>
|
|
| 1990 |
+ </child>
|
|
| 1991 |
+ </object>
|
|
| 1992 |
+ <packing>
|
|
| 1993 |
+ <property name="expand">False</property>
|
|
| 1994 |
+ <property name="fill">True</property>
|
|
| 1995 |
+ <property name="position">0</property>
|
|
| 1996 |
+ </packing>
|
|
| 1997 |
+ </child>
|
|
| 1998 |
+ </object>
|
|
| 1999 |
+ <packing>
|
|
| 2000 |
+ <property name="name">muc-settings</property>
|
|
| 2001 |
+ <property name="position">14</property>
|
|
| 2002 |
+ </packing>
|
|
| 2003 |
+ </child>
|
|
| 1943 | 2004 |
</object>
|
| 1944 | 2005 |
<packing>
|
| 1945 | 2006 |
<property name="index">-1</property>
|
| ... | ... | @@ -73,12 +73,12 @@ from gajim.gtk.adhoc import AdHocCommand |
| 73 | 73 |
from gajim.gtk.dataform import DataFormWidget
|
| 74 | 74 |
from gajim.gtk.groupchat_info import GroupChatInfoScrolled
|
| 75 | 75 |
from gajim.gtk.groupchat_invite import GroupChatInvite
|
| 76 |
+from gajim.gtk.groupchat_settings import GroupChatSettingsScrolled
|
|
| 76 | 77 |
from gajim.gtk.groupchat_roster import GroupchatRoster
|
| 77 | 78 |
from gajim.gtk.util import NickCompletionGenerator
|
| 78 | 79 |
from gajim.gtk.util import get_app_window
|
| 79 | 80 |
from gajim.gtk.const import ControlType
|
| 80 | 81 |
|
| 81 |
- |
|
| 82 | 82 |
log = logging.getLogger('gajim.groupchat_control')
|
| 83 | 83 |
|
| 84 | 84 |
|
| ... | ... | @@ -177,6 +177,12 @@ class GroupchatControl(ChatControlBase): |
| 177 | 177 |
self._muc_info_box = GroupChatInfoScrolled(self.account, {'width': 600})
|
| 178 | 178 |
self.xml.info_grid.attach(self._muc_info_box, 0, 0, 1, 1)
|
| 179 | 179 |
|
| 180 |
+ # Groupchat settings
|
|
| 181 |
+ self._groupchat_settings_box = GroupChatSettingsScrolled(
|
|
| 182 |
+ self.account, self.room_jid, self.context)
|
|
| 183 |
+ self.xml.settings_grid.attach(self._groupchat_settings_box, 0, 0, 1, 1)
|
|
| 184 |
+ |
|
| 185 |
+ |
|
| 180 | 186 |
# Groupchat invite
|
| 181 | 187 |
self.xml.quick_invite_button.set_action_name(
|
| 182 | 188 |
'win.invite-%s' % self.control_id)
|
| ... | ... | @@ -279,6 +285,7 @@ class GroupchatControl(ChatControlBase): |
| 279 | 285 |
def add_actions(self):
|
| 280 | 286 |
super().add_actions()
|
| 281 | 287 |
actions = [
|
| 288 |
+ ('groupchat-settings-', None, self._on_groupchat_settings),
|
|
| 282 | 289 |
('rename-groupchat-', None, self._on_rename_groupchat),
|
| 283 | 290 |
('change-subject-', None, self._on_change_subject),
|
| 284 | 291 |
('change-nickname-', None, self._on_change_nick),
|
| ... | ... | @@ -305,66 +312,6 @@ class GroupchatControl(ChatControlBase): |
| 305 | 312 |
act.connect("activate", func)
|
| 306 | 313 |
self.parent_win.window.add_action(act)
|
| 307 | 314 |
|
| 308 |
- minimize = self.contact.settings.get('minimize_on_close')
|
|
| 309 |
- |
|
| 310 |
- act = Gio.SimpleAction.new_stateful(
|
|
| 311 |
- 'minimize-on-close-' + self.control_id, None,
|
|
| 312 |
- GLib.Variant.new_boolean(minimize))
|
|
| 313 |
- act.connect('change-state', self._on_minimize_on_close)
|
|
| 314 |
- self.parent_win.window.add_action(act)
|
|
| 315 |
- |
|
| 316 |
- minimize = self.contact.settings.get('minimize_on_autojoin')
|
|
| 317 |
- |
|
| 318 |
- act = Gio.SimpleAction.new_stateful(
|
|
| 319 |
- 'minimize-on-autojoin-' + self.control_id, None,
|
|
| 320 |
- GLib.Variant.new_boolean(minimize))
|
|
| 321 |
- act.connect('change-state', self._on_minimize_on_autojoin)
|
|
| 322 |
- self.parent_win.window.add_action(act)
|
|
| 323 |
- |
|
| 324 |
- chatstate = self.contact.settings.get('send_chatstate')
|
|
| 325 |
- |
|
| 326 |
- act = Gio.SimpleAction.new_stateful(
|
|
| 327 |
- 'send-chatstate-' + self.control_id,
|
|
| 328 |
- GLib.VariantType.new("s"),
|
|
| 329 |
- GLib.Variant("s", chatstate))
|
|
| 330 |
- act.connect('change-state', self._on_send_chatstate)
|
|
| 331 |
- self.parent_win.window.add_action(act)
|
|
| 332 |
- |
|
| 333 |
- value = self.contact.settings.get('notify_on_all_messages',
|
|
| 334 |
- context=self.context)
|
|
| 335 |
- |
|
| 336 |
- act = Gio.SimpleAction.new_stateful(
|
|
| 337 |
- 'notify-on-message-' + self.control_id,
|
|
| 338 |
- None, GLib.Variant.new_boolean(value))
|
|
| 339 |
- act.connect('change-state', self._on_notify_on_all_messages)
|
|
| 340 |
- self.parent_win.window.add_action(act)
|
|
| 341 |
- |
|
| 342 |
- value = self.contact.settings.get('print_status')
|
|
| 343 |
- |
|
| 344 |
- act = Gio.SimpleAction.new_stateful(
|
|
| 345 |
- 'print-status-' + self.control_id,
|
|
| 346 |
- None, GLib.Variant.new_boolean(value))
|
|
| 347 |
- act.connect('change-state', self._on_print_status)
|
|
| 348 |
- self.parent_win.window.add_action(act)
|
|
| 349 |
- |
|
| 350 |
- value = self.contact.settings.get('print_join_left')
|
|
| 351 |
- |
|
| 352 |
- act = Gio.SimpleAction.new_stateful(
|
|
| 353 |
- 'print-join-left-' + self.control_id,
|
|
| 354 |
- None, GLib.Variant.new_boolean(value))
|
|
| 355 |
- act.connect('change-state', self._on_print_join_left)
|
|
| 356 |
- self.parent_win.window.add_action(act)
|
|
| 357 |
- |
|
| 358 |
- threshold = self.contact.settings.get('sync_threshold',
|
|
| 359 |
- context=self.context)
|
|
| 360 |
- |
|
| 361 |
- initial = GLib.Variant.new_string(str(threshold))
|
|
| 362 |
- act = Gio.SimpleAction.new_stateful(
|
|
| 363 |
- 'choose-sync-' + self.control_id,
|
|
| 364 |
- initial.get_type(), initial)
|
|
| 365 |
- act.connect('change-state', self._on_sync_threshold)
|
|
| 366 |
- self.parent_win.window.add_action(act)
|
|
| 367 |
- |
|
| 368 | 315 |
def update_actions(self, *args):
|
| 369 | 316 |
if self.parent_win is None:
|
| 370 | 317 |
return
|
| ... | ... | @@ -427,16 +374,6 @@ class GroupchatControl(ChatControlBase): |
| 427 | 374 |
vcard_support and
|
| 428 | 375 |
contact.affiliation.is_owner)
|
| 429 | 376 |
|
| 430 |
- # Print join/left
|
|
| 431 |
- value = self.contact.settings.get('print_join_left')
|
|
| 432 |
- self._get_action('print-join-left-').set_state(
|
|
| 433 |
- GLib.Variant.new_boolean(value))
|
|
| 434 |
- |
|
| 435 |
- # Print join/left
|
|
| 436 |
- value = self.contact.settings.get('print_status')
|
|
| 437 |
- self._get_action('print-status-').set_state(
|
|
| 438 |
- GLib.Variant.new_boolean(value))
|
|
| 439 |
- |
|
| 440 | 377 |
self._get_action('contact-information-').set_enabled(self.is_connected)
|
| 441 | 378 |
|
| 442 | 379 |
self._get_action('execute-command-').set_enabled(self.is_connected)
|
| ... | ... | @@ -448,6 +385,7 @@ class GroupchatControl(ChatControlBase): |
| 448 | 385 |
def remove_actions(self):
|
| 449 | 386 |
super().remove_actions()
|
| 450 | 387 |
actions = [
|
| 388 |
+ 'groupchat-settings-',
|
|
| 451 | 389 |
'rename-groupchat-',
|
| 452 | 390 |
'change-subject-',
|
| 453 | 391 |
'change-nickname-',
|
| ... | ... | @@ -464,13 +402,6 @@ class GroupchatControl(ChatControlBase): |
| 464 | 402 |
'kick-',
|
| 465 | 403 |
'change-role-',
|
| 466 | 404 |
'change-affiliation-',
|
| 467 |
- 'minimize-on-close-',
|
|
| 468 |
- 'minimize-on-autojoin-',
|
|
| 469 |
- 'send-chatstate-',
|
|
| 470 |
- 'notify-on-message-',
|
|
| 471 |
- 'print-status-',
|
|
| 472 |
- 'print-join-left-',
|
|
| 473 |
- 'choose-sync-',
|
|
| 474 | 405 |
]
|
| 475 | 406 |
|
| 476 | 407 |
for action in actions:
|
| ... | ... | @@ -531,19 +462,10 @@ class GroupchatControl(ChatControlBase): |
| 531 | 462 |
def _on_disco_update(self, _event):
|
| 532 | 463 |
if self.parent_win is None:
|
| 533 | 464 |
return
|
| 534 |
- win = self.parent_win.window
|
|
| 535 | 465 |
self.update_actions()
|
| 536 | 466 |
self.draw_banner_text()
|
| 537 | 467 |
|
| 538 |
- # After the room has been created, reevaluate threshold
|
|
| 539 |
- if self.disco_info.has_mam:
|
|
| 540 |
- threshold = self.contact.settings.get('sync_threshold',
|
|
| 541 |
- context=self.context)
|
|
| 542 |
- win.change_action_state('choose-sync-%s' % self.control_id,
|
|
| 543 |
- GLib.Variant('s', str(threshold)))
|
|
| 544 |
- |
|
| 545 | 468 |
# Actions
|
| 546 |
- |
|
| 547 | 469 |
def _on_disconnect(self, _action, _param):
|
| 548 | 470 |
self.leave()
|
| 549 | 471 |
|
| ... | ... | @@ -555,6 +477,9 @@ class GroupchatControl(ChatControlBase): |
| 555 | 477 |
self._subject_data.user_timestamp)
|
| 556 | 478 |
self._show_page('muc-info')
|
| 557 | 479 |
|
| 480 |
+ def _on_groupchat_settings(self, _action, _param):
|
|
| 481 |
+ self._show_page('muc-settings')
|
|
| 482 |
+ |
|
| 558 | 483 |
def _on_invite(self, _action, _param):
|
| 559 | 484 |
self._invite_box.load_contacts()
|
| 560 | 485 |
self._show_page('invite')
|
| ... | ... | @@ -629,14 +554,6 @@ class GroupchatControl(ChatControlBase): |
| 629 | 554 |
return
|
| 630 | 555 |
GroupchatConfig(self.account, result.jid, 'owner', result.form)
|
| 631 | 556 |
|
| 632 |
- def _on_print_join_left(self, action, param):
|
|
| 633 |
- action.set_state(param)
|
|
| 634 |
- self.contact.settings.set('print_join_left', param.get_boolean())
|
|
| 635 |
- |
|
| 636 |
- def _on_print_status(self, action, param):
|
|
| 637 |
- action.set_state(param)
|
|
| 638 |
- self.contact.settings.set('print_status', param.get_boolean())
|
|
| 639 |
- |
|
| 640 | 557 |
def _on_request_voice(self, _action, _param):
|
| 641 | 558 |
"""
|
| 642 | 559 |
Request voice in the current room
|
| ... | ... | @@ -644,29 +561,6 @@ class GroupchatControl(ChatControlBase): |
| 644 | 561 |
con = app.connections[self.account]
|
| 645 | 562 |
con.get_module('MUC').request_voice(self.room_jid)
|
| 646 | 563 |
|
| 647 |
- def _on_minimize_on_close(self, action, param):
|
|
| 648 |
- action.set_state(param)
|
|
| 649 |
- self.contact.settings.set('minimize_on_close', param.get_boolean())
|
|
| 650 |
- |
|
| 651 |
- def _on_minimize_on_autojoin(self, action, param):
|
|
| 652 |
- action.set_state(param)
|
|
| 653 |
- self.contact.settings.set('minimize_on_autojoin', param.get_boolean())
|
|
| 654 |
- |
|
| 655 |
- def _on_send_chatstate(self, action, param):
|
|
| 656 |
- action.set_state(param)
|
|
| 657 |
- self.contact.settings.set('send_chatstate', param.get_string())
|
|
| 658 |
- |
|
| 659 |
- def _on_notify_on_all_messages(self, action, param):
|
|
| 660 |
- action.set_state(param)
|
|
| 661 |
- self.contact.settings.set('notify_on_all_messages', param.get_boolean())
|
|
| 662 |
- |
|
| 663 |
- def _on_sync_threshold(self, action, param):
|
|
| 664 |
- threshold = param.get_string()
|
|
| 665 |
- action.set_state(param)
|
|
| 666 |
- self.contact.settings.set('sync_threshold',
|
|
| 667 |
- int(threshold),
|
|
| 668 |
- context=self.context)
|
|
| 669 |
- |
|
| 670 | 564 |
def _on_execute_command(self, _action, param):
|
| 671 | 565 |
jid = self.room_jid
|
| 672 | 566 |
nick = param.get_string()
|
| 1 |
+# This file is part of Gajim.
|
|
| 2 |
+#
|
|
| 3 |
+# Gajim is free software; you can redistribute it and/or modify
|
|
| 4 |
+# it under the terms of the GNU General Public License as published
|
|
| 5 |
+# by the Free Software Foundation; version 3 only.
|
|
| 6 |
+#
|
|
| 7 |
+# Gajim is distributed in the hope that it will be useful,
|
|
| 8 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 9 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 10 |
+# GNU General Public License for more details.
|
|
| 11 |
+#
|
|
| 12 |
+# You should have received a copy of the GNU General Public License
|
|
| 13 |
+# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
|
| 14 |
+ |
|
| 15 |
+from gi.repository import Gtk
|
|
| 16 |
+ |
|
| 17 |
+from gajim.common.const import THRESHOLD_OPTIONS
|
|
| 18 |
+from gajim.common.i18n import _
|
|
| 19 |
+ |
|
| 20 |
+from gajim.gtk.const import Setting
|
|
| 21 |
+from gajim.gtk.const import SettingKind
|
|
| 22 |
+from gajim.gtk.const import SettingType
|
|
| 23 |
+from gajim.gtk.settings import SettingsBox
|
|
| 24 |
+ |
|
| 25 |
+ |
|
| 26 |
+class GroupChatSettingsScrolled(Gtk.ScrolledWindow):
|
|
| 27 |
+ def __init__(self, account, jid, context):
|
|
| 28 |
+ Gtk.ScrolledWindow.__init__(self)
|
|
| 29 |
+ self.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
|
|
| 30 |
+ self.set_max_content_height(400)
|
|
| 31 |
+ self.set_propagate_natural_height(True)
|
|
| 32 |
+ self.set_hexpand(True)
|
|
| 33 |
+ self.set_vexpand(True)
|
|
| 34 |
+ |
|
| 35 |
+ box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=18)
|
|
| 36 |
+ box.set_valign(Gtk.Align.CENTER)
|
|
| 37 |
+ label = Gtk.Label(label=_('Settings for this Chat'))
|
|
| 38 |
+ label.get_style_context().add_class('bold16')
|
|
| 39 |
+ label.set_halign(Gtk.Align.CENTER)
|
|
| 40 |
+ box.add(label)
|
|
| 41 |
+ |
|
| 42 |
+ chat_settings = ChatSettings(account, jid, context)
|
|
| 43 |
+ box.add(chat_settings)
|
|
| 44 |
+ |
|
| 45 |
+ self.add(box)
|
|
| 46 |
+ self.show_all()
|
|
| 47 |
+ |
|
| 48 |
+ |
|
| 49 |
+class GroupchatSettingsBox(SettingsBox):
|
|
| 50 |
+ def __init__(self, account, jid, settings):
|
|
| 51 |
+ SettingsBox.__init__(self, account, jid)
|
|
| 52 |
+ |
|
| 53 |
+ self.get_style_context().add_class('settings-border')
|
|
| 54 |
+ self.set_selection_mode(Gtk.SelectionMode.NONE)
|
|
| 55 |
+ |
|
| 56 |
+ for setting in settings:
|
|
| 57 |
+ self.add_setting(setting)
|
|
| 58 |
+ self.update_states()
|
|
| 59 |
+ |
|
| 60 |
+ |
|
| 61 |
+class ChatSettings(GroupchatSettingsBox):
|
|
| 62 |
+ def __init__(self, account, jid, context):
|
|
| 63 |
+ |
|
| 64 |
+ chat_state = {
|
|
| 65 |
+ 'disabled': _('Disabled'),
|
|
| 66 |
+ 'composing_only': _('Composing Only'),
|
|
| 67 |
+ 'all': _('All Chat States')
|
|
| 68 |
+ }
|
|
| 69 |
+ |
|
| 70 |
+ settings = [
|
|
| 71 |
+ Setting(SettingKind.SWITCH,
|
|
| 72 |
+ _('Show Join/Leave'),
|
|
| 73 |
+ SettingType.GROUP_CHAT,
|
|
| 74 |
+ 'print_join_left'),
|
|
| 75 |
+ |
|
| 76 |
+ Setting(SettingKind.SWITCH,
|
|
| 77 |
+ _('Show Status Changes'),
|
|
| 78 |
+ SettingType.GROUP_CHAT,
|
|
| 79 |
+ 'print_status'),
|
|
| 80 |
+ |
|
| 81 |
+ Setting(SettingKind.SWITCH,
|
|
| 82 |
+ _('Notify on all Messages'),
|
|
| 83 |
+ SettingType.GROUP_CHAT,
|
|
| 84 |
+ 'notify_on_all_messages',
|
|
| 85 |
+ context=context),
|
|
| 86 |
+ |
|
| 87 |
+ Setting(SettingKind.SWITCH,
|
|
| 88 |
+ _('Minimize on Close'),
|
|
| 89 |
+ SettingType.GROUP_CHAT,
|
|
| 90 |
+ 'minimize_on_close'),
|
|
| 91 |
+ |
|
| 92 |
+ Setting(SettingKind.SWITCH,
|
|
| 93 |
+ _('Minimize When Joining Automatically'),
|
|
| 94 |
+ SettingType.GROUP_CHAT,
|
|
| 95 |
+ 'minimize_on_autojoin'),
|
|
| 96 |
+ |
|
| 97 |
+ Setting(SettingKind.POPOVER,
|
|
| 98 |
+ _('Send Chat State'),
|
|
| 99 |
+ SettingType.GROUP_CHAT,
|
|
| 100 |
+ 'send_chatstate',
|
|
| 101 |
+ props={'entries': chat_state}),
|
|
| 102 |
+ |
|
| 103 |
+ Setting(SettingKind.POPOVER,
|
|
| 104 |
+ _('Sync Threshold'),
|
|
| 105 |
+ SettingType.GROUP_CHAT,
|
|
| 106 |
+ 'sync_threshold',
|
|
| 107 |
+ context=context,
|
|
| 108 |
+ props={'entries': THRESHOLD_OPTIONS}),
|
|
| 109 |
+ ]
|
|
| 110 |
+ |
|
| 111 |
+ GroupchatSettingsBox.__init__(self, account, jid, settings)
|
| ... | ... | @@ -25,7 +25,6 @@ from gajim.common.helpers import is_role_change_allowed |
| 25 | 25 |
from gajim.common.i18n import _
|
| 26 | 26 |
from gajim.common.const import URIType
|
| 27 | 27 |
from gajim.common.const import URIAction
|
| 28 |
-from gajim.common.const import THRESHOLD_OPTIONS
|
|
| 29 | 28 |
|
| 30 | 29 |
from gajim.gtk.util import get_builder
|
| 31 | 30 |
from gajim.gtk.const import ControlType
|
| ... | ... | @@ -572,6 +571,7 @@ def get_singlechat_menu(control_id, account, jid): |
| 572 | 571 |
def get_groupchat_menu(control_id, account, jid):
|
| 573 | 572 |
groupchat_menu = [
|
| 574 | 573 |
('win.information-', _('Information')),
|
| 574 |
+ ('win.groupchat-settings-', _('Settings…')),
|
|
| 575 | 575 |
(_('Manage Group Chat'), [
|
| 576 | 576 |
('win.rename-groupchat-', _('Rename…')),
|
| 577 | 577 |
('win.change-subject-', _('Change Subject…')),
|
| ... | ... | @@ -579,16 +579,6 @@ def get_groupchat_menu(control_id, account, jid): |
| 579 | 579 |
('win.configure-', _('Configure…')),
|
| 580 | 580 |
('win.destroy-', _('Destroy…')),
|
| 581 | 581 |
]),
|
| 582 |
- (_('Chat Settings'), [
|
|
| 583 |
- ('win.print-join-left-', _('Show Join/Leave')),
|
|
| 584 |
- ('win.print-status-', _('Show Status Changes')),
|
|
| 585 |
- ('win.notify-on-message-', _('Notify on all Messages')),
|
|
| 586 |
- ('win.minimize-on-close-', _('Minimize on Close')),
|
|
| 587 |
- ('win.minimize-on-autojoin-',
|
|
| 588 |
- _('Minimize When Joining Automatically')),
|
|
| 589 |
- (_('Send Chatstate'), ['chatstate']),
|
|
| 590 |
- ]),
|
|
| 591 |
- (_('Sync Threshold'), ['sync']),
|
|
| 592 | 582 |
('win.change-nickname-', _('Change Nickname…')),
|
| 593 | 583 |
('win.request-voice-', _('Request Voice')),
|
| 594 | 584 |
('win.execute-command-', _('Execute Command…')),
|
| ... | ... | @@ -620,38 +610,10 @@ def get_groupchat_menu(control_id, account, jid): |
| 620 | 610 |
menu.append(label, action_name + control_id)
|
| 621 | 611 |
else:
|
| 622 | 612 |
label, sub_menu = item
|
| 623 |
- if 'sync' in sub_menu:
|
|
| 624 |
- # Sync threshold menu
|
|
| 625 |
- submenu = build_sync_menu()
|
|
| 626 |
- elif 'chatstate' in sub_menu:
|
|
| 627 |
- submenu = build_chatstate_menu()
|
|
| 628 |
- else:
|
|
| 629 |
- # This is a submenu
|
|
| 630 |
- submenu = build_menu(sub_menu)
|
|
| 613 |
+ submenu = build_menu(sub_menu)
|
|
| 631 | 614 |
menu.append_submenu(label, submenu)
|
| 632 | 615 |
return menu
|
| 633 | 616 |
|
| 634 |
- def build_sync_menu():
|
|
| 635 |
- menu = Gio.Menu()
|
|
| 636 |
- action_name = 'win.choose-sync-%s::' % control_id
|
|
| 637 |
- for days, label in THRESHOLD_OPTIONS.items():
|
|
| 638 |
- menu.append(label, '%s%s' % (action_name, days))
|
|
| 639 |
- return menu
|
|
| 640 |
- |
|
| 641 |
- def build_chatstate_menu():
|
|
| 642 |
- menu = Gio.Menu()
|
|
| 643 |
- entries = [
|
|
| 644 |
- (_('Disabled'), 'disabled'),
|
|
| 645 |
- (_('Composing only'), 'composing_only'),
|
|
| 646 |
- (_('All chat states'), 'all')
|
|
| 647 |
- ]
|
|
| 648 |
- |
|
| 649 |
- for entry in entries:
|
|
| 650 |
- label, setting = entry
|
|
| 651 |
- action = 'win.send-chatstate-%s::%s' % (control_id, setting)
|
|
| 652 |
- menu.append(label, action)
|
|
| 653 |
- return menu
|
|
| 654 |
- |
|
| 655 | 617 |
return build_menu(groupchat_menu)
|
| 656 | 618 |
|
| 657 | 619 |
|