aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-status-icon.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2009-01-07 00:46:57 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-01-07 00:46:57 +0800
commit4e6eb8852b873cebc9b8fd6d4df7bdffc57117c2 (patch)
treedbdcab76de07e3de4eb99159a4dc709583b6560a /src/empathy-status-icon.c
parent4a80cadbc7e0a02f0a1122a62733d52e3334f634 (diff)
downloadgsoc2013-empathy-4e6eb8852b873cebc9b8fd6d4df7bdffc57117c2.tar
gsoc2013-empathy-4e6eb8852b873cebc9b8fd6d4df7bdffc57117c2.tar.gz
gsoc2013-empathy-4e6eb8852b873cebc9b8fd6d4df7bdffc57117c2.tar.bz2
gsoc2013-empathy-4e6eb8852b873cebc9b8fd6d4df7bdffc57117c2.tar.lz
gsoc2013-empathy-4e6eb8852b873cebc9b8fd6d4df7bdffc57117c2.tar.xz
gsoc2013-empathy-4e6eb8852b873cebc9b8fd6d4df7bdffc57117c2.tar.zst
gsoc2013-empathy-4e6eb8852b873cebc9b8fd6d4df7bdffc57117c2.zip
Port EmpathyStatusIcon to the new API.
svn path=/trunk/; revision=2043
Diffstat (limited to 'src/empathy-status-icon.c')
-rw-r--r--src/empathy-status-icon.c63
1 files changed, 28 insertions, 35 deletions
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c
index dfe4bb630..3a517db91 100644
--- a/src/empathy-status-icon.c
+++ b/src/empathy-status-icon.c
@@ -29,6 +29,7 @@
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-idle.h>
+#include <libempathy/empathy-account-manager.h>
#include <libempathy-gtk/empathy-presence-chooser.h>
#include <libempathy-gtk/empathy-conf.h>
@@ -51,10 +52,9 @@
typedef struct {
GtkStatusIcon *icon;
EmpathyIdle *idle;
- MissionControl *mc;
+ EmpathyAccountManager *account_manager;
gboolean showing_event_icon;
guint blink_timeout;
- gpointer token;
EmpathyEventManager *event_manager;
EmpathyEvent *event;
@@ -342,6 +342,23 @@ status_icon_create_menu (EmpathyStatusIcon *icon)
}
static void
+status_icon_connection_changed_cb (EmpathyAccountManager *manager,
+ McAccount *account,
+ TpConnectionStatusReason reason,
+ TpConnectionStatus current,
+ TpConnectionStatus previous,
+ EmpathyStatusIcon *icon)
+{
+ EmpathyStatusIconPriv *priv = GET_PRIV (icon);
+ int connected_accounts;
+
+ /* Check for a connected account */
+ connected_accounts = empathy_account_manager_get_connected_accounts (manager);
+
+ gtk_widget_set_sensitive (priv->message_item, connected_accounts > 0);
+}
+
+static void
status_icon_finalize (GObject *object)
{
EmpathyStatusIconPriv *priv = GET_PRIV (object);
@@ -350,11 +367,13 @@ status_icon_finalize (GObject *object)
g_source_remove (priv->blink_timeout);
}
- empathy_disconnect_account_status_changed (priv->token);
+ g_signal_handlers_disconnect_by_func (priv->account_manager,
+ status_icon_connection_changed_cb,
+ object);
g_object_unref (priv->icon);
g_object_unref (priv->idle);
- g_object_unref (priv->mc);
+ g_object_unref (priv->account_manager);
g_object_unref (priv->event_manager);
}
@@ -369,33 +388,6 @@ empathy_status_icon_class_init (EmpathyStatusIconClass *klass)
}
static void
-status_icon_status_changed_cb (MissionControl *mc,
- TpConnectionStatus status,
- McPresence presence,
- TpConnectionStatusReason reason,
- const gchar *unique_name,
- EmpathyStatusIcon *icon)
-{
- EmpathyStatusIconPriv *priv = GET_PRIV (icon);
- GList *accounts, *l;
- guint connection_status = 1;
-
- /* Check for a connected account */
- accounts = mc_accounts_list_by_enabled (TRUE);
- for (l = accounts; l; l = l->next) {
- connection_status = mission_control_get_connection_status (priv->mc,
- l->data,
- NULL);
- if (connection_status == 0) {
- break;
- }
- }
- mc_accounts_list_free (accounts);
-
- gtk_widget_set_sensitive (priv->message_item, connection_status == 0);
-}
-
-static void
empathy_status_icon_init (EmpathyStatusIcon *icon)
{
EmpathyStatusIconPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (icon,
@@ -403,12 +395,13 @@ empathy_status_icon_init (EmpathyStatusIcon *icon)
icon->priv = priv;
priv->icon = gtk_status_icon_new ();
- priv->mc = empathy_mission_control_new ();
+ priv->account_manager = empathy_account_manager_new ();
priv->idle = empathy_idle_new ();
priv->event_manager = empathy_event_manager_new ();
- priv->token = empathy_connect_to_account_status_changed (priv->mc,
- G_CALLBACK (status_icon_status_changed_cb),
- icon, NULL);
+
+ g_signal_connect (priv->account_manager,
+ "account-connection-changed",
+ G_CALLBACK (status_icon_connection_changed_cb), icon);
/* make icon listen and respond to MAIN_WINDOW_HIDDEN changes */
empathy_conf_notify_add (empathy_conf_get (),