soylent r44 - trunk/src



Author: treitter
Date: Sat Jan 12 21:46:08 2008
New Revision: 44
URL: http://svn.gnome.org/viewvc/soylent?rev=44&view=rev

Log:
Clean up more functions

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

Modified: trunk/src/soylent-browser-person-view.c
==============================================================================
--- trunk/src/soylent-browser-person-view.c	(original)
+++ trunk/src/soylent-browser-person-view.c	Sat Jan 12 21:46:08 2008
@@ -31,9 +31,10 @@
 
 static void soylent_browser_person_view_save_changes (GtkWidget *widget,
                                                       gpointer user_data);
-static gint soylent_browser_person_edit_save_scroll_cb (EBookView *book_view,
-                                                        const GList *e_contacts,
-                                                        SoylentPerson *person);
+static gboolean soylent_browser_person_edit_save_scroll_cb
+                                                      (EBookView *book_view,
+                                                       const GList *e_contacts,
+                                                       SoylentPerson *person);
 static gint soylent_browser_person_new_edit_cb
                                     (EBookView *book_view,
                                      const GList *e_contacts,
@@ -884,12 +885,12 @@
     }
 }
 
-static gint
+static gboolean
 soylent_browser_person_edit_save_scroll_cb (EBookView *book_view,
                                             const GList *e_contacts,
                                             SoylentPerson *person)
 {
-  gint retval = -1;
+  gint retval = FALSE;
 
   if (person)
     {

Modified: trunk/src/soylent-browser.c
==============================================================================
--- trunk/src/soylent-browser.c	(original)
+++ trunk/src/soylent-browser.c	Sat Jan 12 21:46:08 2008
@@ -54,6 +54,8 @@
   GdkPixbuf *icon_stock_person;
 };
 
+static gchar* soylent_browser_person_get_display_name_with_presence
+                                                        (SoylentPerson *person);
 static int soylent_browser_compare_people_by_icon_iter (GtkTreeModel *model,
                                                         GtkTreeIter *a,
                                                         GtkTreeIter *b,
@@ -62,11 +64,12 @@
                                       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);
@@ -390,7 +393,7 @@
     }
   else
     {
-      g_warning ("failed to get SoylentBrowser's widget tree ");
+      g_warning ("SoylentBrowser's widget tree is invalid");
     }
 
   return retval;
@@ -941,11 +944,14 @@
 /* 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 */
-void
+ * detail editor
+ *
+ * Return TRUE for success, FALSE for any failure */
+gboolean
 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;
@@ -955,204 +961,299 @@
   GtkWidget *hs_detail_new = NULL;
   GtkWidget *btn_detail_add = NULL;
 
-  wtree = browser->main_window;
-  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);
+  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);
 
-        gtk_widget_hide (icon_entry_person);
-        gtk_widget_show (hbox_detail_new);
-        gtk_widget_show (hs_detail_new);
-        break;
+  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);
+
+            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);
+
+            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;
+        }
+    }
+  else
+    {
+      g_warning ("SoylentBrowser's widget tree is invalid");
     }
+
+  return retval;
 }
 
-gint
+/* Visually select the given person in the browser's main view.
+ *
+ * Return TRUE for success, FALSE for any failure */
+gboolean
 soylent_browser_person_select (SoylentBrowser *browser, SoylentPerson *person,
                                gboolean scroll)
 {
-  gint retval = -1;
+  gboolean retval = FALSE;
+  GladeXML *wtree = NULL;
 
-  if (browser)
+  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);
+   */
+
+  wtree = browser->main_window;
+  if (wtree)
     {
-      if (person)
+      GtkIconView *iv_people = NULL;
+
+      iv_people = GTK_ICON_VIEW (glade_xml_get_widget (wtree, "iv_people"));
+      if (iv_people && GTK_IS_ICON_VIEW (iv_people))
         {
-          GladeXML *wtree = NULL;
-          GtkIconView *iv_people = NULL;
           GtkTreeModel *model = NULL;
-          GtkTreePath *path = NULL;
-          GtkTreeIter *icon_view_iter = NULL;
 
-          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);
+          if (model)
+            {
+              GtkTreeIter *icon_view_iter = NULL;
 
-          gtk_icon_view_select_path (iv_people, path);
+              icon_view_iter = soylent_person_get_icon_view_iter (person);
+              if (icon_view_iter)
+                {
+                  GtkTreePath *path = NULL;
 
-          if (scroll)
-            {
-              /* minimal-distance scroll; don't bother with alignment */
-              gtk_icon_view_scroll_to_path (iv_people, path, FALSE, 0, 0);
+                  path = gtk_tree_model_get_path (model, icon_view_iter);
+                  gtk_icon_view_select_path (iv_people, path);
 
-            }
+                  if (scroll)
+                    {
+                      /* minimal-distance scroll; don't bother with alignment */
+                      gtk_icon_view_scroll_to_path (iv_people, path, FALSE, 0,
+                                                    0);
+                    }
 
-          retval = 0;
+                  gtk_tree_path_free (path);
+
+                  retval = TRUE;
+                }
+              else
+                {
+                  g_warning ("icon view iterator is NULL");
+                }
+            }
+          else
+            {
+              g_warning ("icon view's model is NULL");
+            }
         }
       else
         {
-          g_warning ("soylent_browser_person_select: invalid Person");
+          g_warning ("SoylentBrowser's main icon view is invalid");
         }
     }
   else
     {
-      g_warning ("soylent_browser_person_select: invalid Browser");
+      g_warning ("SoylentBrowser's widget tree is invalid");
     }
 
   return retval;
 }
 
-/* Update the visual representation of the given SoylentPerson in the given
- * SoylentBrowser */
-gboolean
-soylent_browser_update_person_icon (SoylentBrowser *browser,
-                                    SoylentPerson *person)
+/* XXX: should this be in another file? */
+static gchar*
+soylent_browser_person_get_display_name_with_presence (SoylentPerson *person)
 {
-  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;
+  gchar *retval = NULL;
   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;
-    }
+  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 */
-  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)
+  if (e_contact && E_IS_CONTACT (e_contact))
     {
-      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);
+      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
     {
-      GList *live_contacts = NULL;
+      g_warning ("person's EContact is invalid");
+    }
 
-      live_contacts = soylent_person_get_live_contacts (person);
-      if (live_contacts)
+  return retval;
+}
+
+/* FIXME: break this up into multiple functions */
+/* 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);
+   */
+
+  icon_view = GTK_ICON_VIEW (glade_xml_get_widget (browser->main_window,
+                                                   "iv_people"));
+  if (icon_view && GTK_IS_ICON_VIEW (icon_view))
+    {
+      GtkListStore *model = NULL;
+
+      model = GTK_LIST_STORE (gtk_icon_view_get_model (icon_view));
+      if (model)
         {
-          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,
+          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;
+                  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->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);
+                    }
+
+                  /* FIXME: handle this memory management logic somewhere */
+#if 0
+                  if (avatar_pixbuf_needs_unref)
+                    {
+                      g_object_unref (avatar_pixbuf);
+                    }
+#endif
+                  g_free (name_display);
 
-          if (avatar_pixbuf)
+                  retval = TRUE;
+                }
+              else
+                {
+                  g_warning ("person's EContact is invalid");
+                }
+            }
+          else
             {
-              avatar_pixbuf_needs_unref = TRUE;
+              g_warning ("failed to get display name for person");
             }
         }
-    }
-
-  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
+        {
+          g_warning ("main icon view's model is invalid");
+        }
     }
   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_warning ("failed to get main icon view widget");
     }
 
-  g_free (name_display_final);
-
-  if (avatar_pixbuf_needs_unref)
-    g_object_unref (avatar_pixbuf);
-
-  return TRUE;
+  return retval;
 }
 
 /* Union the given group with the SoylentBrowser's current set of groups */

Modified: trunk/src/soylent-browser.h
==============================================================================
--- trunk/src/soylent-browser.h	(original)
+++ trunk/src/soylent-browser.h	Sat Jan 12 21:46:08 2008
@@ -48,14 +48,25 @@
 #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;
 
 enum soylent_browser_people_view_mode_tag
 {
-  SB_PEOPLE_VIEW_MODE_BROWSE = 0,
-  SB_PEOPLE_VIEW_MODE_EDIT
+  /* intentionally invalid */
+  FIRST_SB_PEOPLE_VIEW_MODE = 0,
+
+  SB_PEOPLE_VIEW_MODE_BROWSE,
+  SB_PEOPLE_VIEW_MODE_EDIT,
+
+  /* intentionally invalid */
+  LAST_SB_PEOPLE_VIEW_MODE,
 };
 
 #include "soylent-defs.h"
@@ -126,11 +137,11 @@
 void soylent_browser_check_add_group (SoylentBrowser *browser,
                                       const gchar *group);
 void soylent_browser_update_view (SoylentBrowser *browser);
-void soylent_browser_view_set_mode (SoylentBrowser *browser,
-                                    soylent_browser_people_view_mode mode);
-gint soylent_browser_person_select (SoylentBrowser *browser,
-                                    SoylentPerson *person,
-                                    gboolean scroll);
+gboolean soylent_browser_view_set_mode (SoylentBrowser *browser,
+                                        soylent_browser_people_view_mode mode);
+gboolean soylent_browser_person_select (SoylentBrowser *browser,
+                                        SoylentPerson *person,
+                                        gboolean scroll);
 gboolean soylent_browser_update_person_icon (SoylentBrowser *browser,
                                              SoylentPerson *person);
 

Modified: trunk/src/soylent-person.c
==============================================================================
--- trunk/src/soylent-person.c	(original)
+++ trunk/src/soylent-person.c	Sat Jan 12 21:46:08 2008
@@ -22,6 +22,7 @@
  *
  */
 
+#include "eds-utils.h"
 #include "soylent-person.h"
 #include "soylent-utils.h"
 
@@ -142,6 +143,79 @@
   return person->browser;
 }
 
+/* FIXME: this should just return person->avatar; this functionality should
+ * mostly be pushed into a _set_avatar() function, which is also called in
+ * soylent_person_new() */
+/* Return the person's Avatar (will use default Avatar if none exists).
+ *
+ * This memory will be freed upon Person destruction (Do not free it manually!)
+ * */
+GdkPixbuf*
+soylent_person_get_avatar (SoylentPerson *person, guint icon_width_max,
+                           guint icon_height_max)
+{
+  GdkPixbuf *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);
+  if (e_contact && E_IS_CONTACT (e_contact))
+    {
+      EContactPhoto *photo = NULL;
+      /*
+      gboolean avatar_pixbuf_needs_unref = FALSE;
+      */
+
+      photo = e_contact_get (e_contact, E_CONTACT_PHOTO);
+      if (photo && photo->type == E_CONTACT_PHOTO_TYPE_INLINED)
+        {
+          retval = gdk_pixbuf_from_inline_photo (photo,
+                                                 icon_width_max,
+                                                 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) && !retval;
+                   c = g_list_next (c))
+                {
+                  empathy_contact = EMPATHY_CONTACT (c->data);
+                  retval = empathy_pixbuf_avatar_from_contact_scaled
+                                                    (empathy_contact,
+                                                     icon_width_max,
+                                                     icon_height_max);
+                }
+
+              /* FIXME: do something with this logic elsewhere */
+              /*
+              if (retval)
+                {
+                  avatar_pixbuf_needs_unref = TRUE;
+                }
+              */
+            }
+        }
+    }
+  else
+    {
+      g_warning ("person's EContact is invalid");
+    }
+
+  return retval;
+}
+
 /* Returns TRUE upon success, FALSE otherwise */
 gboolean
 soylent_person_set_e_contact (SoylentPerson *person, EContact *e_contact)
@@ -435,8 +509,8 @@
   browser = person->browser;
 #if 0
   pixbuf = empathy_pixbuf_avatar_from_contact_scaled (empathy_contact,
-                                                      browser->icon_width_max,
-                                                      browser->icon_height_max);
+                                                      icon_width_max,
+                                                      icon_height_max);
 
   if (!pixbuf || e_contact_get (person->e_contact, E_CONTACT_PHOTO))
     {

Modified: trunk/src/soylent-person.h
==============================================================================
--- trunk/src/soylent-person.h	(original)
+++ trunk/src/soylent-person.h	Sat Jan 12 21:46:08 2008
@@ -59,6 +59,9 @@
 SoylentPresence soylent_person_get_presence       (SoylentPerson *person);
 GtkTreeIter*    soylent_person_get_icon_view_iter (SoylentPerson *person);
 SoylentBrowser* soylent_person_get_browser        (SoylentPerson *person);
+GdkPixbuf*      soylent_person_get_avatar         (SoylentPerson *person,
+                                                   guint icon_width_max,
+                                                   guint icon_height_max);
 gboolean        soylent_person_set_e_contact      (SoylentPerson *person,
                                                    EContact *e_contact);
 gboolean        soylent_person_set_live_contacts  (SoylentPerson *person,



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