[empathy] unsensitive the keep-alive spin button if keep-alive is disabled



commit db4180342c107e1641ae528739409e4168ba7d91
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon Nov 16 18:00:02 2009 +0000

    unsensitive the keep-alive spin button if keep-alive is disabled

 libempathy-gtk/empathy-account-widget-sip.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-account-widget-sip.c b/libempathy-gtk/empathy-account-widget-sip.c
index fba053f..71efa4f 100644
--- a/libempathy-gtk/empathy-account-widget-sip.c
+++ b/libempathy-gtk/empathy-account-widget-sip.c
@@ -28,6 +28,7 @@
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
 
+#include <telepathy-glib/util.h>
 #include <libempathy/empathy-utils.h>
 
 #include "empathy-account-widget.h"
@@ -44,6 +45,7 @@ typedef struct {
   GtkWidget *checkbutton_discover_stun;
   GtkWidget *combobox_transport;
   GtkWidget *combobox_keep_alive_mechanism;
+  GtkWidget *spinbutton_keepalive_interval;
 } EmpathyAccountWidgetSip;
 
 static void
@@ -65,6 +67,21 @@ account_widget_sip_discover_stun_toggled_cb (
   gtk_widget_set_sensitive (settings->spinbutton_stun_part, !active);
 }
 
+static void
+keep_alive_mechanism_combobox_change_cb (GtkWidget *widget,
+    EmpathyAccountWidgetSip *self)
+{
+  const gchar *mechanism;
+  gboolean enabled;
+
+  /* Unsensitive the keep-alive spin button if keep-alive is disabled */
+  mechanism = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
+
+  enabled = tp_strdiff (mechanism, "none");
+
+  gtk_widget_set_sensitive (self->spinbutton_keepalive_interval, enabled);
+}
+
 void
 empathy_account_widget_sip_build (EmpathyAccountWidget *self,
     const char *filename,
@@ -102,6 +119,8 @@ empathy_account_widget_sip_build (EmpathyAccountWidget *self,
           "entry_stun-server", &settings->entry_stun_server,
           "spinbutton_stun-port", &settings->spinbutton_stun_part,
           "checkbutton_discover-stun", &settings->checkbutton_discover_stun,
+          "spinbutton_keepalive-interval",
+            &settings->spinbutton_keepalive_interval,
           NULL);
       settings->vbox_settings = vbox_settings;
 
@@ -165,6 +184,9 @@ empathy_account_widget_sip_build (EmpathyAccountWidget *self,
       gtk_combo_box_append_text (
           GTK_COMBO_BOX (settings->combobox_keep_alive_mechanism), "none");
 
+      g_signal_connect (settings->combobox_keep_alive_mechanism, "changed",
+          G_CALLBACK (keep_alive_mechanism_combobox_change_cb), settings);
+
       account_widget_setup_widget (self,
           settings->combobox_keep_alive_mechanism, "keepalive-mechanism");
 



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