Permalink
Browse files

[Gtk] Update front end to handle presence correctly

  • Loading branch information...
1 parent 3c03650 commit 587be6099e2bf931328e0622b219e7f15fb028a1 @luckyluke luckyluke committed Sep 22, 2009
Showing with 13 additions and 12 deletions.
  1. +1 −1 amsn2/core/personalinfo_manager.py
  2. +12 −11 amsn2/gui/front_ends/gtk/login.py
@@ -34,7 +34,7 @@ def setAccount(self, amsn_account):
self._personalinfoview.psm = strv
# set login presence, from this moment the client appears to the others
- self._personalinfoview.presence = amsn_account.view.presence
+ self._personalinfoview.presence = self._core.p2s[amsn_account.view.presence]
""" Actions from ourselves """
def _onNickChanged(self, new_nick):
@@ -110,8 +110,8 @@ def __init__(self, amsn_core, parent):
for key in self._amsn_core.p2s:
name = self._amsn_core.p2s[key]
_, path = self._theme_manager.get_statusicon("buddy_%s" % name)
- if (name == 'offline'): continue
- self.status_values[name] = status_n
+ if (key == self._amsn_core.Presence.OFFLINE): continue
+ self.status_values[key] = status_n
status_n = status_n +1
icon = gtk.gdk.pixbuf_new_from_file(path)
status_list.append([icon, name, key])
@@ -125,7 +125,7 @@ def __init__(self, amsn_core, parent):
# status combobox
self.statusCombo = gtk.ComboBox()
self.statusCombo.set_model(status_list)
- self.statusCombo.set_active(4) # Set status to 'online'
+ self.statusCombo.set_active(7) # Set status to 'online'
self.statusCombo.pack_start(iconCell, False)
self.statusCombo.pack_start(txtCell, False)
self.statusCombo.add_attribute(iconCell, 'pixbuf',0)
@@ -233,13 +233,15 @@ def __switch_to_account(self, email):
accv = self.getAccountViewFromEmail(email)
if accv is None:
- accv = AccountView()
+ accv = AccountView(self._amsn_core)
accv.email = email
self.user.get_children()[0].set_text(accv.email)
if accv.password:
self.password.set_text(accv.password)
+ self.statusCombo.set_active(self.status_values[accv.presence])
+
self.rememberMe.set_active(accv.save)
self.rememberPass.set_active(accv.save_password)
self.autoLogin.set_active(accv.autologin)
@@ -290,15 +292,14 @@ def signin(self):
accv = self.getAccountViewFromEmail(email)
if accv is None:
- accv = AccountView()
+ accv = AccountView(self._amsn_core)
accv.email = email
accv.password = self.password.get_text()
- status = self.statusCombo.get_active()
- for key in self.status_values:
- if self.status_values[key] == status:
- break
- accv.presence = key
+ iter = self.statusCombo.get_active_iter()
+ model = self.statusCombo.get_model()
+ status = model.get_value(iter, 2)
+ accv.presence = status
accv.save = self.rememberMe.get_active()
accv.save_password = self.rememberPass.get_active()
@@ -344,7 +345,7 @@ def __on_toggled_cb(self, source):
accv = self.getAccountViewFromEmail(email)
if accv is None:
- accv = AccountView()
+ accv = AccountView(self._amsn_core)
accv.email = email
if source is self.rememberMe:

0 comments on commit 587be60

Please sign in to comment.