Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
7fa0b97b
by Philipp Hörist at 2019-07-06T00:10:26Z
7 changed files:
- gajim/app_actions.py
- gajim/application.py
- gajim/data/gui/account_context_menu.ui
- gajim/data/gui/application_menu.ui
- gajim/data/gui/zeroconf_context_menu.ui
- gajim/gui_menu_builder.py
- gajim/roster_window.py
Changes:
| ... | ... | @@ -73,10 +73,14 @@ def on_plugins(action, param): |
| 73 | 73 |
def on_accounts(action, param):
|
| 74 | 74 |
window = app.get_app_window(AccountsWindow)
|
| 75 | 75 |
if window is None:
|
| 76 |
- AccountsWindow()
|
|
| 76 |
+ window = AccountsWindow()
|
|
| 77 | 77 |
else:
|
| 78 | 78 |
window.present()
|
| 79 | 79 |
|
| 80 |
+ account = param.get_string()
|
|
| 81 |
+ if account:
|
|
| 82 |
+ window.select_account(account)
|
|
| 83 |
+ |
|
| 80 | 84 |
|
| 81 | 85 |
def on_history_manager(action, param):
|
| 82 | 86 |
from gajim.history_manager import HistoryManager
|
| ... | ... | @@ -392,7 +392,6 @@ class GajimApplication(Gtk.Application): |
| 392 | 392 |
|
| 393 | 393 |
general_actions = [
|
| 394 | 394 |
('quit', app_actions.on_quit),
|
| 395 |
- ('accounts', app_actions.on_accounts),
|
|
| 396 | 395 |
('add-account', app_actions.on_add_account),
|
| 397 | 396 |
('join-groupchat', app_actions.on_join_gc),
|
| 398 | 397 |
('manage-proxies', app_actions.on_manage_proxies),
|
| ... | ... | @@ -412,6 +411,11 @@ class GajimApplication(Gtk.Application): |
| 412 | 411 |
('show-next-pending-event', app_actions.show_next_pending_event),
|
| 413 | 412 |
]
|
| 414 | 413 |
|
| 414 |
+ act = Gio.SimpleAction.new('accounts', GLib.VariantType.new('s'))
|
|
| 415 |
+ act.connect("activate", app_actions.on_accounts)
|
|
| 416 |
+ self.add_action(act)
|
|
| 417 |
+ self.set_accels_for_action('app.accounts::', ['<Alt>A'])
|
|
| 418 |
+ |
|
| 415 | 419 |
act = Gio.SimpleAction.new('add-contact', GLib.VariantType.new('s'))
|
| 416 | 420 |
act.connect("activate", app_actions.on_add_contact_jid)
|
| 417 | 421 |
self.add_action(act)
|
| ... | ... | @@ -84,7 +84,7 @@ |
| 84 | 84 |
<object class="GtkMenuItem" id="edit_account_menuitem">
|
| 85 | 85 |
<property name="visible">True</property>
|
| 86 | 86 |
<property name="can_focus">False</property>
|
| 87 |
- <property name="label" translatable="yes">_Modify Account...</property>
|
|
| 87 |
+ <property name="label" translatable="yes">_Modify Account…</property>
|
|
| 88 | 88 |
<property name="use_underline">True</property>
|
| 89 | 89 |
</object>
|
| 90 | 90 |
</child>
|
| ... | ... | @@ -67,11 +67,6 @@ |
| 67 | 67 |
</menu>
|
| 68 | 68 |
<menu id="appmenu">
|
| 69 | 69 |
<section>
|
| 70 |
- <item>
|
|
| 71 |
- <attribute name="label" translatable="yes">Accounts</attribute>
|
|
| 72 |
- <attribute name="action">app.accounts</attribute>
|
|
| 73 |
- <attribute name="accel"><Primary><Shift>A</attribute>
|
|
| 74 |
- </item>
|
|
| 75 | 70 |
<item>
|
| 76 | 71 |
<attribute name="label" translatable="yes">Start Chat</attribute>
|
| 77 | 72 |
<attribute name="action">app.start-chat</attribute>
|
| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 |
<object class="GtkMenuItem" id="zeroconf_properties_menuitem">
|
| 24 | 24 |
<property name="visible">True</property>
|
| 25 | 25 |
<property name="can_focus">False</property>
|
| 26 |
- <property name="label" translatable="yes">_Modify Account...</property>
|
|
| 26 |
+ <property name="label" translatable="yes">_Modify Account…</property>
|
|
| 27 | 27 |
<property name="use_underline">True</property>
|
| 28 | 28 |
</object>
|
| 29 | 29 |
</child>
|
| ... | ... | @@ -807,18 +807,27 @@ def build_accounts_menu(): |
| 807 | 807 |
|
| 808 | 808 |
acc_menu = menubar.get_item_link(menu_position, 'submenu')
|
| 809 | 809 |
acc_menu.remove_all()
|
| 810 |
+ |
|
| 810 | 811 |
accounts_list = sorted(app.contacts.get_accounts())
|
| 811 | 812 |
if not accounts_list:
|
| 812 |
- no_accounts = _('No Accounts available')
|
|
| 813 |
- acc_menu.append_item(Gio.MenuItem.new(no_accounts, None))
|
|
| 813 |
+ modify_account_item = Gio.MenuItem.new(_('_Add Account…'),
|
|
| 814 |
+ 'app.accounts::')
|
|
| 815 |
+ acc_menu.append_item(modify_account_item)
|
|
| 814 | 816 |
return
|
| 817 |
+ |
|
| 815 | 818 |
if len(accounts_list) > 1:
|
| 819 |
+ modify_account_item = Gio.MenuItem.new(_('_Modify Accounts…'),
|
|
| 820 |
+ 'app.accounts::')
|
|
| 821 |
+ acc_menu.append_item(modify_account_item)
|
|
| 816 | 822 |
for acc in accounts_list:
|
| 817 | 823 |
label = escape_mnemonic(app.get_account_label(acc))
|
| 818 | 824 |
acc_menu.append_submenu(
|
| 819 | 825 |
label, get_account_menu(acc))
|
| 820 | 826 |
else:
|
| 821 | 827 |
acc_menu = get_account_menu(accounts_list[0])
|
| 828 |
+ modify_account_item = Gio.MenuItem.new(_('_Modify Account…'),
|
|
| 829 |
+ 'app.accounts::')
|
|
| 830 |
+ acc_menu.insert_item(0, modify_account_item)
|
|
| 822 | 831 |
menubar.remove(menu_position)
|
| 823 | 832 |
menubar.insert_submenu(menu_position, _('Accounts'), acc_menu)
|
| 824 | 833 |
|
| ... | ... | @@ -837,19 +846,21 @@ def build_bookmark_menu(account): |
| 837 | 846 |
acc_menu = menubar.get_item_link(menu_position, 'submenu')
|
| 838 | 847 |
|
| 839 | 848 |
# We have more than one Account active
|
| 840 |
- if acc_menu.get_item_link(0, 'submenu'):
|
|
| 849 |
+ if acc_menu.get_item_link(1, 'submenu'):
|
|
| 841 | 850 |
for i in range(acc_menu.get_n_items()):
|
| 842 | 851 |
label = acc_menu.get_item_attribute_value(i, 'label')
|
| 843 | 852 |
account_label = escape_mnemonic(
|
| 844 | 853 |
app.config.get_per('accounts', account, 'account_label'))
|
| 845 | 854 |
if label.get_string() in (account_label, account):
|
| 846 | 855 |
menu = acc_menu.get_item_link(i, 'submenu')
|
| 856 |
+ bookmark_position = 1
|
|
| 847 | 857 |
else:
|
| 848 | 858 |
# We have only one Account active
|
| 849 | 859 |
menu = acc_menu
|
| 860 |
+ bookmark_position = 2
|
|
| 850 | 861 |
label = menu.get_item_attribute_value(1, 'label').get_string()
|
| 851 |
- menu.remove(1)
|
|
| 852 |
- menu.insert_submenu(1, label, bookmark_menu)
|
|
| 862 |
+ menu.remove(bookmark_position)
|
|
| 863 |
+ menu.insert_submenu(bookmark_position, label, bookmark_menu)
|
|
| 853 | 864 |
|
| 854 | 865 |
|
| 855 | 866 |
def get_encryption_menu(control_id, type_id, zeroconf=False):
|
| ... | ... | @@ -3076,14 +3076,6 @@ class RosterWindow: |
| 3076 | 3076 |
mw.set_active_tab(ctrl)
|
| 3077 | 3077 |
self.remove_groupchat(jid, account, maximize=True)
|
| 3078 | 3078 |
|
| 3079 |
- def on_edit_account(self, widget, account):
|
|
| 3080 |
- window = app.get_app_window(AccountsWindow)
|
|
| 3081 |
- if window is None:
|
|
| 3082 |
- window = AccountsWindow()
|
|
| 3083 |
- else:
|
|
| 3084 |
- window.present()
|
|
| 3085 |
- window.select_account(account)
|
|
| 3086 |
- |
|
| 3087 | 3079 |
def on_change_status_message_activate(self, widget, account):
|
| 3088 | 3080 |
show = app.SHOW_LIST[app.connections[account].connected]
|
| 3089 | 3081 |
def on_response(message, pep_dict):
|
| ... | ... | @@ -4892,8 +4884,8 @@ class RosterWindow: |
| 4892 | 4884 |
else:
|
| 4893 | 4885 |
pep_menuitem.set_sensitive(False)
|
| 4894 | 4886 |
|
| 4895 |
- edit_account_menuitem.connect('activate', self.on_edit_account,
|
|
| 4896 |
- account)
|
|
| 4887 |
+ edit_account_menuitem.set_detailed_action_name(
|
|
| 4888 |
+ 'app.accounts::%s' % account)
|
|
| 4897 | 4889 |
if app.connections[account].roster_supported:
|
| 4898 | 4890 |
add_contact_menuitem.connect('activate',
|
| 4899 | 4891 |
self.on_add_new_contact, account)
|
| ... | ... | @@ -4950,8 +4942,8 @@ class RosterWindow: |
| 4950 | 4942 |
sub_menu.append(item)
|
| 4951 | 4943 |
item.connect('activate', self.change_status, account, 'offline')
|
| 4952 | 4944 |
|
| 4953 |
- zeroconf_properties_menuitem.connect('activate',
|
|
| 4954 |
- self.on_edit_account, account)
|
|
| 4945 |
+ zeroconf_properties_menuitem.set_detailed_action_name(
|
|
| 4946 |
+ 'app.accounts::%s' % account)
|
|
| 4955 | 4947 |
|
| 4956 | 4948 |
return account_context_menu
|
| 4957 | 4949 |
|