Remove BlockedContactsWindow. Fixes #3142

This commit is contained in:
Stephan Erb 2007-08-21 23:39:51 +00:00
parent 78f2c8c021
commit 7b45c9c8f0
3 changed files with 91 additions and 246 deletions

View File

@ -1,142 +1,93 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--*- mode: xml -*-->
<glade-interface>
<widget class="GtkMenu" id="advanced_menuitem_menu">
<child>
<widget class="GtkImageMenuItem" id="send_single_message_menuitem">
<property name="label" translatable="yes">_Send Single Message</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1466">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="xml_console_menuitem">
<property name="label" translatable="yes">Show _XML Console</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="blocked_contacts_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">_Blocked Contacts</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_blocked_contacts_menuitem_activate" last_modification_time="Thu, 19 Apr 2007 15:32:47 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1467">
<property name="visible">True</property>
<property name="stock">gtk-stop</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="privacy_lists_menuitem">
<property name="label" translatable="yes">_Privacy Lists</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator8">
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="administrator_menuitem">
<property name="label" translatable="yes">_Administrator</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="administrator_menuitem_menu">
<child>
<widget class="GtkImageMenuItem" id="send_server_message_menuitem">
<property name="tooltip" translatable="yes">Sends a message to users currently connected to this server</property>
<property name="label" translatable="yes">_Send Server Message</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1468">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator9">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="set_motd_menuitem">
<property name="tooltip" translatable="yes">Sets Message of the Day</property>
<property name="label" translatable="yes">Set MOTD</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="update_motd_menuitem">
<property name="tooltip" translatable="yes">Updates Message of the Day</property>
<property name="label" translatable="yes">Update MOTD</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="delete_motd_menuitem">
<property name="tooltip" translatable="yes">Deletes Message of the Day</property>
<property name="label" translatable="yes">Delete MOTD</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1469">
<property name="visible">True</property>
<property name="stock">gtk-clear</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<widget class="GtkMenu" id="advanced_menuitem_menu">
<child>
<widget class="GtkImageMenuItem" id="send_single_message_menuitem">
<property name="label" translatable="yes">_Send Single Message</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1466">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="xml_console_menuitem">
<property name="label" translatable="yes">Show _XML Console</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="privacy_lists_menuitem">
<property name="label" translatable="yes">_Privacy Lists</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator8">
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="administrator_menuitem">
<property name="label" translatable="yes">_Administrator</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="administrator_menuitem_menu">
<child>
<widget class="GtkImageMenuItem" id="send_server_message_menuitem">
<property name="tooltip" translatable="yes">Sends a message to users currently connected to this server</property>
<property name="label" translatable="yes">_Send Server Message</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1468">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator9">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="set_motd_menuitem">
<property name="tooltip" translatable="yes">Sets Message of the Day</property>
<property name="label" translatable="yes">Set MOTD</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="update_motd_menuitem">
<property name="tooltip" translatable="yes">Updates Message of the Day</property>
<property name="label" translatable="yes">Update MOTD</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="delete_motd_menuitem">
<property name="tooltip" translatable="yes">Deletes Message of the Day</property>
<property name="label" translatable="yes">Delete MOTD</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1469">
<property name="visible">True</property>
<property name="stock">gtk-clear</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -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

View File

@ -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: