soylent r83 - trunk/src



Author: treitter
Date: Tue Feb 19 06:29:57 2008
New Revision: 83
URL: http://svn.gnome.org/viewvc/soylent?rev=83&view=rev

Log:
update to the libempathy/libempathy-gtk API as of Empathy 0.21.90

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

Modified: trunk/src/soylent-browser.c
==============================================================================
--- trunk/src/soylent-browser.c	(original)
+++ trunk/src/soylent-browser.c	Tue Feb 19 06:29:57 2008
@@ -23,7 +23,7 @@
  */
 
 #include <libempathy/empathy-idle.h>
-#include <libempathy-gtk/empathy-status-presets.h>
+#include <libempathy/empathy-status-presets.h>
 
 #include "eds-utils.h"
 #include "soylent-browser.h"

Modified: trunk/src/soylent-browser.h
==============================================================================
--- trunk/src/soylent-browser.h	(original)
+++ trunk/src/soylent-browser.h	Tue Feb 19 06:29:57 2008
@@ -39,7 +39,6 @@
 
 #include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-presence.h>
 #include <libempathy/empathy-contact.h>
 #include <libempathy/empathy-chandler.h>
 #include <libempathy/empathy-tp-chat.h>

Modified: trunk/src/soylent-defs.h
==============================================================================
--- trunk/src/soylent-defs.h	(original)
+++ trunk/src/soylent-defs.h	Tue Feb 19 06:29:57 2008
@@ -30,7 +30,6 @@
 
 #include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-presence.h>
 #include <libempathy/empathy-contact.h>
 #include <libempathy/empathy-chandler.h>
 #include <libempathy/empathy-tp-chat.h>

Modified: trunk/src/soylent-person.c
==============================================================================
--- trunk/src/soylent-person.c	(original)
+++ trunk/src/soylent-person.c	Tue Feb 19 06:29:57 2008
@@ -520,6 +520,7 @@
                  "soylent_person_live_groups_updated_cb");
 }
 
+#if 0
 /* Transform an EmpathyPresence into our internal representation */
 SoylentPresence
 soylent_person_presence_from_empathy_presence (EmpathyPresence *presence)
@@ -550,7 +551,40 @@
 
   return SP_PRESENCE_UNSET;
 }
+#endif
+
+/* Transform an EmpathyPresence into our internal representation */
+SoylentPresence
+soylent_person_presence_from_mc_presence (McPresence presence)
+{
+  /*
+  McPresence mc_state = MC_PRESENCE_UNSET;
+  */
 
+  switch (presence)
+    {
+      case MC_PRESENCE_AVAILABLE:
+        return SP_PRESENCE_AVAILABLE;
+        break;
+      case MC_PRESENCE_AWAY:
+      case MC_PRESENCE_EXTENDED_AWAY:
+      case MC_PRESENCE_DO_NOT_DISTURB:
+        return SP_PRESENCE_BUSY;
+        break;
+      case MC_PRESENCE_OFFLINE:
+      case MC_PRESENCE_HIDDEN:
+      case MC_PRESENCE_UNSET:
+        return SP_PRESENCE_OFFLINE;
+        break;
+      default:
+        g_warning ("unknown Mission Control presence: %u", presence);
+        break;
+    }
+
+  return SP_PRESENCE_UNSET;
+}
+
+#if 0
 /* Propagate IM contacts' presence changes to our internal state, updating
  * the SoylentPerson's representation and other widgets accordingly.
  *
@@ -604,6 +638,60 @@
 
   return retval;
 }
+#endif
+
+/* Propagate IM contacts' presence changes to our internal state, updating
+ * the SoylentPerson's representation and other widgets accordingly.
+ *
+ * Return TRUE for success, FALSE for any failure
+ */
+gboolean
+soylent_person_live_presence_updated_cb (EmpathyContact *empathy_contact,
+                                         GParamSpec *param,
+                                         SoylentPerson *person)
+{
+  gboolean retval = FALSE;
+  SoylentPresence soylent_person_presence_effective = SP_PRESENCE_OFFLINE;
+  GList *l = NULL;
+
+  g_return_val_if_fail (empathy_contact != NULL, retval);
+  g_return_val_if_fail (EMPATHY_IS_CONTACT (empathy_contact), retval);
+  g_return_val_if_fail (person != NULL, retval);
+  /* FIXME: uncomment once SoylentPerson is a GObject:
+  g_return_val_if_fail (SOYLENT_IS_PERSON (person), retval);
+   */
+
+  for (l = person->live_contacts;
+       l && l->data && EMPATHY_IS_CONTACT (l->data);
+       l = g_list_next (l))
+    {
+      EmpathyContact  *empathy_contact_cur = NULL;
+      McPresence mc_presence_cur = MC_PRESENCE_UNSET;
+      SoylentPresence soylent_presence_cur = SP_PRESENCE_UNSET;
+      
+      empathy_contact_cur = EMPATHY_CONTACT (l->data);
+      mc_presence_cur = empathy_contact_get_presence (empathy_contact_cur);
+      soylent_presence_cur = soylent_person_presence_from_mc_presence
+                                                              (mc_presence_cur);
+      
+      if (SP_PRESENCE_IS_VALID (soylent_presence_cur))
+        {
+          if ((soylent_person_live_presence_compare
+                                            (soylent_presence_cur,
+                                             soylent_person_presence_effective))
+              > 0)
+            {
+              soylent_person_presence_effective = soylent_presence_cur;
+            }
+        }
+    }
+
+  person->presence = soylent_person_presence_effective;
+
+  retval = soylent_browser_update_person_icon (person->browser, person);
+
+  return retval;
+}
 
 /* Propagate IM contacts' IM name changes to our internal state (most likely
  * ignoring the changes) */

Modified: trunk/src/soylent-person.h
==============================================================================
--- trunk/src/soylent-person.h	(original)
+++ trunk/src/soylent-person.h	Tue Feb 19 06:29:57 2008
@@ -39,7 +39,6 @@
 
 #include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-presence.h>
 #include <libempathy/empathy-contact.h>
 #include <libempathy/empathy-chandler.h>
 #include <libempathy/empathy-tp-chat.h>
@@ -98,8 +97,12 @@
                                           GParamSpec *param,
                                           SoylentPerson *person);
 
+/*
 SoylentPresence soylent_person_presence_from_empathy_presence
                                                     (EmpathyPresence *presence);
+                                                    */
+
+SoylentPresence soylent_person_presence_from_mc_presence (McPresence presence);
 
 gboolean soylent_person_action_communicate (SoylentPerson *person);
 



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