From 7b45c9c8f09895c1504ec0a32155d311514a6a31 Mon Sep 17 00:00:00 2001 From: Stephan Erb Date: Tue, 21 Aug 2007 23:39:51 +0000 Subject: [PATCH] Remove BlockedContactsWindow. Fixes #3142 --- data/glade/advanced_menuitem_menu.glade | 231 ++++++++++-------------- src/dialogs.py | 95 ---------- src/roster_window.py | 11 -- 3 files changed, 91 insertions(+), 246 deletions(-) diff --git a/data/glade/advanced_menuitem_menu.glade b/data/glade/advanced_menuitem_menu.glade index b331dbb3e..35517651a 100644 --- a/data/glade/advanced_menuitem_menu.glade +++ b/data/glade/advanced_menuitem_menu.glade @@ -1,142 +1,93 @@ - - - + + + - - - - - - _Send Single Message - True - - - - True - gtk-new - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - Show _XML Console - True - - - - - - True - _Blocked Contacts - True - - - - - True - gtk-stop - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - _Privacy Lists - True - - - - - - - - - - - _Administrator - True - - - - - - - Sends a message to users currently connected to this server - _Send Server Message - True - - - - True - gtk-new - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - - - - - - Sets Message of the Day - Set MOTD - True - - - - - - Updates Message of the Day - Update MOTD - True - - - - - - Deletes Message of the Day - Delete MOTD - True - - - - True - gtk-clear - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - - - + + + + _Send Single Message + True + + + True + gtk-new + 1 + + + + + + + Show _XML Console + True + + + + + _Privacy Lists + True + + + + + + + + + _Administrator + True + + + + + Sends a message to users currently connected to this server + _Send Server Message + True + + + True + gtk-new + 1 + + + + + + + True + + + + + Sets Message of the Day + Set MOTD + True + + + + + Updates Message of the Day + Update MOTD + True + + + + + Deletes Message of the Day + Delete MOTD + True + + + True + gtk-clear + 1 + + + + + + + + + diff --git a/src/dialogs.py b/src/dialogs.py index f6f3ff63c..287048661 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -2361,101 +2361,6 @@ class PrivacyListWindow: def on_close_button_clicked(self, widget): self.window.destroy() -class BlockedContactsWindow: - '''Window that is the main window for ContactWindows;''' - def __init__(self, account): - self.account = account - self.xml = gtkgui_helpers.get_glade('blocked_contacts_window.glade') - self.window = self.xml.get_widget('blocked_contacts_window') - self.remove_button = self.xml.get_widget('remove_button') - self.contacts_treeview = self.xml.get_widget('contacts_treeview') - renderer = gtk.CellRendererText() - - self.store = gtk.ListStore(str) - self.contacts_treeview.set_model(self.store) - - column = gtk.TreeViewColumn('Contact', renderer, text=0) - self.contacts_treeview.append_column(column) - - if len(gajim.connections) > 1: - title = _('Blocked Contacts for %s') % self.account - else: - title = _('Blocked Contacts') - self.window.set_title(title) - self.window.show_all() - self.xml.signal_autoconnect(self) - gajim.connections[self.account].get_privacy_list('block') - - def on_blocked_contacts_window_destroy(self, widget): - key_name = 'blocked_contacts' - if key_name in gajim.interface.instances[self.account]: - del gajim.interface.instances[self.account][key_name] - - def on_remove_button_clicked(self, widget): - if self.contacts_treeview.get_selection().get_selected()[1] == None: - return - tags = [] - rule_selected = self.store.get_path( - self.contacts_treeview.get_selection().get_selected()[1])[0] - for i in range(0, len(self.global_rules)): - if i != rule_selected: - tags.append(self.global_rules[i]) - else: - deleted_rule = self.global_rules[i] - for rule in self.global_rules_to_append: - tags.append(rule) - gajim.connections[self.account].set_privacy_list( - 'block', tags) - gajim.connections[self.account].get_privacy_list('block') - if len(tags) == 0: - self.privacy_list_received([]) - gajim.connections[self.account].blocked_contacts = [] - gajim.connections[self.account].blocked_groups = [] - gajim.connections[self.account].blocked_list = [] - gajim.connections[self.account].set_default_list('') - gajim.connections[self.account].set_active_list('') - gajim.connections[self.account].del_privacy_list('block') - status = gajim.connections[self.account].connected - msg = gajim.connections[self.account].status - show = gajim.SHOW_LIST[gajim.connections[self.account].connected] - if deleted_rule['type'] == 'jid': - jid = deleted_rule['value'] - gajim.connections[self.account].send_custom_status(show, msg, jid) - # needed for draw_contact: - if jid in gajim.connections[self.account].blocked_contacts: - gajim.connections[self.account].blocked_contacts.remove(jid) - gajim.interface.roster.draw_contact(jid, self.account) - else: - group = deleted_rule['value'] - # needed for draw_group: - if group in gajim.connections[self.account].blocked_groups: - gajim.connections[self.account].blocked_groups.remove(group) - gajim.interface.roster.draw_group(group, self.account) - for jid in gajim.contacts.get_jid_list(self.account): - contact = gajim.contacts.get_contact_with_highest_priority( - self.account, jid) - if group in contact.groups: - gajim.connections[self.account].send_custom_status(show, msg, - contact.jid) - gajim.interface.roster.draw_contact(contact.jid, self.account) - - def privacy_list_received(self, rules): - self.store.clear() - self.global_rules = [] - self.global_rules_to_append = [] - for rule in rules: - if rule['type'] == 'jid' and rule['action'] == 'deny': - #self.global_rules[text_item] = rule - self.store.append([rule['value']]) - self.global_rules.append(rule) - elif rule['type'] == 'group' and rule['action'] == 'deny': - text_item = _('Group %s') % rule['value'] - self.store.append([text_item]) - self.global_rules.append(rule) - else: - self.global_rules_to_append.append(rule) - - class PrivacyListsWindow: '''Window that is the main window for Privacy Lists; we can list there the privacy lists and ask to create a new one diff --git a/src/roster_window.py b/src/roster_window.py index fe7be527e..99dd80b85 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -824,13 +824,6 @@ class RosterWindow: gajim.interface.instances[account]['privacy_lists'] = \ dialogs.PrivacyListsWindow(account) - def on_blocked_contacts_menuitem_activate(self, widget, account): - if gajim.interface.instances[account].has_key('blocked_contacts'): - gajim.interface.instances[account]['blocked_contacts'].window.present() - else: - gajim.interface.instances[account]['blocked_contacts'] = \ - dialogs.BlockedContactsWindow(account) - def on_set_motd_menuitem_activate(self, widget, account): server = gajim.config.get_per('accounts', account, 'hostname') server += '/announce/motd' @@ -863,7 +856,6 @@ class RosterWindow: send_single_message_menuitem = xml.get_widget( 'send_single_message_menuitem') xml_console_menuitem = xml.get_widget('xml_console_menuitem') - blocked_contacts_menuitem = xml.get_widget('blocked_contacts_menuitem') privacy_lists_menuitem = xml.get_widget('privacy_lists_menuitem') administrator_menuitem = xml.get_widget('administrator_menuitem') send_server_message_menuitem = xml.get_widget( @@ -877,12 +869,9 @@ class RosterWindow: if gajim.connections[account] and gajim.connections[account].\ privacy_rules_supported: - blocked_contacts_menuitem.connect('activate', - self.on_blocked_contacts_menuitem_activate, account) privacy_lists_menuitem.connect('activate', self.on_privacy_lists_menuitem_activate, account) else: - blocked_contacts_menuitem.set_sensitive(False) privacy_lists_menuitem.set_sensitive(False) if gajim.connections[account].is_zeroconf: