Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
61828eb7
by Daniel Brötzmann at 2019-11-14T21:33:08Z
3 changed files:
Changes:
| ... | ... | @@ -430,67 +430,54 @@ class GajimApplication(Gtk.Application): |
| 430 | 430 |
# General Actions
|
| 431 | 431 |
|
| 432 | 432 |
general_actions = [
|
| 433 |
- ('quit', app_actions.on_quit),
|
|
| 434 |
- ('add-account', app_actions.on_add_account),
|
|
| 435 |
- ('manage-proxies', app_actions.on_manage_proxies),
|
|
| 436 |
- ('history-manager', app_actions.on_history_manager),
|
|
| 437 |
- ('preferences', app_actions.on_preferences),
|
|
| 438 |
- ('plugins', app_actions.on_plugins),
|
|
| 439 |
- ('xml-console', app_actions.on_xml_console),
|
|
| 440 |
- ('file-transfer', app_actions.on_file_transfers),
|
|
| 441 |
- ('history', app_actions.on_history),
|
|
| 442 |
- ('shortcuts', app_actions.on_keyboard_shortcuts),
|
|
| 443 |
- ('features', app_actions.on_features),
|
|
| 444 |
- ('content', app_actions.on_contents),
|
|
| 445 |
- ('about', app_actions.on_about),
|
|
| 446 |
- ('faq', app_actions.on_faq),
|
|
| 447 |
- ('ipython', app_actions.toggle_ipython),
|
|
| 448 |
- ('show-next-pending-event', app_actions.show_next_pending_event),
|
|
| 433 |
+ ('quit', app_actions.on_quit, ['<Primary>Q']),
|
|
| 434 |
+ ('add-account', app_actions.on_add_account, None),
|
|
| 435 |
+ ('manage-proxies', app_actions.on_manage_proxies, None),
|
|
| 436 |
+ ('history-manager', app_actions.on_history_manager, None),
|
|
| 437 |
+ ('preferences', app_actions.on_preferences, ['<Primary>P']),
|
|
| 438 |
+ ('plugins', app_actions.on_plugins, ['<Primary>E']),
|
|
| 439 |
+ ('xml-console', app_actions.on_xml_console, ['<Primary><Shift>X']),
|
|
| 440 |
+ ('file-transfer', app_actions.on_file_transfers, ['<Primary>T']),
|
|
| 441 |
+ ('history', app_actions.on_history, ['<Primary>H']),
|
|
| 442 |
+ ('shortcuts', app_actions.on_keyboard_shortcuts, None),
|
|
| 443 |
+ ('features', app_actions.on_features, None),
|
|
| 444 |
+ ('content', app_actions.on_contents, None),
|
|
| 445 |
+ ('about', app_actions.on_about, None),
|
|
| 446 |
+ ('faq', app_actions.on_faq, None),
|
|
| 447 |
+ ('ipython', app_actions.toggle_ipython, ['<Primary><Alt>I']),
|
|
| 448 |
+ ('show-next-pending-event', app_actions.show_next_pending_event,
|
|
| 449 |
+ None),
|
|
| 449 | 450 |
]
|
| 450 | 451 |
|
| 451 |
- act = Gio.SimpleAction.new('start-chat', GLib.VariantType.new('s'))
|
|
| 452 |
- act.connect("activate", app_actions.on_new_chat)
|
|
| 453 |
- self.add_action(act)
|
|
| 454 |
- |
|
| 455 |
- act = Gio.SimpleAction.new('accounts', GLib.VariantType.new('s'))
|
|
| 456 |
- act.connect("activate", app_actions.on_accounts)
|
|
| 457 |
- self.add_action(act)
|
|
| 458 |
- self.set_accels_for_action('app.accounts::', ['<Alt>A'])
|
|
| 459 |
- |
|
| 460 |
- act = Gio.SimpleAction.new('add-contact', GLib.VariantType.new('s'))
|
|
| 461 |
- act.connect("activate", app_actions.on_add_contact_jid)
|
|
| 462 |
- self.add_action(act)
|
|
| 463 |
- |
|
| 464 |
- act = Gio.SimpleAction.new('copy-text', GLib.VariantType.new('s'))
|
|
| 465 |
- act.connect("activate", app_actions.copy_text)
|
|
| 466 |
- self.add_action(act)
|
|
| 467 |
- |
|
| 468 |
- act = Gio.SimpleAction.new('open-link', GLib.VariantType.new('as'))
|
|
| 469 |
- act.connect("activate", app_actions.open_link)
|
|
| 470 |
- self.add_action(act)
|
|
| 471 |
- |
|
| 472 |
- act = Gio.SimpleAction.new('open-mail', GLib.VariantType.new('s'))
|
|
| 473 |
- act.connect("activate", app_actions.open_mail)
|
|
| 474 |
- self.add_action(act)
|
|
| 475 |
- |
|
| 476 |
- act = Gio.SimpleAction.new('create-groupchat', GLib.VariantType.new('s'))
|
|
| 477 |
- act.connect("activate", app_actions.on_create_gc)
|
|
| 478 |
- self.add_action(act)
|
|
| 479 |
- |
|
| 480 |
- act = Gio.SimpleAction.new('browse-history',
|
|
| 481 |
- GLib.VariantType.new('a{sv}'))
|
|
| 482 |
- act.connect("activate", app_actions.on_browse_history)
|
|
| 483 |
- self.add_action(act)
|
|
| 484 |
- |
|
| 485 |
- act = Gio.SimpleAction.new('groupchat-join',
|
|
| 486 |
- GLib.VariantType.new('as'))
|
|
| 487 |
- act.connect("activate", app_actions.on_groupchat_join)
|
|
| 488 |
- self.add_action(act)
|
|
| 452 |
+ additional_actions = [
|
|
| 453 |
+ ('start-chat', 's', app_actions.on_new_chat, ['<Primary>N']),
|
|
| 454 |
+ ('accounts', 's', app_actions.on_accounts, ['<Alt>A']),
|
|
| 455 |
+ ('add-contact', 's', app_actions.on_add_contact_jid, None),
|
|
| 456 |
+ ('copy-text', 's', app_actions.copy_text, None),
|
|
| 457 |
+ ('open-link', 'as', app_actions.open_link, None),
|
|
| 458 |
+ ('open-mail', 's', app_actions.open_mail, None),
|
|
| 459 |
+ ('create-groupchat', 's', app_actions.on_create_gc, ['<Primary>G']),
|
|
| 460 |
+ ('browse-history', 'a{sv}', app_actions.on_browse_history, None),
|
|
| 461 |
+ ('groupchat-join', 'as', app_actions.on_groupchat_join, None),
|
|
| 462 |
+ ]
|
|
| 489 | 463 |
|
| 490 | 464 |
for action in general_actions:
|
| 491 |
- action_name, func = action
|
|
| 465 |
+ action_name, func, accel = action
|
|
| 492 | 466 |
act = Gio.SimpleAction.new(action_name, None)
|
| 493 |
- act.connect("activate", func)
|
|
| 467 |
+ act.connect('activate', func)
|
|
| 468 |
+ if accel:
|
|
| 469 |
+ full_action_name = 'app.%s' % action_name
|
|
| 470 |
+ self.set_accels_for_action(full_action_name, accel)
|
|
| 471 |
+ self.add_action(act)
|
|
| 472 |
+ |
|
| 473 |
+ for action in additional_actions:
|
|
| 474 |
+ action_name, variant, func, accel = action
|
|
| 475 |
+ act = Gio.SimpleAction.new(
|
|
| 476 |
+ action_name, GLib.VariantType.new(variant))
|
|
| 477 |
+ act.connect('activate', func)
|
|
| 478 |
+ if accel:
|
|
| 479 |
+ full_action_name = 'app.%s::' % action_name
|
|
| 480 |
+ self.set_accels_for_action(full_action_name, accel)
|
|
| 494 | 481 |
self.add_action(act)
|
| 495 | 482 |
|
| 496 | 483 |
accounts_list = sorted(app.config.get_per('accounts'))
|
| ... | ... | @@ -10,17 +10,14 @@ |
| 10 | 10 |
<item>
|
| 11 | 11 |
<attribute name="label" translatable="yes">Show Contact List</attribute>
|
| 12 | 12 |
<attribute name="action">win.show-roster</attribute>
|
| 13 |
- <attribute name="accel"><Primary>R</attribute>
|
|
| 14 | 13 |
</item>
|
| 15 | 14 |
<item>
|
| 16 | 15 |
<attribute name="label" translatable="yes">Show Offline Contacts</attribute>
|
| 17 | 16 |
<attribute name="action">win.show-offline</attribute>
|
| 18 |
- <attribute name="accel"><Primary>O</attribute>
|
|
| 19 | 17 |
</item>
|
| 20 | 18 |
<item>
|
| 21 | 19 |
<attribute name="label" translatable="yes">Show Active Contacts</attribute>
|
| 22 | 20 |
<attribute name="action">win.show-active</attribute>
|
| 23 |
- <attribute name="accel"><Primary>Y</attribute>
|
|
| 24 | 21 |
</item>
|
| 25 | 22 |
<item>
|
| 26 | 23 |
<attribute name="label" translatable="yes">Show Transports</attribute>
|
| ... | ... | @@ -31,12 +28,10 @@ |
| 31 | 28 |
<item>
|
| 32 | 29 |
<attribute name="label" translatable="yes">XML Console</attribute>
|
| 33 | 30 |
<attribute name="action">app.xml-console</attribute>
|
| 34 |
- <attribute name="accel"><Primary><Shift>X</attribute>
|
|
| 35 | 31 |
</item>
|
| 36 | 32 |
<item>
|
| 37 | 33 |
<attribute name="label" translatable="yes">File Transfer</attribute>
|
| 38 | 34 |
<attribute name="action">app.file-transfer</attribute>
|
| 39 |
- <attribute name="accel"><Primary>T</attribute>
|
|
| 40 | 35 |
</item>
|
| 41 | 36 |
<item>
|
| 42 | 37 |
<attribute name="label" translatable="yes">History</attribute>
|
| ... | ... | @@ -75,13 +70,11 @@ |
| 75 | 70 |
<item>
|
| 76 | 71 |
<attribute name="label" translatable="yes">Start Chat</attribute>
|
| 77 | 72 |
<attribute name="action">app.start-chat</attribute>
|
| 78 |
- <attribute name="accel"><Primary>N</attribute>
|
|
| 79 | 73 |
<attribute name="target"></attribute>
|
| 80 | 74 |
</item>
|
| 81 | 75 |
<item>
|
| 82 | 76 |
<attribute name="label" translatable="yes">Create Group Chat</attribute>
|
| 83 | 77 |
<attribute name="action">app.create-groupchat</attribute>
|
| 84 |
- <attribute name="accel"><Primary>G</attribute>
|
|
| 85 | 78 |
<attribute name="target"></attribute>
|
| 86 | 79 |
</item>
|
| 87 | 80 |
<item>
|
| ... | ... | @@ -95,12 +88,10 @@ |
| 95 | 88 |
<item>
|
| 96 | 89 |
<attribute name="label" translatable="yes">Preferences</attribute>
|
| 97 | 90 |
<attribute name="action">app.preferences</attribute>
|
| 98 |
- <attribute name="accel"><Primary>P</attribute>
|
|
| 99 | 91 |
</item>
|
| 100 | 92 |
<item>
|
| 101 | 93 |
<attribute name="label" translatable="yes">Quit</attribute>
|
| 102 | 94 |
<attribute name="action">app.quit</attribute>
|
| 103 |
- <attribute name="accel"><Primary>Q</attribute>
|
|
| 104 | 95 |
</item>
|
| 105 | 96 |
</section>
|
| 106 | 97 |
</menu>
|
| ... | ... | @@ -5366,34 +5366,38 @@ class RosterWindow: |
| 5366 | 5366 |
return value
|
| 5367 | 5367 |
|
| 5368 | 5368 |
def add_actions(self):
|
| 5369 |
- action = Gio.SimpleAction.new_stateful(
|
|
| 5370 |
- "show-roster", None,
|
|
| 5371 |
- GLib.Variant.new_boolean(
|
|
| 5372 |
- not self.xml.get_object('roster_vbox2').get_no_show_all()))
|
|
| 5373 |
- action.connect("change-state",
|
|
| 5374 |
- self.on_show_roster_action)
|
|
| 5375 |
- self.window.add_action(action)
|
|
| 5376 |
- |
|
| 5377 |
- action = Gio.SimpleAction.new_stateful(
|
|
| 5378 |
- "show-offline", None,
|
|
| 5379 |
- GLib.Variant.new_boolean(app.config.get('showoffline')))
|
|
| 5380 |
- action.connect("change-state",
|
|
| 5381 |
- self.on_show_offline_contacts_action)
|
|
| 5382 |
- self.window.add_action(action)
|
|
| 5383 |
- |
|
| 5384 |
- action = Gio.SimpleAction.new_stateful(
|
|
| 5385 |
- "show-active", None,
|
|
| 5386 |
- GLib.Variant.new_boolean(
|
|
| 5387 |
- app.config.get('show_only_chat_and_online')))
|
|
| 5388 |
- action.connect("change-state",
|
|
| 5389 |
- self.on_show_active_contacts_action)
|
|
| 5390 |
- self.window.add_action(action)
|
|
| 5391 |
- |
|
| 5392 |
- action = Gio.SimpleAction.new_stateful(
|
|
| 5393 |
- "show-transports", None,
|
|
| 5394 |
- GLib.Variant.new_boolean(app.config.get('show_transports_group')))
|
|
| 5395 |
- action.connect("change-state", self.on_show_transports_action)
|
|
| 5396 |
- self.window.add_action(action)
|
|
| 5369 |
+ |
|
| 5370 |
+ actions = [
|
|
| 5371 |
+ ('show-roster',
|
|
| 5372 |
+ not self.xml.get_object('roster_vbox2').get_no_show_all(),
|
|
| 5373 |
+ self.on_show_roster_action,
|
|
| 5374 |
+ ['<Primary>R']),
|
|
| 5375 |
+ |
|
| 5376 |
+ ('show-offline',
|
|
| 5377 |
+ app.config.get('showoffline'),
|
|
| 5378 |
+ self.on_show_offline_contacts_action,
|
|
| 5379 |
+ ['<Primary>O']),
|
|
| 5380 |
+ |
|
| 5381 |
+ ('show-active',
|
|
| 5382 |
+ app.config.get('show_only_chat_and_online'),
|
|
| 5383 |
+ self.on_show_active_contacts_action,
|
|
| 5384 |
+ ['<Primary>Y']),
|
|
| 5385 |
+ |
|
| 5386 |
+ ('show-transports',
|
|
| 5387 |
+ app.config.get('show_transports_group'),
|
|
| 5388 |
+ self.on_show_transports_action,
|
|
| 5389 |
+ None),
|
|
| 5390 |
+ ]
|
|
| 5391 |
+ |
|
| 5392 |
+ for action in actions:
|
|
| 5393 |
+ action_name, variant, func, accel = action
|
|
| 5394 |
+ act = Gio.SimpleAction.new_stateful(
|
|
| 5395 |
+ action_name, None, GLib.Variant.new_boolean(variant))
|
|
| 5396 |
+ act.connect('change-state', func)
|
|
| 5397 |
+ if accel:
|
|
| 5398 |
+ full_action_name = 'win.%s' % action_name
|
|
| 5399 |
+ app.app.set_accels_for_action(full_action_name, accel)
|
|
| 5400 |
+ self.window.add_action(act)
|
|
| 5397 | 5401 |
|
| 5398 | 5402 |
################################################################################
|
| 5399 | 5403 |
###
|