]> Pileus Git - ~andy/gtk/commitdiff
switch: allow the user to toggle the switch by clicking on the handle
authorThomas Wood <thos@gnome.org>
Tue, 11 Jan 2011 11:34:23 +0000 (11:34 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 12 Jan 2011 23:50:45 +0000 (18:50 -0500)
gtk/gtkswitch.c

index 28a5d8d46862ff8fd1feaa4d43b76b1119f1cfcc..6b9866e1676d1adc920d776e3615802068a92470 100644 (file)
@@ -202,6 +202,15 @@ gtk_switch_button_release (GtkWidget      *widget,
       return TRUE;
     }
 
+  /* toggle the switch if the handle was clicked but a drag had not been
+   * initiated */
+  if (!priv->is_dragging && !priv->in_press)
+    {
+      gtk_switch_set_active (GTK_SWITCH (widget), !priv->is_active);
+
+      return TRUE;
+    }
+
   /* dragged toggle */
   if (priv->is_dragging)
     {