aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy-gtk/empathy-presence-chooser.c22
-rw-r--r--libempathy-gtk/empathy-ui-utils.c1
-rw-r--r--libempathy/Makefile.am4
-rw-r--r--libempathy/empathy-account-settings.c11
-rw-r--r--libempathy/empathy-idle.h74
-rw-r--r--libempathy/empathy-presence-manager.c (renamed from libempathy/empathy-idle.c)151
-rw-r--r--libempathy/empathy-presence-manager.h74
-rw-r--r--libempathy/empathy-utils.c10
-rw-r--r--src/empathy-chat.c8
-rw-r--r--src/empathy-event-manager.c10
-rw-r--r--src/empathy-main-window.c1
-rw-r--r--src/empathy.c26
12 files changed, 197 insertions, 195 deletions
diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c
index 33bf02811..2c8a3c871 100644
--- a/libempathy-gtk/empathy-presence-chooser.c
+++ b/libempathy-gtk/empathy-presence-chooser.c
@@ -37,7 +37,7 @@
#include <telepathy-glib/util.h>
#include <libempathy/empathy-connectivity.h>
-#include <libempathy/empathy-idle.h>
+#include <libempathy/empathy-presence-manager.h>
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-status-presets.h>
@@ -99,7 +99,7 @@ typedef enum {
} PresenceChooserEntryType;
typedef struct {
- EmpathyIdle *idle;
+ EmpathyPresenceManager *presence_mgr;
EmpathyConnectivity *connectivity;
gboolean editing_status;
@@ -433,7 +433,7 @@ mc_set_custom_state (EmpathyPresenceChooser *self)
DEBUG ("Sending state to MC-> %d (%s)", priv->state, status);
- empathy_idle_set_presence (priv->idle, priv->state, status);
+ empathy_presence_manager_set_presence (priv->presence_mgr, priv->state, status);
}
static void
@@ -664,7 +664,7 @@ presence_chooser_changed_cb (GtkComboBox *self, gpointer user_data)
COL_STATUS_TEXT, &status,
-1);
- empathy_idle_set_presence (priv->idle, priv->state, status);
+ empathy_presence_manager_set_presence (priv->presence_mgr, priv->state, status);
g_free (status);
}
@@ -922,7 +922,7 @@ presence_chooser_constructed (GObject *object)
G_CALLBACK (presence_chooser_entry_focus_out_cb),
chooser);
- priv->idle = empathy_idle_dup_singleton ();
+ priv->presence_mgr = empathy_presence_manager_dup_singleton ();
priv->account_manager = tp_account_manager_dup ();
g_signal_connect_swapped (priv->account_manager,
@@ -970,10 +970,10 @@ presence_chooser_finalize (GObject *object)
if (priv->account_manager != NULL)
g_object_unref (priv->account_manager);
- g_signal_handlers_disconnect_by_func (priv->idle,
+ g_signal_handlers_disconnect_by_func (priv->presence_mgr,
presence_chooser_presence_changed_cb,
object);
- g_object_unref (priv->idle);
+ g_object_unref (priv->presence_mgr);
g_object_unref (priv->connectivity);
if (priv->not_favorite_pixbuf != NULL)
@@ -1197,11 +1197,11 @@ static void
presence_chooser_set_state (TpConnectionPresenceType state,
const gchar *status)
{
- EmpathyIdle *idle;
+ EmpathyPresenceManager *presence_mgr;
- idle = empathy_idle_dup_singleton ();
- empathy_idle_set_presence (idle, state, status);
- g_object_unref (idle);
+ presence_mgr = empathy_presence_manager_dup_singleton ();
+ empathy_presence_manager_set_presence (presence_mgr, state, status);
+ g_object_unref (presence_mgr);
}
static void
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index e2946e513..ca63a0c2c 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -50,7 +50,6 @@
#include <libempathy/empathy-debug.h>
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-dispatcher.h>
-#include <libempathy/empathy-idle.h>
#include <libempathy/empathy-ft-factory.h>
void
diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am
index ef85581b1..25153eab8 100644
--- a/libempathy/Makefile.am
+++ b/libempathy/Makefile.am
@@ -43,7 +43,7 @@ libempathy_headers = \
empathy-ft-factory.h \
empathy-ft-handler.h \
empathy-gsettings.h \
- empathy-idle.h \
+ empathy-presence-manager.h \
empathy-individual-manager.h \
empathy-irc-network-manager.h \
empathy-irc-network.h \
@@ -84,7 +84,7 @@ libempathy_la_SOURCES = \
empathy-dispatcher.c \
empathy-ft-factory.c \
empathy-ft-handler.c \
- empathy-idle.c \
+ empathy-presence-manager.c \
empathy-individual-manager.c \
empathy-irc-network-manager.c \
empathy-irc-network.c \
diff --git a/libempathy/empathy-account-settings.c b/libempathy/empathy-account-settings.c
index a90aaa8f4..8c673dfcf 100644
--- a/libempathy/empathy-account-settings.c
+++ b/libempathy/empathy-account-settings.c
@@ -31,7 +31,7 @@
#include "empathy-connection-managers.h"
#include "empathy-keyring.h"
#include "empathy-utils.h"
-#include "empathy-idle.h"
+#include "empathy-presence-manager.h"
#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
#include <libempathy/empathy-debug.h>
@@ -1499,13 +1499,14 @@ empathy_account_settings_do_create_account (EmpathyAccountSettings *settings)
TpConnectionPresenceType type;
gchar *status;
gchar *message;
- EmpathyIdle *idle;
+ EmpathyPresenceManager *presence_mgr;
properties = tp_asv_new (NULL, NULL);
- idle = empathy_idle_dup_singleton ();
- type = empathy_idle_get_requested_presence (idle, &status, &message);
- g_object_unref (idle);
+ presence_mgr = empathy_presence_manager_dup_singleton ();
+ type = empathy_presence_manager_get_requested_presence (presence_mgr, &status,
+ &message);
+ g_object_unref (presence_mgr);
if (type != TP_CONNECTION_PRESENCE_TYPE_UNSET)
{
diff --git a/libempathy/empathy-idle.h b/libempathy/empathy-idle.h
deleted file mode 100644
index 95b99dc40..000000000
--- a/libempathy/empathy-idle.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2007-2008 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Authors: Xavier Claessens <xclaesse@gmail.com>
- */
-
-#ifndef __EMPATHY_IDLE_H__
-#define __EMPATHY_IDLE_H__
-
-#include <glib.h>
-
-#include <telepathy-glib/account.h>
-#include <telepathy-glib/enums.h>
-
-G_BEGIN_DECLS
-
-#define EMPATHY_TYPE_IDLE (empathy_idle_get_type ())
-#define EMPATHY_IDLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_IDLE, EmpathyIdle))
-#define EMPATHY_IDLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_IDLE, EmpathyIdleClass))
-#define EMPATHY_IS_IDLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_IDLE))
-#define EMPATHY_IS_IDLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_IDLE))
-#define EMPATHY_IDLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_IDLE, EmpathyIdleClass))
-
-typedef struct _EmpathyIdle EmpathyIdle;
-typedef struct _EmpathyIdleClass EmpathyIdleClass;
-
-struct _EmpathyIdle {
- GObject parent;
- gpointer priv;
-};
-
-struct _EmpathyIdleClass {
- GObjectClass parent_class;
-};
-
-GType empathy_idle_get_type (void) G_GNUC_CONST;
-EmpathyIdle *empathy_idle_dup_singleton (void);
-TpConnectionPresenceType empathy_idle_get_state (EmpathyIdle *idle);
-void empathy_idle_set_state (EmpathyIdle *idle,
- TpConnectionPresenceType state);
-void empathy_idle_set_status (EmpathyIdle *idle,
- const gchar *status);
-void empathy_idle_set_presence (EmpathyIdle *idle,
- TpConnectionPresenceType state,
- const gchar *status);
-gboolean empathy_idle_get_auto_away (EmpathyIdle *idle);
-void empathy_idle_set_auto_away (EmpathyIdle *idle,
- gboolean auto_away);
-
-TpConnectionPresenceType empathy_idle_get_requested_presence (EmpathyIdle *idle,
- gchar **status,
- gchar **status_message);
-
-gboolean empathy_idle_account_is_just_connected (EmpathyIdle *idle,
- TpAccount *account);
-
-G_END_DECLS
-
-#endif /* __EMPATHY_IDLE_H__ */
diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-presence-manager.c
index 12686daa4..035b50aba 100644
--- a/libempathy/empathy-idle.c
+++ b/libempathy/empathy-presence-manager.c
@@ -19,6 +19,8 @@
* Authors: Xavier Claessens <xclaesse@gmail.com>
*/
+#include "empathy-presence-manager.h"
+
#include <config.h>
#include <string.h>
@@ -30,7 +32,6 @@
#include <telepathy-glib/dbus.h>
#include <telepathy-glib/util.h>
-#include "empathy-idle.h"
#include "empathy-utils.h"
#include "empathy-connectivity.h"
@@ -44,7 +45,7 @@
* for. */
#define ACCOUNT_IS_JUST_CONNECTED_SECONDS 10
-#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyIdle)
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyPresenceManager)
typedef struct {
DBusGProxy *gs_proxy;
EmpathyConnectivity *connectivity;
@@ -72,7 +73,7 @@ typedef struct {
TpConnectionPresenceType requested_presence_type;
gchar *requested_status_message;
-} EmpathyIdlePriv;
+} EmpathyPresenceManagerPriv;
typedef enum {
SESSION_STATUS_AVAILABLE,
@@ -89,9 +90,9 @@ enum {
PROP_AUTO_AWAY
};
-G_DEFINE_TYPE (EmpathyIdle, empathy_idle, G_TYPE_OBJECT);
+G_DEFINE_TYPE (EmpathyPresenceManager, empathy_presence_manager, G_TYPE_OBJECT);
-static EmpathyIdle * idle_singleton = NULL;
+static EmpathyPresenceManager * idle_singleton = NULL;
static const gchar *presence_type_to_status[NUM_TP_CONNECTION_PRESENCE_TYPES] = {
NULL,
@@ -110,9 +111,9 @@ idle_presence_changed_cb (TpAccountManager *manager,
TpConnectionPresenceType state,
gchar *status,
gchar *status_message,
- EmpathyIdle *idle)
+ EmpathyPresenceManager *idle)
{
- EmpathyIdlePriv *priv;
+ EmpathyPresenceManagerPriv *priv;
priv = GET_PRIV (idle);
@@ -135,23 +136,23 @@ idle_presence_changed_cb (TpAccountManager *manager,
}
static gboolean
-idle_ext_away_cb (EmpathyIdle *idle)
+idle_ext_away_cb (EmpathyPresenceManager *idle)
{
- EmpathyIdlePriv *priv;
+ EmpathyPresenceManagerPriv *priv;
priv = GET_PRIV (idle);
DEBUG ("Going to extended autoaway");
- empathy_idle_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY);
+ empathy_presence_manager_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY);
priv->ext_away_timeout = 0;
return FALSE;
}
static void
-idle_ext_away_stop (EmpathyIdle *idle)
+idle_ext_away_stop (EmpathyPresenceManager *idle)
{
- EmpathyIdlePriv *priv;
+ EmpathyPresenceManagerPriv *priv;
priv = GET_PRIV (idle);
@@ -162,9 +163,9 @@ idle_ext_away_stop (EmpathyIdle *idle)
}
static void
-idle_ext_away_start (EmpathyIdle *idle)
+idle_ext_away_start (EmpathyPresenceManager *idle)
{
- EmpathyIdlePriv *priv;
+ EmpathyPresenceManagerPriv *priv;
priv = GET_PRIV (idle);
@@ -179,9 +180,9 @@ idle_ext_away_start (EmpathyIdle *idle)
static void
idle_session_status_changed_cb (DBusGProxy *gs_proxy,
SessionStatus status,
- EmpathyIdle *idle)
+ EmpathyPresenceManager *idle)
{
- EmpathyIdlePriv *priv;
+ EmpathyPresenceManagerPriv *priv;
gboolean is_idle;
priv = GET_PRIV (idle);
@@ -224,7 +225,7 @@ idle_session_status_changed_cb (DBusGProxy *gs_proxy,
DEBUG ("Going to autoaway. Saved state=%d, new state=%d",
priv->away_saved_state, new_state);
- empathy_idle_set_state (idle, new_state);
+ empathy_presence_manager_set_state (idle, new_state);
} else if (!is_idle && priv->is_idle) {
/* We are no more idle, restore state */
@@ -239,7 +240,7 @@ idle_session_status_changed_cb (DBusGProxy *gs_proxy,
DEBUG ("Restoring state to %d",
priv->away_saved_state);
- empathy_idle_set_state (idle,priv->away_saved_state);
+ empathy_presence_manager_set_state (idle,priv->away_saved_state);
} else {
DEBUG ("Away saved state is unset. This means that we "
"weren't told when the session went idle. "
@@ -255,9 +256,9 @@ idle_session_status_changed_cb (DBusGProxy *gs_proxy,
static void
idle_state_change_cb (EmpathyConnectivity *connectivity,
gboolean new_online,
- EmpathyIdle *idle)
+ EmpathyPresenceManager *idle)
{
- EmpathyIdlePriv *priv;
+ EmpathyPresenceManagerPriv *priv;
priv = GET_PRIV (idle);
@@ -268,14 +269,14 @@ idle_state_change_cb (EmpathyConnectivity *connectivity,
priv->saved_state = priv->state;
g_free (priv->saved_status);
priv->saved_status = g_strdup (priv->status);
- empathy_idle_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_OFFLINE);
+ empathy_presence_manager_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_OFFLINE);
}
else if (new_online
&& priv->saved_state != TP_CONNECTION_PRESENCE_TYPE_UNSET) {
/* We are now connected */
DEBUG ("Reconnected: Restore state %d (%s)",
priv->saved_state, priv->saved_status);
- empathy_idle_set_presence (idle,
+ empathy_presence_manager_set_presence (idle,
priv->saved_state,
priv->saved_status);
priv->saved_state = TP_CONNECTION_PRESENCE_TYPE_UNSET;
@@ -287,7 +288,7 @@ idle_state_change_cb (EmpathyConnectivity *connectivity,
static void
idle_finalize (GObject *object)
{
- EmpathyIdlePriv *priv;
+ EmpathyPresenceManagerPriv *priv;
priv = GET_PRIV (object);
@@ -313,7 +314,7 @@ idle_finalize (GObject *object)
g_hash_table_destroy (priv->connect_times);
priv->connect_times = NULL;
- idle_ext_away_stop (EMPATHY_IDLE (object));
+ idle_ext_away_stop (EMPATHY_PRESENCE_MANAGER (object));
}
static GObject *
@@ -326,10 +327,10 @@ idle_constructor (GType type,
if (idle_singleton) {
retval = g_object_ref (idle_singleton);
} else {
- retval = G_OBJECT_CLASS (empathy_idle_parent_class)->constructor
+ retval = G_OBJECT_CLASS (empathy_presence_manager_parent_class)->constructor
(type, n_props, props);
- idle_singleton = EMPATHY_IDLE (retval);
+ idle_singleton = EMPATHY_PRESENCE_MANAGER (retval);
g_object_add_weak_pointer (retval, (gpointer) &idle_singleton);
}
@@ -337,9 +338,9 @@ idle_constructor (GType type,
}
static const gchar *
-empathy_idle_get_status (EmpathyIdle *idle)
+empathy_presence_manager_get_status (EmpathyPresenceManager *idle)
{
- EmpathyIdlePriv *priv;
+ EmpathyPresenceManagerPriv *priv;
priv = GET_PRIV (idle);
@@ -360,21 +361,21 @@ idle_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- EmpathyIdlePriv *priv;
- EmpathyIdle *idle;
+ EmpathyPresenceManagerPriv *priv;
+ EmpathyPresenceManager *idle;
priv = GET_PRIV (object);
- idle = EMPATHY_IDLE (object);
+ idle = EMPATHY_PRESENCE_MANAGER (object);
switch (param_id) {
case PROP_STATE:
- g_value_set_enum (value, empathy_idle_get_state (idle));
+ g_value_set_enum (value, empathy_presence_manager_get_state (idle));
break;
case PROP_STATUS:
- g_value_set_string (value, empathy_idle_get_status (idle));
+ g_value_set_string (value, empathy_presence_manager_get_status (idle));
break;
case PROP_AUTO_AWAY:
- g_value_set_boolean (value, empathy_idle_get_auto_away (idle));
+ g_value_set_boolean (value, empathy_presence_manager_get_auto_away (idle));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -388,21 +389,21 @@ idle_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- EmpathyIdlePriv *priv;
- EmpathyIdle *idle;
+ EmpathyPresenceManagerPriv *priv;
+ EmpathyPresenceManager *idle;
priv = GET_PRIV (object);
- idle = EMPATHY_IDLE (object);
+ idle = EMPATHY_PRESENCE_MANAGER (object);
switch (param_id) {
case PROP_STATE:
- empathy_idle_set_state (idle, g_value_get_enum (value));
+ empathy_presence_manager_set_state (idle, g_value_get_enum (value));
break;
case PROP_STATUS:
- empathy_idle_set_status (idle, g_value_get_string (value));
+ empathy_presence_manager_set_status (idle, g_value_get_string (value));
break;
case PROP_AUTO_AWAY:
- empathy_idle_set_auto_away (idle, g_value_get_boolean (value));
+ empathy_presence_manager_set_auto_away (idle, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -411,7 +412,7 @@ idle_set_property (GObject *object,
}
static void
-empathy_idle_class_init (EmpathyIdleClass *klass)
+empathy_presence_manager_class_init (EmpathyPresenceManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -444,7 +445,7 @@ empathy_idle_class_init (EmpathyIdleClass *klass)
FALSE,
G_PARAM_READWRITE));
- g_type_class_add_private (object_class, sizeof (EmpathyIdlePriv));
+ g_type_class_add_private (object_class, sizeof (EmpathyPresenceManagerPriv));
}
static void
@@ -456,8 +457,8 @@ account_status_changed_cb (TpAccount *account,
GHashTable *details,
gpointer user_data)
{
- EmpathyIdle *idle = EMPATHY_IDLE (user_data);
- EmpathyIdlePriv *priv = GET_PRIV (idle);
+ EmpathyPresenceManager *idle = EMPATHY_PRESENCE_MANAGER (user_data);
+ EmpathyPresenceManagerPriv *priv = GET_PRIV (idle);
GTimeVal val;
if (new_status == TP_CONNECTION_STATUS_CONNECTED) {
@@ -474,9 +475,9 @@ account_manager_ready_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
- EmpathyIdle *idle = user_data;
+ EmpathyPresenceManager *idle = user_data;
TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object);
- EmpathyIdlePriv *priv;
+ EmpathyPresenceManagerPriv *priv;
TpConnectionPresenceType state;
gchar *status, *status_message;
GList *accounts, *l;
@@ -514,10 +515,10 @@ account_manager_ready_cb (GObject *source_object,
}
static void
-empathy_idle_init (EmpathyIdle *idle)
+empathy_presence_manager_init (EmpathyPresenceManager *idle)
{
- EmpathyIdlePriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (idle,
- EMPATHY_TYPE_IDLE, EmpathyIdlePriv);
+ EmpathyPresenceManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (idle,
+ EMPATHY_TYPE_PRESENCE_MANAGER, EmpathyPresenceManagerPriv);
TpDBusDaemon *dbus;
idle->priv = priv;
@@ -558,16 +559,16 @@ empathy_idle_init (EmpathyIdle *idle)
priv->connect_times = g_hash_table_new (g_direct_hash, g_direct_equal);
}
-EmpathyIdle *
-empathy_idle_dup_singleton (void)
+EmpathyPresenceManager *
+empathy_presence_manager_dup_singleton (void)
{
- return g_object_new (EMPATHY_TYPE_IDLE, NULL);
+ return g_object_new (EMPATHY_TYPE_PRESENCE_MANAGER, NULL);
}
TpConnectionPresenceType
-empathy_idle_get_state (EmpathyIdle *idle)
+empathy_presence_manager_get_state (EmpathyPresenceManager *idle)
{
- EmpathyIdlePriv *priv;
+ EmpathyPresenceManagerPriv *priv;
priv = GET_PRIV (idle);
@@ -579,33 +580,33 @@ empathy_idle_get_state (EmpathyIdle *idle)
}
void
-empathy_idle_set_state (EmpathyIdle *idle,
+empathy_presence_manager_set_state (EmpathyPresenceManager *idle,
TpConnectionPresenceType state)
{
- EmpathyIdlePriv *priv;
+ EmpathyPresenceManagerPriv *priv;
priv = GET_PRIV (idle);
- empathy_idle_set_presence (idle, state, priv->status);
+ empathy_presence_manager_set_presence (idle, state, priv->status);
}
void
-empathy_idle_set_status (EmpathyIdle *idle,
+empathy_presence_manager_set_status (EmpathyPresenceManager *idle,
const gchar *status)
{
- EmpathyIdlePriv *priv;
+ EmpathyPresenceManagerPriv *priv;
priv = GET_PRIV (idle);
- empathy_idle_set_presence (idle, priv->state, status);
+ empathy_presence_manager_set_presence (idle, priv->state, status);
}
static void
-empathy_idle_do_set_presence (EmpathyIdle *idle,
+empathy_presence_manager_do_set_presence (EmpathyPresenceManager *idle,
TpConnectionPresenceType status_type,
const gchar *status_message)
{
- EmpathyIdlePriv *priv = GET_PRIV (idle);
+ EmpathyPresenceManagerPriv *priv = GET_PRIV (idle);
const gchar *status;
g_assert (status_type > 0 && status_type < NUM_TP_CONNECTION_PRESENCE_TYPES);
@@ -616,7 +617,7 @@ empathy_idle_do_set_presence (EmpathyIdle *idle,
/* We possibly should be sure that the account manager is prepared, but
* sometimes this isn't possible, like when exiting. In other words,
- * we need a callback to empathy_idle_set_presence to be sure the
+ * we need a callback to empathy_presence_manager_set_presence to be sure the
* presence is set on all accounts successfully.
* However, in practice, this is fine as we've already prepared the
* account manager here in _init. */
@@ -625,11 +626,11 @@ empathy_idle_do_set_presence (EmpathyIdle *idle,
}
void
-empathy_idle_set_presence (EmpathyIdle *idle,
+empathy_presence_manager_set_presence (EmpathyPresenceManager *idle,
TpConnectionPresenceType state,
const gchar *status)
{
- EmpathyIdlePriv *priv;
+ EmpathyPresenceManagerPriv *priv;
const gchar *default_status;
priv = GET_PRIV (idle);
@@ -661,22 +662,22 @@ empathy_idle_set_presence (EmpathyIdle *idle,
return;
}
- empathy_idle_do_set_presence (idle, state, status);
+ empathy_presence_manager_do_set_presence (idle, state, status);
}
gboolean
-empathy_idle_get_auto_away (EmpathyIdle *idle)
+empathy_presence_manager_get_auto_away (EmpathyPresenceManager *idle)
{
- EmpathyIdlePriv *priv = GET_PRIV (idle);
+ EmpathyPresenceManagerPriv *priv = GET_PRIV (idle);
return priv->auto_away;
}
void
-empathy_idle_set_auto_away (EmpathyIdle *idle,
+empathy_presence_manager_set_auto_away (EmpathyPresenceManager *idle,
gboolean auto_away)
{
- EmpathyIdlePriv *priv = GET_PRIV (idle);
+ EmpathyPresenceManagerPriv *priv = GET_PRIV (idle);
priv->auto_away = auto_away;
@@ -684,11 +685,11 @@ empathy_idle_set_auto_away (EmpathyIdle *idle,
}
TpConnectionPresenceType
-empathy_idle_get_requested_presence (EmpathyIdle *idle,
+empathy_presence_manager_get_requested_presence (EmpathyPresenceManager *idle,
gchar **status,
gchar **status_message)
{
- EmpathyIdlePriv *priv = GET_PRIV (idle);
+ EmpathyPresenceManagerPriv *priv = GET_PRIV (idle);
if (status != NULL) {
*status = g_strdup (presence_type_to_status[priv->requested_presence_type]);
@@ -701,14 +702,14 @@ empathy_idle_get_requested_presence (EmpathyIdle *idle,
return priv->requested_presence_type;
}
-/* This function returns %TRUE if EmpathyIdle considers the account
+/* This function returns %TRUE if EmpathyPresenceManager considers the account
* @account as having just connected recently. Otherwise, it returns
* %FALSE. In doubt, %FALSE is returned. */
gboolean
-empathy_idle_account_is_just_connected (EmpathyIdle *idle,
+empathy_presence_manager_account_is_just_connected (EmpathyPresenceManager *idle,
TpAccount *account)
{
- EmpathyIdlePriv *priv = GET_PRIV (idle);
+ EmpathyPresenceManagerPriv *priv = GET_PRIV (idle);
GTimeVal val;
gpointer ptr;
glong t;
diff --git a/libempathy/empathy-presence-manager.h b/libempathy/empathy-presence-manager.h
new file mode 100644
index 000000000..bdbe4cf62
--- /dev/null
+++ b/libempathy/empathy-presence-manager.h
@@ -0,0 +1,74 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007-2008 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Xavier Claessens <xclaesse@gmail.com>
+ */
+
+#ifndef __EMPATHY_PRESENCE_MANAGER_H__
+#define __EMPATHY_PRESENCE_MANAGER_H__
+
+#include <glib.h>
+
+#include <telepathy-glib/account.h>
+#include <telepathy-glib/enums.h>
+
+G_BEGIN_DECLS
+
+#define EMPATHY_TYPE_PRESENCE_MANAGER (empathy_presence_manager_get_type ())
+#define EMPATHY_PRESENCE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_PRESENCE_MANAGER, EmpathyPresenceManager))
+#define EMPATHY_PRESENCE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_PRESENCE_MANAGER, EmpathyPresenceManagerClass))
+#define EMPATHY_IS_PRESENCE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_PRESENCE_MANAGER))
+#define EMPATHY_IS_PRESENCE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_PRESENCE_MANAGER))
+#define EMPATHY_PRESENCE_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_PRESENCE_MANAGER, EmpathyPresenceManagerClass))
+
+typedef struct _EmpathyPresenceManager EmpathyPresenceManager;
+typedef struct _EmpathyPresenceManagerClass EmpathyPresenceManagerClass;
+
+struct _EmpathyPresenceManager {
+ GObject parent;
+ gpointer priv;
+};
+
+struct _EmpathyPresenceManagerClass {
+ GObjectClass parent_class;
+};
+
+GType empathy_presence_manager_get_type (void) G_GNUC_CONST;
+EmpathyPresenceManager *empathy_presence_manager_dup_singleton (void);
+TpConnectionPresenceType empathy_presence_manager_get_state (EmpathyPresenceManager *idle);
+void empathy_presence_manager_set_state (EmpathyPresenceManager *idle,
+ TpConnectionPresenceType state);
+void empathy_presence_manager_set_status (EmpathyPresenceManager *idle,
+ const gchar *status);
+void empathy_presence_manager_set_presence (EmpathyPresenceManager *idle,
+ TpConnectionPresenceType state,
+ const gchar *status);
+gboolean empathy_presence_manager_get_auto_away (EmpathyPresenceManager *idle);
+void empathy_presence_manager_set_auto_away (EmpathyPresenceManager *idle,
+ gboolean auto_away);
+
+TpConnectionPresenceType empathy_presence_manager_get_requested_presence (EmpathyPresenceManager *idle,
+ gchar **status,
+ gchar **status_message);
+
+gboolean empathy_presence_manager_account_is_just_connected (EmpathyPresenceManager *idle,
+ TpAccount *account);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_PRESENCE_MANAGER_H__ */
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index 6bbd53f86..3730e43a8 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -49,7 +49,7 @@
#include "empathy-contact-manager.h"
#include "empathy-individual-manager.h"
#include "empathy-dispatcher.h"
-#include "empathy-idle.h"
+#include "empathy-presence-manager.h"
#include "empathy-tp-call.h"
#include "empathy-tp-contact-factory.h"
@@ -482,11 +482,11 @@ gboolean
empathy_check_available_state (void)
{
TpConnectionPresenceType presence;
- EmpathyIdle *idle;
+ EmpathyPresenceManager *presence_mgr;
- idle = empathy_idle_dup_singleton ();
- presence = empathy_idle_get_state (idle);
- g_object_unref (idle);
+ presence_mgr = empathy_presence_manager_dup_singleton ();
+ presence = empathy_presence_manager_get_state (presence_mgr);
+ g_object_unref (presence_mgr);
if (presence != TP_CONNECTION_PRESENCE_TYPE_AVAILABLE &&
presence != TP_CONNECTION_PRESENCE_TYPE_UNSET) {
diff --git a/src/empathy-chat.c b/src/empathy-chat.c
index 7d8fcd323..db4000e66 100644
--- a/src/empathy-chat.c
+++ b/src/empathy-chat.c
@@ -30,7 +30,7 @@
#include <telepathy-glib/debug-sender.h>
-#include <libempathy/empathy-idle.h>
+#include <libempathy/empathy-presence-manager.h>
#include <libempathy-gtk/empathy-ui-utils.h>
#include "empathy-chat-manager.h"
@@ -95,7 +95,7 @@ main (int argc,
TpDebugSender *debug_sender;
#endif
GError *error = NULL;
- EmpathyIdle *idle;
+ EmpathyPresenceManager *presence_mgr;
gint retval;
/* Init */
@@ -133,7 +133,7 @@ main (int argc,
#endif
/* Setting up Idle */
- idle = empathy_idle_dup_singleton ();
+ presence_mgr = empathy_presence_manager_dup_singleton ();
if (g_getenv ("EMPATHY_PERSIST") != NULL)
{
@@ -152,7 +152,7 @@ main (int argc,
retval = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
- g_object_unref (idle);
+ g_object_unref (presence_mgr);
tp_clear_object (&chat_mgr);
#ifdef ENABLE_DEBUG
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index c7dd660a0..b20f1719f 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -29,7 +29,7 @@
#include <telepathy-glib/interfaces.h>
#include <telepathy-glib/simple-approver.h>
-#include <libempathy/empathy-idle.h>
+#include <libempathy/empathy-presence-manager.h>
#include <libempathy/empathy-tp-contact-factory.h>
#include <libempathy/empathy-contact-manager.h>
#include <libempathy/empathy-tp-chat.h>
@@ -1092,13 +1092,13 @@ event_manager_presence_changed_cb (EmpathyContact *contact,
EmpathyEventManagerPriv *priv = GET_PRIV (manager);
TpAccount *account;
gchar *header = NULL;
- EmpathyIdle *idle;
+ EmpathyPresenceManager *presence_mgr;
GtkWidget *window = empathy_main_window_dup ();
account = empathy_contact_get_account (contact);
- idle = empathy_idle_dup_singleton ();
+ presence_mgr = empathy_presence_manager_dup_singleton ();
- if (empathy_idle_account_is_just_connected (idle, account))
+ if (empathy_presence_manager_account_is_just_connected (presence_mgr, account))
goto out;
if (tp_connection_presence_type_cmp_availability (previous,
@@ -1149,7 +1149,7 @@ event_manager_presence_changed_cb (EmpathyContact *contact,
g_free (header);
out:
- g_object_unref (idle);
+ g_object_unref (presence_mgr);
g_object_unref (window);
}
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c
index d7422d874..97e03dc04 100644
--- a/src/empathy-main-window.c
+++ b/src/empathy-main-window.c
@@ -34,7 +34,6 @@
#include <folks/folks.h>
#include <libempathy/empathy-contact.h>
-#include <libempathy/empathy-idle.h>
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-dispatcher.h>
#include <libempathy/empathy-chatroom-manager.h>
diff --git a/src/empathy.c b/src/empathy.c
index 357b47e8e..c5de83bbe 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -46,7 +46,7 @@
#include <telepathy-logger/log-manager.h>
-#include <libempathy/empathy-idle.h>
+#include <libempathy/empathy-presence-manager.h>
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-chatroom-manager.h>
#include <libempathy/empathy-account-settings.h>
@@ -114,7 +114,7 @@ struct _EmpathyApp
TplLogManager *log_manager;
EmpathyChatroomManager *chatroom_manager;
EmpathyFTFactory *ft_factory;
- EmpathyIdle *idle;
+ EmpathyPresenceManager *presence_mgr;
EmpathyConnectivity *connectivity;
GSettings *gsettings;
EmpathyNotificationsApprover *notifications_approver;
@@ -136,16 +136,17 @@ empathy_app_dispose (GObject *object)
void (*dispose) (GObject *) =
G_OBJECT_CLASS (empathy_app_parent_class)->dispose;
- if (self->idle != NULL)
+ if (self->presence_mgr != NULL)
{
- empathy_idle_set_state (self->idle, TP_CONNECTION_PRESENCE_TYPE_OFFLINE);
+ empathy_presence_manager_set_state (self->presence_mgr,
+ TP_CONNECTION_PRESENCE_TYPE_OFFLINE);
}
#ifdef ENABLE_DEBUG
tp_clear_object (&self->debug_sender);
#endif
- tp_clear_object (&self->idle);
+ tp_clear_object (&self->presence_mgr);
tp_clear_object (&self->connectivity);
tp_clear_object (&self->icon);
tp_clear_object (&self->account_manager);
@@ -520,7 +521,7 @@ account_manager_ready_cb (GObject *source_object,
(presence, TP_CONNECTION_PRESENCE_TYPE_OFFLINE)
<= 0)
/* if current state is Offline, then put it online */
- empathy_idle_set_state (self->idle,
+ empathy_presence_manager_set_state (self->presence_mgr,
TP_CONNECTION_PRESENCE_TYPE_AVAILABLE);
/* Pop up the accounts dialog if we don't have any account */
@@ -612,13 +613,13 @@ chatroom_manager_ready_cb (EmpathyChatroomManager *chatroom_manager,
}
static void
-empathy_idle_set_auto_away_cb (GSettings *gsettings,
+empathy_presence_manager_set_auto_away_cb (GSettings *gsettings,
const gchar *key,
gpointer user_data)
{
- EmpathyIdle *idle = user_data;
+ EmpathyPresenceManager *presence_mgr = user_data;
- empathy_idle_set_auto_away (idle,
+ empathy_presence_manager_set_auto_away (presence_mgr,
g_settings_get_boolean (gsettings, key));
}
@@ -643,16 +644,17 @@ empathy_app_constructed (GObject *object)
notify_init (_(PACKAGE_NAME));
/* Setting up Idle */
- self->idle = empathy_idle_dup_singleton ();
+ self->presence_mgr = empathy_presence_manager_dup_singleton ();
self->gsettings = g_settings_new (EMPATHY_PREFS_SCHEMA);
autoaway = g_settings_get_boolean (self->gsettings, EMPATHY_PREFS_AUTOAWAY);
g_signal_connect (self->gsettings,
"changed::" EMPATHY_PREFS_AUTOAWAY,
- G_CALLBACK (empathy_idle_set_auto_away_cb), self->idle);
+ G_CALLBACK (empathy_presence_manager_set_auto_away_cb),
+ self->presence_mgr);
- empathy_idle_set_auto_away (self->idle, autoaway);
+ empathy_presence_manager_set_auto_away (self->presence_mgr, autoaway);
/* Setting up Connectivity */
self->connectivity = empathy_connectivity_dup_singleton ();