Changeset 8536

Show
Ignore:
Timestamp:
08/22/07 01:39:51 (17 months ago)
Author:
steve-e
Message:

Remove BlockedContactsWindow?. Fixes #3142

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/data/glade/advanced_menuitem_menu.glade

    r8106 r8536  
    1 <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> 
    2 <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> 
    3  
     1<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
     2<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> 
     3<!--*- mode: xml -*--> 
    44<glade-interface> 
    5  
    6 <widget class="GtkMenu" id="advanced_menuitem_menu"> 
    7  
    8   <child> 
    9     <widget class="GtkImageMenuItem" id="send_single_message_menuitem"> 
    10       <property name="label" translatable="yes">_Send Single Message</property> 
    11       <property name="use_underline">True</property> 
    12  
    13       <child internal-child="image"> 
    14         <widget class="GtkImage" id="image1466"> 
    15           <property name="visible">True</property> 
    16           <property name="stock">gtk-new</property> 
    17           <property name="icon_size">1</property> 
    18           <property name="xalign">0.5</property> 
    19           <property name="yalign">0.5</property> 
    20           <property name="xpad">0</property> 
    21           <property name="ypad">0</property> 
    22         </widget> 
    23       </child> 
    24     </widget> 
    25   </child> 
    26  
    27   <child> 
    28     <widget class="GtkMenuItem" id="xml_console_menuitem"> 
    29       <property name="label" translatable="yes">Show _XML Console</property> 
    30       <property name="use_underline">True</property> 
    31     </widget> 
    32   </child> 
    33  
    34   <child> 
    35     <widget class="GtkImageMenuItem" id="blocked_contacts_menuitem"> 
    36       <property name="visible">True</property> 
    37       <property name="label" translatable="yes">_Blocked Contacts</property> 
    38       <property name="use_underline">True</property> 
    39       <signal name="activate" handler="on_blocked_contacts_menuitem_activate" last_modification_time="Thu, 19 Apr 2007 15:32:47 GMT"/> 
    40  
    41       <child internal-child="image"> 
    42         <widget class="GtkImage" id="image1467"> 
    43           <property name="visible">True</property> 
    44           <property name="stock">gtk-stop</property> 
    45           <property name="icon_size">1</property> 
    46           <property name="xalign">0.5</property> 
    47           <property name="yalign">0.5</property> 
    48           <property name="xpad">0</property> 
    49           <property name="ypad">0</property> 
    50         </widget> 
    51       </child> 
    52     </widget> 
    53   </child> 
    54  
    55   <child> 
    56     <widget class="GtkMenuItem" id="privacy_lists_menuitem"> 
    57       <property name="label" translatable="yes">_Privacy Lists</property> 
    58       <property name="use_underline">True</property> 
    59     </widget> 
    60   </child> 
    61  
    62   <child> 
    63     <widget class="GtkSeparatorMenuItem" id="separator8"> 
    64     </widget> 
    65   </child> 
    66  
    67   <child> 
    68     <widget class="GtkMenuItem" id="administrator_menuitem"> 
    69       <property name="label" translatable="yes">_Administrator</property> 
    70       <property name="use_underline">True</property> 
    71  
    72       <child> 
    73         <widget class="GtkMenu" id="administrator_menuitem_menu"> 
    74  
    75           <child> 
    76             <widget class="GtkImageMenuItem" id="send_server_message_menuitem"> 
    77               <property name="tooltip" translatable="yes">Sends a message to users currently connected to this server</property> 
    78               <property name="label" translatable="yes">_Send Server Message</property> 
    79               <property name="use_underline">True</property> 
    80  
    81               <child internal-child="image"> 
    82                 <widget class="GtkImage" id="image1468"> 
    83                   <property name="visible">True</property> 
    84                   <property name="stock">gtk-new</property> 
    85                   <property name="icon_size">1</property> 
    86                   <property name="xalign">0.5</property> 
    87                   <property name="yalign">0.5</property> 
    88                   <property name="xpad">0</property> 
    89                   <property name="ypad">0</property> 
    90                 </widget> 
    91               </child> 
    92             </widget> 
    93           </child> 
    94  
    95           <child> 
    96             <widget class="GtkSeparatorMenuItem" id="separator9"> 
    97               <property name="visible">True</property> 
    98             </widget> 
    99           </child> 
    100  
    101           <child> 
    102             <widget class="GtkMenuItem" id="set_motd_menuitem"> 
    103               <property name="tooltip" translatable="yes">Sets Message of the Day</property> 
    104               <property name="label" translatable="yes">Set MOTD</property> 
    105               <property name="use_underline">True</property> 
    106             </widget> 
    107           </child> 
    108  
    109           <child> 
    110             <widget class="GtkMenuItem" id="update_motd_menuitem"> 
    111               <property name="tooltip" translatable="yes">Updates Message of the Day</property> 
    112               <property name="label" translatable="yes">Update MOTD</property> 
    113               <property name="use_underline">True</property> 
    114             </widget> 
    115           </child> 
    116  
    117           <child> 
    118             <widget class="GtkImageMenuItem" id="delete_motd_menuitem"> 
    119               <property name="tooltip" translatable="yes">Deletes Message of the Day</property> 
    120               <property name="label" translatable="yes">Delete MOTD</property> 
    121               <property name="use_underline">True</property> 
    122  
    123               <child internal-child="image"> 
    124                 <widget class="GtkImage" id="image1469"> 
    125                   <property name="visible">True</property> 
    126                   <property name="stock">gtk-clear</property> 
    127                   <property name="icon_size">1</property> 
    128                   <property name="xalign">0.5</property> 
    129                   <property name="yalign">0.5</property> 
    130                   <property name="xpad">0</property> 
    131                   <property name="ypad">0</property> 
    132                 </widget> 
    133               </child> 
    134             </widget> 
    135           </child> 
    136         </widget> 
    137       </child> 
    138     </widget> 
    139   </child> 
    140 </widget> 
    141  
     5  <widget class="GtkMenu" id="advanced_menuitem_menu"> 
     6    <child> 
     7      <widget class="GtkImageMenuItem" id="send_single_message_menuitem"> 
     8        <property name="label" translatable="yes">_Send Single Message</property> 
     9        <property name="use_underline">True</property> 
     10        <child internal-child="image"> 
     11          <widget class="GtkImage" id="image1466"> 
     12            <property name="visible">True</property> 
     13            <property name="stock">gtk-new</property> 
     14            <property name="icon_size">1</property> 
     15          </widget> 
     16        </child> 
     17      </widget> 
     18    </child> 
     19    <child> 
     20      <widget class="GtkMenuItem" id="xml_console_menuitem"> 
     21        <property name="label" translatable="yes">Show _XML Console</property> 
     22        <property name="use_underline">True</property> 
     23      </widget> 
     24    </child> 
     25    <child> 
     26      <widget class="GtkMenuItem" id="privacy_lists_menuitem"> 
     27        <property name="label" translatable="yes">_Privacy Lists</property> 
     28        <property name="use_underline">True</property> 
     29      </widget> 
     30    </child> 
     31    <child> 
     32      <widget class="GtkSeparatorMenuItem" id="separator8"> 
     33      </widget> 
     34    </child> 
     35    <child> 
     36      <widget class="GtkMenuItem" id="administrator_menuitem"> 
     37        <property name="label" translatable="yes">_Administrator</property> 
     38        <property name="use_underline">True</property> 
     39        <child> 
     40          <widget class="GtkMenu" id="administrator_menuitem_menu"> 
     41            <child> 
     42              <widget class="GtkImageMenuItem" id="send_server_message_menuitem"> 
     43                <property name="tooltip" translatable="yes">Sends a message to users currently connected to this server</property> 
     44                <property name="label" translatable="yes">_Send Server Message</property> 
     45                <property name="use_underline">True</property> 
     46                <child internal-child="image"> 
     47                  <widget class="GtkImage" id="image1468"> 
     48                    <property name="visible">True</property> 
     49                    <property name="stock">gtk-new</property> 
     50                    <property name="icon_size">1</property> 
     51                  </widget> 
     52                </child> 
     53              </widget> 
     54            </child> 
     55            <child> 
     56              <widget class="GtkSeparatorMenuItem" id="separator9"> 
     57                <property name="visible">True</property> 
     58              </widget> 
     59            </child> 
     60            <child> 
     61              <widget class="GtkMenuItem" id="set_motd_menuitem"> 
     62                <property name="tooltip" translatable="yes">Sets Message of the Day</property> 
     63                <property name="label" translatable="yes">Set MOTD</property> 
     64                <property name="use_underline">True</property> 
     65              </widget> 
     66            </child> 
     67            <child> 
     68              <widget class="GtkMenuItem" id="update_motd_menuitem"> 
     69                <property name="tooltip" translatable="yes">Updates Message of the Day</property> 
     70                <property name="label" translatable="yes">Update MOTD</property> 
     71                <property name="use_underline">True</property> 
     72              </widget> 
     73            </child> 
     74            <child> 
     75              <widget class="GtkImageMenuItem" id="delete_motd_menuitem"> 
     76                <property name="tooltip" translatable="yes">Deletes Message of the Day</property> 
     77                <property name="label" translatable="yes">Delete MOTD</property> 
     78                <property name="use_underline">True</property> 
     79                <child internal-child="image"> 
     80                  <widget class="GtkImage" id="image1469"> 
     81                    <property name="visible">True</property> 
     82                    <property name="stock">gtk-clear</property> 
     83                    <property name="icon_size">1</property> 
     84                  </widget> 
     85                </child> 
     86              </widget> 
     87            </child> 
     88          </widget> 
     89        </child> 
     90      </widget> 
     91    </child> 
     92  </widget> 
    14293</glade-interface> 
  • trunk/src/dialogs.py

    r8535 r8536  
    23622362                self.window.destroy() 
    23632363 
    2364 class BlockedContactsWindow: 
    2365         '''Window that is the main window for ContactWindows;''' 
    2366         def __init__(self, account): 
    2367                 self.account = account 
    2368                 self.xml = gtkgui_helpers.get_glade('blocked_contacts_window.glade') 
    2369                 self.window = self.xml.get_widget('blocked_contacts_window') 
    2370                 self.remove_button = self.xml.get_widget('remove_button') 
    2371                 self.contacts_treeview = self.xml.get_widget('contacts_treeview') 
    2372                 renderer = gtk.CellRendererText() 
    2373                  
    2374                 self.store = gtk.ListStore(str) 
    2375                 self.contacts_treeview.set_model(self.store) 
    2376                  
    2377                 column = gtk.TreeViewColumn('Contact', renderer, text=0) 
    2378                 self.contacts_treeview.append_column(column) 
    2379          
    2380                 if len(gajim.connections) > 1: 
    2381                         title = _('Blocked Contacts for %s') % self.account 
    2382                 else: 
    2383                         title = _('Blocked Contacts') 
    2384                 self.window.set_title(title) 
    2385                 self.window.show_all() 
    2386                 self.xml.signal_autoconnect(self) 
    2387                 gajim.connections[self.account].get_privacy_list('block') 
    2388          
    2389         def on_blocked_contacts_window_destroy(self, widget): 
    2390                 key_name = 'blocked_contacts' 
    2391                 if key_name in gajim.interface.instances[self.account]: 
    2392                         del gajim.interface.instances[self.account][key_name] 
    2393  
    2394         def on_remove_button_clicked(self, widget): 
    2395                 if self.contacts_treeview.get_selection().get_selected()[1] == None: 
    2396                         return 
    2397                 tags = [] 
    2398                 rule_selected = self.store.get_path( 
    2399                         self.contacts_treeview.get_selection().get_selected()[1])[0] 
    2400                 for i in range(0, len(self.global_rules)): 
    2401                         if i != rule_selected: 
    2402                                 tags.append(self.global_rules[i]) 
    2403                         else: 
    2404                                 deleted_rule = self.global_rules[i] 
    2405                 for rule in self.global_rules_to_append: 
    2406                         tags.append(rule) 
    2407                 gajim.connections[self.account].set_privacy_list( 
    2408                         'block', tags) 
    2409                 gajim.connections[self.account].get_privacy_list('block') 
    2410                 if len(tags) == 0: 
    2411                         self.privacy_list_received([]) 
    2412                         gajim.connections[self.account].blocked_contacts = [] 
    2413                         gajim.connections[self.account].blocked_groups = [] 
    2414                         gajim.connections[self.account].blocked_list = [] 
    2415                         gajim.connections[self.account].set_default_list('') 
    2416                         gajim.connections[self.account].set_active_list('') 
    2417                         gajim.connections[self.account].del_privacy_list('block') 
    2418                 status = gajim.connections[self.account].connected 
    2419                 msg = gajim.connections[self.account].status 
    2420                 show = gajim.SHOW_LIST[gajim.connections[self.account].connected] 
    2421                 if deleted_rule['type'] == 'jid': 
    2422                         jid = deleted_rule['value'] 
    2423                         gajim.connections[self.account].send_custom_status(show, msg, jid) 
    2424                         # needed for draw_contact: 
    2425                         if jid in gajim.connections[self.account].blocked_contacts: 
    2426                                 gajim.connections[self.account].blocked_contacts.remove(jid) 
    2427                         gajim.interface.roster.draw_contact(jid, self.account) 
    2428                 else: 
    2429                         group = deleted_rule['value'] 
    2430                         # needed for draw_group: 
    2431                         if group in gajim.connections[self.account].blocked_groups: 
    2432                                 gajim.connections[self.account].blocked_groups.remove(group) 
    2433                         gajim.interface.roster.draw_group(group, self.account) 
    2434                         for jid in gajim.contacts.get_jid_list(self.account): 
    2435                                 contact = gajim.contacts.get_contact_with_highest_priority( 
    2436                                         self.account, jid) 
    2437                                 if group in contact.groups: 
    2438                                         gajim.connections[self.account].send_custom_status(show, msg, 
    2439                                                 contact.jid) 
    2440                                         gajim.interface.roster.draw_contact(contact.jid, self.account) 
    2441          
    2442         def privacy_list_received(self, rules): 
    2443                 self.store.clear() 
    2444                 self.global_rules = [] 
    2445                 self.global_rules_to_append = [] 
    2446                 for rule in rules: 
    2447                         if rule['type'] == 'jid' and rule['action'] == 'deny': 
    2448                                 #self.global_rules[text_item] = rule 
    2449                                 self.store.append([rule['value']]) 
    2450                                 self.global_rules.append(rule) 
    2451                         elif rule['type'] == 'group' and rule['action'] == 'deny': 
    2452                                 text_item = _('Group %s') % rule['value'] 
    2453                                 self.store.append([text_item]) 
    2454                                 self.global_rules.append(rule) 
    2455                         else: 
    2456                                 self.global_rules_to_append.append(rule) 
    2457  
    2458  
    24592364class PrivacyListsWindow: 
    24602365        '''Window that is the main window for Privacy Lists; 
  • trunk/src/roster_window.py

    r8535 r8536  
    825825                                dialogs.PrivacyListsWindow(account) 
    826826 
    827         def on_blocked_contacts_menuitem_activate(self, widget, account): 
    828                 if gajim.interface.instances[account].has_key('blocked_contacts'): 
    829                         gajim.interface.instances[account]['blocked_contacts'].window.present() 
    830                 else: 
    831                         gajim.interface.instances[account]['blocked_contacts'] = \ 
    832                                 dialogs.BlockedContactsWindow(account) 
    833  
    834827        def on_set_motd_menuitem_activate(self, widget, account): 
    835828                server = gajim.config.get_per('accounts', account, 'hostname') 
     
    864857                        'send_single_message_menuitem') 
    865858                xml_console_menuitem = xml.get_widget('xml_console_menuitem') 
    866                 blocked_contacts_menuitem = xml.get_widget('blocked_contacts_menuitem') 
    867859                privacy_lists_menuitem = xml.get_widget('privacy_lists_menuitem') 
    868860                administrator_menuitem = xml.get_widget('administrator_menuitem') 
     
    878870                if gajim.connections[account] and gajim.connections[account].\ 
    879871                privacy_rules_supported: 
    880                         blocked_contacts_menuitem.connect('activate', 
    881                                 self.on_blocked_contacts_menuitem_activate, account) 
    882872                        privacy_lists_menuitem.connect('activate', 
    883873                                self.on_privacy_lists_menuitem_activate, account) 
    884874                else: 
    885                         blocked_contacts_menuitem.set_sensitive(False) 
    886875                        privacy_lists_menuitem.set_sensitive(False) 
    887876