~ubuntu-branches/ubuntu/oneiric/emesene/oneiric-proposed

« back to all changes in this revision

Viewing changes to ConversationWindow.py

  • Committer: Bazaar Package Importer
  • Author(s): Devid Antonio Filoni
  • Date: 2010-04-14 01:33:51 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20100414013351-r2icbt5gs4ai71j8
Tags: 1.6.1-0ubuntu1
* New upstream release (LP: #562646).
* Fix missing-debian-source-format lintian warning.
* Refresh 20_dont_build_own_libmimic.patch patch.
* Bump Standards-Version to 3.8.4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
        self.notOpen = True
45
45
        self.minimized = False
46
46
 
47
 
        self.width = self.config.user['convWindowWidth']
48
 
        self.height = self.config.user['convWindowHeight']
49
 
        self.set_default_size(self.width, self.height)
 
47
        if not self.config.user['windows']:
 
48
            self.geometry = self.config.user['convWindowGeometry']
 
49
            self.parse_geometry(self.geometry)
 
50
        else:
 
51
            self.width = int(self.config.user['convWindowWidth'])
 
52
            self.height = int(self.config.user['convWindowHeight'])
 
53
            self.set_default_size(self.width, self.height)
 
54
 
 
55
        if self.config.user['convMaximized']:
 
56
            self.maximize()
 
57
 
50
58
        self.connect('size-allocate', self.on_size_alloc)
51
 
        self.connect('window-state-event', self.setIconified)
52
59
 
53
60
        # accelerators
54
61
        accelGroup = gtk.AccelGroup()
105
112
 
106
113
        self.connect('delete-event', self.close)
107
114
        self.connect('focus-in-event', self.on_focus_in_event)
 
115
        self.connect('window-state-event', self.on_window_state_event)
108
116
        self.switchId = self.tabs.connect('switch-page', self.on_switch_page)
109
117
        self.showMenubarId = self.config.connect('change::showMenubar', \
110
118
            self.on_menubar_change)
133
141
        self.unsetUrgency()
134
142
        self.conversation.ui.input.grabFocus()
135
143
 
 
144
    def on_window_state_event(self, widget, event):
 
145
        self.config.user['convMaximized'] = (event.new_window_state == gtk.gdk.WINDOW_STATE_MAXIMIZED)
 
146
        self.minimized = (event.new_window_state == gtk.gdk.WINDOW_STATE_ICONIFIED)
 
147
 
136
148
    def on_size_alloc(self, widget, allocation):
137
149
        self.width = allocation.width
138
150
        self.height = allocation.height
180
192
        if self.conversation.switchboard.firstUser == contact.email:
181
193
            self.set_icon(self.conversation.getWindowIcon())
182
194
 
183
 
    #set minimized to true if the event is launched
184
 
    #this may not always work because the window manager can do other thing
185
 
    #instead of minimizing the window
186
 
    #this should work almost always
187
 
    def setIconified(self, widget, windowstateevent):
188
 
        if windowstateevent.new_window_state == gtk.gdk.WINDOW_STATE_ICONIFIED:
189
 
            self.minimized = True
190
 
        else:
191
 
            self.minimized = False
192
 
 
193
195
    def show_invite_dialog(self, conversation=None):
194
196
        '''show the invite dialog for conversation, if conversation is
195
197
        None, then the current conversation is used'''
408
410
            activeTransfers = []
409
411
            for conv in self.conversations:
410
412
                for tr in conv.transfers:
411
 
                    activeTransfers.append(tr)        
 
413
                    if tr.state not in (tr.RECEIVED, tr.FAILED):
 
414
                        activeTransfers.append(tr)        
412
415
            if len(activeTransfers) > 0:
413
416
                message = _("Transfers are happening, are you sure you want to cancel them?")
414
417
                dialog.yes_no(message, self.close_win_confirmation, activeTransfers)
423
426
            
424
427
    def close_win_for_real(self):
425
428
        ''' this method kills all the tabs (if present) and this very window'''
 
429
        self.x, self.y = self.get_position()
426
430
        for conversation in self.conversations:
427
431
            conversation.setStatus('closed')
428
432
            conversation.setClosed(True)
436
440
        self.conversations = []
437
441
        self.closed = True
438
442
 
 
443
        self.geometry = '%dx%d+%d+%d' % (self.width,self.height,self.x,self.y)
 
444
        self.controller.config.user['convWindowGeometry'] = self.geometry
439
445
        self.controller.config.user['convWindowWidth'] = self.width
440
446
        self.controller.config.user['convWindowHeight'] = self.height
441
447
 
470
476
            try:
471
477
                if self.controller.config.user['blinkTrayIcon']:
472
478
                    self.controller.trayIcon.tray.set_blinking(True)
473
 
            except:
474
 
                pass
475
 
            try:
476
479
                if self.controller.config.user['statusbarHighLight']:
477
480
                    self.set_urgency_hint(True)
478
481
            except:
481
484
    def unsetUrgency(self):
482
485
        '''try to unset the urgency hint to the window and
483
486
        turn off tray icon blink'''
484
 
 
485
487
        try:
486
488
            self.set_urgency_hint(False)
487
489
            self.controller.trayIcon.tray.set_blinking(False)
488
490
            self.conversation.ui.update()
 
491
            self.controller.emit('message-read')
489
492
        except:
490
493
            # errors related to getting disconnected don't really matter
491
494
            pass