aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@src.gnome.org>2008-04-20 21:33:46 +0800
committerFrederic Peters <fpeters@src.gnome.org>2008-04-20 21:33:46 +0800
commit4e2ab1e0c83171c646de24c9330cc83ba82e76a8 (patch)
treeb3d4224593cc31e6b4bf4084725f8e0269c2609a
parent11001c0cb5e6418bcd7a564ec0ca5b911e9c8a54 (diff)
downloadgsoc2013-empathy-4e2ab1e0c83171c646de24c9330cc83ba82e76a8.tar
gsoc2013-empathy-4e2ab1e0c83171c646de24c9330cc83ba82e76a8.tar.gz
gsoc2013-empathy-4e2ab1e0c83171c646de24c9330cc83ba82e76a8.tar.bz2
gsoc2013-empathy-4e2ab1e0c83171c646de24c9330cc83ba82e76a8.tar.lz
gsoc2013-empathy-4e2ab1e0c83171c646de24c9330cc83ba82e76a8.tar.xz
gsoc2013-empathy-4e2ab1e0c83171c646de24c9330cc83ba82e76a8.tar.zst
gsoc2013-empathy-4e2ab1e0c83171c646de24c9330cc83ba82e76a8.zip
keep track of connected status to disable menu item for "new conversation"
under the notification area icon. Fixes: #517300. (Frederic Peters) svn path=/trunk/; revision=1008
-rw-r--r--src/empathy-status-icon.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c
index cd086d199..87c910aed 100644
--- a/src/empathy-status-icon.c
+++ b/src/empathy-status-icon.c
@@ -55,10 +55,12 @@ typedef struct _StatusIconEvent StatusIconEvent;
struct _EmpathyStatusIconPriv {
GtkStatusIcon *icon;
EmpathyIdle *idle;
+ MissionControl *mc;
EmpathyFilter *filter;
EmpathyFilterEvent *event;
gboolean showing_event_icon;
guint blink_timeout;
+ gpointer token;
GtkWindow *window;
GtkWidget *popup_menu;
@@ -320,9 +322,12 @@ status_icon_finalize (GObject *object)
g_source_remove (priv->blink_timeout);
}
+ empathy_disconnect_account_status_changed (priv->token);
+
g_object_unref (priv->icon);
g_object_unref (priv->idle);
g_object_unref (priv->filter);
+ g_object_unref (priv->mc);
}
static void
@@ -336,13 +341,45 @@ 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)
+{
+ GList *accounts, *l;
+ guint connection_status;
+ EmpathyStatusIconPriv *priv;
+
+ priv = GET_PRIV (icon);
+
+ /* 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 = GET_PRIV (icon);
priv->icon = gtk_status_icon_new ();
+ priv->mc = empathy_mission_control_new ();
priv->idle = empathy_idle_new ();
priv->filter = empathy_filter_new ();
+ priv->token = empathy_connect_to_account_status_changed (priv->mc,
+ G_CALLBACK (status_icon_status_changed_cb),
+ icon, NULL);
/* make icon listen and respond to MAIN_WINDOW_HIDDEN changes */
empathy_conf_notify_add (empathy_conf_get (),