[ekiga/v4_0] Roster: Fixed bug that could lead to incorrect presence display.



commit c9b25568e39f45e6f71d26015d13003950ebd880
Author: Damien Sandras <dsandras beip be>
Date:   Sun Feb 24 15:08:02 2013 +0100

    Roster: Fixed bug that could lead to incorrect presence display.
    
    The roster uses an animation to display the presence. The problem is
    that if the presence changed between the time the animation was fired
    and the time the definitive icon had to be displayed, the roster was
    displaying the old presence state.

 lib/engine/gui/gtk-frontend/roster-view-gtk.cpp |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp b/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
index 883fcd6..58a36e4 100644
--- a/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
+++ b/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
@@ -71,7 +71,6 @@ typedef struct _StatusIconInfo {
 
   GtkTreeModel *model;
   GtkTreeIter *iter;
-  std::string new_presence;
   int cpt;
 
 } StatusIconInfo;
@@ -464,12 +463,16 @@ static void roster_view_gtk_set_core (RosterViewGtk* self,
 static int
 roster_view_gtk_icon_blink_cb (gpointer data)
 {
+  gchar *presence = NULL;
   g_return_val_if_fail (data != NULL, FALSE);
 
   StatusIconInfo *info = (StatusIconInfo*) data;
   time_t now = time (0);
   tm *ltm = localtime (&now);
 
+  gtk_tree_model_get (GTK_TREE_MODEL (info->model), info->iter,
+                      COLUMN_PRESENCE, &presence, -1);
+
   std::string icon = "avatar-default";
   if (info->cpt == 0) {
     gtk_tree_store_set (GTK_TREE_STORE (info->model), info->iter,
@@ -477,8 +480,8 @@ roster_view_gtk_icon_blink_cb (gpointer data)
                         -1);
   }
   else if (ltm->tm_sec % 3 == 0 && info->cpt > 2) {
-    if (info->new_presence != "unknown")
-      icon = "user-" + info->new_presence;
+    if (presence && strcmp (presence, "unknown"))
+      icon = "user-" + std::string(presence);
     gtk_tree_store_set (GTK_TREE_STORE (info->model), info->iter,
                         COLUMN_PRESENCE_ICON, icon.c_str (),
                         -1);
@@ -1059,7 +1062,6 @@ on_presentity_added (RosterViewGtk* self,
       StatusIconInfo *info = new StatusIconInfo ();
       info->model = GTK_TREE_MODEL (self->priv->store);
       info->iter = gtk_tree_iter_copy (&iter);
-      info->new_presence = presentity->get_presence ();
       info->cpt = 0;
 
       timeout = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, 1, roster_view_gtk_icon_blink_cb,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]