Philipp Hörist pushed to branch master at gajim / gajim

Commits:

4 changed files:

Changes:

  • gajim/data/gui/account_context_menu.ui
    ... ... @@ -28,14 +28,6 @@
    28 28
             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
    
    29 29
           </object>
    
    30 30
         </child>
    
    31
    -    <child>
    
    32
    -      <object class="GtkMenuItem" id="join_group_chat_menuitem">
    
    33
    -        <property name="visible">True</property>
    
    34
    -        <property name="can_focus">False</property>
    
    35
    -        <property name="label" translatable="yes">Join _Group Chat</property>
    
    36
    -        <property name="use_underline">True</property>
    
    37
    -      </object>
    
    38
    -    </child>
    
    39 31
         <child>
    
    40 32
           <object class="GtkSeparatorMenuItem" id="seperator">
    
    41 33
             <property name="visible">True</property>
    

  • gajim/gui_interface.py
    ... ... @@ -601,9 +601,6 @@ class Interface:
    601 601
             'from', 'both'):
    
    602 602
                 self.instances[account]['sub_request'][obj.jid].destroy()
    
    603 603
     
    
    604
    -    def handle_event_bookmarks(self, obj):
    
    605
    -        gui_menu_builder.build_bookmark_menu(obj.account)
    
    606
    -
    
    607 604
         def handle_event_file_send_error(self, event):
    
    608 605
             ft = self.instances['file_transfers']
    
    609 606
             ft.set_status(event.file_props, 'stop')
    
    ... ... @@ -1226,7 +1223,6 @@ class Interface:
    1226 1223
             self.handlers = {
    
    1227 1224
                 'DB_ERROR': [self.handle_event_db_error],
    
    1228 1225
                 'file-send-error': [self.handle_event_file_send_error],
    
    1229
    -            'bookmarks-received': [self.handle_event_bookmarks],
    
    1230 1226
                 'client-cert-passphrase': [
    
    1231 1227
                     self.handle_event_client_cert_passphrase],
    
    1232 1228
                 'connection-lost': [self.handle_event_connection_lost],
    

  • gajim/gui_menu_builder.py
    ... ... @@ -15,12 +15,11 @@
    15 15
     # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
    
    16 16
     
    
    17 17
     from gi.repository import Gtk, Gio, GLib
    
    18
    -from nbxmpp.protocol import NS_COMMANDS, NS_FILE, NS_MUC
    
    18
    +from nbxmpp.protocol import NS_COMMANDS, NS_FILE
    
    19 19
     from nbxmpp.protocol import NS_JINGLE_FILE_TRANSFER_5, NS_CONFERENCE
    
    20 20
     
    
    21 21
     from gajim import gtkgui_helpers
    
    22 22
     from gajim import message_control
    
    23
    -from gajim.gtkgui_helpers import get_action
    
    24 23
     from gajim.common import app
    
    25 24
     from gajim.common import helpers
    
    26 25
     from gajim.common.i18n import ngettext
    
    ... ... @@ -47,8 +46,6 @@ def build_resources_submenu(contacts, account, action, room_jid=None,
    47 46
             if action == roster.on_invite_to_room:  # pylint: disable=comparison-with-callable
    
    48 47
                 item.connect('activate', action, [(c, account)], room_jid,
    
    49 48
                         room_account, c.resource)
    
    50
    -        elif action == roster.on_invite_to_new_room:  # pylint: disable=comparison-with-callable
    
    51
    -            item.connect('activate', action, [(c, account)], c.resource)
    
    52 49
             else: # start_chat, execute_command, send_file
    
    53 50
                 item.connect('activate', action, c, account, c.resource)
    
    54 51
     
    
    ... ... @@ -92,42 +89,7 @@ show_bookmarked=False, force_resource=False):
    92 89
             return
    
    93 90
         invite_to_submenu = Gtk.Menu()
    
    94 91
         invite_menuitem.set_submenu(invite_to_submenu)
    
    95
    -    invite_to_new_room_menuitem = Gtk.MenuItem.new_with_mnemonic(_(
    
    96
    -        '_New Group Chat'))
    
    97
    -    if len(contact_list) > 1: # several resources
    
    98
    -        invite_to_new_room_menuitem.set_submenu(build_resources_submenu(
    
    99
    -            contact_list, account, roster.on_invite_to_new_room, cap=NS_MUC))
    
    100
    -    elif len(list_) == 1:
    
    101
    -        invite_menuitem.set_sensitive(True)
    
    102
    -        # use resource if it's self contact
    
    103
    -        if contact.jid == app.get_jid_from_account(account) or force_resource:
    
    104
    -            resource = contact.resource
    
    105
    -        else:
    
    106
    -            resource = None
    
    107
    -        invite_to_new_room_menuitem.connect('activate',
    
    108
    -            roster.on_invite_to_new_room, list_, resource)
    
    109
    -    elif len(list_) > 1:
    
    110
    -        list2 = []
    
    111
    -        for (c, a) in list_:
    
    112
    -            if c.supports(NS_MUC):
    
    113
    -                list2.append((c, a))
    
    114
    -        if list2:
    
    115
    -            invite_to_new_room_menuitem.connect('activate',
    
    116
    -                roster.on_invite_to_new_room, list2, None)
    
    117
    -        else:
    
    118
    -            invite_menuitem.set_sensitive(False)
    
    119
    -    else:
    
    120
    -        invite_menuitem.set_sensitive(False)
    
    121
    -    # transform None in 'jabber'
    
    122
    -    c_t = contacts_transport or 'jabber'
    
    123
    -    muc_jid = {}
    
    124
    -    for account in connected_accounts:
    
    125
    -        for t in app.connections[account].muc_jid:
    
    126
    -            muc_jid[t] = app.connections[account].muc_jid[t]
    
    127
    -    if c_t not in muc_jid:
    
    128
    -        invite_to_new_room_menuitem.set_sensitive(False)
    
    129 92
         rooms = [] # a list of (room_jid, account) tuple
    
    130
    -    invite_to_submenu.append(invite_to_new_room_menuitem)
    
    131 93
         minimized_controls = []
    
    132 94
         for account in connected_accounts:
    
    133 95
             minimized_controls += \
    
    ... ... @@ -698,43 +660,6 @@ def get_groupchat_menu(control_id, account, jid):
    698 660
         return build_menu(groupchat_menu)
    
    699 661
     
    
    700 662
     
    
    701
    -def get_bookmarks_menu(account, rebuild=False):
    
    702
    -    con = app.connections[account]
    
    703
    -    bookmarks = con.get_module('Bookmarks').get_sorted_bookmarks(short_name=True)
    
    704
    -
    
    705
    -    menu = Gio.Menu()
    
    706
    -
    
    707
    -    # Build Join Groupchat
    
    708
    -    action = 'app.{}-join-groupchat'.format(account)
    
    709
    -    menuitem = Gio.MenuItem.new(_('Join Group Chat'), action)
    
    710
    -    variant = GLib.Variant('as', [account, ''])
    
    711
    -    menuitem.set_action_and_target_value(action, variant)
    
    712
    -    menu.append_item(menuitem)
    
    713
    -
    
    714
    -    # Build Bookmarks
    
    715
    -    section = Gio.Menu()
    
    716
    -    for bookmark in bookmarks:
    
    717
    -        action = 'app.{}-activate-bookmark'.format(account)
    
    718
    -        menuitem = Gio.MenuItem.new(bookmark.name, action)
    
    719
    -
    
    720
    -        # Create Variant Dict
    
    721
    -        dict_ = {'account': GLib.Variant('s', account),
    
    722
    -                 'jid': GLib.Variant('s', str(bookmark.jid))}
    
    723
    -        if bookmark.nick:
    
    724
    -            dict_['nick'] = GLib.Variant('s', bookmark.nick)
    
    725
    -        if bookmark.password:
    
    726
    -            dict_['password'] = GLib.Variant('s', bookmark.password)
    
    727
    -        variant_dict = GLib.Variant('a{sv}', dict_)
    
    728
    -
    
    729
    -        menuitem.set_action_and_target_value(action, variant_dict)
    
    730
    -        section.append_item(menuitem)
    
    731
    -    menu.append_section(None, section)
    
    732
    -    if not rebuild:
    
    733
    -        get_action(account + '-activate-bookmark').set_enabled(True)
    
    734
    -
    
    735
    -    return menu
    
    736
    -
    
    737
    -
    
    738 663
     def get_account_menu(account):
    
    739 664
         '''
    
    740 665
         [(action, label/sub_menu)]
    
    ... ... @@ -744,7 +669,6 @@ def get_account_menu(account):
    744 669
         '''
    
    745 670
         account_menu = [
    
    746 671
             ('-add-contact', _('Add Contact…')),
    
    747
    -        ('-join-groupchat', _('Join Group Chat')),
    
    748 672
             ('-profile', _('Profile')),
    
    749 673
             ('-services', _('Discover Services')),
    
    750 674
             ('-start-single-chat', _('Send Single Message…')),
    
    ... ... @@ -773,11 +697,6 @@ def get_account_menu(account):
    773 697
             for item in preset:
    
    774 698
                 if isinstance(item[1], str):
    
    775 699
                     action, label = item
    
    776
    -                if action == '-join-groupchat':
    
    777
    -                    bookmark_menu = get_bookmarks_menu(account, True)
    
    778
    -                    if bookmark_menu:
    
    779
    -                        menu.append_submenu(label, bookmark_menu)
    
    780
    -                        continue
    
    781 700
                     action = 'app.{}{}'.format(account, action)
    
    782 701
                     menuitem = Gio.MenuItem.new(label, action)
    
    783 702
                     if 'add-contact' in action:
    
    ... ... @@ -832,37 +751,6 @@ def build_accounts_menu():
    832 751
             menubar.insert_submenu(menu_position, _('Accounts'), acc_menu)
    
    833 752
     
    
    834 753
     
    
    835
    -def build_bookmark_menu(account):
    
    836
    -    menubar = app.app.get_menubar()
    
    837
    -    bookmark_menu = get_bookmarks_menu(account)
    
    838
    -    if not bookmark_menu:
    
    839
    -        return
    
    840
    -
    
    841
    -    menu_position = 1
    
    842
    -    if app.prefers_app_menu():
    
    843
    -        menu_position = 0
    
    844
    -
    
    845
    -    # Accounts Submenu
    
    846
    -    acc_menu = menubar.get_item_link(menu_position, 'submenu')
    
    847
    -
    
    848
    -    # We have more than one Account active
    
    849
    -    if acc_menu.get_item_link(1, 'submenu'):
    
    850
    -        for i in range(acc_menu.get_n_items()):
    
    851
    -            label = acc_menu.get_item_attribute_value(i, 'label')
    
    852
    -            account_label = escape_mnemonic(
    
    853
    -                app.config.get_per('accounts', account, 'account_label'))
    
    854
    -            if label.get_string() in (account_label, account):
    
    855
    -                menu = acc_menu.get_item_link(i, 'submenu')
    
    856
    -                bookmark_position = 1
    
    857
    -    else:
    
    858
    -        # We have only one Account active
    
    859
    -        menu = acc_menu
    
    860
    -        bookmark_position = 2
    
    861
    -    label = menu.get_item_attribute_value(1, 'label').get_string()
    
    862
    -    menu.remove(bookmark_position)
    
    863
    -    menu.insert_submenu(bookmark_position, label, bookmark_menu)
    
    864
    -
    
    865
    -
    
    866 754
     def get_encryption_menu(control_id, type_id, zeroconf=False):
    
    867 755
         menu = Gio.Menu()
    
    868 756
         menu.append(
    

  • gajim/roster_window.py
    ... ... @@ -74,7 +74,6 @@ from gajim.gtk.dialogs import InformationDialog
    74 74
     from gajim.gtk.dialogs import NonModalConfirmationDialog
    
    75 75
     from gajim.gtk.dialogs import CertificateDialog
    
    76 76
     from gajim.gtk.dialogs import InvitationReceivedDialog
    
    77
    -from gajim.gtk.join_groupchat import JoinGroupchatWindow
    
    78 77
     from gajim.gtk.single_message import SingleMessageWindow
    
    79 78
     from gajim.gtk.add_contact import AddNewContactWindow
    
    80 79
     from gajim.gtk.pep_config import ManagePEPServicesWindow
    
    ... ... @@ -2998,34 +2997,6 @@ class RosterWindow:
    2998 2997
             app.interface.instances['file_transfers'].show_file_send_request(
    
    2999 2998
                 account, contact)
    
    3000 2999
     
    
    3001
    -    def on_invite_to_new_room(self, widget, list_, resource=None):
    
    3002
    -        """
    
    3003
    -        Resource parameter MUST NOT be used if more than one contact in list
    
    3004
    -        """
    
    3005
    -        account_list = []
    
    3006
    -        jid_list = []
    
    3007
    -        for (contact, account) in list_:
    
    3008
    -            if contact.jid not in jid_list:
    
    3009
    -                if resource: # we MUST have one contact only in list_
    
    3010
    -                    fjid = contact.jid + '/' + resource
    
    3011
    -                    jid_list.append(fjid)
    
    3012
    -                else:
    
    3013
    -                    jid_list.append(contact.jid)
    
    3014
    -            if account not in account_list:
    
    3015
    -                account_list.append(account)
    
    3016
    -        # transform None in 'jabber'
    
    3017
    -        type_ = app.get_transport_name_from_jid(jid_list[0]) or 'jabber'
    
    3018
    -        for account in account_list:
    
    3019
    -            if app.connections[account].muc_jid[type_]:
    
    3020
    -                # create the room on this muc server
    
    3021
    -                if 'join_gc' in app.interface.instances[account]:
    
    3022
    -                    app.interface.instances[account]['join_gc'].destroy()
    
    3023
    -                else:
    
    3024
    -                    app.interface.instances[account]['join_gc'] = \
    
    3025
    -                        JoinGroupchatWindow(
    
    3026
    -                            account, None, automatic={'invities': jid_list})
    
    3027
    -                break
    
    3028
    -
    
    3029 3000
         def on_invite_to_room(self, widget, list_, room_jid, room_account,
    
    3030 3001
         resource=None):
    
    3031 3002
             """
    
    ... ... @@ -3544,13 +3515,6 @@ class RosterWindow:
    3544 3515
         def on_add_new_contact(self, widget, account):
    
    3545 3516
             AddNewContactWindow(account)
    
    3546 3517
     
    
    3547
    -    def on_join_gc_activate(self, widget, account):
    
    3548
    -        """
    
    3549
    -        When the join gc menuitem is clicked, show the join gc window
    
    3550
    -        """
    
    3551
    -        app.app.activate_action('%s-join-groupchat' % account,
    
    3552
    -                                GLib.Variant('as', [account, '']))
    
    3553
    -
    
    3554 3518
         def on_create_gc_activate(self, widget, account):
    
    3555 3519
             """
    
    3556 3520
             When the create gc menuitem is clicked, show the create gc window
    
    ... ... @@ -4802,8 +4766,6 @@ class RosterWindow:
    4802 4766
                 account_context_menu = xml.get_object('account_context_menu')
    
    4803 4767
     
    
    4804 4768
                 status_menuitem = xml.get_object('status_menuitem')
    
    4805
    -            join_group_chat_menuitem = xml.get_object(
    
    4806
    -                'join_group_chat_menuitem')
    
    4807 4769
                 add_contact_menuitem = xml.get_object('add_contact_menuitem')
    
    4808 4770
                 service_discovery_menuitem = xml.get_object(
    
    4809 4771
                     'service_discovery_menuitem')
    
    ... ... @@ -4900,14 +4862,10 @@ class RosterWindow:
    4900 4862
                 view_certificate_menuitem.connect('activate',
    
    4901 4863
                     self.on_view_certificate, account)
    
    4902 4864
     
    
    4903
    -            gc_sub_menu = Gtk.Menu() # gc is always a submenu
    
    4904
    -            join_group_chat_menuitem.set_submenu(gc_sub_menu)
    
    4905
    -            self.add_bookmarks_list(gc_sub_menu, account)
    
    4906
    -
    
    4907 4865
                 # make some items insensitive if account is offline
    
    4908 4866
                 if not app.account_is_connected(account):
    
    4909 4867
                     for widget in (add_contact_menuitem, service_discovery_menuitem,
    
    4910
    -                join_group_chat_menuitem, execute_command_menuitem,
    
    4868
    +                execute_command_menuitem,
    
    4911 4869
                     view_certificate_menuitem, pep_menuitem):
    
    4912 4870
                         widget.set_sensitive(False)
    
    4913 4871
             else:
    
    ... ... @@ -5345,34 +5303,6 @@ class RosterWindow:
    5345 5303
             menu.append(item)
    
    5346 5304
             item.connect('activate', self.on_history_manager_menuitem_activate)
    
    5347 5305
     
    
    5348
    -    def add_bookmarks_list(self, gc_sub_menu, account):
    
    5349
    -        """
    
    5350
    -        Show join new group chat item and bookmarks list for an account
    
    5351
    -        """
    
    5352
    -        item = Gtk.MenuItem.new_with_mnemonic(_('_Join New Group Chat'))
    
    5353
    -        item.connect('activate', self.on_join_gc_activate, account)
    
    5354
    -        gc_sub_menu.append(item)
    
    5355
    -        item = Gtk.MenuItem.new_with_mnemonic(_('_Create Group Chat'))
    
    5356
    -        item.connect('activate', self.on_create_gc_activate, account)
    
    5357
    -        gc_sub_menu.append(item)
    
    5358
    -
    
    5359
    -        # User has at least one bookmark.
    
    5360
    -        con = app.connections[account]
    
    5361
    -        if con.get_module('Bookmarks').bookmarks:
    
    5362
    -            item = Gtk.SeparatorMenuItem.new()
    
    5363
    -            gc_sub_menu.append(item)
    
    5364
    -
    
    5365
    -        bookmarks = con.get_module('Bookmarks').get_sorted_bookmarks(
    
    5366
    -            short_name=True)
    
    5367
    -        for bookmark in bookmarks:
    
    5368
    -            # Do not use underline.
    
    5369
    -            item = Gtk.MenuItem.new_with_label(bookmark.name)
    
    5370
    -            item.set_use_underline(False)
    
    5371
    -            item.connect(
    
    5372
    -                'activate', self.on_bookmark_menuitem_activate,
    
    5373
    -                account, bookmark)
    
    5374
    -            gc_sub_menu.append(item)
    
    5375
    -
    
    5376 5306
         def show_appropriate_context_menu(self, event, iters):
    
    5377 5307
             # iters must be all of the same type
    
    5378 5308
             model = self.modelfilter
    
    ... ... @@ -5413,19 +5343,6 @@ class RosterWindow:
    5413 5343
     
    
    5414 5344
             return True
    
    5415 5345
     
    
    5416
    -    def on_ctrl_j(self, accel_group, acceleratable, keyval, modifier):
    
    5417
    -        """
    
    5418
    -        Bring up the conference join dialog, when CTRL+J accelerator is being
    
    5419
    -        activated
    
    5420
    -        """
    
    5421
    -        # find a connected account:
    
    5422
    -        for account in app.connections:
    
    5423
    -            if account == 'Local':
    
    5424
    -                continue
    
    5425
    -            if app.account_is_connected(account):
    
    5426
    -                self.on_join_gc_activate(None, account)
    
    5427
    -        return True
    
    5428
    -
    
    5429 5346
         def fill_column(self, col):
    
    5430 5347
             for rend in self.renderers_list:
    
    5431 5348
                 col.pack_start(rend[1], rend[2])
    
    ... ... @@ -5731,12 +5648,6 @@ class RosterWindow:
    5731 5648
                 # transient for the roster window
    
    5732 5649
                 GLib.idle_add(_open_wizard)
    
    5733 5650
     
    
    5734
    -        # Setting CTRL+J to be the shortcut for bringing up the dialog to join a
    
    5735
    -        # conference.
    
    5736
    -        accel_group = Gtk.accel_groups_from_object(self.window)[0]
    
    5737
    -        accel_group.connect(Gdk.KEY_j, Gdk.ModifierType.CONTROL_MASK,
    
    5738
    -                Gtk.AccelFlags.MASK, self.on_ctrl_j)
    
    5739
    -
    
    5740 5651
             # Setting CTRL+S to be the shortcut to change status message
    
    5741 5652
             accel_group = Gtk.AccelGroup()
    
    5742 5653
             keyval, mod = Gtk.accelerator_parse('<Control>s')