When we just received a message from a contact and we close it's chat window/tab Gajim asks if we really want to close it.
This commit is contained in:
parent
973e001832
commit
d330521f4d
|
@ -8105,9 +8105,9 @@ Custom</property>
|
||||||
<property name="skip_pager_hint">False</property>
|
<property name="skip_pager_hint">False</property>
|
||||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||||
<signal name="destroy" handler="on_tabbed_chat_window_destroy" last_modification_time="Wed, 02 Mar 2005 17:56:08 GMT"/>
|
|
||||||
<signal name="focus_in_event" handler="on_tabbed_chat_window_focus_in_event" last_modification_time="Wed, 02 Mar 2005 17:57:33 GMT"/>
|
<signal name="focus_in_event" handler="on_tabbed_chat_window_focus_in_event" last_modification_time="Wed, 02 Mar 2005 17:57:33 GMT"/>
|
||||||
<signal name="key_press_event" handler="on_tabbed_chat_window_key_press_event" last_modification_time="Wed, 02 Mar 2005 17:59:50 GMT"/>
|
<signal name="key_press_event" handler="on_tabbed_chat_window_key_press_event" last_modification_time="Wed, 02 Mar 2005 17:59:50 GMT"/>
|
||||||
|
<signal name="delete_event" handler="on_tabbed_chat_window_delete_event" last_modification_time="Mon, 07 Mar 2005 11:06:00 GMT"/>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkNotebook" id="chat_notebook">
|
<widget class="GtkNotebook" id="chat_notebook">
|
||||||
|
|
|
@ -211,11 +211,12 @@ class tabbed_chat_window:
|
||||||
self.tagStatus = {}
|
self.tagStatus = {}
|
||||||
self.users = {}
|
self.users = {}
|
||||||
self.nb_unread = {}
|
self.nb_unread = {}
|
||||||
|
self.last_message_time = {}
|
||||||
self.window = self.xml.get_widget('tabbed_chat_window')
|
self.window = self.xml.get_widget('tabbed_chat_window')
|
||||||
self.new_user(user)
|
self.new_user(user)
|
||||||
self.show_title()
|
self.show_title()
|
||||||
self.xml.signal_connect('on_tabbed_chat_window_destroy', \
|
self.xml.signal_connect('on_tabbed_chat_window_delete_event', \
|
||||||
self.on_tabbed_chat_window_destroy)
|
self.on_tabbed_chat_window_delete_event)
|
||||||
self.xml.signal_connect('on_tabbed_chat_window_focus_in_event', \
|
self.xml.signal_connect('on_tabbed_chat_window_focus_in_event', \
|
||||||
self.on_tabbed_chat_window_focus_in_event)
|
self.on_tabbed_chat_window_focus_in_event)
|
||||||
self.xml.signal_connect('on_tabbed_chat_window_key_press_event', \
|
self.xml.signal_connect('on_tabbed_chat_window_key_press_event', \
|
||||||
|
@ -281,9 +282,14 @@ class tabbed_chat_window:
|
||||||
self.xmls[jid].get_widget('status_image').\
|
self.xmls[jid].get_widget('status_image').\
|
||||||
set_from_pixbuf(image.get_pixbuf())
|
set_from_pixbuf(image.get_pixbuf())
|
||||||
|
|
||||||
def on_tabbed_chat_window_destroy(self, widget):
|
def on_tabbed_chat_window_delete_event(self, widget, event):
|
||||||
"""close window"""
|
"""close window"""
|
||||||
#clean self.plugin.windows[self.account]['chats']
|
#clean self.plugin.windows[self.account]['chats']
|
||||||
|
for jid in self.users:
|
||||||
|
if time.time() - self.last_message_time[jid] < 2:
|
||||||
|
dialog = Confirmation_dialog(_('You received a message from %s in the last two secondes.\nDo you still want to close this window ?') % jid)
|
||||||
|
if dialog.get_response() != gtk.RESPONSE_YES:
|
||||||
|
return True #stop the propagation of the event
|
||||||
for jid in self.users:
|
for jid in self.users:
|
||||||
del self.plugin.windows[self.account]['chats'][jid]
|
del self.plugin.windows[self.account]['chats'][jid]
|
||||||
if self.plugin.windows[self.account]['chats'].has_key('tabbed'):
|
if self.plugin.windows[self.account]['chats'].has_key('tabbed'):
|
||||||
|
@ -366,6 +372,11 @@ class tabbed_chat_window:
|
||||||
self.chat_notebook.page_num(child))
|
self.chat_notebook.page_num(child))
|
||||||
|
|
||||||
def remove_tab(self, jid):
|
def remove_tab(self, jid):
|
||||||
|
if time.time() - self.last_message_time[jid] < 2:
|
||||||
|
dialog = Confirmation_dialog(_('You received a message from %s in the last two secondes.\nDo you still want to close this tab ?') % jid)
|
||||||
|
if dialog.get_response() != gtk.RESPONSE_YES:
|
||||||
|
return
|
||||||
|
|
||||||
if len(self.xmls) == 1:
|
if len(self.xmls) == 1:
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
else:
|
else:
|
||||||
|
@ -374,6 +385,7 @@ class tabbed_chat_window:
|
||||||
del self.plugin.windows[self.account]['chats'][jid]
|
del self.plugin.windows[self.account]['chats'][jid]
|
||||||
del self.users[jid]
|
del self.users[jid]
|
||||||
del self.nb_unread[jid]
|
del self.nb_unread[jid]
|
||||||
|
del self.last_message_time[jid]
|
||||||
del self.xmls[jid]
|
del self.xmls[jid]
|
||||||
del self.tagIn[jid]
|
del self.tagIn[jid]
|
||||||
del self.tagOut[jid]
|
del self.tagOut[jid]
|
||||||
|
@ -384,6 +396,7 @@ class tabbed_chat_window:
|
||||||
|
|
||||||
def new_user(self, user):
|
def new_user(self, user):
|
||||||
self.nb_unread[user.jid] = 0
|
self.nb_unread[user.jid] = 0
|
||||||
|
self.last_message_time[user.jid] = 0
|
||||||
self.users[user.jid] = user
|
self.users[user.jid] = user
|
||||||
self.xmls[user.jid] = gtk.glade.XML(GTKGUI_GLADE, 'chat_vbox', APP)
|
self.xmls[user.jid] = gtk.glade.XML(GTKGUI_GLADE, 'chat_vbox', APP)
|
||||||
|
|
||||||
|
@ -564,6 +577,7 @@ class tabbed_chat_window:
|
||||||
else:
|
else:
|
||||||
tag = 'incoming'
|
tag = 'incoming'
|
||||||
name = user.name
|
name = user.name
|
||||||
|
self.last_message_time[jid] = time.time()
|
||||||
|
|
||||||
if text.startswith('/me'):
|
if text.startswith('/me'):
|
||||||
ttext = name + text[3:] + '\n'
|
ttext = name + text[3:] + '\n'
|
||||||
|
|
Loading…
Reference in New Issue