]> git.0d.be Git - empathy.git/commitdiff
Remove EmpathyPresence object and have "presence" and "presence-message" properties...
authorXavier Claessens <xclaesse@src.gnome.org>
Thu, 24 Jan 2008 16:33:33 +0000 (16:33 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Thu, 24 Jan 2008 16:33:33 +0000 (16:33 +0000)
svn path=/trunk/; revision=601

26 files changed:
docs/libempathy/libempathy-docs.sgml
docs/libempathy/libempathy.types
libempathy-gtk/empathy-chat-window.c
libempathy-gtk/empathy-contact-list-store.c
libempathy-gtk/empathy-contact-widget.c
libempathy-gtk/empathy-presence-chooser.c
libempathy-gtk/empathy-presence-chooser.h
libempathy-gtk/empathy-status-icon.c
libempathy-gtk/empathy-ui-utils.c
libempathy-gtk/empathy-ui-utils.h
libempathy/Makefile.am
libempathy/empathy-contact.c
libempathy/empathy-contact.h
libempathy/empathy-idle.c
libempathy/empathy-presence.c [deleted file]
libempathy/empathy-presence.h [deleted file]
libempathy/empathy-status-presets.c
libempathy/empathy-status-presets.h
libempathy/empathy-tp-contact-factory.c
libempathy/empathy-utils.c
libempathy/empathy-utils.h
python/README
python/pyempathy.patch [new file with mode: 0644]
python/pyempathy/pyempathy.defs
python/pyempathy/pyempathy.override
python/pyempathygtk/pyempathygtk.defs

index bcdc5d0ff87fb8601357cd639154d0c4a851d29e..dbc8cb573c2be85d09c4504693fcf8aed13f4fbd 100644 (file)
@@ -30,7 +30,6 @@
       <xi:include href="xml/empathy-idle.xml"/>
       <xi:include href="xml/empathy-log-manager.xml"/>
       <xi:include href="xml/empathy-message.xml"/>
-      <xi:include href="xml/empathy-presence.xml"/>
       <xi:include href="xml/empathy-status-presets.xml"/>
       <xi:include href="xml/empathy-time.xml"/>
       <xi:include href="xml/empathy-tp-call.xml"/>
index e056cc83471663aead9ff2d948b9e0c440e94ab3..28706f44f7e2c546b1d4a341a6c2642d0393ef6a 100644 (file)
@@ -8,7 +8,6 @@ empathy_filter_get_type
 empathy_idle_get_type
 empathy_log_manager_get_type
 empathy_message_get_gtype
-empathy_presence_get_type
 empathy_tp_call_get_type
 empathy_tp_chat_get_type
 empathy_tp_chatroom_get_type
index 5acddc1e6c0e0d8ec27692a9a254cf3e4dda41df..444616039c5292600f5f97ee8a375704958049fe 100644 (file)
@@ -781,21 +781,21 @@ chat_window_update_menu (EmpathyChatWindow *window)
                                                   chat_window_show_contacts_toggled_cb,
                                                   window);
        } else {
-               EmpathyPrivateChat  *chat;
-               EmpathyContact      *contact;
-               EmpathyPresence     *presence;
+               EmpathyPrivateChat *chat;
+               EmpathyContact     *contact;
+               McPresence          presence;
 
                chat = EMPATHY_PRIVATE_CHAT (priv->current_chat);
 
                /* Show / Hide widgets */
                gtk_widget_hide (priv->menu_room);
 
-               /* presence==NULL means this contact refuses to send us his
+               /* Unset presence means this contact refuses to send us his
                 * presence. By adding the contact we ask the contact to accept
                 * to send his presence. */
                contact = empathy_private_chat_get_contact (chat);
                presence = empathy_contact_get_presence (contact);
-               if (!presence) {
+               if (presence == MC_PRESENCE_UNSET) {
                        gtk_widget_show (priv->menu_conv_add_contact);
                } else {
                        gtk_widget_hide (priv->menu_conv_add_contact);
index bd5e9bc5e95535e9c82abfcf5182d56e9a85cce4..7cabea78f810af5a7a5c0629c5f5e8713d3fb4a6 100644 (file)
@@ -820,6 +820,9 @@ contact_list_store_members_changed_cb (EmpathyContactList      *list_iface,
                g_signal_connect (contact, "notify::presence",
                                  G_CALLBACK (contact_list_store_contact_updated_cb),
                                  store);
+               g_signal_connect (contact, "notify::presence-message",
+                                 G_CALLBACK (contact_list_store_contact_updated_cb),
+                                 store);
                g_signal_connect (contact, "notify::name",
                                  G_CALLBACK (contact_list_store_contact_updated_cb),
                                  store);
@@ -1351,8 +1354,8 @@ contact_list_store_state_sort_func (GtkTreeModel *model,
        gint            ret_val = 0;
        gchar          *name_a, *name_b;
        gboolean        is_separator_a, is_separator_b;
-       EmpathyContact  *contact_a, *contact_b;
-       EmpathyPresence *presence_a, *presence_b;
+       EmpathyContact *contact_a, *contact_b;
+       guint           presence_a, presence_b;
 
        gtk_tree_model_get (model, iter_a,
                            EMPATHY_CONTACT_LIST_STORE_COL_NAME, &name_a,
@@ -1389,32 +1392,17 @@ contact_list_store_state_sort_func (GtkTreeModel *model,
         * the presences.
         */
        presence_a = empathy_contact_get_presence (EMPATHY_CONTACT (contact_a));
+       presence_a = contact_list_store_ordered_presence (presence_a);
        presence_b = empathy_contact_get_presence (EMPATHY_CONTACT (contact_b));
+       presence_b = contact_list_store_ordered_presence (presence_b);
 
-       if (!presence_a && presence_b) {
-               ret_val = 1;
-       } else if (presence_a && !presence_b) {
+       if (presence_a < presence_b) {
                ret_val = -1;
-       } else if (!presence_a && !presence_b) {
-               /* Both offline, sort by name */
-               ret_val = g_utf8_collate (name_a, name_b);
+       } else if (presence_a > presence_b) {
+               ret_val = 1;
        } else {
-               guint state_a, state_b;
-
-               state_a = empathy_presence_get_state (presence_a);
-               state_b = empathy_presence_get_state (presence_b);
-
-               state_a = contact_list_store_ordered_presence (state_a);
-               state_b = contact_list_store_ordered_presence (state_b);
-
-               if (state_a < state_b) {
-                       ret_val = -1;
-               } else if (state_a > state_b) {
-                       ret_val = 1;
-               } else {
-                       /* Fallback: compare by name */
-                       ret_val = g_utf8_collate (name_a, name_b);
-               }
+               /* Fallback: compare by name */
+               ret_val = g_utf8_collate (name_a, name_b);
        }
 
 free_and_out:
index a03571d9a1562a9d7186163f8f15a958d82bb4f8..c290ef6a3030b212efb222f080dc7e37fb876379 100644 (file)
@@ -429,6 +429,9 @@ contact_widget_contact_update (EmpathyContactWidget *information)
                g_signal_connect_swapped (information->contact, "notify::presence",
                                          G_CALLBACK (contact_widget_presence_notify_cb),
                                          information);
+               g_signal_connect_swapped (information->contact, "notify::presence-message",
+                                         G_CALLBACK (contact_widget_presence_notify_cb),
+                                         information);
                g_signal_connect_swapped (information->contact, "notify::avatar",
                                          G_CALLBACK (contact_widget_avatar_notify_cb),
                                          information);
index c64962afa64996aef21805cfec7b95538e8ded47..e543a5f1fc14fb34aebd12c80b8908fe699f87fe 100644 (file)
@@ -381,7 +381,7 @@ presence_chooser_scroll_event_cb (EmpathyPresenceChooser *chooser,
                /* If we didn't get any match at all, it means the last state
                 * was a custom one. Just switch to the first one.
                 */
-               status = empathy_presence_state_get_default_status (states[0]);
+               status = empathy_presence_get_default_message (states[0]);
 
                presence_chooser_reset_scroll_timeout (chooser);
                empathy_idle_set_presence (priv->idle, states[0], status);
@@ -404,7 +404,7 @@ presence_chooser_get_presets (EmpathyPresenceChooser *chooser)
                StateAndStatus *sas;
                const gchar    *status;
 
-               status = empathy_presence_state_get_default_status (states[i]);
+               status = empathy_presence_get_default_message (states[i]);
                sas = presence_chooser_state_and_status_new (states[i], status);
                list = g_list_prepend (list, sas);
 
@@ -455,7 +455,7 @@ presence_chooser_flash_timeout_cb (EmpathyPresenceChooser *chooser)
        }
 
        gtk_image_set_from_icon_name (GTK_IMAGE (priv->image),
-                                     empathy_icon_name_for_presence_state (state),
+                                     empathy_icon_name_for_presence (state),
                                      GTK_ICON_SIZE_MENU);
 
        on = !on;
@@ -500,7 +500,7 @@ presence_chooser_flash_stop (EmpathyPresenceChooser *chooser,
        }
 
        gtk_image_set_from_icon_name (GTK_IMAGE (priv->image),
-                                     empathy_icon_name_for_presence_state (state),
+                                     empathy_icon_name_for_presence (state),
                                      GTK_ICON_SIZE_MENU);
 
        priv->last_state = state;
@@ -665,7 +665,7 @@ empathy_presence_chooser_create_menu (void)
        for (i = 0; i < G_N_ELEMENTS (states); i += 2) {
                GList       *list, *l;
 
-               status = empathy_presence_state_get_default_status (states[i]);
+               status = empathy_presence_get_default_message (states[i]);
                presence_chooser_menu_add_item (menu,
                                                status,
                                                states[i]);
@@ -714,7 +714,7 @@ presence_chooser_menu_add_item (GtkWidget   *menu,
        const gchar *icon_name;
 
        item = gtk_image_menu_item_new_with_label (str);
-       icon_name = empathy_icon_name_for_presence_state (state);
+       icon_name = empathy_icon_name_for_presence (state);
 
        g_signal_connect (item, "activate",
                          G_CALLBACK (presence_chooser_noncustom_activate_cb),
@@ -891,8 +891,8 @@ presence_chooser_dialog_setup (CustomMessageDialog *dialog)
 
                gtk_list_store_append (store, &iter);
                gtk_list_store_set (store, &iter,
-                                   COL_ICON, empathy_icon_name_for_presence_state (states[i]),
-                                   COL_LABEL, empathy_presence_state_get_default_status (states[i]),
+                                   COL_ICON, empathy_icon_name_for_presence (states[i]),
+                                   COL_LABEL, empathy_presence_get_default_message (states[i]),
                                    COL_PRESENCE, states[i],
                                    -1);
        }
index 8a9349620176fb5acb95dc2915f8327ac1dceafb..a04458d83bab6dd85d071b23171f9d760cd691aa 100644 (file)
@@ -27,8 +27,6 @@
 
 #include <gtk/gtk.h>
 
-#include <libempathy/empathy-presence.h>
-
 G_BEGIN_DECLS
 
 #define EMPATHY_TYPE_PRESENCE_CHOOSER         (empathy_presence_chooser_get_type ())
index 9e62a1e189e363bc4bb5b2ae88db428f1bc9133f..0cffeb1b4d701d7d7ceee85f48ed2d86748e6bb4 100644 (file)
@@ -372,7 +372,7 @@ status_icon_idle_notify_cb (EmpathyStatusIcon *icon)
        if (flash_state != MC_PRESENCE_UNSET) {
                const gchar *icon_name;
 
-               icon_name = empathy_icon_name_for_presence_state (flash_state);
+               icon_name = empathy_icon_name_for_presence (flash_state);
                if (!priv->flash_state_event) {
                        /* We are now flashing */
                        priv->flash_state_event = status_icon_event_new (icon, icon_name, NULL);
@@ -429,7 +429,7 @@ status_icon_set_from_state (EmpathyStatusIcon *icon)
        priv = GET_PRIV (icon);
 
        state = empathy_idle_get_state (priv->idle);
-       icon_name = empathy_icon_name_for_presence_state (state);
+       icon_name = empathy_icon_name_for_presence (state);
        gtk_status_icon_set_from_icon_name (priv->icon, icon_name);
 }
 
index 22a5fc2f739ac04eaef2abd8db6cf6f66bb66e2b..0b29232bcfb661a1a8c2c078e15762cd96456525 100644 (file)
@@ -220,9 +220,9 @@ empathy_icon_name_from_account (McAccount *account)
 }
 
 const gchar *
-empathy_icon_name_for_presence_state (McPresence state)
+empathy_icon_name_for_presence (McPresence presence)
 {
-       switch (state) {
+       switch (presence) {
        case MC_PRESENCE_AVAILABLE:
                return EMPATHY_IMAGE_AVAILABLE;
        case MC_PRESENCE_DO_NOT_DISTURB:
@@ -243,33 +243,16 @@ empathy_icon_name_for_presence_state (McPresence state)
        return NULL;
 }
 
-const gchar *
-empathy_icon_name_for_presence (EmpathyPresence *presence)
-{
-       McPresence state;
-
-       g_return_val_if_fail (EMPATHY_IS_PRESENCE (presence),
-                             EMPATHY_IMAGE_OFFLINE);
-
-       state = empathy_presence_get_state (presence);
-
-       return empathy_icon_name_for_presence_state (state);
-}
-
 const gchar *
 empathy_icon_name_for_contact (EmpathyContact *contact)
 {
-       EmpathyPresence *presence;
+       McPresence presence;
 
        g_return_val_if_fail (EMPATHY_IS_CONTACT (contact),
                              EMPATHY_IMAGE_OFFLINE);
 
        presence = empathy_contact_get_presence (contact);
-       if (presence) {
-               return empathy_icon_name_for_presence (presence);
-       }
-
-       return EMPATHY_IMAGE_UNKNOWN;
+       return empathy_icon_name_for_presence (presence);
 }
 
 GdkPixbuf *
index fd1f7c6339c0edd8c07d9ab67dc0dbebfa6fa292..1fb29a97d09360cfea1b1a4d308d298ef93df6de 100644 (file)
@@ -37,7 +37,6 @@
 #include <libmissioncontrol/mc-account.h>
 #include <libmissioncontrol/mc-profile.h>
 
-#include <libempathy/empathy-presence.h>
 #include <libempathy/empathy-contact.h>
 #include <libempathy/empathy-avatar.h>
 
@@ -68,8 +67,7 @@ void            empathy_glade_setup_size_group          (GladeXML         *gui,
                                                         ...);
 /* Pixbufs */
 const gchar * empathy_icon_name_from_account            (McAccount        *account);
-const gchar * empathy_icon_name_for_presence_state      (McPresence        state);
-const gchar * empathy_icon_name_for_presence            (EmpathyPresence  *presence);
+const gchar * empathy_icon_name_for_presence            (McPresence        presence);
 const gchar * empathy_icon_name_for_contact             (EmpathyContact   *contact);
 GdkPixbuf *   empathy_pixbuf_from_data                  (gchar            *data,
                                                         gsize             data_size);
index 285dff185451aaba5d81a84fdb7fb10427deb046..3c87db37c965630f6d6780f64e705d0c434ecb85 100644 (file)
@@ -18,7 +18,6 @@ lib_LTLIBRARIES = libempathy.la
 libempathy_la_SOURCES =                                        \
        empathy-avatar.c                                \
        empathy-time.c                                  \
-       empathy-presence.c                              \
        empathy-status-presets.c                        \
        empathy-debug.c                                 \
        empathy-utils.c                                 \
@@ -55,7 +54,6 @@ libempathy_la_LDFLAGS =               \
 libempathy_headers =                           \
        empathy-avatar.h                        \
        empathy-time.h                          \
-       empathy-presence.h                      \
        empathy-status-presets.h                \
        empathy-debug.h                         \
        empathy-utils.h                         \
index 76cab2a6e9da4d7c415a21bbf6fcf16675f5c246..70025c7b0bff54cc59db3ca0ceb323820002f722 100644 (file)
@@ -29,6 +29,8 @@
 
 #include <glib/gi18n.h>
 
+#include <telepathy-glib/util.h>
+
 #include "empathy-contact.h"
 #include "empathy-utils.h"
 #include "empathy-debug.h"
@@ -45,7 +47,8 @@ struct _EmpathyContactPriv {
        gchar              *name;
        EmpathyAvatar      *avatar;
        McAccount          *account;
-       EmpathyPresence    *presence;
+       McPresence          presence;
+       gchar              *presence_message;
        guint               handle;
        EmpathyCapabilities capabilities;
        gboolean            is_user;
@@ -72,6 +75,7 @@ enum {
        PROP_AVATAR,
        PROP_ACCOUNT,
        PROP_PRESENCE,
+       PROP_PRESENCE_MESSAGE,
        PROP_GROUPS,
        PROP_SUBSCRIPTION,
        PROP_HANDLE,
@@ -124,12 +128,21 @@ empathy_contact_class_init (EmpathyContactClass *class)
 
        g_object_class_install_property (object_class,
                                         PROP_PRESENCE,
-                                        g_param_spec_object ("presence",
-                                                             "Contact presence",
-                                                             "Presence of contact",
-                                                             EMPATHY_TYPE_PRESENCE,
-                                                             G_PARAM_READWRITE));
+                                        g_param_spec_uint ("presence",
+                                                           "Contact presence",
+                                                           "Presence of contact",
+                                                           MC_PRESENCE_UNSET,
+                                                           LAST_MC_PRESENCE,
+                                                           MC_PRESENCE_UNSET,
+                                                           G_PARAM_READWRITE));
 
+       g_object_class_install_property (object_class,
+                                        PROP_PRESENCE_MESSAGE,
+                                        g_param_spec_string ("presence-message",
+                                                             "Contact presence message",
+                                                             "Presence message of contact",
+                                                             NULL,
+                                                             G_PARAM_READWRITE));
        g_object_class_install_property (object_class,
                                         PROP_HANDLE,
                                         g_param_spec_uint ("handle",
@@ -176,15 +189,12 @@ contact_finalize (GObject *object)
 
        g_free (priv->name);
        g_free (priv->id);
+       g_free (priv->presence_message);
 
        if (priv->avatar) {
                empathy_avatar_unref (priv->avatar);
        }
 
-       if (priv->presence) {
-               g_object_unref (priv->presence);
-       }
-
        if (priv->account) {
                g_object_unref (priv->account);
        }
@@ -218,7 +228,10 @@ contact_get_property (GObject    *object,
                g_value_set_object (value, priv->account);
                break;
        case PROP_PRESENCE:
-               g_value_set_object (value, priv->presence);
+               g_value_set_uint (value, priv->presence);
+               break;
+       case PROP_PRESENCE_MESSAGE:
+               g_value_set_string (value, priv->presence_message);
                break;
        case PROP_HANDLE:
                g_value_set_uint (value, priv->handle);
@@ -264,7 +277,11 @@ contact_set_property (GObject      *object,
                break;
        case PROP_PRESENCE:
                empathy_contact_set_presence (EMPATHY_CONTACT (object),
-                                            EMPATHY_PRESENCE (g_value_get_object (value)));
+                                             g_value_get_uint (value));
+               break;
+       case PROP_PRESENCE_MESSAGE:
+               empathy_contact_set_presence_message (EMPATHY_CONTACT (object),
+                                                     g_value_get_string (value));
                break;
        case PROP_HANDLE:
                empathy_contact_set_handle (EMPATHY_CONTACT (object),
@@ -451,12 +468,12 @@ empathy_contact_set_account (EmpathyContact *contact,
        g_object_notify (G_OBJECT (contact), "account");
 }
 
-EmpathyPresence *
+McPresence
 empathy_contact_get_presence (EmpathyContact *contact)
 {
        EmpathyContactPriv *priv;
 
-       g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
+       g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), MC_PRESENCE_UNSET);
 
        priv = GET_PRIV (contact);
 
@@ -464,8 +481,8 @@ empathy_contact_get_presence (EmpathyContact *contact)
 }
 
 void
-empathy_contact_set_presence (EmpathyContact  *contact,
-                             EmpathyPresence *presence)
+empathy_contact_set_presence (EmpathyContact *contact,
+                             McPresence      presence)
 {
        EmpathyContactPriv *priv;
 
@@ -477,16 +494,39 @@ empathy_contact_set_presence (EmpathyContact  *contact,
                return;
        }
 
-       if (priv->presence) {
-               g_object_unref (priv->presence);
-               priv->presence = NULL;
-       }
+       priv->presence = presence;
+
+       g_object_notify (G_OBJECT (contact), "presence");
+}
+
+const gchar *
+empathy_contact_get_presence_message (EmpathyContact *contact)
+{
+       EmpathyContactPriv *priv;
 
-       if (presence) {
-               priv->presence = g_object_ref (presence);
+       g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
+
+       priv = GET_PRIV (contact);
+
+       return priv->presence_message;
+}
+
+void
+empathy_contact_set_presence_message (EmpathyContact *contact,
+                                     const gchar    *message)
+{
+       EmpathyContactPriv *priv = GET_PRIV (contact);
+
+       g_return_if_fail (EMPATHY_IS_CONTACT (contact));
+
+       if (!tp_strdiff (message, priv->presence_message)) {
+               return;
        }
 
-       g_object_notify (G_OBJECT (contact), "presence");
+       g_free (priv->presence_message);
+       priv->presence_message = g_strdup (message);
+
+       g_object_notify (G_OBJECT (contact), "presence-message");
 }
 
 guint
@@ -591,11 +631,7 @@ empathy_contact_is_online (EmpathyContact *contact)
 
        priv = GET_PRIV (contact);
 
-       if (!priv->presence) {
-               return FALSE;
-       }
-
-       return (empathy_presence_get_state (priv->presence) > MC_PRESENCE_OFFLINE);
+       return (priv->presence > MC_PRESENCE_OFFLINE);
 }
 
 const gchar *
@@ -607,21 +643,11 @@ empathy_contact_get_status (EmpathyContact *contact)
 
        priv = GET_PRIV (contact);
 
-       if (priv->presence) {
-               const gchar *status;
-
-               status = empathy_presence_get_status (priv->presence);
-               if (!status) {
-                       McPresence state;
-
-                       state = empathy_presence_get_state (priv->presence);
-                       status = empathy_presence_state_get_default_status (state);
-               }
-
-               return status;
+       if (priv->presence_message) {
+               return priv->presence_message;
        }
 
-       return empathy_presence_state_get_default_status (MC_PRESENCE_OFFLINE);
+       return empathy_presence_get_default_message (priv->presence);
 }
 
 gboolean
index b5a3c1ec994858b898b7dff5c1d49a929396adb8..57a72c9067f070e1103ae38a64690ce3ded6b611 100644 (file)
@@ -29,9 +29,9 @@
 #include <glib-object.h>
 
 #include <libmissioncontrol/mc-account.h>
+#include <libmissioncontrol/mission-control.h>
 
 #include "empathy-avatar.h"
-#include "empathy-presence.h"
 
 G_BEGIN_DECLS
 
@@ -75,9 +75,12 @@ void                empathy_contact_set_avatar         (EmpathyContact      *con
 McAccount *         empathy_contact_get_account        (EmpathyContact      *contact);
 void                empathy_contact_set_account        (EmpathyContact      *contact,
                                                        McAccount           *account);
-EmpathyPresence *   empathy_contact_get_presence       (EmpathyContact      *contact);
+McPresence          empathy_contact_get_presence       (EmpathyContact      *contact);
 void                empathy_contact_set_presence       (EmpathyContact      *contact,
-                                                       EmpathyPresence     *presence);
+                                                       McPresence           presence);
+const gchar *       empathy_contact_get_presence_message (EmpathyContact    *contact);
+void                empathy_contact_set_presence_message (EmpathyContact    *contact,
+                                                       const gchar         *message);
 guint               empathy_contact_get_handle         (EmpathyContact      *contact);
 void                empathy_contact_set_handle         (EmpathyContact      *contact,
                                                        guint                handle);
index 2f811a622760614ae96a10ce20a387c2aa09bc2e..0f23037bdabe2ca176a8a73b7ffb70919c40143b 100644 (file)
@@ -345,7 +345,7 @@ empathy_idle_get_status (EmpathyIdle *idle)
        priv = GET_PRIV (idle);
 
        if (!priv->status) {
-               return empathy_presence_state_get_default_status (priv->state);
+               return empathy_presence_get_default_message (priv->state);
        }
 
        return priv->status;
@@ -407,7 +407,7 @@ empathy_idle_set_presence (EmpathyIdle *idle,
        }
 
        /* Do not set translated default messages */
-       default_status = empathy_presence_state_get_default_status (state);
+       default_status = empathy_presence_get_default_message (state);
        if (status && strcmp (status, default_status) == 0) {
                status = NULL;
        }
diff --git a/libempathy/empathy-presence.c b/libempathy/empathy-presence.c
deleted file mode 100644 (file)
index b7beb39..0000000
+++ /dev/null
@@ -1,339 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2004-2007 Imendio AB
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Mikael Hallendal <micke@imendio.com>
- */
-
-#include "config.h"
-
-#include <string.h>
-
-#include <glib/gi18n.h>
-
-#include <libmissioncontrol/mc-enum-types.h>
-
-#include "empathy-presence.h"
-#include "empathy-time.h"
-
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_PRESENCE, EmpathyPresencePriv))
-
-typedef struct _EmpathyPresencePriv EmpathyPresencePriv;
-
-struct _EmpathyPresencePriv {
-       McPresence  state;
-       gchar      *status;
-       time_t      timestamp;
-};
-
-static void         presence_finalize     (GObject      *object);
-static void         presence_get_property (GObject      *object,
-                                          guint         param_id,
-                                          GValue       *value,
-                                          GParamSpec   *pspec);
-static void         presence_set_property (GObject      *object,
-                                          guint         param_id,
-                                          const GValue *value,
-                                          GParamSpec   *pspec);
-
-enum {
-       PROP_0,
-       PROP_STATE,
-       PROP_STATUS
-};
-
-G_DEFINE_TYPE (EmpathyPresence, empathy_presence, G_TYPE_OBJECT);
-
-static void
-empathy_presence_class_init (EmpathyPresenceClass *class)
-{
-       GObjectClass *object_class;
-
-       object_class = G_OBJECT_CLASS (class);
-
-       object_class->finalize     = presence_finalize;
-       object_class->get_property = presence_get_property;
-       object_class->set_property = presence_set_property;
-
-       g_object_class_install_property (object_class,
-                                        PROP_STATE,
-                                        g_param_spec_enum ("state",
-                                                           "Presence State",
-                                                           "The current state of the presence",
-                                                           MC_TYPE_PRESENCE,
-                                                           MC_PRESENCE_AVAILABLE,
-                                                           G_PARAM_READWRITE));
-       g_object_class_install_property (object_class,
-                                        PROP_STATUS,
-                                        g_param_spec_string ("status",
-                                                             "Presence Status",
-                                                             "Status string set on presence",
-                                                             NULL,
-                                                             G_PARAM_READWRITE));
-
-       g_type_class_add_private (object_class, sizeof (EmpathyPresencePriv));
-}
-
-static void
-empathy_presence_init (EmpathyPresence *presence)
-{
-       EmpathyPresencePriv *priv;
-
-       priv = GET_PRIV (presence);
-
-       priv->state = MC_PRESENCE_AVAILABLE;
-       priv->status = NULL;
-       priv->timestamp = empathy_time_get_current ();
-}
-
-static void
-presence_finalize (GObject *object)
-{
-       EmpathyPresencePriv *priv;
-
-       priv = GET_PRIV (object);
-
-       g_free (priv->status);
-
-       (G_OBJECT_CLASS (empathy_presence_parent_class)->finalize) (object);
-}
-
-static void
-presence_get_property (GObject    *object,
-                      guint       param_id,
-                      GValue     *value,
-                      GParamSpec *pspec)
-{
-       EmpathyPresencePriv *priv;
-
-       priv = GET_PRIV (object);
-
-       switch (param_id) {
-       case PROP_STATE:
-               g_value_set_enum (value, priv->state);
-               break;
-       case PROP_STATUS:
-               g_value_set_string (value,
-                                   empathy_presence_get_status (EMPATHY_PRESENCE (object)));
-               break;
-       default:
-               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
-               break;
-       }
-}
-static void
-presence_set_property (GObject      *object,
-                      guint         param_id,
-                      const GValue *value,
-                      GParamSpec   *pspec)
-{
-       EmpathyPresencePriv *priv;
-
-       priv = GET_PRIV (object);
-
-       switch (param_id) {
-       case PROP_STATE:
-               priv->state = g_value_get_enum (value);
-               break;
-       case PROP_STATUS:
-               empathy_presence_set_status (EMPATHY_PRESENCE (object),
-                                           g_value_get_string (value));
-               break;
-       default:
-               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
-               break;
-       }
-}
-
-EmpathyPresence *
-empathy_presence_new (void)
-{
-       return g_object_new (EMPATHY_TYPE_PRESENCE, NULL);
-}
-
-EmpathyPresence *
-empathy_presence_new_full (McPresence   state,
-                         const gchar *status)
-{
-       return g_object_new (EMPATHY_TYPE_PRESENCE,
-                            "state", state,
-                            "status", status,
-                            NULL);
-}
-
-const gchar *
-empathy_presence_get_status (EmpathyPresence *presence)
-{
-       EmpathyPresencePriv *priv;
-
-       g_return_val_if_fail (EMPATHY_IS_PRESENCE (presence),
-                             _("Offline"));
-
-       priv = GET_PRIV (presence);
-
-       return priv->status;
-}
-
-McPresence
-empathy_presence_get_state (EmpathyPresence *presence)
-{
-       EmpathyPresencePriv *priv;
-
-       g_return_val_if_fail (EMPATHY_IS_PRESENCE (presence),
-                             MC_PRESENCE_AVAILABLE);
-
-       priv = GET_PRIV (presence);
-
-       return priv->state;
-}
-
-void
-empathy_presence_set_state (EmpathyPresence *presence,
-                          McPresence      state)
-{
-       EmpathyPresencePriv *priv;
-
-       g_return_if_fail (EMPATHY_IS_PRESENCE (presence));
-
-       priv = GET_PRIV (presence);
-
-       priv->state = state;
-
-       g_object_notify (G_OBJECT (presence), "state");
-}
-
-void
-empathy_presence_set_status (EmpathyPresence *presence,
-                           const gchar    *status)
-{
-       EmpathyPresencePriv *priv;
-
-       priv = GET_PRIV (presence);
-       g_return_if_fail (EMPATHY_IS_PRESENCE (presence));
-
-       g_free (priv->status);
-
-       if (status) {
-               priv->status = g_strdup (status);
-       } else {
-               priv->status = NULL;
-       }
-
-       g_object_notify (G_OBJECT (presence), "status");
-}
-
-gint
-empathy_presence_sort_func (gconstpointer a,
-                          gconstpointer b)
-{
-       EmpathyPresencePriv *priv_a;
-       EmpathyPresencePriv *priv_b;
-       gint                diff;
-
-       g_return_val_if_fail (EMPATHY_IS_PRESENCE (a), 0);
-       g_return_val_if_fail (EMPATHY_IS_PRESENCE (b), 0);
-        
-       priv_a = GET_PRIV (a);
-       priv_b = GET_PRIV (b);
-
-       /* 1. State */
-       diff = priv_a->state - priv_b->state;
-       if (diff != 0) {
-               return diff < 1 ? -1 : +1;
-       }
-
-       /* 3. Time (newest first) */
-       diff = priv_b->timestamp - priv_a->timestamp;
-       if (diff != 0) {
-               return diff < 1 ? -1 : +1;
-       }
-               
-       /* No real difference */
-       return 0;
-}
-
-const gchar *
-empathy_presence_state_get_default_status (McPresence state)
-{
-       switch (state) {
-       case MC_PRESENCE_AVAILABLE:
-               return _("Available");
-       case MC_PRESENCE_DO_NOT_DISTURB:
-               return _("Busy");
-       case MC_PRESENCE_AWAY:
-       case MC_PRESENCE_EXTENDED_AWAY:
-               return _("Away");
-       case MC_PRESENCE_HIDDEN:
-               return _("Hidden");
-       case MC_PRESENCE_OFFLINE:
-       case MC_PRESENCE_UNSET:
-               return _("Offline");
-       default:
-               g_assert_not_reached ();
-       }
-
-       return NULL;
-}
-
-const gchar *
-empathy_presence_state_to_str (McPresence state)
-{
-       switch (state) {
-       case MC_PRESENCE_AVAILABLE:
-               return "available";
-       case MC_PRESENCE_DO_NOT_DISTURB:
-               return "busy";
-       case MC_PRESENCE_AWAY:
-               return "away";
-       case MC_PRESENCE_EXTENDED_AWAY:
-               return "ext_away";
-       case MC_PRESENCE_HIDDEN:
-               return "hidden";
-       case MC_PRESENCE_OFFLINE:
-               return "offline";
-       case MC_PRESENCE_UNSET:
-               return "unset";
-       default:
-               g_assert_not_reached ();
-       }
-
-       return NULL;
-}
-
-McPresence
-empathy_presence_state_from_str (const gchar *str)
-{
-       if (strcmp (str, "available") == 0) {
-               return MC_PRESENCE_AVAILABLE;
-       } else if ((strcmp (str, "dnd") == 0) || (strcmp (str, "busy") == 0)) {
-               return MC_PRESENCE_DO_NOT_DISTURB;
-       } else if ((strcmp (str, "away") == 0) || (strcmp (str, "brb") == 0)) {
-               return MC_PRESENCE_AWAY;
-       } else if ((strcmp (str, "xa") == 0) || (strcmp (str, "ext_away") == 0)) {
-               return MC_PRESENCE_EXTENDED_AWAY;
-       } else if (strcmp (str, "hidden") == 0) {
-               return MC_PRESENCE_HIDDEN;
-       } else if (strcmp (str, "offline") == 0) {
-               return MC_PRESENCE_OFFLINE;
-       } else if (strcmp (str, "unset") == 0) {
-               return MC_PRESENCE_UNSET;
-       }
-
-       return MC_PRESENCE_AVAILABLE;
-}
-
diff --git a/libempathy/empathy-presence.h b/libempathy/empathy-presence.h
deleted file mode 100644 (file)
index 940bf9c..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2004 Imendio AB
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __EMPATHY_PRESENCE_H__
-#define __EMPATHY_PRESENCE_H__
-
-#include <glib-object.h>
-#include <libmissioncontrol/mission-control.h>
-
-G_BEGIN_DECLS
-
-#define EMPATHY_TYPE_PRESENCE         (empathy_presence_get_type ())
-#define EMPATHY_PRESENCE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_PRESENCE, EmpathyPresence))
-#define EMPATHY_PRESENCE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_PRESENCE, EmpathyPresenceClass))
-#define EMPATHY_IS_PRESENCE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_PRESENCE))
-#define EMPATHY_IS_PRESENCE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_PRESENCE))
-#define EMPATHY_PRESENCE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_PRESENCE, EmpathyPresenceClass))
-
-typedef struct _EmpathyPresence      EmpathyPresence;
-typedef struct _EmpathyPresenceClass EmpathyPresenceClass;
-
-struct _EmpathyPresence {
-       GObject parent;
-};
-
-struct _EmpathyPresenceClass {
-       GObjectClass parent_class;
-};
-
-GType               empathy_presence_get_type                 (void) G_GNUC_CONST;
-
-EmpathyPresence *    empathy_presence_new                      (void);
-EmpathyPresence *    empathy_presence_new_full                 (McPresence      state,
-                                                             const gchar    *status);
-McPresence          empathy_presence_get_state                (EmpathyPresence *presence);
-const gchar *       empathy_presence_get_status               (EmpathyPresence *presence);
-void                empathy_presence_set_state                (EmpathyPresence *presence,
-                                                             McPresence      state);
-void                empathy_presence_set_status               (EmpathyPresence *presence,
-                                                             const gchar    *status);
-gint                empathy_presence_sort_func                (gconstpointer   a,
-                                                             gconstpointer   b);
-const gchar *       empathy_presence_state_get_default_status (McPresence      state);
-const gchar *       empathy_presence_state_to_str             (McPresence      state);
-McPresence          empathy_presence_state_from_str           (const gchar    *str);
-
-G_END_DECLS
-
-#endif /* __EMPATHY_PRESENCE_H__ */
-
index 54f7b629c82429b38a08ace64d853967b463c6e3..89b1874f3260c08394a9f7f24820de34076dd8dd 100644 (file)
@@ -130,7 +130,7 @@ status_presets_file_parse (const gchar *filename)
                        state_str = (gchar *) xmlGetProp (node, "presence");
 
                        if (state_str) {
-                               state = empathy_presence_state_from_str (state_str);
+                               state = empathy_presence_from_str (state_str);
 
                                if (is_default) {
                                        empathy_debug (DEBUG_DOMAIN,
@@ -215,7 +215,7 @@ status_presets_file_save (void)
                xmlNodePtr  subnode;
                xmlChar    *state;
 
-               state = (gchar*) empathy_presence_state_to_str (default_preset->state);
+               state = (gchar*) empathy_presence_to_str (default_preset->state);
 
                subnode = xmlNewTextChild (root, NULL, "default",
                                           default_preset->status);
@@ -228,7 +228,7 @@ status_presets_file_save (void)
                xmlChar      *state;
 
                sp = l->data;
-               state = (gchar*) empathy_presence_state_to_str (sp->state);
+               state = (gchar*) empathy_presence_to_str (sp->state);
 
                count[sp->state]++;
                if (count[sp->state] > STATUS_PRESETS_MAX_EACH) {
index 68f3cea563b11aa3032f98bf9aa363129b64ad54..06b6c79120fcfc9b26648c47057da4d9217907f3 100644 (file)
@@ -23,7 +23,7 @@
 #ifndef __EMPATHY_STATUS_PRESETS_H__
 #define __EMPATHY_STATUS_PRESETS_H__
 
-#include "empathy-presence.h"
+#include <libmissioncontrol/mission-control.h>
 
 G_BEGIN_DECLS
 
index f71a9101474bfdb3798d5e6e4e75120d93ca4195..14d2640da484ef7fd4868ef70088ddc5838b4b51 100644 (file)
@@ -109,30 +109,19 @@ tp_contact_factory_weak_notify (gpointer data,
 }
 
 static void
-tp_contact_factory_presences_table_foreach (const gchar      *state_str,
-                                           GHashTable       *presences_table,
-                                           EmpathyPresence **presence)
+tp_contact_factory_presences_table_foreach (const gchar    *state_str,
+                                           GHashTable     *presences_table,
+                                           EmpathyContact *contact)
 {
-       McPresence    state;
        const GValue *message;
 
-       state = empathy_presence_state_from_str (state_str);
-       if (state == MC_PRESENCE_UNSET) {
-               return;
-       }
-
-       if (*presence) {
-               g_object_unref (*presence);
-               *presence = NULL;
-       }
-
-       *presence = empathy_presence_new ();
-       empathy_presence_set_state (*presence, state);
-
+       empathy_contact_set_presence (contact,
+                                     empathy_presence_from_str (state_str));
+       
        message = g_hash_table_lookup (presences_table, "message");
        if (message != NULL) {
-               empathy_presence_set_status (*presence,
-                                            g_value_get_string (message));
+               empathy_contact_set_presence_message (contact,
+                                                     g_value_get_string (message));
        }
 }
 
@@ -143,7 +132,6 @@ tp_contact_factory_parse_presence_foreach (guint                    handle,
 {
        GHashTable      *presences_table;
        EmpathyContact  *contact;
-       EmpathyPresence *presence = NULL;
 
        contact = tp_contact_factory_find_by_handle (tp_factory, handle);
        if (!contact) {
@@ -154,16 +142,13 @@ tp_contact_factory_parse_presence_foreach (guint                    handle,
 
        g_hash_table_foreach (presences_table,
                              (GHFunc) tp_contact_factory_presences_table_foreach,
-                             &presence);
+                             contact);
 
        empathy_debug (DEBUG_DOMAIN, "Changing presence for contact %s (%d) to %s (%d)",
                      empathy_contact_get_id (contact),
                      handle,
-                     presence ? empathy_presence_get_status (presence) : "unset",
-                     presence ? empathy_presence_get_state (presence) : MC_PRESENCE_UNSET);
-
-       empathy_contact_set_presence (contact, presence);
-       g_object_unref (presence);
+                     empathy_contact_get_presence_message (contact),
+                     empathy_contact_get_presence (contact));
 }
 
 static void
@@ -699,7 +684,7 @@ tp_contact_factory_disconnect_contact_foreach (gpointer data,
 {
        EmpathyContact *contact = data;
        
-       empathy_contact_set_presence (contact, NULL);
+       empathy_contact_set_presence (contact, MC_PRESENCE_UNSET);
        empathy_contact_set_handle (contact, 0);
 }
 
@@ -910,15 +895,9 @@ tp_contact_factory_add_contact (EmpathyTpContactFactory *tp_factory,
        priv->contacts = g_list_prepend (priv->contacts, contact);
 
        if (!priv->presence_iface) {
-               EmpathyPresence *presence;
-
                /* We have no presence iface, set default presence
                 * to available */
-               presence = empathy_presence_new_full (MC_PRESENCE_AVAILABLE,
-                                                    NULL);
-
-               empathy_contact_set_presence (contact, presence);
-               g_object_unref (presence);
+               empathy_contact_set_presence (contact, MC_PRESENCE_AVAILABLE);
        }
 
        empathy_debug (DEBUG_DOMAIN, "Contact added: %s (%d)",
index 4050f46738924c0e6c782e1c379f5449626792ad..c810f9cca509d237cc5dfd0cceaaaabbe9d1444e 100644 (file)
@@ -485,3 +485,74 @@ empathy_chat_with_contact_id (McAccount *account, const gchar *contact_id)
        g_object_unref (mc);
 }
 
+
+const gchar *
+empathy_presence_get_default_message (McPresence presence)
+{
+       switch (presence) {
+       case MC_PRESENCE_AVAILABLE:
+               return _("Available");
+       case MC_PRESENCE_DO_NOT_DISTURB:
+               return _("Busy");
+       case MC_PRESENCE_AWAY:
+       case MC_PRESENCE_EXTENDED_AWAY:
+               return _("Away");
+       case MC_PRESENCE_HIDDEN:
+               return _("Hidden");
+       case MC_PRESENCE_OFFLINE:
+       case MC_PRESENCE_UNSET:
+               return _("Offline");
+       default:
+               g_assert_not_reached ();
+       }
+
+       return NULL;
+}
+
+const gchar *
+empathy_presence_to_str (McPresence presence)
+{
+       switch (presence) {
+       case MC_PRESENCE_AVAILABLE:
+               return "available";
+       case MC_PRESENCE_DO_NOT_DISTURB:
+               return "busy";
+       case MC_PRESENCE_AWAY:
+               return "away";
+       case MC_PRESENCE_EXTENDED_AWAY:
+               return "ext_away";
+       case MC_PRESENCE_HIDDEN:
+               return "hidden";
+       case MC_PRESENCE_OFFLINE:
+               return "offline";
+       case MC_PRESENCE_UNSET:
+               return "unset";
+       default:
+               g_assert_not_reached ();
+       }
+
+       return NULL;
+}
+
+McPresence
+empathy_presence_from_str (const gchar *str)
+{
+       if (strcmp (str, "available") == 0) {
+               return MC_PRESENCE_AVAILABLE;
+       } else if ((strcmp (str, "dnd") == 0) || (strcmp (str, "busy") == 0)) {
+               return MC_PRESENCE_DO_NOT_DISTURB;
+       } else if ((strcmp (str, "away") == 0) || (strcmp (str, "brb") == 0)) {
+               return MC_PRESENCE_AWAY;
+       } else if ((strcmp (str, "xa") == 0) || (strcmp (str, "ext_away") == 0)) {
+               return MC_PRESENCE_EXTENDED_AWAY;
+       } else if (strcmp (str, "hidden") == 0) {
+               return MC_PRESENCE_HIDDEN;
+       } else if (strcmp (str, "offline") == 0) {
+               return MC_PRESENCE_OFFLINE;
+       } else if (strcmp (str, "unset") == 0) {
+               return MC_PRESENCE_UNSET;
+       }
+
+       return MC_PRESENCE_AVAILABLE;
+}
+
index 1f3700d22858f7a096859573b254432e11b36d79..875128c1e05ab123a1f8b74a90342efaf7a0ccb2 100644 (file)
@@ -92,6 +92,9 @@ void         empathy_call_contact                   (EmpathyContact  *contact);
 void         empathy_chat_with_contact              (EmpathyContact  *contact);
 void         empathy_chat_with_contact_id           (McAccount       *account,
                                                     const gchar     *contact_id);
+const gchar * empathy_presence_get_default_message  (McPresence       presence);
+const gchar * empathy_presence_to_str               (McPresence       presence);
+McPresence    empathy_presence_from_str             (const gchar     *str);
 
 G_END_DECLS
 
index f9c121b5fbaef5a49561bbeabda1ad56dd94b6c9..12725438199e6c6c07fe4cb69e83b2c91709063b 100644 (file)
@@ -15,5 +15,7 @@ Manually modify pyempathy.defs, ContactList is not an object but an interface:
 ContactManager, TpChatroom and TpContactList implements ContactList interface:
   (implements "EmpathyContactList")
 
+That can be done by applying pyempathy.patch
+
 3)
 Manually update headers in pyempathy.override and pyempathygtk.override.
diff --git a/python/pyempathy.patch b/python/pyempathy.patch
new file mode 100644 (file)
index 0000000..497ec4f
--- /dev/null
@@ -0,0 +1,35 @@
+--- pyempathy.defs     2008-01-24 16:03:39.000000000 +0100
++++ pyempathy/pyempathy.defs   2008-01-24 16:04:34.000000000 +0100
+@@ -35,7 +35,7 @@
+   (gtype-id "EMPATHY_TYPE_CONTACT_FACTORY")
+ )
+-(define-object ContactList
++(define-interface ContactList
+   (in-module "Empathy")
+   (c-name "EmpathyContactList")
+   (gtype-id "EMPATHY_TYPE_CONTACT_LIST")
+@@ -44,6 +44,7 @@
+ (define-object ContactManager
+   (in-module "Empathy")
+   (parent "GObject")
++  (implements "EmpathyContactList")
+   (c-name "EmpathyContactManager")
+   (gtype-id "EMPATHY_TYPE_CONTACT_MANAGER")
+ )
+@@ -93,6 +94,7 @@
+ (define-object TpChatroom
+   (in-module "Empathy")
+   (parent "EmpathyTpChat")
++  (implements "EmpathyContactList")
+   (c-name "EmpathyTpChatroom")
+   (gtype-id "EMPATHY_TYPE_TP_CHATROOM")
+ )
+@@ -107,6 +109,7 @@
+ (define-object TpContactList
+   (in-module "Empathy")
+   (parent "GObject")
++  (implements "EmpathyContactList")
+   (c-name "EmpathyTpContactList")
+   (gtype-id "EMPATHY_TYPE_TP_CONTACT_LIST")
+ )
index f6c7e0b8087bd814fe60139c4292cf0d68f89d6c..7f7381fa7a3c4bc69529793c0fb2bcde537bfaa2 100644 (file)
   (gtype-id "EMPATHY_TYPE_MESSAGE")
 )
 
-(define-object Presence
-  (in-module "Empathy")
-  (parent "GObject")
-  (c-name "EmpathyPresence")
-  (gtype-id "EMPATHY_TYPE_PRESENCE")
-)
-
 (define-object TpCall
   (in-module "Empathy")
   (parent "GObject")
 (define-method get_presence
   (of-object "EmpathyContact")
   (c-name "empathy_contact_get_presence")
-  (return-type "EmpathyPresence*")
+  (return-type "McPresence")
 )
 
 (define-method set_presence
   (c-name "empathy_contact_set_presence")
   (return-type "none")
   (parameters
-    '("EmpathyPresence*" "presence")
+    '("McPresence" "presence")
+  )
+)
+
+(define-method get_presence_message
+  (of-object "EmpathyContact")
+  (c-name "empathy_contact_get_presence_message")
+  (return-type "const-gchar*")
+)
+
+(define-method set_presence_message
+  (of-object "EmpathyContact")
+  (c-name "empathy_contact_set_presence_message")
+  (return-type "none")
+  (parameters
+    '("const-gchar*" "message")
   )
 )
 
 
 
 
-;; From empathy-presence.h
-
-(define-function empathy_presence_get_type
-  (c-name "empathy_presence_get_type")
-  (return-type "GType")
-)
-
-(define-function empathy_presence_new
-  (c-name "empathy_presence_new")
-  (is-constructor-of "EmpathyPresence")
-  (return-type "EmpathyPresence*")
-)
-
-(define-function empathy_presence_new_full
-  (c-name "empathy_presence_new_full")
-  (return-type "EmpathyPresence*")
-  (parameters
-    '("McPresence" "state")
-    '("const-gchar*" "status")
-  )
-)
-
-(define-method get_state
-  (of-object "EmpathyPresence")
-  (c-name "empathy_presence_get_state")
-  (return-type "McPresence")
-)
-
-(define-method get_status
-  (of-object "EmpathyPresence")
-  (c-name "empathy_presence_get_status")
-  (return-type "const-gchar*")
-)
-
-(define-method set_state
-  (of-object "EmpathyPresence")
-  (c-name "empathy_presence_set_state")
-  (return-type "none")
-  (parameters
-    '("McPresence" "state")
-  )
-)
-
-(define-method set_status
-  (of-object "EmpathyPresence")
-  (c-name "empathy_presence_set_status")
-  (return-type "none")
-  (parameters
-    '("const-gchar*" "status")
-  )
-)
-
-(define-function empathy_presence_sort_func
-  (c-name "empathy_presence_sort_func")
-  (return-type "gint")
-  (parameters
-    '("gconstpointer" "a")
-    '("gconstpointer" "b")
-  )
-)
-
-(define-function empathy_presence_state_get_default_status
-  (c-name "empathy_presence_state_get_default_status")
-  (return-type "const-gchar*")
-  (parameters
-    '("McPresence" "state")
-  )
-)
-
-(define-function empathy_presence_state_to_str
-  (c-name "empathy_presence_state_to_str")
-  (return-type "const-gchar*")
-  (parameters
-    '("McPresence" "state")
-  )
-)
-
-(define-function empathy_presence_state_from_str
-  (c-name "empathy_presence_state_from_str")
-  (return-type "McPresence")
-  (parameters
-    '("const-gchar*" "str")
-  )
-)
-
-
-
 ;; From empathy-status-presets.h
 
 (define-function empathy_status_presets_get_all
   )
 )
 
+(define-function empathy_presence_get_default_message
+  (c-name "empathy_presence_get_default_message")
+  (return-type "const-gchar*")
+  (parameters
+    '("McPresence" "presence")
+  )
+)
+
+(define-function empathy_presence_to_str
+  (c-name "empathy_presence_to_str")
+  (return-type "const-gchar*")
+  (parameters
+    '("McPresence" "presence")
+  )
+)
+
+(define-function empathy_presence_from_str
+  (c-name "empathy_presence_from_str")
+  (return-type "McPresence")
+  (parameters
+    '("const-gchar*" "str")
+  )
+)
+
 
 
 ;; From tp-stream-engine-gen.h
index a21700fca8c532015819ffa113703c69cb5a8dcb..7425972ea6d7fd575c2cfddd3403a4b7bb9c3534 100644 (file)
@@ -15,7 +15,6 @@ headers
 #include "empathy-idle.h"
 #include "empathy-log-manager.h"
 #include "empathy-message.h"
-#include "empathy-presence.h"
 #include "empathy-status-presets.h"
 #include "empathy-time.h"
 #include "empathy-tp-chat.h"
index a8412437f8de6afaf51ad909e65716e5dfa96005..2a375786a45e192b4a7fecc29c53f443c7f59888 100644 (file)
   )
 )
 
+(define-function empathy_contact_widget_set_contact
+  (c-name "empathy_contact_widget_set_contact")
+  (return-type "none")
+  (parameters
+    '("GtkWidget*" "widget")
+    '("EmpathyContact*" "contact")
+  )
+)
+
 (define-function empathy_contact_widget_set_account_filter
   (c-name "empathy_contact_widget_set_account_filter")
   (return-type "none")
   )
 )
 
-(define-function empathy_icon_name_for_presence_state
-  (c-name "empathy_icon_name_for_presence_state")
-  (return-type "const-gchar*")
-  (parameters
-    '("McPresence" "state")
-  )
-)
-
 (define-function empathy_icon_name_for_presence
   (c-name "empathy_icon_name_for_presence")
   (return-type "const-gchar*")
   (parameters
-    '("EmpathyPresence*" "presence")
+    '("McPresence" "presence")
   )
 )