73
73
self.connect('size-allocate', self.on_size_alloc)
75
theme = controller.getTheme()
75
theme = controller.theme
76
76
gtk.window_set_default_icon_list(theme.getImage('icon16'),
77
77
theme.getImage('icon32'),
78
78
theme.getImage('icon48'),
85
85
self.currentInterface = 'login'
86
86
self.buildInterface('login')
88
self.itemSelectedId = 0
89
91
sap = self.signals.append
90
92
sap(self.config.connect('change::showUserPanel',
98
100
sap(self.config.connect('change::userListAvatarSize',
100
102
sap(self.config.connect('change::smallIcons', self.updateSize))
102
103
# TODO: do we need disconnecting these signals?
104
105
def on_size_alloc(self, widget, allocation):
202
204
self.vbox.pack_start(self.menu, False, False)
203
205
self.userList = UserList.UserList(self.controller, \
204
206
self.controller.theme, self.controller.config)
207
self.itemSelectedId = self.userList.connect('item-selected',
206
210
self.userPanel = UserPanel.UserPanel(self.controller)
207
211
self.vbox.pack_start(self.userPanel, False, False)
302
306
if self.currentInterface == 'userlist':
303
307
self.userPanel.setAvatar(pixbuf)
309
def onItemSelected(self, userlist, objType, obj, path):
310
if objType == 'user':
311
self.controller.newConversation(self.controller.msn,
312
obj.email, None, True)
313
elif objType == 'group':
314
if self.userList.row_expanded(path):
315
self.userList.collapse_row(path)
317
self.userList.expand_row(path, False)
305
320
class StatusCombo(gtk.ComboBox):
306
321
'''this class represent the combo where you set the status'''
335
for i in controller.status_ordered[1]:
336
if emesenelib.common.status_table[i] == \
337
self.controller.getContactStatus():
350
for i in controller.status_ordered[0]:
351
if self.controller.contacts.get_status() == i:
344
self.statusListStore\
345
.append([self.controller.theme.statusToPixbuf(
346
emesenelib.common.status_table[i]), i,
347
self.controller.status_ordered[2][j]])
355
self.statusListStore.append([
356
self.controller.theme.statusToPixbuf(i), i,
357
_(self.controller.status_ordered[2][j])]) # re-gettext-it
350
self.set_active(counter)
360
# flag needed to avoid the double-changing of status when
361
# user changes it from another place
362
self.changeStatusFlag = True
352
self.connect('changed' , self.on_status_changed)
364
self.connect('changed', self.on_status_changed, self.changeStatusFlag)
353
365
self.controller.msn.connect('self-status-changed',
354
366
self.selfStatusChanged)
356
368
def selfStatusChanged(self, msnp, status):
369
self.changeStatusFlag = False
357
370
statusOrdered = self.controller.status_ordered[1]
359
372
if emesenelib.common.reverse_status[status] in statusOrdered:
360
373
self.set_active(statusOrdered.index(\
361
374
emesenelib.common.reverse_status[status]))
376
self.changeStatusFlag = True
363
378
def on_status_changed(self , *args):
364
self.controller.contact_manager.set_status(self.statusListStore.get(\
365
self.get_active_iter(), 1)[0])
379
if self.changeStatusFlag:
380
asd = self.statusListStore.get(self.get_active_iter(), 1)
381
print "on_status_changed", asd
382
self.controller.contacts.set_status(asd[0])