[gtk/wip/exalm/check-activate] checkbutton: Don't allow to uncheck radios by activating them




commit fb6c6c85bf73efa78e60d61546d3df7adcf04f5a
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Thu May 20 14:38:33 2021 +0500

    checkbutton: Don't allow to uncheck radios by activating them
    
    Do the same check as when clicking.

 gtk/gtkcheckbutton.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index e9a30a1ce3..bc4a4c5d04 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -475,10 +475,14 @@ gtk_check_button_focus (GtkWidget         *widget,
 }
 
 static void
-gtk_check_button_real_activate (GtkCheckButton *check_button)
+gtk_check_button_real_activate (GtkCheckButton *self)
 {
-  gtk_check_button_set_active (check_button,
-                               !gtk_check_button_get_active (check_button));
+  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
+
+  if (priv->active && (priv->group_prev || priv->group_next))
+    return;
+
+  gtk_check_button_set_active (self, !gtk_check_button_get_active (self));
 }
 
 static void


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