[empathy] empathy-account-widget: update apply button when our state changes



commit 8b15780d062dfb9263a173ff486fd767f6d47d2c
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon Nov 2 16:33:49 2009 +0000

    empathy-account-widget: update apply button when our state changes

 libempathy-gtk/empathy-account-widget.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index 3fc556a..af9fbb0 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)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]