soylent r45 - trunk/src



Author: treitter
Date: Sun Jan 13 00:46:11 2008
New Revision: 45
URL: http://svn.gnome.org/viewvc/soylent?rev=45&view=rev

Log:
Fix a icon view selection-based bug introduced in the last commit

Modified:
   trunk/src/soylent-browser-person-view.c
   trunk/src/soylent-browser.c
   trunk/src/soylent-browser.h

Modified: trunk/src/soylent-browser-person-view.c
==============================================================================
--- trunk/src/soylent-browser-person-view.c	(original)
+++ trunk/src/soylent-browser-person-view.c	Sun Jan 13 00:46:11 2008
@@ -890,7 +890,7 @@
                                             const GList *e_contacts,
                                             SoylentPerson *person)
 {
-  gint retval = FALSE;
+  gboolean retval = FALSE;
 
   if (person)
     {
@@ -900,7 +900,7 @@
       if (browser)
         {
           /* Just for the scrolling;
-            * XXX: maybe that should be a separate function */
+           * XXX: maybe that should be a separate function */
           retval = soylent_browser_person_select (browser, person, TRUE);
         }
     }

Modified: trunk/src/soylent-browser.c
==============================================================================
--- trunk/src/soylent-browser.c	(original)
+++ trunk/src/soylent-browser.c	Sun Jan 13 00:46:11 2008
@@ -64,12 +64,11 @@
                                       gpointer user_data);
 
 static SoylentPerson* soylent_browser_live_contact_find_owner_person 
-                                            (SoylentBrowser *browser,
-                                             EmpathyContact *empathy_contact);
-static gboolean soylent_browser_associate_live_contact
-                                            (SoylentBrowser *browser,
-                                             SoylentPerson *person,
-                                             EmpathyContact *empathy_contact);
+                                                      (SoylentBrowser *browser,
+                                              EmpathyContact *empathy_contact);
+static gboolean soylent_browser_associate_live_contact (SoylentBrowser *browser,
+                                                        SoylentPerson *person,
+                                              EmpathyContact *empathy_contact);
 
 static gboolean soylent_browser_widget_setup (SoylentBrowser *browser);
 static gboolean soylent_browser_ebook_setup (SoylentBrowser *browser);
@@ -393,7 +392,7 @@
     }
   else
     {
-      g_warning ("SoylentBrowser's widget tree is invalid");
+      g_warning ("failed to get SoylentBrowser's widget tree ");
     }
 
   return retval;
@@ -944,14 +943,11 @@
 /* FIXME: this is vestigial - split it into two functions (show and hide the
  * edit window) */
 /* Set the main section of the window to browseable icons or a single-person
- * detail editor
- *
- * Return TRUE for success, FALSE for any failure */
-gboolean
+ * detail editor */
+void
 soylent_browser_view_set_mode (SoylentBrowser *browser,
                                soylent_browser_people_view_mode mode)
 {
-  gboolean retval = FALSE;
   GladeXML  *wtree = NULL;
   GtkWidget *sw_people = NULL;
   GtkWidget *window_person_view = NULL;
@@ -961,63 +957,88 @@
   GtkWidget *hs_detail_new = NULL;
   GtkWidget *btn_detail_add = NULL;
 
-  g_return_val_if_fail (browser != NULL, retval);
-  /* FIXME: uncomment once SoylentBrowser is a GObject:
-  g_return_val_if_fail (SOYLENT_IS_BROWSER (browser), NULL);
-   */
-  g_return_val_if_fail (SOYLENT_BROWSER_PEOPLE_VIEW_MODE_IS_VALID (mode),
-                        retval);
-
   wtree = browser->main_window;
-  if (wtree)
+  sw_people = glade_xml_get_widget (wtree, "sw_people");
+  window_person_view = glade_xml_get_widget (wtree, "window_person_view");
+  img_person_view = glade_xml_get_widget (wtree, "img_person_view");
+  icon_entry_person = glade_xml_get_widget (wtree, "icon_entry_person");
+  hbox_detail_new = glade_xml_get_widget (wtree, "hbox_detail_new");
+  hs_detail_new = glade_xml_get_widget (wtree, "hs_detail_new");
+  btn_detail_add = glade_xml_get_widget (wtree, "btn_detail_add");
+
+  browser->view_mode = mode;
+  switch (browser->view_mode)
+    {
+      case SB_PEOPLE_VIEW_MODE_BROWSE:
+        gtk_widget_set_sensitive (btn_detail_add, FALSE);
+
+        gtk_widget_show (sw_people);
+        gtk_widget_hide (window_person_view);
+        break;
+      case SB_PEOPLE_VIEW_MODE_EDIT:
+        /*
+        gtk_widget_hide (sw_people);
+        */
+        gtk_widget_show (window_person_view);
+        gtk_widget_show (img_person_view);
+
+        gtk_widget_hide (icon_entry_person);
+        gtk_widget_show (hbox_detail_new);
+        gtk_widget_show (hs_detail_new);
+        break;
+      default:
+        g_warning ("should never get here");
+        break;
+    }
+}
+
+# if 0
+gint
+soylent_browser_person_select (SoylentBrowser *browser, SoylentPerson *person,
+                               gboolean scroll)
+{
+  gint retval = -1;
+
+  if (browser)
     {
-      sw_people = glade_xml_get_widget (wtree, "sw_people");
-      window_person_view = glade_xml_get_widget (wtree, "window_person_view");
-      img_person_view = glade_xml_get_widget (wtree, "img_person_view");
-      icon_entry_person = glade_xml_get_widget (wtree, "icon_entry_person");
-      hbox_detail_new = glade_xml_get_widget (wtree, "hbox_detail_new");
-      hs_detail_new = glade_xml_get_widget (wtree, "hs_detail_new");
-      btn_detail_add = glade_xml_get_widget (wtree, "btn_detail_add");
-
-      browser->view_mode = mode;
-      switch (browser->view_mode)
+      if (person)
         {
-          case SB_PEOPLE_VIEW_MODE_BROWSE:
-            gtk_widget_set_sensitive (btn_detail_add, FALSE);
+          GladeXML *wtree = NULL;
+          GtkIconView *iv_people = NULL;
+          GtkTreeModel *model = NULL;
+          GtkTreePath *path = NULL;
+          GtkTreeIter *icon_view_iter = NULL;
 
-            gtk_widget_show (sw_people);
-            gtk_widget_hide (window_person_view);
+          wtree = browser->main_window;
+          iv_people = GTK_ICON_VIEW (glade_xml_get_widget (wtree, "iv_people"));
+          model = gtk_icon_view_get_model (iv_people);
+          icon_view_iter = soylent_person_get_icon_view_iter (person);
+          path = gtk_tree_model_get_path (model, icon_view_iter);
 
-            retval = TRUE;
-            break;
-          case SB_PEOPLE_VIEW_MODE_EDIT:
-            /*
-            gtk_widget_hide (sw_people);
-            */
-            gtk_widget_show (window_person_view);
-            gtk_widget_show (img_person_view);
-
-            gtk_widget_hide (icon_entry_person);
-            gtk_widget_show (hbox_detail_new);
-            gtk_widget_show (hs_detail_new);
+          gtk_icon_view_select_path (iv_people, path);
 
-            retval = TRUE;
-            break;
-          default:
-            /* the g_return_val_if_fail() mode check above should prevent us
-             * from reaching this block */
-            g_warning ("invalid SoylentBrowser mode (you should never get this "
-                       "warning)");
-            break;
+          if (scroll)
+            {
+              /* minimal-distance scroll; don't bother with alignment */
+              gtk_icon_view_scroll_to_path (iv_people, path, FALSE, 0, 0);
+
+            }
+
+          retval = 0;
+        }
+      else
+        {
+          g_warning ("soylent_browser_person_select: invalid Person");
         }
     }
   else
     {
-      g_warning ("SoylentBrowser's widget tree is invalid");
+      g_warning ("soylent_browser_person_select: invalid Browser");
     }
 
   return retval;
 }
+#endif
 
 /* Visually select the given person in the browser's main view.
  *
@@ -1095,58 +1116,400 @@
   return retval;
 }
 
-/* XXX: should this be in another file? */
-static gchar*
-soylent_browser_person_get_display_name_with_presence (SoylentPerson *person)
+/* Update the visual representation of the given SoylentPerson in the given
+ * SoylentBrowser */
+#if 0
+gboolean
+soylent_browser_update_person_icon (SoylentBrowser *browser,
+                                    SoylentPerson *person)
 {
-  gchar *retval = NULL;
+  GtkIconView *iconview = NULL;
+  GtkListStore *model = NULL;
+  const gchar *name_display_base = NULL;
+  gchar *name_display_final = NULL;
+  const gchar *e_uid = NULL;
+  EContactPhoto *photo = NULL;
+  GdkPixbuf *avatar_pixbuf = NULL;
+  gboolean avatar_pixbuf_needs_unref = FALSE;
+  EContact *e_contact = NULL;
+  SoylentPresence presence = SP_PRESENCE_UNSET;
+  GtkTreeIter *icon_view_iter = NULL;
+
+  if (!browser || !person)
+    {
+      g_warning ("%s:%d: NULL browser or person", __FILE__, __LINE__);
+      return FALSE;
+    }
+
+  e_contact = soylent_person_get_e_contact (person);
+  /* FIXME: make sure e_contact is non-NULL, and IS_ECONTACT */
+  e_uid = e_contact_get_const (e_contact, E_CONTACT_UID);
+
+  iconview = GTK_ICON_VIEW (glade_xml_get_widget (browser->main_window,
+                                                  "iv_people"));
+  g_assert (iconview);
+
+  model = GTK_LIST_STORE (gtk_icon_view_get_model (iconview));
+  name_display_base = display_name_from_e_contact (e_contact);
+  
+  presence = soylent_person_get_presence (person);
+  switch (presence)
+    {
+      case SP_PRESENCE_AVAILABLE:
+      /* TODO: indicate idleness eventually */
+      case SP_PRESENCE_IDLE:
+        name_display_final = g_strdup_printf ("%s [*]", name_display_base);
+        break;
+      case SP_PRESENCE_BUSY:
+      /* TODO: indicate idleness eventually */
+      case SP_PRESENCE_IDLE_BUSY:
+        name_display_final = g_strdup_printf ("%s [...]", name_display_base);
+        break;
+      case SP_PRESENCE_OFFLINE:
+        name_display_final = g_strdup (name_display_base);
+        break;
+      default:
+        name_display_final = g_strdup (name_display_base);
+        break;
+    }
+
+  photo = e_contact_get (e_contact, E_CONTACT_PHOTO);
+  if (photo && photo->type == E_CONTACT_PHOTO_TYPE_INLINED)
+    {
+      avatar_pixbuf = gdk_pixbuf_from_inline_photo (photo,
+                                                    browser->icon_width_max,
+                                                    browser->icon_height_max);
+    }
+  else
+    {
+      GList *live_contacts = NULL;
+
+      live_contacts = soylent_person_get_live_contacts (person);
+      if (live_contacts)
+        {
+          GList *c = NULL; 
+          EmpathyContact *empathy_contact = NULL;
+    
+          for (c = live_contacts;
+               c && c->data && EMPATHY_IS_CONTACT (c->data) && !avatar_pixbuf;
+               c = g_list_next (c)) 
+            { 
+              empathy_contact = EMPATHY_CONTACT (c->data);
+              avatar_pixbuf = empathy_pixbuf_avatar_from_contact_scaled
+                                                    (empathy_contact,
+                                                     browser->icon_width_max,
+                                                     browser->icon_height_max);
+            }
+
+          if (avatar_pixbuf)
+            {
+              avatar_pixbuf_needs_unref = TRUE;
+            }
+        }
+    }
+
+  if (!avatar_pixbuf)
+    {
+      avatar_pixbuf = browser->icon_stock_person;
+    }
+
+  icon_view_iter = soylent_person_get_icon_view_iter (person);
+  if (icon_view_iter->stamp == SP_ITER_UNSET)
+    {
+      gtk_list_store_insert_with_values (model, icon_view_iter, 0,
+                                         PEOPLE_COL_NAME, name_display_final,
+                                         PEOPLE_COL_UID, e_uid,
+                                         PEOPLE_COL_PHOTO, avatar_pixbuf, -1);
+    }
+  else
+    {
+      gtk_list_store_set (model, icon_view_iter,
+                          /* XXX - for some reason, if we don't set the uid
+                          * here again, the UID stored can get corrupted */
+                          PEOPLE_COL_UID, e_uid,
+                          PEOPLE_COL_NAME, name_display_final,
+                          PEOPLE_COL_PHOTO, avatar_pixbuf, -1);
+    }
+
+  g_free (name_display_final);
+
+  if (avatar_pixbuf_needs_unref)
+    g_object_unref (avatar_pixbuf);
+
+  return TRUE;
+}
+#endif
+
+#if 0
+/* Update the visual representation of the given SoylentPerson in the given
+ * SoylentBrowser */
+gboolean
+soylent_browser_update_person_icon (SoylentBrowser *browser,
+                                    SoylentPerson *person)
+{
+  GtkIconView *iconview = NULL;
+  GtkListStore *model = NULL;
+  /*
+  const gchar *name_display_base = NULL;
+  */
+  gchar *name_display = NULL;
+  const gchar *e_uid = NULL;
+  /*
+  EContactPhoto *photo = NULL;
+  */
+  GdkPixbuf *avatar_pixbuf = NULL;
+  /*
+  gboolean avatar_pixbuf_needs_unref = FALSE;
+  */
   EContact *e_contact = NULL;
+  /*
+  SoylentPresence presence = SP_PRESENCE_UNSET;
+  */
+  GtkTreeIter *icon_view_iter = NULL;
 
+  if (!browser || !person)
+    {
+      g_warning ("%s:%d: NULL browser or person", __FILE__, __LINE__);
+      return FALSE;
+    }
+
+  e_contact = soylent_person_get_e_contact (person);
+  /* FIXME: make sure e_contact is non-NULL, and IS_ECONTACT */
+  e_uid = e_contact_get_const (e_contact, E_CONTACT_UID);
+
+  iconview = GTK_ICON_VIEW (glade_xml_get_widget (browser->main_window,
+                                                  "iv_people"));
+  g_assert (iconview);
+
+  model = GTK_LIST_STORE (gtk_icon_view_get_model (iconview));
+
+#if 0
+  name_display_base = display_name_from_e_contact (e_contact);
+  
+  presence = soylent_person_get_presence (person);
+  switch (presence)
+    {
+      case SP_PRESENCE_AVAILABLE:
+      /* TODO: indicate idleness eventually */
+      case SP_PRESENCE_IDLE:
+        name_display_final = g_strdup_printf ("%s [*]", name_display_base);
+        break;
+      case SP_PRESENCE_BUSY:
+      /* TODO: indicate idleness eventually */
+      case SP_PRESENCE_IDLE_BUSY:
+        name_display_final = g_strdup_printf ("%s [...]", name_display_base);
+        break;
+      case SP_PRESENCE_OFFLINE:
+        name_display_final = g_strdup (name_display_base);
+        break;
+      default:
+        name_display_final = g_strdup (name_display_base);
+        break;
+    }
+#endif
+  name_display = soylent_browser_person_get_display_name_with_presence (person);
+
+#if 0
+  photo = e_contact_get (e_contact, E_CONTACT_PHOTO);
+  if (photo && photo->type == E_CONTACT_PHOTO_TYPE_INLINED)
+    {
+      avatar_pixbuf = gdk_pixbuf_from_inline_photo (photo,
+                                                    browser->icon_width_max,
+                                                    browser->icon_height_max);
+    }
+  else
+    {
+      GList *live_contacts = NULL;
+
+      live_contacts = soylent_person_get_live_contacts (person);
+      if (live_contacts)
+        {
+          GList *c = NULL; 
+          EmpathyContact *empathy_contact = NULL;
+    
+          for (c = live_contacts;
+               c && c->data && EMPATHY_IS_CONTACT (c->data) && !avatar_pixbuf;
+               c = g_list_next (c)) 
+            { 
+              empathy_contact = EMPATHY_CONTACT (c->data);
+              avatar_pixbuf = empathy_pixbuf_avatar_from_contact_scaled
+                                                    (empathy_contact,
+                                                     browser->icon_width_max,
+                                                     browser->icon_height_max);
+            }
+
+          if (avatar_pixbuf)
+            {
+              avatar_pixbuf_needs_unref = TRUE;
+            }
+        }
+    }
+#endif
+
+  avatar_pixbuf = soylent_person_get_avatar (person, browser->icon_width_max,
+                                             browser->icon_height_max);
+
+  if (!avatar_pixbuf)
+    {
+      avatar_pixbuf = browser->icon_stock_person;
+    }
+
+  icon_view_iter = soylent_person_get_icon_view_iter (person);
+  if (icon_view_iter->stamp == SP_ITER_UNSET)
+    {
+      gtk_list_store_insert_with_values (model, icon_view_iter, 0,
+                                         PEOPLE_COL_NAME, name_display,
+                                         PEOPLE_COL_UID, e_uid,
+                                         PEOPLE_COL_PHOTO, avatar_pixbuf, -1);
+    }
+  else
+    {
+      gtk_list_store_set (model, icon_view_iter,
+                          /* XXX - for some reason, if we don't set the uid
+                          * here again, the UID stored can get corrupted */
+                          PEOPLE_COL_UID, e_uid,
+                          PEOPLE_COL_NAME, name_display,
+                          PEOPLE_COL_PHOTO, avatar_pixbuf, -1);
+    }
+
+  g_free (name_display);
+
+  /* FIXME: handle this memory management */
+  /*
+  if (avatar_pixbuf_needs_unref)
+    g_object_unref (avatar_pixbuf);
+    */
+
+  return TRUE;
+}
+#endif
+
+/* Update the visual representation of the given SoylentPerson in the given
+ * SoylentBrowser */
+gboolean
+soylent_browser_update_person_icon (SoylentBrowser *browser,
+                                    SoylentPerson *person)
+{
+  gboolean retval = FALSE;
+  GtkIconView *icon_view = NULL;
+
+  g_return_val_if_fail (browser != NULL, retval);
+  /* FIXME: uncomment once SoylentBrowser is a GObject:
+  g_return_val_if_fail (SOYLENT_IS_BROWSER (browser), NULL);
+   */
   g_return_val_if_fail (person != NULL, retval);
   /* FIXME: uncomment once SoylentPerson is a GObject:
   g_return_val_if_fail (SOYLENT_IS_PERSON (person), NULL);
    */
 
-  e_contact = soylent_person_get_e_contact (person);
-  /* FIXME: make sure e_contact is non-NULL, and IS_ECONTACT */
-  if (e_contact && E_IS_CONTACT (e_contact))
+  icon_view = GTK_ICON_VIEW (glade_xml_get_widget (browser->main_window,
+                                                  "iv_people"));
+  if (icon_view && GTK_IS_ICON_VIEW (icon_view))
     {
-      const gchar *e_uid = NULL;
-      const gchar *name_display_base = NULL;
-      SoylentPresence presence = SP_PRESENCE_UNSET;
+      GtkListStore *model = NULL;
 
-      e_uid = e_contact_get_const (e_contact, E_CONTACT_UID);
-      name_display_base = display_name_from_e_contact (e_contact);
-      
-      presence = soylent_person_get_presence (person);
-      switch (presence)
+      model = GTK_LIST_STORE (gtk_icon_view_get_model (icon_view));
+      if (model)
         {
-          case SP_PRESENCE_AVAILABLE:
-          /* TODO: indicate idleness eventually */
-          case SP_PRESENCE_IDLE:
-            retval = g_strdup_printf ("%s [*]", name_display_base);
-            break;
-          case SP_PRESENCE_BUSY:
-          /* TODO: indicate idleness eventually */
-          case SP_PRESENCE_IDLE_BUSY:
-            retval = g_strdup_printf ("%s [...]", name_display_base);
-            break;
-          case SP_PRESENCE_OFFLINE:
-            retval = g_strdup (name_display_base);
-            break;
-          default:
-            retval = g_strdup (name_display_base);
-            break;
+          gchar *name_display = NULL;
+
+          name_display = soylent_browser_person_get_display_name_with_presence
+                                                                      (person);
+          if (name_display)
+            {
+              EContact *e_contact = NULL;
+
+              e_contact = soylent_person_get_e_contact (person);
+              if (e_contact && E_IS_CONTACT (e_contact))
+                {
+                  const gchar *e_uid = NULL;
+
+                  e_uid = e_contact_get_const (e_contact, E_CONTACT_UID);
+                  if (e_uid)
+                    {
+                      GdkPixbuf *avatar_pixbuf = NULL;
+                      GtkTreeIter *icon_view_iter = NULL;
+
+                      avatar_pixbuf = soylent_person_get_avatar
+                                                    (person,
+                                                     browser->icon_width_max,
+                                                     browser->icon_height_max);
+
+                      if (!avatar_pixbuf)
+                        {
+                          avatar_pixbuf = browser->icon_stock_person;
+                        }
+
+                      icon_view_iter = soylent_person_get_icon_view_iter
+                                                                      (person);
+                      if (icon_view_iter)
+                        {
+                          if (icon_view_iter->stamp == SP_ITER_UNSET)
+                            {
+                              gtk_list_store_insert_with_values
+                                              (model, icon_view_iter, 0,
+                                               PEOPLE_COL_NAME, name_display,
+                                               PEOPLE_COL_UID, e_uid,
+                                               PEOPLE_COL_PHOTO, avatar_pixbuf,
+                                               -1);
+                            }
+                          else
+                            {
+                              gtk_list_store_set
+                                              (model, icon_view_iter,
+                                               /* XXX - for some reason, if we
+                                                * don't set the uid here again,
+                                                * the UID stored can get
+                                                * corrupted */
+                                               PEOPLE_COL_UID, e_uid,
+                                               PEOPLE_COL_NAME, name_display,
+                                               PEOPLE_COL_PHOTO, avatar_pixbuf,
+                                               -1);
+                            }
+
+                          g_free (name_display);
+
+                          /* FIXME: handle this memory management */
+                          /*
+                          if (avatar_pixbuf_needs_unref)
+                            g_object_unref (avatar_pixbuf);
+                            */
+                          retval =  TRUE;
+                        }
+                      else
+                        {
+                          g_warning ("failed to get main icon view's iterator");
+                        }
+                    }
+                  else
+                    {
+                      g_warning ("failed to get EContact's UID");
+                    }
+                }
+              else
+                {
+                  g_warning ("person's EContact is invalid");
+                }
+            }
+          else
+            {
+              g_warning ("failed to get display name for person");
+            }
+        }
+      else
+        {
+          g_warning ("main icon view's model is invalid");
         }
     }
   else
     {
-      g_warning ("person's EContact is invalid");
+      g_warning ("failed to get main icon view widget");
     }
 
   return retval;
 }
 
+#if 0
 /* FIXME: break this up into multiple functions */
 /* Update the visual representation of the given SoylentPerson in the given
  * SoylentBrowser */
@@ -1189,7 +1552,6 @@
                   const gchar *e_uid = NULL;
                   GdkPixbuf *avatar_pixbuf = NULL;
                   GtkTreeIter *icon_view_iter = NULL;
-
                   avatar_pixbuf = soylent_person_get_avatar
                                                     (person,
                                                      browser->icon_width_max,
@@ -1255,6 +1617,8 @@
 
   return retval;
 }
+#endif
+
 
 /* Union the given group with the SoylentBrowser's current set of groups */
 void
@@ -1372,6 +1736,58 @@
   return g_ascii_strcasecmp (name_a, name_b);
 }
 
+/* XXX: should this be in another file? */
+static gchar*
+soylent_browser_person_get_display_name_with_presence (SoylentPerson *person)
+{
+  gchar *retval = NULL;
+  EContact *e_contact = NULL;
+
+  g_return_val_if_fail (person != NULL, retval);
+  /* FIXME: uncomment once SoylentPerson is a GObject:
+  g_return_val_if_fail (SOYLENT_IS_PERSON (person), NULL);
+   */
+
+  e_contact = soylent_person_get_e_contact (person);
+  /* FIXME: make sure e_contact is non-NULL, and IS_ECONTACT */
+  if (e_contact && E_IS_CONTACT (e_contact))
+    {
+      const gchar *e_uid = NULL;
+      const gchar *name_display_base = NULL;
+      SoylentPresence presence = SP_PRESENCE_UNSET;
+
+      e_uid = e_contact_get_const (e_contact, E_CONTACT_UID);
+      name_display_base = display_name_from_e_contact (e_contact);
+
+      presence = soylent_person_get_presence (person);
+      switch (presence)
+        {
+          case SP_PRESENCE_AVAILABLE:
+          /* TODO: indicate idleness eventually */
+          case SP_PRESENCE_IDLE:
+            retval = g_strdup_printf ("%s [*]", name_display_base);
+            break;
+          case SP_PRESENCE_BUSY:
+          /* TODO: indicate idleness eventually */
+          case SP_PRESENCE_IDLE_BUSY:
+            retval = g_strdup_printf ("%s [...]", name_display_base);
+            break;
+          case SP_PRESENCE_OFFLINE:
+            retval = g_strdup (name_display_base);
+            break;
+          default:
+            retval = g_strdup (name_display_base);
+            break;
+        }
+    }
+  else
+    {
+      g_warning ("person's EContact is invalid");
+    }
+
+  return retval;
+}
+
 /* Handle the person icon activation */
 static void
 iv_people_item_activated (GtkIconView *iv, GtkTreePath *path,

Modified: trunk/src/soylent-browser.h
==============================================================================
--- trunk/src/soylent-browser.h	(original)
+++ trunk/src/soylent-browser.h	Sun Jan 13 00:46:11 2008
@@ -48,11 +48,6 @@
 #include <libempathy/empathy-contact-list.h>
 #include <libempathy-gtk/empathy-ui-utils.h>
 
-#define SOYLENT_BROWSER_PEOPLE_VIEW_MODE_IS_VALID(x) \
-          (1 \
-           && ((x) > FIRST_SB_PEOPLE_VIEW_MODE) \
-           && ((x) < LAST_SB_PEOPLE_VIEW_MODE))
-
 typedef struct SoylentBrowser_tag SoylentBrowser;
 typedef enum soylent_browser_people_view_mode_tag
              soylent_browser_people_view_mode;
@@ -137,8 +132,8 @@
 void soylent_browser_check_add_group (SoylentBrowser *browser,
                                       const gchar *group);
 void soylent_browser_update_view (SoylentBrowser *browser);
-gboolean soylent_browser_view_set_mode (SoylentBrowser *browser,
-                                        soylent_browser_people_view_mode mode);
+void soylent_browser_view_set_mode (SoylentBrowser *browser,
+                                    soylent_browser_people_view_mode mode);
 gboolean soylent_browser_person_select (SoylentBrowser *browser,
                                         SoylentPerson *person,
                                         gboolean scroll);



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