From 8b15780d062dfb9263a173ff486fd767f6d47d2c Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 2 Nov 2009 16:33:49 +0000 Subject: =?UTF-8?q?empathy-account-widget:=C2=A0update=C2=A0apply=C2=A0but?= =?UTF-8?q?ton=C2=A0when=20our=20state=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libempathy-gtk/empathy-account-widget.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'libempathy-gtk/empathy-account-widget.c') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 3fc556af8..af9fbb026 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -1147,6 +1147,26 @@ do_get_property (GObject *object, } } +static void +idle_state_change_cb (EmpathyIdle *idle, + GParamSpec *spec, + EmpathyAccountWidget *self) +{ + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + TpConnectionPresenceType state; + + state = empathy_idle_get_state (priv->idle); + + if (state > TP_CONNECTION_PRESENCE_TYPE_OFFLINE) + { + g_object_set (priv->apply_button, "label", GTK_STOCK_CONNECT, NULL); + } + else + { + g_object_set (priv->apply_button, "label", GTK_STOCK_APPLY, NULL); + } +} + #define WIDGET(cm, proto) \ { #cm, #proto, "empathy-account-widget-"#proto".ui", \ account_widget_build_##proto } @@ -1252,6 +1272,9 @@ do_constructed (GObject *obj) TpConnectionPresenceType state; priv->idle = empathy_idle_dup_singleton (); + empathy_signal_connect_weak (priv->idle, "notify::state", + G_CALLBACK (idle_state_change_cb), obj); + state = empathy_idle_get_state (priv->idle); if (state > TP_CONNECTION_PRESENCE_TYPE_OFFLINE) -- cgit v1.2.3