]> git.0d.be Git - empathy.git/commitdiff
unsensitive the keep-alive spin button if keep-alive is disabled
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 16 Nov 2009 18:00:02 +0000 (18:00 +0000)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 23 Nov 2009 15:06:37 +0000 (16:06 +0100)
libempathy-gtk/empathy-account-widget-sip.c

index fba053f333ac0f00cbd68d28ffe39e87053c0660..71efa4f247a2aae45ce54f8a71aaf914c11d5a59 100644 (file)
@@ -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");