}
}
-static guint
-contact_list_store_ordered_presence (McPresence state)
-{
- switch (state) {
- case MC_PRESENCE_UNSET:
- case MC_PRESENCE_OFFLINE:
- return 5;
- case MC_PRESENCE_AVAILABLE:
- return 0;
- case MC_PRESENCE_AWAY:
- return 2;
- case MC_PRESENCE_EXTENDED_AWAY:
- return 3;
- case MC_PRESENCE_HIDDEN:
- return 4;
- case MC_PRESENCE_DO_NOT_DISTURB:
- return 1;
- default:
- g_return_val_if_reached (6);
- }
-}
-
static gint
contact_list_store_state_sort_func (GtkTreeModel *model,
GtkTreeIter *iter_a,
gchar *name_a, *name_b;
gboolean is_separator_a, is_separator_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,
/* If we managed to get this far, we can start looking at
* 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);
+ ret_val = tp_connection_presence_type_cmp_availability (
+ empathy_contact_get_presence (EMPATHY_CONTACT (contact_a)),
+ empathy_contact_get_presence (EMPATHY_CONTACT (contact_b)));
- if (presence_a < presence_b) {
- ret_val = -1;
- } else if (presence_a > presence_b) {
- ret_val = 1;
- } else {
+ if (ret_val == 0) {
/* Fallback: compare by name */
ret_val = g_utf8_collate (name_a, name_b);
}
#include <gdk/gdkkeysyms.h>
#include <telepathy-glib/util.h>
-#include <libmissioncontrol/mc-enum-types.h>
#include <libempathy/empathy-idle.h>
#include <libempathy/empathy-utils.h>
int block_changed;
guint focus_out_idle_source;
- McPresence state;
+ TpConnectionPresenceType state;
PresenceChooserEntryType previous_type;
- McPresence flash_state_1;
- McPresence flash_state_2;
+ TpConnectionPresenceType flash_state_1;
+ TpConnectionPresenceType flash_state_2;
guint flash_timeout_id;
} EmpathyPresenceChooserPriv;
/* States to be listed in the menu.
* Each state has a boolean telling if it can have custom message */
-static guint states[] = {MC_PRESENCE_AVAILABLE, TRUE,
- MC_PRESENCE_DO_NOT_DISTURB, TRUE,
- MC_PRESENCE_AWAY, TRUE,
- MC_PRESENCE_HIDDEN, FALSE,
- MC_PRESENCE_OFFLINE, FALSE};
+static struct { TpConnectionPresenceType state;
+ gboolean customisable;
+} states[] = { { TP_CONNECTION_PRESENCE_TYPE_AVAILABLE, TRUE } ,
+ { TP_CONNECTION_PRESENCE_TYPE_BUSY, TRUE },
+ { TP_CONNECTION_PRESENCE_TYPE_AWAY, TRUE },
+ { TP_CONNECTION_PRESENCE_TYPE_HIDDEN, FALSE },
+ { TP_CONNECTION_PRESENCE_TYPE_OFFLINE, FALSE},
+ { TP_CONNECTION_PRESENCE_TYPE_UNSET, },
+ };
static void presence_chooser_finalize (GObject *object);
static void presence_chooser_presence_changed_cb (EmpathyPresenceChooser *chooser);
static gboolean presence_chooser_flash_timeout_cb (EmpathyPresenceChooser *chooser);
static void presence_chooser_flash_start (EmpathyPresenceChooser *chooser,
- McPresence state_1,
- McPresence state_2);
+ TpConnectionPresenceType state_1,
+ TpConnectionPresenceType state_2);
static void presence_chooser_flash_stop (EmpathyPresenceChooser *chooser,
- McPresence state);
+ TpConnectionPresenceType state);
static void presence_chooser_menu_add_item (GtkWidget *menu,
const gchar *str,
- McPresence state);
+ TpConnectionPresenceType state);
static void presence_chooser_noncustom_activate_cb (GtkWidget *item,
gpointer user_data);
-static void presence_chooser_set_state (McPresence state,
+static void presence_chooser_set_state (TpConnectionPresenceType state,
const gchar *status);
static void presence_chooser_custom_activate_cb (GtkWidget *item,
gpointer user_data);
store = gtk_list_store_new (N_COLUMNS,
G_TYPE_STRING, /* COL_STATE_ICON_NAME */
- MC_TYPE_PRESENCE, /* COL_STATE */
+ G_TYPE_UINT, /* COL_STATE */
G_TYPE_STRING, /* COL_STATUS_TEXT */
G_TYPE_STRING, /* COL_DISPLAY_MARKUP */
G_TYPE_BOOLEAN, /* COL_STATUS_CUSTOMISABLE */
custom_message = g_strdup_printf ("<i>%s</i>", _("Custom Message..."));
- for (i = 0; i < G_N_ELEMENTS (states); i += 2) {
+ for (i = 0; states[i].state != TP_CONNECTION_PRESENCE_TYPE_UNSET; i++) {
GList *list, *l;
const char *status, *icon_name;
- status = empathy_presence_get_default_message (states[i]);
- icon_name = empathy_icon_name_for_presence (states[i]);
+ status = empathy_presence_get_default_message (states[i].state);
+ icon_name = empathy_icon_name_for_presence (states[i].state);
gtk_list_store_insert_with_values (store, NULL, -1,
COL_STATE_ICON_NAME, icon_name,
- COL_STATE, states[i],
+ COL_STATE, states[i].state,
COL_STATUS_TEXT, status,
COL_DISPLAY_MARKUP, status,
- COL_STATUS_CUSTOMISABLE, states[i+1],
+ COL_STATUS_CUSTOMISABLE, states[i].customisable,
COL_TYPE, ENTRY_TYPE_BUILTIN,
-1);
- if (states[i+1]) {
-
+ if (states[i].customisable) {
/* Set custom messages if wanted */
- list = empathy_status_presets_get (states[i], -1);
+ list = empathy_status_presets_get (states[i].state, -1);
list = g_list_sort (list, (GCompareFunc) g_utf8_collate);
for (l = list; l; l = l->next) {
gtk_list_store_insert_with_values (store,
presence_chooser_is_preset (EmpathyPresenceChooser *self)
{
EmpathyPresenceChooserPriv *priv = GET_PRIV (self);
- McPresence state;
+ TpConnectionPresenceType state;
const char *status;
GList *presets, *l;
gboolean match = FALSE;
/* update the status with MC */
status = gtk_entry_get_text (GTK_ENTRY (entry));
- DEBUG ("Sending state to MC-> %s (%s)\n",
- g_enum_get_value (g_type_class_peek (MC_TYPE_PRESENCE),
- priv->state)->value_name,
- status);
+ DEBUG ("Sending state to MC-> %d (%s)\n", priv->state, status);
empathy_idle_set_presence (priv->idle, priv->state, status);
}
static void
ui_set_custom_state (EmpathyPresenceChooser *self,
- McPresence state,
+ TpConnectionPresenceType state,
const char *status)
{
EmpathyPresenceChooserPriv *priv = GET_PRIV (self);
}
else {
PresenceChooserEntryType type;
- McPresence state;
+ TpConnectionPresenceType state;
const char *status;
type = presence_chooser_get_entry_type (self);
EmpathyPresenceChooserPriv *priv = GET_PRIV (self);
GtkTreeIter iter;
char *icon_name;
- McPresence new_state;
+ TpConnectionPresenceType new_state;
gboolean customisable = TRUE;
PresenceChooserEntryType type = -1;
GtkWidget *entry;
presence_chooser_presence_changed_cb (EmpathyPresenceChooser *chooser)
{
EmpathyPresenceChooserPriv *priv;
- McPresence state;
- McPresence flash_state;
+ TpConnectionPresenceType state;
+ TpConnectionPresenceType flash_state;
const gchar *status;
GtkTreeModel *model;
GtkTreeIter iter;
valid;
valid = gtk_tree_model_iter_next (model, &iter)) {
int m_type;
- McPresence m_state;
+ TpConnectionPresenceType m_state;
char *m_status;
gtk_tree_model_get (model, &iter,
ui_set_custom_state (chooser, state, status);
}
- if (flash_state != MC_PRESENCE_UNSET) {
+ if (flash_state != TP_CONNECTION_PRESENCE_TYPE_UNSET) {
presence_chooser_flash_start (chooser, state, flash_state);
}
else {
presence_chooser_flash_timeout_cb (EmpathyPresenceChooser *chooser)
{
EmpathyPresenceChooserPriv *priv;
- McPresence state;
+ TpConnectionPresenceType state;
static gboolean on = FALSE;
GtkWidget *entry;
static void
presence_chooser_flash_start (EmpathyPresenceChooser *chooser,
- McPresence state_1,
- McPresence state_2)
+ TpConnectionPresenceType state_1,
+ TpConnectionPresenceType state_2)
{
EmpathyPresenceChooserPriv *priv;
static void
presence_chooser_flash_stop (EmpathyPresenceChooser *chooser,
- McPresence state)
+ TpConnectionPresenceType state)
{
EmpathyPresenceChooserPriv *priv = GET_PRIV (chooser);
GtkWidget *entry;
menu = gtk_menu_new ();
- for (i = 0; i < G_N_ELEMENTS (states); i += 2) {
+ for (i = 0; states[i].state != TP_CONNECTION_PRESENCE_TYPE_UNSET; i++) {
GList *list, *l;
- status = empathy_presence_get_default_message (states[i]);
+ status = empathy_presence_get_default_message (states[i].state);
presence_chooser_menu_add_item (menu,
status,
- states[i]);
+ states[i].state);
- if (states[i+1]) {
+ if (states[i].customisable) {
/* Set custom messages if wanted */
- list = empathy_status_presets_get (states[i], 5);
+ list = empathy_status_presets_get (states[i].state, 5);
for (l = list; l; l = l->next) {
presence_chooser_menu_add_item (menu,
l->data,
- states[i]);
+ states[i].state);
}
g_list_free (list);
}
static void
presence_chooser_menu_add_item (GtkWidget *menu,
const gchar *str,
- McPresence state)
+ TpConnectionPresenceType state)
{
GtkWidget *item;
GtkWidget *image;
presence_chooser_noncustom_activate_cb (GtkWidget *item,
gpointer user_data)
{
- McPresence state;
+ TpConnectionPresenceType state;
const gchar *status;
status = g_object_get_data (G_OBJECT (item), "status");
}
static void
-presence_chooser_set_state (McPresence state,
+presence_chooser_set_state (TpConnectionPresenceType state,
const gchar *status)
{
EmpathyIdle *idle;
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
-#include <libmissioncontrol/mc-enum-types.h>
-
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-status-presets.h>
G_DEFINE_TYPE (EmpathyStatusPresetDialog, empathy_status_preset_dialog, GTK_TYPE_DIALOG);
-static McPresence states[] = {
- MC_PRESENCE_AVAILABLE,
- MC_PRESENCE_DO_NOT_DISTURB,
- MC_PRESENCE_AWAY
+static TpConnectionPresenceType states[] = {
+ TP_CONNECTION_PRESENCE_TYPE_AVAILABLE,
+ TP_CONNECTION_PRESENCE_TYPE_BUSY,
+ TP_CONNECTION_PRESENCE_TYPE_AWAY,
};
typedef struct _EmpathyStatusPresetDialogPriv EmpathyStatusPresetDialogPriv;
int i;
store = gtk_list_store_new (ADD_COMBO_N_COLS,
- MC_TYPE_PRESENCE, /* ADD_COMBO_STATE */
+ G_TYPE_UINT, /* ADD_COMBO_STATE */
G_TYPE_STRING, /* ADD_COMBO_ICON_NAME */
G_TYPE_STRING, /* ADD_COMBO_STATUS */
G_TYPE_STRING); /* ADD_COMBO_DEFAULT_TEXT */
GtkTreeModel *model;
GtkTreePath *path;
GtkTreeIter iter;
- McPresence state;
+ TpConnectionPresenceType state;
char *old_status;
gboolean valid;
GtkCellRenderer *renderer;
store = gtk_list_store_new (PRESETS_STORE_N_COLS,
- MC_TYPE_PRESENCE, /* PRESETS_STORE_STATE */
+ G_TYPE_UINT, /* PRESETS_STORE_STATE */
G_TYPE_STRING, /* PRESETS_STORE_ICON_NAME */
G_TYPE_STRING); /* PRESETS_STORE_STATUS */
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
- McPresence state;
+ TpConnectionPresenceType state;
char *status;
selection = gtk_tree_view_get_selection (
GtkTreeModel *model;
GtkTreeIter iter;
GtkWidget *entry;
- McPresence state, cstate;
+ TpConnectionPresenceType state, cstate;
const char *status;
char *cstatus;
gboolean valid, match = FALSE;
}
const gchar *
-empathy_icon_name_for_presence (McPresence presence)
+empathy_icon_name_for_presence (TpConnectionPresenceType presence)
{
switch (presence) {
- case MC_PRESENCE_AVAILABLE:
+ case TP_CONNECTION_PRESENCE_TYPE_AVAILABLE:
return EMPATHY_IMAGE_AVAILABLE;
- case MC_PRESENCE_DO_NOT_DISTURB:
+ case TP_CONNECTION_PRESENCE_TYPE_BUSY:
return EMPATHY_IMAGE_BUSY;
- case MC_PRESENCE_AWAY:
+ case TP_CONNECTION_PRESENCE_TYPE_AWAY:
return EMPATHY_IMAGE_AWAY;
- case MC_PRESENCE_EXTENDED_AWAY:
+ case TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY:
return EMPATHY_IMAGE_EXT_AWAY;
- case MC_PRESENCE_HIDDEN:
+ case TP_CONNECTION_PRESENCE_TYPE_HIDDEN:
return EMPATHY_IMAGE_HIDDEN;
- case MC_PRESENCE_OFFLINE:
- case MC_PRESENCE_UNSET:
+ case TP_CONNECTION_PRESENCE_TYPE_OFFLINE:
+ case TP_CONNECTION_PRESENCE_TYPE_ERROR:
+ case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN:
return EMPATHY_IMAGE_OFFLINE;
- default:
- g_assert_not_reached ();
+ case TP_CONNECTION_PRESENCE_TYPE_UNSET:
+ return NULL;
}
return NULL;
const gchar *
empathy_icon_name_for_contact (EmpathyContact *contact)
{
- McPresence presence;
+ TpConnectionPresenceType presence;
g_return_val_if_fail (EMPATHY_IS_CONTACT (contact),
EMPATHY_IMAGE_OFFLINE);
/* Pixbufs */
const gchar * empathy_icon_name_from_account (McAccount *account);
-const gchar * empathy_icon_name_for_presence (McPresence presence);
+const gchar * empathy_icon_name_for_presence (TpConnectionPresenceType presence);
const gchar * empathy_icon_name_for_contact (EmpathyContact *contact);
GdkPixbuf * empathy_pixbuf_from_data (gchar *data,
gsize data_size);
typedef struct {
TpConnection *connection;
- McPresence presence;
+ TpConnectionPresenceType presence;
TpConnectionStatus status;
gboolean is_enabled;
EmpathyAccountManager *manager)
{
ChangedSignalData *data;
+ TpConnectionPresenceType tp_presence;
+
+ switch (presence)
+ {
+ case MC_PRESENCE_OFFLINE:
+ tp_presence = TP_CONNECTION_PRESENCE_TYPE_OFFLINE;
+ break;
+ case MC_PRESENCE_AVAILABLE:
+ tp_presence = TP_CONNECTION_PRESENCE_TYPE_AVAILABLE;
+ break;
+ case MC_PRESENCE_AWAY:
+ tp_presence = TP_CONNECTION_PRESENCE_TYPE_AWAY;
+ break;
+ case MC_PRESENCE_EXTENDED_AWAY:
+ tp_presence = TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY;
+ break;
+ case MC_PRESENCE_HIDDEN:
+ tp_presence = TP_CONNECTION_PRESENCE_TYPE_HIDDEN;
+ break;
+ case MC_PRESENCE_DO_NOT_DISTURB:
+ tp_presence = TP_CONNECTION_PRESENCE_TYPE_BUSY;
+ break;
+ default:
+ tp_presence = TP_CONNECTION_PRESENCE_TYPE_UNSET;
+ }
data = g_slice_new0 (ChangedSignalData);
data->status = status;
- data->presence = presence;
+ data->presence = tp_presence;
data->reason = reason;
data->unique_name = g_strdup (unique_name);
data->manager = g_object_ref (manager);
#include "config.h"
#include <glib-object.h>
-#include <libmissioncontrol/mc-enum-types.h>
#include "empathy-contact-monitor.h"
#include "empathy-contact-list.h"
static void
contact_monitor_presence_changed_cb (EmpathyContact *contact,
- McPresence current_presence,
- McPresence previous_presence,
- EmpathyContactMonitor *self)
+ TpConnectionPresenceType current_presence,
+ TpConnectionPresenceType previous_presence,
+ EmpathyContactMonitor *self)
{
g_signal_emit (self, signals[CONTACT_PRESENCE_CHANGED], 0, contact,
current_presence, previous_presence);
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- _empathy_marshal_VOID__OBJECT_ENUM_ENUM,
+ _empathy_marshal_VOID__OBJECT_UINT_UINT,
G_TYPE_NONE,
3, EMPATHY_TYPE_CONTACT,
- MC_TYPE_PRESENCE,
- MC_TYPE_PRESENCE);
+ G_TYPE_UINT,
+ G_TYPE_UINT);
signals[CONTACT_PRESENCE_MESSAGE_CHANGED] =
g_signal_new ("contact-presence-message-changed",
G_TYPE_FROM_CLASS (klass),
#include <glib/gi18n-lib.h>
#include <telepathy-glib/util.h>
-#include <libmissioncontrol/mc-enum-types.h>
#include "empathy-contact.h"
#include "empathy-account-manager.h"
gchar *id;
gchar *name;
EmpathyAvatar *avatar;
- McPresence presence;
+ TpConnectionPresenceType presence;
gchar *presence_message;
guint handle;
EmpathyCapabilities capabilities;
if (!tp_strdiff (param->name, "alias"))
g_object_notify (contact, "name");
else if (!tp_strdiff (param->name, "presence-type")) {
- McPresence presence;
+ TpConnectionPresenceType presence;
presence = empathy_contact_get_presence (EMPATHY_CONTACT (contact));
- g_signal_emit (contact, signals[PRESENCE_CHANGED], 0, presence, priv->presence);
+ g_signal_emit (contact, signals[PRESENCE_CHANGED], 0, presence,
+ priv->presence);
priv->presence = presence;
g_object_notify (contact, "presence");
}
g_param_spec_uint ("presence",
"Contact presence",
"Presence of contact",
- MC_PRESENCE_UNSET,
- LAST_MC_PRESENCE,
- MC_PRESENCE_UNSET,
+ TP_CONNECTION_PRESENCE_TYPE_UNSET,
+ NUM_TP_CONNECTION_PRESENCE_TYPES,
+ TP_CONNECTION_PRESENCE_TYPE_UNSET,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- _empathy_marshal_VOID__ENUM_ENUM,
+ _empathy_marshal_VOID__UINT_UINT,
G_TYPE_NONE,
- 2, MC_TYPE_PRESENCE,
- MC_TYPE_PRESENCE);
+ 2, G_TYPE_UINT,
+ G_TYPE_UINT);
g_type_class_add_private (object_class, sizeof (EmpathyContactPriv));
}
return NULL;
}
-static McPresence
-presence_type_to_mc_presence (TpConnectionPresenceType type)
-{
- switch (type)
- {
- case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN:
- case TP_CONNECTION_PRESENCE_TYPE_ERROR:
- return MC_PRESENCE_UNSET;
- case TP_CONNECTION_PRESENCE_TYPE_OFFLINE:
- return MC_PRESENCE_OFFLINE;
- case TP_CONNECTION_PRESENCE_TYPE_UNSET:
- case TP_CONNECTION_PRESENCE_TYPE_AVAILABLE:
- return MC_PRESENCE_AVAILABLE;
- case TP_CONNECTION_PRESENCE_TYPE_AWAY:
- return MC_PRESENCE_AWAY;
- case TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY:
- return MC_PRESENCE_EXTENDED_AWAY;
- case TP_CONNECTION_PRESENCE_TYPE_HIDDEN:
- return MC_PRESENCE_HIDDEN;
- case TP_CONNECTION_PRESENCE_TYPE_BUSY:
- return MC_PRESENCE_DO_NOT_DISTURB;
- }
-
- return MC_PRESENCE_UNSET;
-}
-
-McPresence
+TpConnectionPresenceType
empathy_contact_get_presence (EmpathyContact *contact)
{
EmpathyContactPriv *priv;
- g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), MC_PRESENCE_UNSET);
+ g_return_val_if_fail (EMPATHY_IS_CONTACT (contact),
+ TP_CONNECTION_PRESENCE_TYPE_UNSET);
priv = GET_PRIV (contact);
if (priv->tp_contact != NULL)
- return presence_type_to_mc_presence (tp_contact_get_presence_type (
- priv->tp_contact));
+ return tp_contact_get_presence_type (priv->tp_contact);
return priv->presence;
}
void
empathy_contact_set_presence (EmpathyContact *contact,
- McPresence presence)
+ TpConnectionPresenceType presence)
{
EmpathyContactPriv *priv;
- McPresence old_presence;
+ TpConnectionPresenceType old_presence;
g_return_if_fail (EMPATHY_IS_CONTACT (contact));
{
g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), FALSE);
- return (empathy_contact_get_presence (contact) > MC_PRESENCE_OFFLINE);
+ switch (empathy_contact_get_presence(contact))
+ {
+ case TP_CONNECTION_PRESENCE_TYPE_OFFLINE:
+ case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN:
+ case TP_CONNECTION_PRESENCE_TYPE_ERROR:
+ return FALSE;
+ default:
+ return TRUE;
+ }
}
const gchar *
EmpathyAvatar *avatar);
McAccount * empathy_contact_get_account (EmpathyContact *contact);
TpConnection * empathy_contact_get_connection (EmpathyContact *contact);
-McPresence empathy_contact_get_presence (EmpathyContact *contact);
+TpConnectionPresenceType empathy_contact_get_presence (EmpathyContact *contact);
void empathy_contact_set_presence (EmpathyContact *contact,
- McPresence presence);
+ TpConnectionPresenceType presence);
const gchar * empathy_contact_get_presence_message (EmpathyContact *contact);
void empathy_contact_set_presence_message (EmpathyContact *contact,
const gchar *message);
DBusGProxy *gs_proxy;
DBusGProxy *nm_proxy;
- McPresence state;
+ TpConnectionPresenceType state;
gchar *status;
- McPresence flash_state;
+ TpConnectionPresenceType flash_state;
gboolean auto_away;
gboolean use_nm;
- McPresence away_saved_state;
- McPresence nm_saved_state;
+ TpConnectionPresenceType away_saved_state;
+ TpConnectionPresenceType nm_saved_state;
gchar *nm_saved_status;
gboolean is_idle;
static void
idle_presence_changed_cb (MissionControl *mc,
- McPresence state,
+ TpConnectionPresenceType state,
gchar *status,
EmpathyIdle *idle)
{
priv = GET_PRIV (idle);
DEBUG ("Going to extended autoaway");
- empathy_idle_set_state (idle, MC_PRESENCE_EXTENDED_AWAY);
+ empathy_idle_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY);
priv->ext_away_timeout = 0;
return FALSE;
is_idle ? "yes" : "no");
if (!priv->auto_away ||
- (priv->nm_saved_state == MC_PRESENCE_UNSET &&
- (priv->state <= MC_PRESENCE_OFFLINE ||
- priv->state == MC_PRESENCE_HIDDEN))) {
+ (priv->nm_saved_state == TP_CONNECTION_PRESENCE_TYPE_UNSET &&
+ (priv->state <= TP_CONNECTION_PRESENCE_TYPE_OFFLINE ||
+ priv->state == TP_CONNECTION_PRESENCE_TYPE_HIDDEN))) {
/* We don't want to go auto away OR we explicitely asked to be
* offline, nothing to do here */
priv->is_idle = is_idle;
}
if (is_idle && !priv->is_idle) {
- McPresence new_state;
+ TpConnectionPresenceType new_state;
/* We are now idle */
idle_ext_away_start (idle);
- if (priv->nm_saved_state != MC_PRESENCE_UNSET) {
+ if (priv->nm_saved_state != TP_CONNECTION_PRESENCE_TYPE_UNSET) {
/* We are disconnected, when coming back from away
* we want to restore the presence before the
* disconnection. */
priv->away_saved_state = priv->state;
}
- new_state = MC_PRESENCE_AWAY;
- if (priv->state == MC_PRESENCE_EXTENDED_AWAY) {
- new_state = MC_PRESENCE_EXTENDED_AWAY;
+ new_state = TP_CONNECTION_PRESENCE_TYPE_AWAY;
+ if (priv->state == TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY) {
+ new_state = TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY;
}
DEBUG ("Going to autoaway. Saved state=%d, new state=%d",
idle_ext_away_stop (idle);
- if (priv->away_saved_state == MC_PRESENCE_AWAY ||
- priv->away_saved_state == MC_PRESENCE_EXTENDED_AWAY) {
- priv->away_saved_state = MC_PRESENCE_AVAILABLE;
+ if (priv->away_saved_state == TP_CONNECTION_PRESENCE_TYPE_AWAY ||
+ priv->away_saved_state == TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY) {
+ priv->away_saved_state = TP_CONNECTION_PRESENCE_TYPE_AVAILABLE;
new_status = NULL;
} else {
new_status = priv->status;
priv->away_saved_state,
new_status);
- priv->away_saved_state = MC_PRESENCE_UNSET;
+ priv->away_saved_state = TP_CONNECTION_PRESENCE_TYPE_UNSET;
}
priv->is_idle = is_idle;
priv->nm_saved_state = priv->state;
g_free (priv->nm_saved_status);
priv->nm_saved_status = g_strdup (priv->status);
- empathy_idle_set_state (idle, MC_PRESENCE_OFFLINE);
+ empathy_idle_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_OFFLINE);
}
else if (!old_nm_connected && new_nm_connected) {
/* We are now connected */
empathy_idle_set_presence (idle,
priv->nm_saved_state,
priv->nm_saved_status);
- priv->nm_saved_state = MC_PRESENCE_UNSET;
+ priv->nm_saved_state = TP_CONNECTION_PRESENCE_TYPE_UNSET;
g_free (priv->nm_saved_status);
priv->nm_saved_status = NULL;
}
g_object_class_install_property (object_class,
PROP_STATE,
- g_param_spec_enum ("state",
+ g_param_spec_uint ("state",
"state",
"state",
- MC_TYPE_PRESENCE,
- MC_PRESENCE_AVAILABLE,
+ 0, NUM_TP_CONNECTION_PRESENCE_TYPES,
+ TP_CONNECTION_PRESENCE_TYPE_UNSET,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_STATUS,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_FLASH_STATE,
- g_param_spec_enum ("flash-state",
+ g_param_spec_uint ("flash-state",
"flash-state",
"flash-state",
- MC_TYPE_PRESENCE,
- MC_PRESENCE_UNSET,
+ 0, NUM_TP_CONNECTION_PRESENCE_TYPES,
+ TP_CONNECTION_PRESENCE_TYPE_UNSET,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
g_type_class_add_private (object_class, sizeof (EmpathyIdlePriv));
}
+static TpConnectionPresenceType
+empathy_idle_get_actual_presence (EmpathyIdle *idle, GError **error)
+{
+ McPresence presence;
+ EmpathyIdlePriv *priv = GET_PRIV (idle);
+
+ presence = mission_control_get_presence_actual (priv->mc, error);
+
+ switch (presence) {
+ case MC_PRESENCE_OFFLINE:
+ return TP_CONNECTION_PRESENCE_TYPE_OFFLINE;
+ case MC_PRESENCE_AVAILABLE:
+ return TP_CONNECTION_PRESENCE_TYPE_AVAILABLE;
+ case MC_PRESENCE_AWAY:
+ return TP_CONNECTION_PRESENCE_TYPE_AWAY;
+ case MC_PRESENCE_EXTENDED_AWAY:
+ return TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY;
+ case MC_PRESENCE_HIDDEN:
+ return TP_CONNECTION_PRESENCE_TYPE_HIDDEN;
+ case MC_PRESENCE_DO_NOT_DISTURB:
+ return TP_CONNECTION_PRESENCE_TYPE_BUSY;
+ default:
+ return TP_CONNECTION_PRESENCE_TYPE_UNSET;
+ }
+}
+
static void
empathy_idle_init (EmpathyIdle *idle)
{
idle->priv = priv;
priv->is_idle = FALSE;
priv->mc = empathy_mission_control_dup_singleton ();
- priv->state = mission_control_get_presence_actual (priv->mc, &error);
+ priv->state = empathy_idle_get_actual_presence (idle, &error);
if (error) {
DEBUG ("Error getting actual presence: %s", error->message);
- priv->state = MC_PRESENCE_UNSET;
+ priv->state = TP_CONNECTION_PRESENCE_TYPE_UNSET;
g_clear_error (&error);
}
priv->status = mission_control_get_presence_message_actual (priv->mc, &error);
return g_object_new (EMPATHY_TYPE_IDLE, NULL);
}
-McPresence
+TpConnectionPresenceType
empathy_idle_get_state (EmpathyIdle *idle)
{
EmpathyIdlePriv *priv;
void
empathy_idle_set_state (EmpathyIdle *idle,
- McPresence state)
+ TpConnectionPresenceType state)
{
EmpathyIdlePriv *priv;
empathy_idle_set_presence (idle, priv->state, status);
}
-McPresence
+TpConnectionPresenceType
empathy_idle_get_flash_state (EmpathyIdle *idle)
{
EmpathyIdlePriv *priv;
void
empathy_idle_set_flash_state (EmpathyIdle *idle,
- McPresence state)
+ TpConnectionPresenceType state)
{
EmpathyIdlePriv *priv;
priv->flash_state = state;
- if (state == MC_PRESENCE_UNSET) {
+ if (state == TP_CONNECTION_PRESENCE_TYPE_UNSET) {
}
g_object_notify (G_OBJECT (idle), "flash-state");
}
+static void
+empathy_idle_do_set_presence (EmpathyIdle *idle,
+ TpConnectionPresenceType state,
+ const gchar *status)
+{
+ McPresence mc_state = MC_PRESENCE_UNSET;
+ EmpathyIdlePriv *priv = GET_PRIV (idle);
+
+ switch (state) {
+ case TP_CONNECTION_PRESENCE_TYPE_OFFLINE:
+ mc_state = MC_PRESENCE_OFFLINE;
+ break;
+ case TP_CONNECTION_PRESENCE_TYPE_AVAILABLE:
+ mc_state = MC_PRESENCE_AVAILABLE;
+ break;
+ case TP_CONNECTION_PRESENCE_TYPE_AWAY:
+ mc_state = MC_PRESENCE_AWAY;
+ break;
+ case TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY:
+ mc_state = MC_PRESENCE_EXTENDED_AWAY;
+ break;
+ case TP_CONNECTION_PRESENCE_TYPE_HIDDEN:
+ mc_state = MC_PRESENCE_HIDDEN;
+ break;
+ case TP_CONNECTION_PRESENCE_TYPE_BUSY:
+ mc_state = MC_PRESENCE_DO_NOT_DISTURB;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ mission_control_set_presence (priv->mc, mc_state, status, NULL, NULL);
+}
+
void
empathy_idle_set_presence (EmpathyIdle *idle,
- McPresence state,
+ TpConnectionPresenceType state,
const gchar *status)
{
EmpathyIdlePriv *priv;
return;
}
- mission_control_set_presence (priv->mc, state, status, NULL, NULL);
+ empathy_idle_do_set_presence (idle, state, status);
}
gboolean
idle_nm_state_change_cb (priv->nm_proxy, nm_status, idle);
} else {
priv->nm_connected = TRUE;
- if (priv->nm_saved_state != MC_PRESENCE_UNSET) {
+ if (priv->nm_saved_state != TP_CONNECTION_PRESENCE_TYPE_UNSET) {
empathy_idle_set_state (idle, priv->nm_saved_state);
}
- priv->nm_saved_state = MC_PRESENCE_UNSET;
+ priv->nm_saved_state = TP_CONNECTION_PRESENCE_TYPE_UNSET;
}
g_object_notify (G_OBJECT (idle), "use-nm");
GType empathy_idle_get_type (void) G_GNUC_CONST;
EmpathyIdle *empathy_idle_dup_singleton (void);
-McPresence empathy_idle_get_state (EmpathyIdle *idle);
+TpConnectionPresenceType empathy_idle_get_state (EmpathyIdle *idle);
void empathy_idle_set_state (EmpathyIdle *idle,
- McPresence state);
+ TpConnectionPresenceType state);
const gchar *empathy_idle_get_status (EmpathyIdle *idle);
void empathy_idle_set_status (EmpathyIdle *idle,
const gchar *status);
-McPresence empathy_idle_get_flash_state (EmpathyIdle *idle);
+TpConnectionPresenceType empathy_idle_get_flash_state (EmpathyIdle *idle);
void empathy_idle_set_flash_state (EmpathyIdle *idle,
- McPresence state);
+ TpConnectionPresenceType state);
void empathy_idle_set_presence (EmpathyIdle *idle,
- McPresence state,
+ TpConnectionPresenceType state,
const gchar *status);
gboolean empathy_idle_get_auto_away (EmpathyIdle *idle);
void empathy_idle_set_auto_away (EmpathyIdle *idle,
typedef struct {
gchar *status;
- McPresence state;
+ TpConnectionPresenceType state;
} StatusPreset;
-static StatusPreset *status_preset_new (McPresence state,
+static StatusPreset *status_preset_new (TpConnectionPresenceType state,
const gchar *status);
static void status_preset_free (StatusPreset *status);
static void status_presets_file_parse (const gchar *filename);
-const gchar * status_presets_get_state_as_str (McPresence state);
+const gchar * status_presets_get_state_as_str (TpConnectionPresenceType state);
static gboolean status_presets_file_save (void);
-static void status_presets_set_default (McPresence state,
+static void status_presets_set_default (TpConnectionPresenceType state,
const gchar *status);
static GList *presets = NULL;
static StatusPreset *default_preset = NULL;
static StatusPreset *
-status_preset_new (McPresence state,
+status_preset_new (TpConnectionPresenceType state,
const gchar *status)
{
StatusPreset *preset;
while (node) {
if (strcmp ((gchar *) node->name, "status") == 0 ||
strcmp ((gchar *) node->name, "default") == 0) {
- McPresence state;
+ TpConnectionPresenceType state;
gchar *status;
gchar *state_str;
StatusPreset *preset;
/* Use the default if not set */
if (!default_preset) {
- status_presets_set_default (MC_PRESENCE_OFFLINE, NULL);
+ status_presets_set_default (TP_CONNECTION_PRESENCE_TYPE_OFFLINE, NULL);
}
DEBUG ("Parsed %d status presets", g_list_length (presets));
GList *l;
gchar *dir;
gchar *file;
- gint count[LAST_MC_PRESENCE];
+ gint count[NUM_TP_CONNECTION_PRESENCE_TYPES];
gint i;
- for (i = 0; i < LAST_MC_PRESENCE; i++) {
+ for (i = 0; i < NUM_TP_CONNECTION_PRESENCE_TYPES; i++) {
count[i] = 0;
}
}
GList *
-empathy_status_presets_get (McPresence state,
+empathy_status_presets_get (TpConnectionPresenceType state,
gint max_number)
{
GList *list = NULL;
}
void
-empathy_status_presets_set_last (McPresence state,
+empathy_status_presets_set_last (TpConnectionPresenceType state,
const gchar *status)
{
GList *l;
}
void
-empathy_status_presets_remove (McPresence state,
+empathy_status_presets_remove (TpConnectionPresenceType state,
const gchar *status)
{
StatusPreset *preset;
presets = NULL;
- status_presets_set_default (MC_PRESENCE_AVAILABLE, NULL);
+ status_presets_set_default (TP_CONNECTION_PRESENCE_TYPE_AVAILABLE, NULL);
status_presets_file_save ();
}
-McPresence
+TpConnectionPresenceType
empathy_status_presets_get_default_state (void)
{
if (!default_preset) {
- return MC_PRESENCE_OFFLINE;
+ return TP_CONNECTION_PRESENCE_TYPE_OFFLINE;
}
return default_preset->state;
}
static void
-status_presets_set_default (McPresence state,
+status_presets_set_default (TpConnectionPresenceType state,
const gchar *status)
{
if (default_preset) {
}
void
-empathy_status_presets_set_default (McPresence state,
+empathy_status_presets_set_default (TpConnectionPresenceType state,
const gchar *status)
{
status_presets_set_default (state, status);
#ifndef __EMPATHY_STATUS_PRESETS_H__
#define __EMPATHY_STATUS_PRESETS_H__
-#include <libmissioncontrol/mission-control.h>
+#include <telepathy-glib/enums.h>
G_BEGIN_DECLS
void empathy_status_presets_get_all (void);
-GList * empathy_status_presets_get (McPresence state,
+GList * empathy_status_presets_get (TpConnectionPresenceType state,
gint max_number);
-void empathy_status_presets_set_last (McPresence state,
+void empathy_status_presets_set_last (TpConnectionPresenceType state,
const gchar *status);
-void empathy_status_presets_remove (McPresence state,
+void empathy_status_presets_remove (TpConnectionPresenceType state,
const gchar *status);
void empathy_status_presets_reset (void);
-McPresence empathy_status_presets_get_default_state (void);
+TpConnectionPresenceType empathy_status_presets_get_default_state (void);
const gchar * empathy_status_presets_get_default_status (void);
-void empathy_status_presets_set_default (McPresence state,
+void empathy_status_presets_set_default (TpConnectionPresenceType state,
const gchar *status);
void empathy_status_presets_clear_default (void);
#include <telepathy-glib/connection.h>
#include <telepathy-glib/channel.h>
#include <telepathy-glib/dbus.h>
+#include <telepathy-glib/util.h>
#include "empathy-utils.h"
#include "empathy-contact-manager.h"
#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
#include "empathy-debug.h"
+/* Translation between presence types and string */
+static struct {
+ gchar *name;
+ TpConnectionPresenceType type;
+} presence_types[] = {
+ { "available", TP_CONNECTION_PRESENCE_TYPE_AVAILABLE },
+ { "busy", TP_CONNECTION_PRESENCE_TYPE_BUSY },
+ { "away", TP_CONNECTION_PRESENCE_TYPE_AWAY },
+ { "ext_away", TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY },
+ { "hidden", TP_CONNECTION_PRESENCE_TYPE_HIDDEN },
+ { "offline", TP_CONNECTION_PRESENCE_TYPE_OFFLINE },
+ { "unset", TP_CONNECTION_PRESENCE_TYPE_UNSET },
+ { "unknown", TP_CONNECTION_PRESENCE_TYPE_UNKNOWN },
+ { "error", TP_CONNECTION_PRESENCE_TYPE_ERROR },
+ /* alternative names */
+ { "dnd", TP_CONNECTION_PRESENCE_TYPE_BUSY },
+ { "brb", TP_CONNECTION_PRESENCE_TYPE_AWAY },
+ { "xa", TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY },
+ { NULL, },
+};
+
+
void
empathy_init (void)
}
const gchar *
-empathy_presence_get_default_message (McPresence presence)
+empathy_presence_get_default_message (TpConnectionPresenceType presence)
{
switch (presence) {
- case MC_PRESENCE_AVAILABLE:
+ case TP_CONNECTION_PRESENCE_TYPE_AVAILABLE:
return _("Available");
- case MC_PRESENCE_DO_NOT_DISTURB:
+ case TP_CONNECTION_PRESENCE_TYPE_BUSY:
return _("Busy");
- case MC_PRESENCE_AWAY:
- case MC_PRESENCE_EXTENDED_AWAY:
+ case TP_CONNECTION_PRESENCE_TYPE_AWAY:
+ case TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY:
return _("Away");
- case MC_PRESENCE_HIDDEN:
+ case TP_CONNECTION_PRESENCE_TYPE_HIDDEN:
return _("Hidden");
- case MC_PRESENCE_OFFLINE:
- case MC_PRESENCE_UNSET:
+ case TP_CONNECTION_PRESENCE_TYPE_OFFLINE:
return _("Offline");
- default:
- g_assert_not_reached ();
+ case TP_CONNECTION_PRESENCE_TYPE_UNSET:
+ case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN:
+ case TP_CONNECTION_PRESENCE_TYPE_ERROR:
+ return NULL;
}
return NULL;
}
const gchar *
-empathy_presence_to_str (McPresence presence)
+empathy_presence_to_str (TpConnectionPresenceType 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 ();
- }
+ int i;
+
+ for (i = 0 ; presence_types[i].name != NULL; i++)
+ if (presence == presence_types[i].type)
+ return presence_types[i].name;
return NULL;
}
-McPresence
+TpConnectionPresenceType
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;
- }
+ int i;
+
+ for (i = 0 ; presence_types[i].name != NULL; i++)
+ if (!tp_strdiff (str, presence_types[i].name))
+ return presence_types[i].type;
- return MC_PRESENCE_UNSET;
+ return TP_CONNECTION_PRESENCE_TYPE_UNSET;
}
gchar *
gboolean
empathy_check_available_state (void)
{
- McPresence presence;
+ TpConnectionPresenceType presence;
EmpathyIdle *idle;
idle = empathy_idle_dup_singleton ();
presence = empathy_idle_get_state (idle);
g_object_unref (idle);
- if (presence != MC_PRESENCE_AVAILABLE &&
- presence != MC_PRESENCE_UNSET) {
+ if (presence != TP_CONNECTION_PRESENCE_TYPE_AVAILABLE &&
+ presence != TP_CONNECTION_PRESENCE_TYPE_UNSET) {
return FALSE;
}
gboolean empathy_account_equal (gconstpointer a,
gconstpointer b);
MissionControl *empathy_mission_control_dup_singleton (void);
-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);
+const gchar * empathy_presence_get_default_message (TpConnectionPresenceType presence);
+const gchar * empathy_presence_to_str (TpConnectionPresenceType presence);
+TpConnectionPresenceType empathy_presence_from_str (const gchar *str);
gchar * empathy_file_lookup (const gchar *filename,
const gchar *subdir);
gboolean empathy_proxy_equal (gconstpointer a,
(define-method get_presence
(of-object "EmpathyContact")
(c-name "empathy_contact_get_presence")
- (return-type "McPresence")
+ (return-type "TpConnectionPresenceType")
)
(define-method set_presence
(c-name "empathy_contact_set_presence")
(return-type "none")
(parameters
- '("McPresence" "presence")
+ '("TpConnectionPresenceType" "presence")
)
)
(define-method get_state
(of-object "EmpathyIdle")
(c-name "empathy_idle_get_state")
- (return-type "McPresence")
+ (return-type "TpConnectionPresenceType")
)
(define-method set_state
(c-name "empathy_idle_set_state")
(return-type "none")
(parameters
- '("McPresence" "state")
+ '("TpConnectionPresenceType" "state")
)
)
(define-method get_flash_state
(of-object "EmpathyIdle")
(c-name "empathy_idle_get_flash_state")
- (return-type "McPresence")
+ (return-type "TpConnectionPresenceType")
)
(define-method set_flash_state
(c-name "empathy_idle_set_flash_state")
(return-type "none")
(parameters
- '("McPresence" "state")
+ '("TpConnectionPresenceType" "state")
)
)
(c-name "empathy_idle_set_presence")
(return-type "none")
(parameters
- '("McPresence" "state")
+ '("TpConnectionPresenceType" "state")
'("const-gchar*" "status")
)
)
(c-name "empathy_status_presets_get")
(return-type "GList*")
(parameters
- '("McPresence" "state")
+ '("TpConnectionPresenceType" "state")
'("gint" "max_number")
)
)
(c-name "empathy_status_presets_set_last")
(return-type "none")
(parameters
- '("McPresence" "state")
+ '("TpConnectionPresenceType" "state")
'("const-gchar*" "status")
)
)
(c-name "empathy_status_presets_remove")
(return-type "none")
(parameters
- '("McPresence" "state")
+ '("TpConnectionPresenceType" "state")
'("const-gchar*" "status")
)
)
(define-function status_presets_get_default_state
(c-name "empathy_status_presets_get_default_state")
- (return-type "McPresence")
+ (return-type "TpConnectionPresenceType")
)
(define-function status_presets_get_default_status
(c-name "empathy_status_presets_set_default")
(return-type "none")
(parameters
- '("McPresence" "state")
+ '("TpConnectionPresenceType" "state")
'("const-gchar*" "status")
)
)
)
)
+(define-function time_to_string_relative
+ (c-name "empathy_time_to_string_relative")
+ (return-type "gchar*")
+ (parameters
+ '("time_t" "t")
+ )
+)
+
;; From empathy-tp-call.h
(c-name "empathy_presence_get_default_message")
(return-type "const-gchar*")
(parameters
- '("McPresence" "presence")
+ '("TpConnectionPresenceType" "presence")
)
)
(c-name "empathy_presence_to_str")
(return-type "const-gchar*")
(parameters
- '("McPresence" "presence")
+ '("TpConnectionPresenceType" "presence")
)
)
(define-function presence_from_str
(c-name "empathy_presence_from_str")
- (return-type "McPresence")
+ (return-type "TpConnectionPresenceType")
(parameters
'("const-gchar*" "str")
)
'("edit-id" "EMPATHY_CONTACT_WIDGET_EDIT_ID")
'("edit-groups" "EMPATHY_CONTACT_WIDGET_EDIT_GROUPS")
'("for-tooltip" "EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP")
+ '("show-location" "EMPATHY_CONTACT_WIDGET_SHOW_LOCATION")
)
)
)
)
+(define-function account_widget_set_default_focus
+ (c-name "empathy_account_widget_set_default_focus")
+ (return-type "none")
+ (parameters
+ '("GtkBuilder*" "gui")
+ '("const-gchar*" "entry")
+ )
+)
+
(define-function account_widget_generic_new
(c-name "empathy_account_widget_generic_new")
(is-constructor-of "EmpathyAccountWidgetGeneric")
(c-name "empathy_icon_name_for_presence")
(return-type "const-gchar*")
(parameters
- '("McPresence" "presence")
+ '("TpConnectionPresenceType" "presence")
)
)
static void
main_window_contact_presence_changed_cb (EmpathyContactMonitor *monitor,
EmpathyContact *contact,
- McPresence current,
- McPresence previous,
+ TpConnectionPresenceType current,
+ TpConnectionPresenceType previous,
EmpathyMainWindow *window)
{
McAccount *account;
return;
}
- if (previous < MC_PRESENCE_AVAILABLE && current > MC_PRESENCE_OFFLINE) {
- /* someone is logging in */
- empathy_sound_play (GTK_WIDGET (window->window),
- EMPATHY_SOUND_CONTACT_CONNECTED);
- return;
- }
-
- if (previous > MC_PRESENCE_OFFLINE && current < MC_PRESENCE_AVAILABLE) {
- /* someone is logging off */
- empathy_sound_play (GTK_WIDGET (window->window),
- EMPATHY_SOUND_CONTACT_DISCONNECTED);
- }
+ if (tp_connection_presence_type_cmp_availability (previous,
+ TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0)
+ {
+ /* contact was online */
+ if (tp_connection_presence_type_cmp_availability (current,
+ TP_CONNECTION_PRESENCE_TYPE_OFFLINE) <= 0)
+ /* someone is logging off */
+ empathy_sound_play (GTK_WIDGET (window->window),
+ EMPATHY_SOUND_CONTACT_DISCONNECTED);
+ }
+ else
+ {
+ /* contact was offline */
+ if (tp_connection_presence_type_cmp_availability (current,
+ TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0)
+ /* someone is logging in */
+ empathy_sound_play (GTK_WIDGET (window->window),
+ EMPATHY_SOUND_CONTACT_CONNECTED);
+ }
}
static void
if (priv->event && priv->showing_event_icon) {
icon_name = priv->event->icon_name;
} else {
- McPresence state;
+ TpConnectionPresenceType state;
state = empathy_idle_get_state (priv->idle);
icon_name = empathy_icon_name_for_presence (state);
EMPATHY_PREFS_AUTOCONNECT,
&autoconnect);
if (autoconnect && ! no_connect &&
- empathy_idle_get_state (idle) <= MC_PRESENCE_OFFLINE) {
+ tp_connection_presence_type_cmp_availability (empathy_idle_get_state
+ (idle), TP_CONNECTION_PRESENCE_TYPE_OFFLINE) <= 0) {
empathy_idle_set_state (idle, MC_PRESENCE_AVAILABLE);
}
gtk_main ();
- empathy_idle_set_state (idle, MC_PRESENCE_OFFLINE);
+ empathy_idle_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_OFFLINE);
g_object_unref (mc);
g_object_unref (idle);