Changeset 10157
- Timestamp:
- 08/08/08 17:19:08 (4 months ago)
- Location:
- trunk/src
- Files:
-
- 7 modified
-
chat_control.py (modified) (1 diff)
-
dialogs.py (modified) (1 diff)
-
groupchat_control.py (modified) (3 diffs)
-
gtkgui_helpers.py (modified) (1 diff)
-
message_control.py (modified) (1 diff)
-
message_window.py (modified) (3 diffs)
-
roster_window.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/chat_control.py
r10111 r10157 2201 2201 self.msg_textview.destroy() 2202 2202 2203 def allow_shutdown(self, method ):2203 def allow_shutdown(self, method, on_yes, on_no, on_minimize): 2204 2204 if time.time() - gajim.last_message_time[self.account]\ 2205 2205 [self.get_full_jid()] < 2: 2206 2206 # 2 seconds 2207 def on_ok(): 2208 on_yes(self) 2209 2210 def on_cancel(): 2211 on_no(self) 2212 2207 2213 dialog = dialogs.ConfirmationDialog( 2208 2214 # %s is being replaced in the code with JID 2209 2215 _('You just received a new message from "%s"') % self.contact.jid, 2210 2216 _('If you close this tab and you have history disabled, '\ 2211 'this message will be lost.') )2212 if dialog.get_response() != gtk.RESPONSE_OK:2213 return 'no' # stop the propagation of the event2214 return 'yes'2217 'this message will be lost.'), on_response_ok=on_ok, 2218 on_response_cancel=on_cancel) 2219 return 2220 on_yes(self) 2215 2221 2216 2222 def handle_incoming_chatstate(self): -
trunk/src/dialogs.py
r10155 r10157 1363 1363 if self.user_response_cancel: 1364 1364 if isinstance(self.user_response_cancel, tuple): 1365 self.user_response_cancel[0](*self.user_response_cancel[1:]) 1365 self.user_response_cancel[0](self.is_checked(), 1366 *self.user_response_cancel[1:]) 1366 1367 else: 1367 self.user_response_cancel( )1368 self.user_response_cancel(self.is_checked()) 1368 1369 self.destroy() 1369 1370 -
trunk/src/groupchat_control.py
r10154 r10157 1668 1668 gajim.events.remove_events(self.account, self.room_jid) 1669 1669 1670 def allow_shutdown(self, method ):1670 def allow_shutdown(self, method, on_yes, on_no, on_minimize): 1671 1671 if self.contact.jid in gajim.config.get_per('accounts', self.account, 1672 1672 'minimized_gc').split(' '): 1673 return 'minimize' 1673 on_minimize(self) 1674 return 1674 1675 if method == self.parent_win.CLOSE_ESC: 1675 1676 model, iter = self.list_treeview.get_selection().get_selected() 1676 1677 if iter: 1677 1678 self.list_treeview.get_selection().unselect_all() 1678 return 'no'1679 retval = 'yes'1679 on_no(self) 1680 return 1680 1681 includes = gajim.config.get('confirm_close_muc_rooms').split(' ') 1681 1682 excludes = gajim.config.get('noconfirm_close_muc_rooms').split(' ') … … 1684 1685 and gajim.gc_connected[self.account][self.room_jid] and self.room_jid not\ 1685 1686 in excludes: 1687 1688 def on_ok(clicked): 1689 if clicked: 1690 # user does not want to be asked again 1691 gajim.config.set('confirm_close_muc', False) 1692 on_yes(self) 1693 1694 def on_cancel(clicked): 1695 if clicked: 1696 # user does not want to be asked again 1697 gajim.config.set('confirm_close_muc', False) 1698 on_no(self) 1699 1686 1700 pritext = _('Are you sure you want to leave group chat "%s"?')\ 1687 1701 % self.name … … 1690 1704 1691 1705 dialog = dialogs.ConfirmationDialogCheck(pritext, sectext, 1692 _('Do _not ask me again')) 1693 1694 if dialog.get_response() != gtk.RESPONSE_OK: 1695 retval = 'no' 1696 1697 if dialog.is_checked(): # user does not want to be asked again 1698 gajim.config.set('confirm_close_muc', False) 1699 1700 return retval 1706 _('Do _not ask me again'), on_response_ok=on_ok, 1707 on_response_cancel=on_cancel) 1708 return 1709 1710 on_yes(self) 1701 1711 1702 1712 def set_control_active(self, state): -
trunk/src/gtkgui_helpers.py
r10142 r10157 731 731 checktext = _('Always check to see if Gajim is the default Jabber client ' 732 732 'on startup') 733 def on_cancel(): 734 gajim.config.set('check_if_gajim_is_default', 735 dlg.is_checked()) 733 def on_cancel(checked): 734 gajim.config.set('check_if_gajim_is_default', checked) 736 735 dlg = dialogs.ConfirmationDialogCheck(pritext, sectext, checktext, 737 736 set_gajim_as_xmpp_handler, on_cancel) -
trunk/src/message_control.py
r10084 r10157 63 63 pass # Derived classes MUST implement this method 64 64 65 def allow_shutdown(self, method): 65 def allow_shutdown(self, method, on_response_yes, on_response_no, 66 on_response_minimize): 66 67 '''Called to check is a control is allowed to shutdown. 67 68 If a control is not in a suitable shutdown state this method 68 should return 'no', else 'yes' or 'minimize' ''' 69 should call on_response_no, else on_response_yes or 70 on_response_minimize ''' 69 71 # NOTE: Derived classes MAY implement this 70 return 'yes'72 on_response_yes(self) 71 73 72 74 def shutdown(self): -
trunk/src/message_window.py
r10107 r10157 66 66 # lead to cylcular references 67 67 self.handlers = {} 68 # Don't show warning dialogs when we want to delete the window 69 self.dont_warn_on_delete = False 68 70 69 71 self.widget_name = 'message_window' … … 183 185 184 186 def _on_window_delete(self, win, event): 187 if self.dont_warn_on_delete: 188 # Destroy the window 189 return False 190 191 def on_yes(ctrl): 192 if self.on_delete_ok == 1: 193 self.dont_warn_on_delete = True 194 win.destroy() 195 self.on_delete_ok -= 1 196 197 def on_no(ctrl): 198 return 199 200 def on_minimize(ctrl): 201 self.on_delete_ok -= 1 202 ctrl.minimize() 203 185 204 # Make sure all controls are okay with being deleted 186 205 ctrl_to_minimize = [] 206 self.on_delete_ok = self.get_nb_controls() 187 207 for ctrl in self.controls(): 188 allow_shutdown = ctrl.allow_shutdown(self.CLOSE_CLOSE_BUTTON) 189 if allow_shutdown == 'no': 190 return True # halt the delete 191 elif allow_shutdown == 'minimize': 192 ctrl_to_minimize.append(ctrl) 193 # If all are ok, minimize the one that need to be minimized 194 for ctrl in ctrl_to_minimize: 195 ctrl.minimize() 196 return False 208 ctrl.allow_shutdown(self.CLOSE_CLOSE_BUTTON, on_yes, on_no, 209 on_minimize) 210 return True # halt the delete for the moment 197 211 198 212 def _on_window_destroy(self, win): … … 607 621 for ctrl in jid_dict.values(): 608 622 yield ctrl 623 624 def get_nb_controls(self): 625 nb_ctrl = 0 626 for jid_dict in self._controls.values(): 627 for ctrl in jid_dict.values(): 628 nb_ctrl += 1 629 return nb_ctrl 609 630 610 631 def move_to_next_unread_tab(self, forward): -
trunk/src/roster_window.py
r10155 r10157 3796 3796 'accounts or transport accounts.') 3797 3797 dlg = dialogs.ConfirmationDialogCheck(pritext, sectext, 3798 _('Do _not ask me again'), on_response_ok =merge_contacts)3798 _('Do _not ask me again'), on_response_ok=merge_contacts) 3799 3799 if not confirm_metacontacts: # First time we see this window 3800 3800 dlg.checkbutton.set_active(True)
