aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-01-25 00:33:33 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-01-25 00:33:33 +0800
commita687b7c513d3bb967781f17dc5d247161bcffd8c (patch)
tree116b335b3c4fe96ddd09c64e9aa382516168af03
parentff21a5f6bfedae8ca32ac871ccad5c106e831b28 (diff)
downloadgsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar.gz
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar.bz2
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar.lz
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar.xz
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar.zst
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.zip
Remove EmpathyPresence object and have "presence" and "presence-message" properties directly in EmpathyContact
svn path=/trunk/; revision=601
-rw-r--r--docs/libempathy/libempathy-docs.sgml1
-rw-r--r--docs/libempathy/libempathy.types1
-rw-r--r--libempathy-gtk/empathy-chat-window.c10
-rw-r--r--libempathy-gtk/empathy-contact-list-store.c36
-rw-r--r--libempathy-gtk/empathy-contact-widget.c3
-rw-r--r--libempathy-gtk/empathy-presence-chooser.c16
-rw-r--r--libempathy-gtk/empathy-presence-chooser.h2
-rw-r--r--libempathy-gtk/empathy-status-icon.c4
-rw-r--r--libempathy-gtk/empathy-ui-utils.c25
-rw-r--r--libempathy-gtk/empathy-ui-utils.h4
-rw-r--r--libempathy/Makefile.am2
-rw-r--r--libempathy/empathy-contact.c108
-rw-r--r--libempathy/empathy-contact.h9
-rw-r--r--libempathy/empathy-idle.c4
-rw-r--r--libempathy/empathy-presence.c339
-rw-r--r--libempathy/empathy-presence.h67
-rw-r--r--libempathy/empathy-status-presets.c6
-rw-r--r--libempathy/empathy-status-presets.h2
-rw-r--r--libempathy/empathy-tp-contact-factory.c47
-rw-r--r--libempathy/empathy-utils.c71
-rw-r--r--libempathy/empathy-utils.h3
-rw-r--r--python/README2
-rw-r--r--python/pyempathy.patch35
-rw-r--r--python/pyempathy/pyempathy.defs137
-rw-r--r--python/pyempathy/pyempathy.override1
-rw-r--r--python/pyempathygtk/pyempathygtk.defs19
26 files changed, 289 insertions, 665 deletions
diff --git a/docs/libempathy/libempathy-docs.sgml b/docs/libempathy/libempathy-docs.sgml
index bcdc5d0ff..dbc8cb573 100644
--- a/docs/libempathy/libempathy-docs.sgml
+++ b/docs/libempathy/libempathy-docs.sgml
@@ -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"/>
diff --git a/docs/libempathy/libempathy.types b/docs/libempathy/libempathy.types
index e056cc834..28706f44f 100644
--- a/docs/libempathy/libempathy.types
+++ b/docs/libempathy/libempathy.types
@@ -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
diff --git a/libempathy-gtk/empathy-chat-window.c b/libempathy-gtk/empathy-chat-window.c
index 5acddc1e6..444616039 100644
--- a/libempathy-gtk/empathy-chat-window.c
+++ b/libempathy-gtk/empathy-chat-window.c
@@ -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);
diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c
index bd5e9bc5e..7cabea78f 100644
--- a/libempathy-gtk/empathy-contact-list-store.c
+++ b/libempathy-gtk/empathy-contact-list-store.c
@@ -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:
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index a03571d9a..c290ef6a3 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -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);
diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c
index c64962afa..e543a5f1f 100644
--- a/libempathy-gtk/empathy-presence-chooser.c
+++ b/libempathy-gtk/empathy-presence-chooser.c
@@ -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);
}
diff --git a/libempathy-gtk/empathy-presence-chooser.h b/libempathy-gtk/empathy-presence-chooser.h
index 8a9349620..a04458d83 100644
--- a/libempathy-gtk/empathy-presence-chooser.h
+++ b/libempathy-gtk/empathy-presence-chooser.h
@@ -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 ())
diff --git a/libempathy-gtk/empathy-status-icon.c b/libempathy-gtk/empathy-status-icon.c
index 9e62a1e18..0cffeb1b4 100644
--- a/libempathy-gtk/empathy-status-icon.c
+++ b/libempathy-gtk/empathy-status-icon.c
@@ -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);
}
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index 22a5fc2f7..0b29232bc 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -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:
@@ -244,32 +244,15 @@ empathy_icon_name_for_presence_state (McPresence state)
}
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 *
diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h
index fd1f7c633..1fb29a97d 100644
--- a/libempathy-gtk/empathy-ui-utils.h
+++ b/libempathy-gtk/empathy-ui-utils.h
@@ -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);
diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am
index 285dff185..3c87db37c 100644
--- a/libempathy/Makefile.am
+++ b/libempathy/Makefile.am
@@ -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 \
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 76cab2a6e..70025c7b0 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -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,13 +128,22 @@ 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",
"Contact 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
diff --git a/libempathy/empathy-contact.h b/libempathy/empathy-contact.h
index b5a3c1ec9..57a72c906 100644
--- a/libempathy/empathy-contact.h
+++ b/libempathy/empathy-contact.h
@@ -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);
diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c
index 2f811a622..0f23037bd 100644
--- a/libempathy/empathy-idle.c
+++ b/libempathy/empathy-idle.c
@@ -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
index b7beb3900..000000000
--- a/libempathy/empathy-presence.c
+++ /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
index 940bf9ca6..000000000
--- a/libempathy/empathy-presence.h
+++ /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__ */
-
diff --git a/libempathy/empathy-status-presets.c b/libempathy/empathy-status-presets.c
index 54f7b629c..89b1874f3 100644
--- a/libempathy/empathy-status-presets.c
+++ b/libempathy/empathy-status-presets.c
@@ -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) {
diff --git a/libempathy/empathy-status-presets.h b/libempathy/empathy-status-presets.h
index 68f3cea56..06b6c7912 100644
--- a/libempathy/empathy-status-presets.h
+++ b/libempathy/empathy-status-presets.h
@@ -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
diff --git a/libempathy/empathy-tp-contact-factory.c b/libempathy/empathy-tp-contact-factory.c
index f71a91014..14d2640da 100644
--- a/libempathy/empathy-tp-contact-factory.c
+++ b/libempathy/empathy-tp-contact-factory.c
@@ -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)",
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index 4050f4673..c810f9cca 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -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;
+}
+
diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h
index 1f3700d22..875128c1e 100644
--- a/libempathy/empathy-utils.h
+++ b/libempathy/empathy-utils.h
@@ -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
diff --git a/python/README b/python/README
index f9c121b5f..127254381 100644
--- a/python/README
+++ b/python/README
@@ -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
index 000000000..497ec4fe7
--- /dev/null
+++ b/python/pyempathy.patch
@@ -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")
+ )
diff --git a/python/pyempathy/pyempathy.defs b/python/pyempathy/pyempathy.defs
index f6c7e0b80..7f7381fa7 100644
--- a/python/pyempathy/pyempathy.defs
+++ b/python/pyempathy/pyempathy.defs
@@ -77,13 +77,6 @@
(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")
@@ -602,7 +595,7 @@
(define-method get_presence
(of-object "EmpathyContact")
(c-name "empathy_contact_get_presence")
- (return-type "EmpathyPresence*")
+ (return-type "McPresence")
)
(define-method set_presence
@@ -610,7 +603,22 @@
(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")
)
)
@@ -1205,93 +1213,6 @@
-;; 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
@@ -2058,6 +1979,30 @@
)
)
+(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
diff --git a/python/pyempathy/pyempathy.override b/python/pyempathy/pyempathy.override
index a21700fca..7425972ea 100644
--- a/python/pyempathy/pyempathy.override
+++ b/python/pyempathy/pyempathy.override
@@ -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"
diff --git a/python/pyempathygtk/pyempathygtk.defs b/python/pyempathygtk/pyempathygtk.defs
index a8412437f..2a375786a 100644
--- a/python/pyempathygtk/pyempathygtk.defs
+++ b/python/pyempathygtk/pyempathygtk.defs
@@ -1349,6 +1349,15 @@
)
)
+(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")
@@ -1921,19 +1930,11 @@
)
)
-(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")
)
)