RosterWindow: Remove blocked contacts from contact list if not in roster
When blocking a contact which is not in the roster, the contact is removed and the ChatControl is closed (if any).
This commit is contained in:
parent
a50cedaa6b
commit
ba1f88a006
2 changed files with 27 additions and 13 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.22.1 -->
|
<!-- Generated with glade 3.22.1 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.12"/>
|
<requires lib="gtk+" version="3.20"/>
|
||||||
<object class="GtkListStore" id="blocking_store">
|
<object class="GtkListStore" id="blocking_store">
|
||||||
<columns>
|
<columns>
|
||||||
<!-- column-name jid -->
|
<!-- column-name jid -->
|
||||||
|
@ -13,10 +13,7 @@
|
||||||
<property name="height_request">300</property>
|
<property name="height_request">300</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="margin_left">18</property>
|
<property name="border_width">18</property>
|
||||||
<property name="margin_right">18</property>
|
|
||||||
<property name="margin_top">18</property>
|
|
||||||
<property name="margin_bottom">18</property>
|
|
||||||
<property name="row_spacing">5</property>
|
<property name="row_spacing">5</property>
|
||||||
<property name="column_spacing">10</property>
|
<property name="column_spacing">10</property>
|
||||||
<child>
|
<child>
|
||||||
|
@ -83,6 +80,9 @@
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="always_show_image">True</property>
|
<property name="always_show_image">True</property>
|
||||||
<signal name="clicked" handler="_on_save" swapped="no"/>
|
<signal name="clicked" handler="_on_save" swapped="no"/>
|
||||||
|
<style>
|
||||||
|
<class name="suggested-action"/>
|
||||||
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
|
|
|
@ -64,8 +64,8 @@ from gajim.common.dbus import location
|
||||||
from gajim.common import ged
|
from gajim.common import ged
|
||||||
from gajim.message_window import MessageWindowMgr
|
from gajim.message_window import MessageWindowMgr
|
||||||
|
|
||||||
from gajim.gtk.dialogs import ConfirmationDialogCheck
|
|
||||||
from gajim.gtk.dialogs import ConfirmationDialog
|
from gajim.gtk.dialogs import ConfirmationDialog
|
||||||
|
from gajim.gtk.dialogs import ConfirmationDialogCheck
|
||||||
from gajim.gtk.dialogs import ErrorDialog
|
from gajim.gtk.dialogs import ErrorDialog
|
||||||
from gajim.gtk.dialogs import InputDialog
|
from gajim.gtk.dialogs import InputDialog
|
||||||
from gajim.gtk.dialogs import WarningDialog
|
from gajim.gtk.dialogs import WarningDialog
|
||||||
|
@ -2789,6 +2789,15 @@ class RosterWindow:
|
||||||
con = app.connections[acct]
|
con = app.connections[acct]
|
||||||
con.get_module('PrivacyLists').block_contacts(l_, msg)
|
con.get_module('PrivacyLists').block_contacts(l_, msg)
|
||||||
for contact in l_:
|
for contact in l_:
|
||||||
|
ctrl = app.interface.msg_win_mgr.get_control(
|
||||||
|
contact.jid, acct)
|
||||||
|
if ctrl:
|
||||||
|
ctrl.parent_win.remove_tab(
|
||||||
|
ctrl, ctrl.parent_win.CLOSE_COMMAND, force=True)
|
||||||
|
if contact.show == 'not in roster':
|
||||||
|
self.remove_contact(contact.jid, acct, force=True,
|
||||||
|
backend=True)
|
||||||
|
return
|
||||||
self.draw_contact(contact.jid, acct)
|
self.draw_contact(contact.jid, acct)
|
||||||
else:
|
else:
|
||||||
for acct in accounts:
|
for acct in accounts:
|
||||||
|
@ -2811,12 +2820,17 @@ class RosterWindow:
|
||||||
if confirm_block == 'no':
|
if confirm_block == 'no':
|
||||||
_block_it()
|
_block_it()
|
||||||
return
|
return
|
||||||
pritext = _('You are about to block a contact. Are you sure you want'
|
NewConfirmationCheckDialog(_('Block Contact'),
|
||||||
' to continue?')
|
_('Really block this contact?'),
|
||||||
sectext = _('This contact will see you offline and you will not '
|
_('This contact will see you offline and '
|
||||||
'receive messages it sends you.')
|
'you will not receive messages sent to '
|
||||||
ConfirmationDialogCheck(pritext, sectext,
|
'you by this contact.'),
|
||||||
_('_Do not ask me again'), on_response_ok=_block_it)
|
_('_Do not ask me again'),
|
||||||
|
[DialogButton.make('Cancel'),
|
||||||
|
DialogButton.make('Remove',
|
||||||
|
text=_('Block Contact'),
|
||||||
|
callback=_block_it)],
|
||||||
|
modal=False).show()
|
||||||
|
|
||||||
def on_unblock(self, widget, list_, group=None):
|
def on_unblock(self, widget, list_, group=None):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue