[gtk/wip/baedert/for-master: 132/133] WIP: Change button hierarchy




commit 4b3f24ca1f440c2a326f244d69952c3d7cc9042c
Author: Timm Bäder <mail baedert org>
Date:   Fri Aug 7 05:45:30 2020 +0200

    WIP: Change button hierarchy
    
    A radiobutton without indicator is really just a togglebutton with a
    group.
    
    A radiobutton with indicator is really just a checkbutton with a group.
    
    Make checkbutton its own widget not inheriting from GtkButton.
    GtkRadioButton could be removed but it stays for now.

 demos/widget-factory/widget-factory.ui      |  25 +-
 gtk/gtkcheckbutton.c                        | 599 ++++++++++++++++++++++------
 gtk/gtkcheckbutton.h                        |  46 ++-
 gtk/gtkfontchooserwidget.c                  |  43 +-
 gtk/gtkradiobutton.c                        | 123 +++---
 gtk/inspector/prop-editor.c                 |  10 +-
 gtk/theme/Adwaita/_common.scss              |   3 +-
 tests/testflowbox.c                         |  26 +-
 tests/testlogout.c                          |   8 +-
 tests/testtextview2.c                       |   4 +-
 testsuite/gtk/focus-chain/widget-factory.ui |   6 +-
 11 files changed, 619 insertions(+), 274 deletions(-)
---
diff --git a/demos/widget-factory/widget-factory.ui b/demos/widget-factory/widget-factory.ui
index fccbb520d9..066557dea5 100644
--- a/demos/widget-factory/widget-factory.ui
+++ b/demos/widget-factory/widget-factory.ui
@@ -687,8 +687,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
                                   </object>
                                 </child>
                                 <child>
-                                  <object class="GtkRadioButton" id="radiobutton1">
-                                    <property name="label" translatable="yes">radiobutton</property>
+                                  <object class="GtkCheckButton" id="radiobutton1">
+                                    <property name="label" translatable="yes">checkbutton</property>
                                     <property name="active">1</property>
                                     <layout>
                                       <property name="column">0</property>
@@ -697,8 +697,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
                                   </object>
                                 </child>
                                 <child>
-                                  <object class="GtkRadioButton" id="radiobutton2">
-                                    <property name="label" translatable="yes">radiobutton</property>
+                                  <object class="GtkCheckButton">
+                                    <property name="label" translatable="yes">checkbutton</property>
                                     <property name="group">radiobutton1</property>
                                     <layout>
                                       <property name="column">1</property>
@@ -707,8 +707,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
                                   </object>
                                 </child>
                                 <child>
-                                  <object class="GtkRadioButton" id="radiobutton3">
-                                    <property name="label" translatable="yes">radiobutton</property>
+                                  <object class="GtkCheckButton" id="radiobutton3">
+                                    <property name="label" translatable="yes">checkbutton</property>
                                     <property name="inconsistent">1</property>
                                     <property name="group">radiobutton1</property>
                                     <layout>
@@ -718,8 +718,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
                                   </object>
                                 </child>
                                 <child>
-                                  <object class="GtkRadioButton" id="radiobutton4">
-                                    <property name="label" translatable="yes">radiobutton</property>
+                                  <object class="GtkCheckButton" id="radiobutton4">
+                                    <property name="label" translatable="yes">checkbutton</property>
                                     <property name="sensitive">0</property>
                                     <layout>
                                       <property name="column">1</property>
@@ -728,8 +728,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
                                   </object>
                                 </child>
                                 <child>
-                                  <object class="GtkRadioButton" id="radiobutton5">
-                                    <property name="label" translatable="yes">radiobutton</property>
+                                  <object class="GtkCheckButton" id="radiobutton5">
+                                    <property name="label" translatable="yes">checkbutton</property>
                                     <property name="sensitive">0</property>
                                     <property name="group">radiobutton3</property>
                                     <layout>
@@ -739,7 +739,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
                                   </object>
                                 </child>
                                 <child>
-                                  <object class="GtkRadioButton" id="radiobutton6">
+                                  <object class="GtkCheckButton" id="radiobutton6">
                                     <property name="label" translatable="yes">radiobutton</property>
                                     <property name="sensitive">0</property>
                                     <property name="inconsistent">1</property>
@@ -2283,7 +2283,6 @@ microphone-sensitivity-medium-symbolic</property>
                                     </style>
                                     <child>
                                       <object class="GtkRadioButton" id="grid_button">
-                                        <property name="draw-indicator">0</property>
                                         <property name="active">1</property>
                                         <property name="icon-name">view-grid-symbolic</property>
                                       </object>
@@ -2291,7 +2290,6 @@ microphone-sensitivity-medium-symbolic</property>
                                     <child>
                                       <object class="GtkRadioButton" id="list_button">
                                         <property name="active">1</property>
-                                        <property name="draw-indicator">0</property>
                                         <property name="group">grid_button</property>
                                         <property name="icon-name">view-list-symbolic</property>
                                       </object>
@@ -2944,6 +2942,7 @@ bad things might happen.</property>
         <property name="use-underline">1</property>
       </object>
     </child>
+
     <action-widgets>
       <action-widget response="cancel">cancel_info_dialog</action-widget>
       <action-widget response="ok">doit_info_dialog</action-widget>
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index c6db13518f..8edc6de1d0 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -19,26 +19,24 @@
  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
  * file for a list of people on the GTK+ Team.  See the ChangeLog
  * files for a list of changes.  These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  */
 
 #include "config.h"
 
+#include "gtkactionhelperprivate.h"
+#include "gtkboxlayout.h"
+#include "gtkbuiltiniconprivate.h"
 #include "gtkcheckbuttonprivate.h"
-
-#include "gtkbuttonprivate.h"
-#include "gtklabel.h"
-
-#include "gtkintl.h"
-#include "gtkprivate.h"
-#include "gtkwidgetprivate.h"
 #include "gtkcssnodeprivate.h"
-#include "gtkstylecontextprivate.h"
 #include "gtkcssnumbervalueprivate.h"
+#include "gtkgestureclick.h"
+#include "gtkintl.h"
+#include "gtklabel.h"
+#include "gtkprivate.h"
 #include "gtkradiobutton.h"
-#include "gtkbuiltiniconprivate.h"
-#include "gtkboxlayout.h"
-
+#include "gtkstylecontextprivate.h"
+#include "gtkwidgetprivate.h"
 
 /**
  * SECTION:gtkcheckbutton
@@ -64,16 +62,6 @@
  * A GtkCheckButton with indicator (see gtk_check_button_set_draw_indicator()) has a
  * main CSS node with name checkbutton and a subnode with name check.
  *
- * |[<!-- language="plain" -->
- * button.check
- * ├── check
- * ╰── <child>
- * ]|
- *
- * A GtkCheckButton without indicator changes the name of its main node
- * to button and adds a .check style class to it. The subnode is invisible
- * in this case.
- *
  * # Accessibility
  *
  * GtkCheckButton uses the #GTK_ACCESSIBLE_ROLE_CHECKBOX role.
@@ -81,55 +69,94 @@
 
 typedef struct {
   GtkWidget *indicator_widget;
+  GtkWidget *label_widget;
+
+  guint draw_indicator: 1;
+  guint inconsistent: 1;
+  guint active: 1;
+  guint use_underline: 1;
+
+  GtkCheckButton *group_next;
+  GtkCheckButton *group_prev;
 
-  guint draw_indicator : 1;
-  guint inconsistent   : 1;
+  GtkActionHelper *action_helper;
 } GtkCheckButtonPrivate;
 
 enum {
   PROP_0,
+  PROP_ACTIVE,
+  PROP_GROUP,
+  PROP_LABEL,
   PROP_DRAW_INDICATOR,
   PROP_INCONSISTENT,
-  NUM_PROPERTIES
+  PROP_USE_UNDERLINE,
+
+  /* actionable properties */
+  PROP_ACTION_NAME,
+  PROP_ACTION_TARGET,
+  LAST_PROP = PROP_ACTION_NAME
+};
+
+enum {
+  TOGGLED,
+  LAST_SIGNAL
 };
 
-static GParamSpec *props[NUM_PROPERTIES] = { NULL, };
+static void gtk_check_button_actionable_iface_init (GtkActionableInterface *iface);
 
-G_DEFINE_TYPE_WITH_PRIVATE (GtkCheckButton, gtk_check_button, GTK_TYPE_TOGGLE_BUTTON)
+static guint signals[LAST_SIGNAL] = { 0 };
+static GParamSpec *props[LAST_PROP] = { NULL, };
 
+G_DEFINE_TYPE_WITH_CODE (GtkCheckButton, gtk_check_button, GTK_TYPE_WIDGET,
+                         G_ADD_PRIVATE (GtkCheckButton)
+                         G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTIONABLE, gtk_check_button_actionable_iface_init))
 
 static void
-gtk_check_button_update_node_state (GtkWidget *widget)
+gtk_check_button_dispose (GObject *object)
 {
-  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (widget));
-  GtkStateFlags state;
+  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (object));
 
-  if (!priv->indicator_widget)
-    return;
+  g_clear_pointer (&priv->indicator_widget, gtk_widget_unparent);
+  g_clear_pointer (&priv->label_widget, gtk_widget_unparent);
 
-  state = gtk_widget_get_state_flags (widget);
+  gtk_check_button_set_group (GTK_CHECK_BUTTON (object), NULL);
 
-  gtk_widget_set_state_flags (priv->indicator_widget, state, TRUE);
+  G_OBJECT_CLASS (gtk_check_button_parent_class)->dispose (object);
 }
 
+static void
+gtk_check_button_activate_action (GtkCheckButton *self)
+{
+  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
+
+  if (priv->action_helper)
+    gtk_action_helper_activate (priv->action_helper);
+}
 
 static void
-gtk_check_button_state_flags_changed (GtkWidget     *widget,
-                                      GtkStateFlags  previous_state_flags)
+gtk_check_button_set_action_name (GtkActionable *actionable,
+                                  const char    *action_name)
 {
-  gtk_check_button_update_node_state (widget);
+  GtkCheckButton *self = GTK_CHECK_BUTTON (actionable);
+  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
+
+  if (!priv->action_helper)
+    priv->action_helper = gtk_action_helper_new (actionable);
 
-  GTK_WIDGET_CLASS (gtk_check_button_parent_class)->state_flags_changed (widget, previous_state_flags);
+  gtk_action_helper_set_action_name (priv->action_helper, action_name);
 }
 
 static void
-gtk_check_button_finalize (GObject *object)
+gtk_check_button_set_action_target_value (GtkActionable *actionable,
+                                          GVariant      *action_target)
 {
-  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (object));
+  GtkCheckButton *self = GTK_CHECK_BUTTON (actionable);
+  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
 
-  g_clear_pointer (&priv->indicator_widget, gtk_widget_unparent);
+  if (!priv->action_helper)
+    priv->action_helper = gtk_action_helper_new (actionable);
 
-  G_OBJECT_CLASS (gtk_check_button_parent_class)->finalize (object);
+  gtk_action_helper_set_action_target_value (priv->action_helper, action_target);
 }
 
 static void
@@ -140,41 +167,131 @@ gtk_check_button_set_property (GObject      *object,
 {
   switch (prop_id)
     {
-      case PROP_DRAW_INDICATOR:
-        gtk_check_button_set_draw_indicator (GTK_CHECK_BUTTON (object),
-                                             g_value_get_boolean (value));
-
+    case PROP_ACTIVE:
+      gtk_check_button_set_active (GTK_CHECK_BUTTON (object), g_value_get_boolean (value));
+      break;
+    case PROP_GROUP:
+      gtk_check_button_set_group (GTK_CHECK_BUTTON (object), g_value_get_object (value));
+      break;
+    case PROP_LABEL:
+      gtk_check_button_set_label (GTK_CHECK_BUTTON (object), g_value_get_string (value));
       break;
-      case PROP_INCONSISTENT:
-        gtk_check_button_set_inconsistent (GTK_CHECK_BUTTON (object),
-                                           g_value_get_boolean (value));
+    case PROP_DRAW_INDICATOR:
+      gtk_check_button_set_draw_indicator (GTK_CHECK_BUTTON (object), g_value_get_boolean (value));
       break;
-      default:
+    case PROP_INCONSISTENT:
+      gtk_check_button_set_inconsistent (GTK_CHECK_BUTTON (object), g_value_get_boolean (value));
+      break;
+    case PROP_USE_UNDERLINE:
+      gtk_check_button_set_use_underline (GTK_CHECK_BUTTON (object), g_value_get_boolean (value));
+      break;
+    case PROP_ACTION_NAME:
+      gtk_check_button_set_action_name (GTK_ACTIONABLE (object), g_value_get_string (value));
+      break;
+    case PROP_ACTION_TARGET:
+      gtk_check_button_set_action_target_value (GTK_ACTIONABLE (object), g_value_get_variant (value));
+      break;
+    default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
     }
 }
 
 static void
-gtk_check_button_get_property (GObject      *object,
-                               guint         prop_id,
-                               GValue       *value,
-                               GParamSpec   *pspec)
+gtk_check_button_get_property (GObject    *object,
+                               guint       prop_id,
+                               GValue     *value,
+                               GParamSpec *pspec)
 {
+  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (object));
+
   switch (prop_id)
     {
-      case PROP_DRAW_INDICATOR:
-        g_value_set_boolean (value, gtk_check_button_get_draw_indicator (GTK_CHECK_BUTTON (object)));
+    case PROP_ACTIVE:
+      g_value_set_boolean (value, gtk_check_button_get_active (GTK_CHECK_BUTTON (object)));
+      break;
+    case PROP_LABEL:
+      g_value_set_string (value, gtk_check_button_get_label (GTK_CHECK_BUTTON (object)));
+      break;
+    case PROP_DRAW_INDICATOR:
+      g_value_set_boolean (value, gtk_check_button_get_draw_indicator (GTK_CHECK_BUTTON (object)));
+      break;
+    case PROP_INCONSISTENT:
+      g_value_set_boolean (value, gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (object)));
       break;
-      case PROP_INCONSISTENT:
-        g_value_set_boolean (value, gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (object)));
+    case PROP_USE_UNDERLINE:
+      g_value_set_boolean (value, gtk_check_button_get_use_underline (GTK_CHECK_BUTTON (object)));
       break;
-      default:
+    case PROP_ACTION_NAME:
+      g_value_set_string (value, gtk_action_helper_get_action_name (priv->action_helper));
+      break;
+    case PROP_ACTION_TARGET:
+      g_value_set_variant (value, gtk_action_helper_get_action_target_value (priv->action_helper));
+      break;
+    default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
     }
 }
 
+static const char *
+gtk_check_button_get_action_name (GtkActionable *actionable)
+{
+  GtkCheckButton *self = GTK_CHECK_BUTTON (actionable);
+  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
+
+  return gtk_action_helper_get_action_name (priv->action_helper);
+}
+
+static GVariant *
+gtk_check_button_get_action_target_value (GtkActionable *actionable)
+{
+  GtkCheckButton *self = GTK_CHECK_BUTTON (actionable);
+  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
+
+  return gtk_action_helper_get_action_target_value (priv->action_helper);
+}
+
+static void
+gtk_check_button_actionable_iface_init (GtkActionableInterface *iface)
+{
+  iface->get_action_name = gtk_check_button_get_action_name;
+  iface->set_action_name = gtk_check_button_set_action_name;
+  iface->get_action_target_value = gtk_check_button_get_action_target_value;
+  iface->set_action_target_value = gtk_check_button_set_action_target_value;
+}
+
+static void
+click_pressed_cb (GtkGestureClick *gesture,
+                  guint            n_press,
+                  double           x,
+                  double           y,
+                  GtkWidget       *widget)
+{
+  if (gtk_widget_get_focus_on_click (widget) && !gtk_widget_has_focus (widget))
+    gtk_widget_grab_focus (widget);
+
+  gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
+}
+
+static void
+click_released_cb (GtkGestureClick *gesture,
+                   guint            n_press,
+                   double           x,
+                   double           y,
+                   GtkWidget       *widget)
+{
+  GtkCheckButton *self = GTK_CHECK_BUTTON (widget);
+  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
+
+  gtk_check_button_set_active (self, !priv->active);
+
+  g_message (__FUNCTION__);
+
+  if (priv->action_helper)
+    gtk_action_helper_activate (priv->action_helper);
+}
+
 static void
 update_accessible_state (GtkCheckButton *check_button)
 {
@@ -184,7 +301,7 @@ update_accessible_state (GtkCheckButton *check_button)
 
   if (priv->inconsistent)
     checked_state = GTK_ACCESSIBLE_TRISTATE_MIXED;
-  else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_button)))
+  else if (priv->active)
     checked_state = GTK_ACCESSIBLE_TRISTATE_TRUE;
   else
     checked_state = GTK_ACCESSIBLE_TRISTATE_FALSE;
@@ -194,29 +311,34 @@ update_accessible_state (GtkCheckButton *check_button)
                                -1);
 }
 
-static void
-gtk_check_button_notify (GObject    *object,
-                         GParamSpec *pspec)
-{
-  if (pspec->name == I_("active"))
-    update_accessible_state (GTK_CHECK_BUTTON (object));
-
-  if (G_OBJECT_CLASS (gtk_check_button_parent_class)->notify)
-    G_OBJECT_CLASS (gtk_check_button_parent_class)->notify (object, pspec);
-}
-
 static void
 gtk_check_button_class_init (GtkCheckButtonClass *class)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (class);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
 
-  object_class->notify = gtk_check_button_notify;
-  object_class->finalize = gtk_check_button_finalize;
+  object_class->dispose = gtk_check_button_dispose;
   object_class->set_property = gtk_check_button_set_property;
   object_class->get_property = gtk_check_button_get_property;
 
-  widget_class->state_flags_changed = gtk_check_button_state_flags_changed;
+  props[PROP_ACTIVE] =
+      g_param_spec_boolean ("active",
+                            P_("Active"),
+                            P_("If the toggle button should be pressed in"),
+                            FALSE,
+                            GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+  props[PROP_GROUP] =
+      g_param_spec_object ("group",
+                           P_("Group"),
+                           P_("The check button whose group this widget belongs to."),
+                           GTK_TYPE_CHECK_BUTTON,
+                           GTK_PARAM_WRITABLE);
+  props[PROP_LABEL] =
+    g_param_spec_string ("label",
+                         P_("Label"),
+                         P_("Text of the label widget inside the button, if the button contains a label 
widget"),
+                         NULL,
+                         GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
 
   props[PROP_DRAW_INDICATOR] =
       g_param_spec_boolean ("draw-indicator",
@@ -232,68 +354,64 @@ gtk_check_button_class_init (GtkCheckButtonClass *class)
                             FALSE,
                             GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
 
-  g_object_class_install_properties (object_class, NUM_PROPERTIES, props);
+  props[PROP_USE_UNDERLINE] =
+      g_param_spec_boolean ("use-underline",
+                            P_("Use underline"),
+                            P_("If set, an underline in the text indicates the next character should be used 
for the mnemonic accelerator key"),
+                            FALSE,
+                            GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
 
-  gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
-  gtk_widget_class_set_css_name (widget_class, I_("checkbutton"));
-  gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_CHECKBOX);
-}
+  g_object_class_install_properties (object_class, LAST_PROP, props);
 
-static void
-draw_indicator_changed (GtkCheckButton *check_button)
-{
-  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (check_button);
-  GtkCssNode *widget_node;
+  g_object_class_override_property (object_class, PROP_ACTION_NAME, "action-name");
+  g_object_class_override_property (object_class, PROP_ACTION_TARGET, "action-target");
 
-  widget_node = gtk_widget_get_css_node (GTK_WIDGET (check_button));
 
-  if (priv->draw_indicator)
-    {
-      priv->indicator_widget = gtk_builtin_icon_new ("check");
-      gtk_widget_set_halign (priv->indicator_widget, GTK_ALIGN_CENTER);
-      gtk_widget_set_valign (priv->indicator_widget, GTK_ALIGN_CENTER);
-      gtk_widget_set_parent (priv->indicator_widget, GTK_WIDGET (check_button));
-      if (GTK_IS_RADIO_BUTTON (check_button))
-        {
-          gtk_css_node_remove_class (widget_node, g_quark_from_static_string ("radio"));
-          gtk_css_node_set_name (widget_node, g_quark_from_static_string ("radiobutton"));
-        }
-      else if (GTK_IS_CHECK_BUTTON (check_button))
-        {
-          gtk_css_node_remove_class (widget_node, g_quark_from_static_string ("check"));
-          gtk_css_node_set_name (widget_node, g_quark_from_static_string ("checkbutton"));
-        }
-    }
-  else
-    {
-      gtk_widget_unparent (priv->indicator_widget);
-      priv->indicator_widget = NULL;
-      if (GTK_IS_RADIO_BUTTON (check_button))
-        {
-          gtk_css_node_add_class (widget_node, g_quark_from_static_string ("radio"));
-          gtk_css_node_set_name (widget_node, g_quark_from_static_string ("button"));
-        }
-      else if (GTK_IS_CHECK_BUTTON (check_button))
-        {
-          gtk_css_node_add_class (widget_node, g_quark_from_static_string ("check"));
-          gtk_css_node_set_name (widget_node, g_quark_from_static_string ("button"));
-        }
-    }
+  /**
+   * GtkCheckButton::toggled:
+   */
+  signals[TOGGLED] =
+    g_signal_new (I_("toggled"),
+                  G_OBJECT_CLASS_TYPE (object_class),
+                  G_SIGNAL_RUN_FIRST,
+                  G_STRUCT_OFFSET (GtkCheckButtonClass, toggled),
+                  NULL, NULL,
+                  NULL,
+                  G_TYPE_NONE, 0);
+
+  gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
+  gtk_widget_class_set_css_name (widget_class, I_("checkbutton"));
+  gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_CHECKBOX);
 }
 
 static void
 gtk_check_button_init (GtkCheckButton *check_button)
 {
   GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (check_button);
+  GtkGesture *gesture;
 
   gtk_widget_set_receives_default (GTK_WIDGET (check_button), FALSE);
+  priv->draw_indicator = TRUE;
+  priv->indicator_widget = gtk_builtin_icon_new ("check");
+  gtk_widget_set_halign (priv->indicator_widget, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (priv->indicator_widget, GTK_ALIGN_CENTER);
+  gtk_widget_set_parent (priv->indicator_widget, GTK_WIDGET (check_button));
 
-  gtk_widget_remove_css_class (GTK_WIDGET (check_button), "toggle");
+  priv->label_widget = gtk_label_new (NULL);
+  gtk_label_set_xalign (GTK_LABEL (priv->label_widget), 0.0f);
+  gtk_widget_set_parent (priv->label_widget, GTK_WIDGET (check_button));
+  gtk_widget_set_hexpand (priv->label_widget, TRUE);
 
-  priv->draw_indicator = TRUE;
-  draw_indicator_changed (check_button);
-  gtk_check_button_update_node_state (GTK_WIDGET (check_button));
   update_accessible_state (check_button);
+
+  gesture = gtk_gesture_click_new ();
+  gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), FALSE);
+  gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (gesture), TRUE);
+  gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_PRIMARY);
+  g_signal_connect (gesture, "pressed", G_CALLBACK (click_pressed_cb), check_button);
+  g_signal_connect (gesture, "released", G_CALLBACK (click_released_cb), check_button);
+  gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture), GTK_PHASE_CAPTURE);
+  gtk_widget_add_controller (GTK_WIDGET (check_button), GTK_EVENT_CONTROLLER (gesture));
 }
 
 /**
@@ -338,9 +456,9 @@ gtk_check_button_new_with_label (const char *label)
 GtkWidget*
 gtk_check_button_new_with_mnemonic (const char *label)
 {
-  return g_object_new (GTK_TYPE_CHECK_BUTTON, 
-                       "label", label, 
-                       "use-underline", TRUE, 
+  return g_object_new (GTK_TYPE_CHECK_BUTTON,
+                       "label", label,
+                       "use-underline", TRUE,
                        NULL);
 }
 
@@ -369,12 +487,13 @@ gtk_check_button_set_draw_indicator (GtkCheckButton *check_button,
 
   g_return_if_fail (GTK_IS_CHECK_BUTTON (check_button));
 
+  g_warning (__FUNCTION__);
+
   draw_indicator = !!draw_indicator;
 
   if (draw_indicator != priv->draw_indicator)
     {
       priv->draw_indicator = draw_indicator;
-      draw_indicator_changed (check_button);
       gtk_widget_queue_resize (GTK_WIDGET (check_button));
       g_object_notify_by_pspec (G_OBJECT (check_button), props[PROP_DRAW_INDICATOR]);
     }
@@ -426,9 +545,15 @@ gtk_check_button_set_inconsistent (GtkCheckButton *check_button,
       priv->inconsistent = inconsistent;
 
       if (inconsistent)
-        gtk_widget_set_state_flags (GTK_WIDGET (check_button), GTK_STATE_FLAG_INCONSISTENT, FALSE);
+        {
+          gtk_widget_set_state_flags (GTK_WIDGET (check_button), GTK_STATE_FLAG_INCONSISTENT, FALSE);
+          gtk_widget_set_state_flags (priv->indicator_widget, GTK_STATE_FLAG_INCONSISTENT, FALSE);
+        }
       else
-        gtk_widget_unset_state_flags (GTK_WIDGET (check_button), GTK_STATE_FLAG_INCONSISTENT);
+        {
+          gtk_widget_unset_state_flags (GTK_WIDGET (check_button), GTK_STATE_FLAG_INCONSISTENT);
+          gtk_widget_unset_state_flags (priv->indicator_widget, GTK_STATE_FLAG_INCONSISTENT);
+        }
 
       update_accessible_state (check_button);
 
@@ -441,7 +566,7 @@ gtk_check_button_set_inconsistent (GtkCheckButton *check_button,
  * @check_button: a #GtkCheckButton
  *
  * Returns whether the check button is in an inconsistent state.
- * 
+ *
  * Returns: %TRUE if @check_button is currently in an 'in between' state, %FALSE otherwise.
  */
 gboolean
@@ -453,3 +578,221 @@ gtk_check_button_get_inconsistent (GtkCheckButton *check_button)
 
   return priv->inconsistent;
 }
+
+/**
+ * gtk_check_button_get_active:
+ * @self: a #GtkCheckButton
+ *
+ * Returns the current value of the #GtkCheckButton:active property.
+ *
+ * Returns: The value of the #GtkCheckButton:active property.
+ *   See gtk_check_button_set_active() for details on how to set a new value.
+ */
+gboolean
+gtk_check_button_get_active (GtkCheckButton *self)
+{
+  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
+
+  g_return_val_if_fail (GTK_IS_CHECK_BUTTON (self), FALSE);
+
+  return priv->active;
+}
+
+static GtkCheckButton *
+get_group_next (GtkCheckButton *self)
+{
+  return ((GtkCheckButtonPrivate *)gtk_check_button_get_instance_private (self))->group_next;
+}
+
+static GtkCheckButton *
+get_group_prev (GtkCheckButton *self)
+{
+  return ((GtkCheckButtonPrivate *)gtk_check_button_get_instance_private (self))->group_prev;
+}
+
+/**
+ * gtk_check_button_set_active:
+ * @self: a #GtkCheckButton
+ * @setting: the new value to set
+ *
+ * Sets the new value of the #GtkCheckButton:active property.
+ * See also gtk_check_button_get_active()
+ */
+void
+gtk_check_button_set_active (GtkCheckButton *self,
+                             gboolean       setting)
+{
+  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
+
+  g_return_if_fail (GTK_IS_CHECK_BUTTON (self));
+
+  setting = !!setting;
+
+  if (setting == priv->active)
+    return;
+
+  if (setting)
+    {
+      gtk_widget_set_state_flags (GTK_WIDGET (self), GTK_STATE_FLAG_CHECKED, FALSE);
+      gtk_widget_set_state_flags (priv->indicator_widget, GTK_STATE_FLAG_CHECKED, FALSE);
+    }
+  else
+    {
+      gtk_widget_unset_state_flags (GTK_WIDGET (self), GTK_STATE_FLAG_CHECKED);
+      gtk_widget_unset_state_flags (priv->indicator_widget, GTK_STATE_FLAG_CHECKED);
+    }
+
+  if (setting && (priv->group_prev || priv->group_next))
+    {
+      GtkCheckButton *group_first = NULL;
+      GtkCheckButton *iter;
+
+      /* Find first in group */
+      iter = self;
+      while (iter)
+        {
+          group_first = iter;
+
+          iter = get_group_prev (iter);
+          if (!iter)
+            break;
+        }
+
+      g_assert (group_first);
+
+      /* Set all buttons in group to !active */
+      for (iter = group_first; iter; iter = get_group_next (iter))
+        gtk_check_button_set_active (iter, FALSE);
+
+      /* ... and the next code block will set this one to active */
+    }
+
+  update_accessible_state (self);
+  priv->active = setting;
+  g_object_notify_by_pspec (G_OBJECT (self), props[PROP_ACTIVE]);
+  g_signal_emit (self, signals[TOGGLED], 0);
+}
+
+const char *
+gtk_check_button_get_label (GtkCheckButton *self)
+{
+  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
+
+  g_return_val_if_fail (GTK_IS_CHECK_BUTTON (self), "");
+
+  return gtk_label_get_label (GTK_LABEL (priv->label_widget));
+}
+
+void
+gtk_check_button_set_label (GtkCheckButton *self,
+                            const char     *label)
+{
+  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
+
+  g_return_if_fail (GTK_IS_CHECK_BUTTON (self));
+
+  gtk_label_set_label (GTK_LABEL (priv->label_widget), label);
+  g_object_notify_by_pspec (G_OBJECT (self), props[PROP_LABEL]);
+}
+
+void
+gtk_check_button_set_group (GtkCheckButton *self,
+                            GtkCheckButton *group)
+{
+  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
+  GtkCheckButtonPrivate *group_priv = gtk_check_button_get_instance_private (group);
+
+  g_return_if_fail (GTK_IS_CHECK_BUTTON (self));
+
+  if (priv->group_next == group)
+    return;
+
+  if (!group)
+    {
+      if (priv->group_prev)
+        {
+          GtkCheckButtonPrivate *p = gtk_check_button_get_instance_private (priv->group_prev);
+          p->group_next = priv->group_next;
+        }
+      if (priv->group_next)
+        {
+          GtkCheckButtonPrivate *p = gtk_check_button_get_instance_private (priv->group_next);
+          p->group_prev = priv->group_prev;
+        }
+
+      priv->group_next = NULL;
+      priv->group_prev = NULL;
+      g_object_notify_by_pspec (G_OBJECT (self), props[PROP_GROUP]);
+
+      if (priv->indicator_widget)
+        gtk_css_node_set_name (gtk_widget_get_css_node (priv->indicator_widget),
+                               g_quark_from_static_string("check"));
+
+      return;
+    }
+
+  priv->group_prev = NULL;
+  if (group_priv->group_prev)
+    {
+      GtkCheckButtonPrivate *prev = gtk_check_button_get_instance_private (group_priv->group_prev);
+
+      prev->group_next = self;
+      priv->group_prev = group_priv->group_prev;
+    }
+
+  group_priv->group_prev = self;
+  priv->group_next = group;
+
+  if (priv->indicator_widget)
+    gtk_css_node_set_name (gtk_widget_get_css_node (priv->indicator_widget),
+                           g_quark_from_static_string("radio"));
+
+  gtk_css_node_set_name (gtk_widget_get_css_node (group_priv->indicator_widget),
+                         g_quark_from_static_string("radio"));
+
+  g_object_notify_by_pspec (G_OBJECT (self), props[PROP_GROUP]);
+}
+
+/**
+ * gtk_check_button_get_use_underline:
+ * @self: a #GtkCheckButton
+ *
+ * Returns the current value of the #GtkCheckButton:use-underline property.
+ *
+ * Returns: The value of the #GtkCheckButton:use-underline property.
+ *   See gtk_check_button_set_use_underline() for details on how to set a new value.
+ */
+gboolean
+gtk_check_button_get_use_underline (GtkCheckButton *self)
+{
+  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
+
+  g_return_val_if_fail (GTK_IS_CHECK_BUTTON (self), FALSE);
+
+  return priv->use_underline;
+}
+
+/**
+ * gtk_check_button_set_use_underline:
+ * @self: a #GtkCheckButton
+ * @setting: the new value to set
+ *
+ * Sets the new value of the #GtkCheckButton:use-underline property.
+ * See also gtk_check_button_get_use_underline()
+ */
+void
+gtk_check_button_set_use_underline (GtkCheckButton *self,
+                                    gboolean       setting)
+{
+  GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
+
+  g_return_if_fail (GTK_IS_CHECK_BUTTON (self));
+
+  setting = !!setting;
+
+  if (setting == priv->use_underline)
+    return;
+
+  priv->use_underline = setting;
+  g_object_notify_by_pspec (G_OBJECT (self), props[PROP_USE_UNDERLINE]);
+}
diff --git a/gtk/gtkcheckbutton.h b/gtk/gtkcheckbutton.h
index 2fd23b33c6..520b3e56d1 100644
--- a/gtk/gtkcheckbutton.h
+++ b/gtk/gtkcheckbutton.h
@@ -48,37 +48,57 @@ typedef struct _GtkCheckButtonClass  GtkCheckButtonClass;
 
 struct _GtkCheckButton
 {
-  GtkToggleButton toggle_button;
+  GtkWidget parent_instance;
 };
 
 struct _GtkCheckButtonClass
 {
-  GtkToggleButtonClass parent_class;
+  GtkWidgetClass parent_class;
 
-  /*< private >*/
+  void (* toggled) (GtkCheckButton *check_button);
 
+  /*< private >*/
   gpointer padding[8];
 };
 
 
 GDK_AVAILABLE_IN_ALL
-GType      gtk_check_button_get_type       (void) G_GNUC_CONST;
+GType           gtk_check_button_get_type           (void) G_GNUC_CONST;
+GDK_AVAILABLE_IN_ALL
+GtkWidget *     gtk_check_button_new                (void);
+GDK_AVAILABLE_IN_ALL
+GtkWidget *     gtk_check_button_new_with_label     (const char *label);
+GDK_AVAILABLE_IN_ALL
+GtkWidget *     gtk_check_button_new_with_mnemonic  (const char *label);
+GDK_AVAILABLE_IN_ALL
+void            gtk_check_button_set_draw_indicator (GtkCheckButton *check_button,
+                                                     gboolean        draw_indicator);
+GDK_AVAILABLE_IN_ALL
+gboolean        gtk_check_button_get_draw_indicator (GtkCheckButton *check_button);
+GDK_AVAILABLE_IN_ALL
+void            gtk_check_button_set_inconsistent   (GtkCheckButton *check_button,
+                                                     gboolean        inconsistent);
+GDK_AVAILABLE_IN_ALL
+gboolean        gtk_check_button_get_inconsistent   (GtkCheckButton *check_button);
+
 GDK_AVAILABLE_IN_ALL
-GtkWidget* gtk_check_button_new               (void);
+gboolean        gtk_check_button_get_active         (GtkCheckButton *self);
 GDK_AVAILABLE_IN_ALL
-GtkWidget* gtk_check_button_new_with_label    (const char *label);
+void            gtk_check_button_set_active         (GtkCheckButton *self,
+                                                     gboolean        setting);
 GDK_AVAILABLE_IN_ALL
-GtkWidget* gtk_check_button_new_with_mnemonic (const char *label);
+const char *    gtk_check_button_get_label          (GtkCheckButton *self);
 GDK_AVAILABLE_IN_ALL
-void       gtk_check_button_set_draw_indicator (GtkCheckButton *check_button,
-                                                gboolean        draw_indicator);
+void            gtk_check_button_set_label          (GtkCheckButton *self,
+                                                     const char     *label);
 GDK_AVAILABLE_IN_ALL
-gboolean   gtk_check_button_get_draw_indicator (GtkCheckButton *check_button);
+void            gtk_check_button_set_group          (GtkCheckButton *self,
+                                                     GtkCheckButton *group);
 GDK_AVAILABLE_IN_ALL
-void       gtk_check_button_set_inconsistent   (GtkCheckButton *check_button,
-                                                gboolean        inconsistent);
+gboolean        gtk_check_button_get_use_underline  (GtkCheckButton *self);
 GDK_AVAILABLE_IN_ALL
-gboolean   gtk_check_button_get_inconsistent   (GtkCheckButton *check_button);
+void            gtk_check_button_set_use_underline  (GtkCheckButton *self,
+                                                     gboolean        setting);
 
 G_END_DECLS
 
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index 6463a66520..2e88529a7c 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -1300,31 +1300,31 @@ set_inconsistent (GtkCheckButton *button,
 }
 
 static void
-feat_clicked (GtkWidget *feat,
-              gpointer   data)
+feat_pressed (GtkGestureClick *gesture,
+              int              n_press,
+              double           x,
+              double           y,
+              GtkWidget       *feat)
 {
-  g_signal_handlers_block_by_func (feat, feat_clicked, NULL);
+  const guint button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
 
-  if (gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (feat)))
+  if (button == GDK_BUTTON_PRIMARY)
     {
-      set_inconsistent (GTK_CHECK_BUTTON (feat), FALSE);
-      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (feat), TRUE);
-    }
-
-  g_signal_handlers_unblock_by_func (feat, feat_clicked, NULL);
-}
+      g_signal_handlers_block_by_func (feat, feat_pressed, NULL);
 
-static void
-feat_pressed (GtkGesture *gesture,
-              int         n_press,
-              double      x,
-              double      y,
-              GtkWidget  *feat)
-{
-  gboolean inconsistent;
+      if (gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (feat)))
+        {
+          set_inconsistent (GTK_CHECK_BUTTON (feat), FALSE);
+          gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (feat), TRUE);
+        }
 
-  inconsistent = gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (feat));
-  set_inconsistent (GTK_CHECK_BUTTON (feat), !inconsistent);
+      g_signal_handlers_unblock_by_func (feat, feat_pressed, NULL);
+    }
+  else if (button == GDK_BUTTON_SECONDARY)
+    {
+      gboolean inconsistent = gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (feat));
+      set_inconsistent (GTK_CHECK_BUTTON (feat), !inconsistent);
+    }
 }
 
 static char *
@@ -1543,7 +1543,6 @@ add_check_group (GtkFontChooserWidget *fontchooser,
       set_inconsistent (GTK_CHECK_BUTTON (feat), TRUE);
       g_signal_connect_swapped (feat, "notify::active", G_CALLBACK (update_font_features), fontchooser);
       g_signal_connect_swapped (feat, "notify::inconsistent", G_CALLBACK (update_font_features), 
fontchooser);
-      g_signal_connect (feat, "clicked", G_CALLBACK (feat_clicked), NULL);
 
       gesture = gtk_gesture_click_new ();
       gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
@@ -1785,7 +1784,7 @@ update_font_features (GtkFontChooserWidget *fontchooser)
 
           g_string_append_printf (s, "%s\"%s\" %d",
                                   s->len > 0 ? ", " : "", item->name,
-                                  gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (item->feat)));
+                                  gtk_check_button_get_active (GTK_CHECK_BUTTON (item->feat)));
         }
     }
 
diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c
index a986f3cc89..29c48e8a19 100644
--- a/gtk/gtkradiobutton.c
+++ b/gtk/gtkradiobutton.c
@@ -134,12 +134,12 @@ typedef struct _GtkRadioButtonClass         GtkRadioButtonClass;
 
 struct _GtkRadioButton
 {
-  GtkCheckButton parent_instance;
+  GtkToggleButton parent_instance;
 };
 
 struct _GtkRadioButtonClass
 {
-  GtkCheckButtonClass parent_class;
+  GtkToggleButtonClass parent_class;
 
   void (*group_changed) (GtkRadioButton *radio_button);
 };
@@ -167,16 +167,52 @@ static void     gtk_radio_button_dispose        (GObject             *object);
 static gboolean gtk_radio_button_focus          (GtkWidget           *widget,
                                                 GtkDirectionType     direction);
 static void     gtk_radio_button_clicked        (GtkButton           *button);
-static void     gtk_radio_button_set_property   (GObject             *object,
-                                                guint                prop_id,
-                                                const GValue        *value,
-                                                GParamSpec          *pspec);
-static void     gtk_radio_button_get_property   (GObject             *object,
-                                                guint                prop_id,
-                                                GValue              *value,
-                                                GParamSpec          *pspec);
 
-G_DEFINE_TYPE_WITH_PRIVATE (GtkRadioButton, gtk_radio_button, GTK_TYPE_CHECK_BUTTON)
+G_DEFINE_TYPE_WITH_PRIVATE (GtkRadioButton, gtk_radio_button, GTK_TYPE_TOGGLE_BUTTON)
+
+static void
+gtk_radio_button_set_property (GObject      *object,
+                               guint         prop_id,
+                               const GValue *value,
+                               GParamSpec   *pspec)
+{
+  GtkRadioButton *radio_button;
+
+  radio_button = GTK_RADIO_BUTTON (object);
+
+  switch (prop_id)
+    {
+      GSList *slist;
+      GtkRadioButton *button;
+
+    case PROP_GROUP:
+        button = g_value_get_object (value);
+
+      if (button)
+        slist = gtk_radio_button_get_group (button);
+      else
+        slist = NULL;
+      gtk_radio_button_set_group (radio_button, slist);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+gtk_radio_button_get_property (GObject    *object,
+                               guint       prop_id,
+                               GValue     *value,
+                               GParamSpec *pspec)
+{
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
 
 static void
 gtk_radio_button_class_init (GtkRadioButtonClass *class)
@@ -232,7 +268,6 @@ gtk_radio_button_class_init (GtkRadioButtonClass *class)
                                          NULL,
                                          G_TYPE_NONE, 0);
 
-  gtk_widget_class_set_css_name (widget_class, I_("radiobutton"));
   gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_RADIO);
 }
 
@@ -241,62 +276,12 @@ gtk_radio_button_init (GtkRadioButton *self)
 {
   GtkRadioButtonPrivate *priv = gtk_radio_button_get_instance_private (self);
   GtkWidget *widget = GTK_WIDGET (self);
-  GtkCssNode *css_node;
 
   gtk_widget_set_receives_default (widget, FALSE);
 
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self), TRUE);
 
   priv->group = g_slist_prepend (NULL, self);
-
-  css_node = gtk_widget_get_css_node (widget);
-  gtk_css_node_set_name (css_node, g_quark_from_static_string ("radiobutton"));
-  css_node = gtk_check_button_get_indicator_node (GTK_CHECK_BUTTON (self));
-  gtk_css_node_set_name (css_node, g_quark_from_static_string ("radio"));
-}
-
-static void
-gtk_radio_button_set_property (GObject      *object,
-                              guint         prop_id,
-                              const GValue *value,
-                              GParamSpec   *pspec)
-{
-  GtkRadioButton *radio_button;
-
-  radio_button = GTK_RADIO_BUTTON (object);
-
-  switch (prop_id)
-    {
-      GSList *slist;
-      GtkRadioButton *button;
-
-    case PROP_GROUP:
-        button = g_value_get_object (value);
-
-      if (button)
-       slist = gtk_radio_button_get_group (button);
-      else
-       slist = NULL;
-      gtk_radio_button_set_group (radio_button, slist);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-    }
-}
-
-static void
-gtk_radio_button_get_property (GObject    *object,
-                              guint       prop_id,
-                              GValue     *value,
-                              GParamSpec *pspec)
-{
-  switch (prop_id)
-    {
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-    }
 }
 
 /**
@@ -637,17 +622,16 @@ static gboolean
 gtk_radio_button_focus (GtkWidget         *widget,
                        GtkDirectionType   direction)
 {
-  GtkRadioButton *radio_button = GTK_RADIO_BUTTON (widget);
-  GtkRadioButtonPrivate *priv = gtk_radio_button_get_instance_private (radio_button);
-  GSList *tmp_slist;
-  GtkRadioButton *selected_button = NULL;
+  /*GtkRadioButton *radio_button = GTK_RADIO_BUTTON (widget);*/
+  /*GtkRadioButtonPrivate *priv = gtk_radio_button_get_instance_private (radio_button);*/
+  /*GSList *tmp_slist;*/
+  /*GtkRadioButton *selected_button = NULL;*/
 
   /* Radio buttons with draw_indicator unset focus "normally", since
    * they look like buttons to the user.
    */
-  if (!gtk_check_button_get_draw_indicator (GTK_CHECK_BUTTON (widget)))
-    return GTK_WIDGET_CLASS (gtk_radio_button_parent_class)->focus (widget, direction);
-
+  return GTK_WIDGET_CLASS (gtk_radio_button_parent_class)->focus (widget, direction);
+#if 0
   /* Find the currently active button in the group */
   tmp_slist = priv->group;
   while (tmp_slist)
@@ -721,6 +705,7 @@ gtk_radio_button_focus (GtkWidget         *widget,
       gtk_widget_grab_focus (widget);
       return TRUE;
     }
+#endif
 }
 
 static void
diff --git a/gtk/inspector/prop-editor.c b/gtk/inspector/prop-editor.c
index acea1268ac..51d78c5589 100644
--- a/gtk/inspector/prop-editor.c
+++ b/gtk/inspector/prop-editor.c
@@ -432,17 +432,17 @@ bool_modified (GtkToggleButton *tb, ObjectProperty *p)
 static void
 bool_changed (GObject *object, GParamSpec *pspec, gpointer data)
 {
-  GtkToggleButton *tb = GTK_TOGGLE_BUTTON (data);
+  GtkCheckButton *cb = GTK_CHECK_BUTTON (data);
   GValue val = G_VALUE_INIT;
 
   g_value_init (&val, G_TYPE_BOOLEAN);
   get_property_value (object, pspec, &val);
 
-  if (g_value_get_boolean (&val) != gtk_toggle_button_get_active (tb))
+  if (g_value_get_boolean (&val) != gtk_check_button_get_active (cb))
     {
-      block_controller (G_OBJECT (tb));
-      gtk_toggle_button_set_active (tb, g_value_get_boolean (&val));
-      unblock_controller (G_OBJECT (tb));
+      block_controller (G_OBJECT (cb));
+      gtk_check_button_set_active (cb, g_value_get_boolean (&val));
+      unblock_controller (G_OBJECT (cb));
     }
 
   g_value_unset (&val);
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index 429bd371f0..a4b370df65 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -2269,8 +2269,7 @@ switch {
   }
 }
 
-checkbutton,
-radiobutton {
+checkbutton {
   border-spacing: 4px;
   border-radius: $button_radius;
   transition: $focus_transition;
diff --git a/tests/testflowbox.c b/tests/testflowbox.c
index f2841bf301..c43f2a2575 100644
--- a/tests/testflowbox.c
+++ b/tests/testflowbox.c
@@ -279,10 +279,10 @@ items_changed (GtkComboBox   *box,
 }
 
 static void
-homogeneous_toggled (GtkToggleButton *button,
-                     GtkFlowBox      *flowbox)
+homogeneous_toggled (GtkCheckButton *button,
+                     GtkFlowBox     *flowbox)
 {
-  gboolean state = gtk_toggle_button_get_active (button);
+  gboolean state = gtk_check_button_get_active (button);
 
   gtk_flow_box_set_homogeneous (flowbox, state);
 }
@@ -327,10 +327,10 @@ filter_func (GtkFlowBoxChild *child, gpointer user_data)
 }
 
 static void
-filter_toggled (GtkToggleButton *button,
-                GtkFlowBox      *flowbox)
+filter_toggled (GtkCheckButton *button,
+                GtkFlowBox     *flowbox)
 {
-  gboolean state = gtk_toggle_button_get_active (button);
+  gboolean state = gtk_check_button_get_active (button);
 
   if (state)
     gtk_flow_box_set_filter_func (flowbox, filter_func, NULL, NULL);
@@ -351,10 +351,10 @@ sort_func (GtkFlowBoxChild *a,
 }
 
 static void
-sort_toggled (GtkToggleButton *button,
-              GtkFlowBox      *flowbox)
+sort_toggled (GtkCheckButton *button,
+              GtkFlowBox     *flowbox)
 {
-  gboolean state = gtk_toggle_button_get_active (button);
+  gboolean state = gtk_check_button_get_active (button);
 
   if (state)
     gtk_flow_box_set_sort_func (flowbox, sort_func, NULL, NULL);
@@ -409,7 +409,7 @@ create_window (void)
   gtk_box_append (GTK_BOX (vbox), expander);
 
   widget = gtk_check_button_new_with_label ("Homogeneous");
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
+  gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), FALSE);
 
   gtk_widget_set_tooltip_text (widget, "Set whether the items should be displayed at the same size");
   gtk_box_append (GTK_BOX (flowbox_cntl), widget);
@@ -418,7 +418,7 @@ create_window (void)
                     G_CALLBACK (homogeneous_toggled), flowbox);
 
   widget = gtk_check_button_new_with_label ("Activate on single click");
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
+  gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), FALSE);
   g_object_bind_property (widget, "active",
                           flowbox, "activate-on-single-click",
                           G_BINDING_SYNC_CREATE);
@@ -541,7 +541,7 @@ create_window (void)
   /* filtering and sorting */
 
   widget = gtk_check_button_new_with_label ("Filter");
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
+  gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), FALSE);
 
   gtk_widget_set_tooltip_text (widget, "Set whether some items should be filtered out");
   gtk_box_append (GTK_BOX (flowbox_cntl), widget);
@@ -550,7 +550,7 @@ create_window (void)
                     G_CALLBACK (filter_toggled), flowbox);
 
   widget = gtk_check_button_new_with_label ("Sort");
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
+  gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), FALSE);
 
   gtk_widget_set_tooltip_text (widget, "Set whether items should be sorted");
   gtk_box_append (GTK_BOX (flowbox_cntl), widget);
diff --git a/tests/testlogout.c b/tests/testlogout.c
index 67788debde..bf05fae7d1 100644
--- a/tests/testlogout.c
+++ b/tests/testlogout.c
@@ -21,13 +21,13 @@ inhibitor_toggled (GtkToggleButton *button, GtkApplication *app)
   reason = gtk_editable_get_text (GTK_EDITABLE (inhibit_entry));
 
   flags = 0;
-  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (inhibit_logout)))
+  if (gtk_check_button_get_active (GTK_CHECK_BUTTON (inhibit_logout)))
     flags |= GTK_APPLICATION_INHIBIT_LOGOUT;
-  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (inhibit_switch)))
+  if (gtk_check_button_get_active (GTK_CHECK_BUTTON (inhibit_switch)))
     flags |= GTK_APPLICATION_INHIBIT_SWITCH;
-  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (inhibit_suspend)))
+  if (gtk_check_button_get_active (GTK_CHECK_BUTTON (inhibit_suspend)))
     flags |= GTK_APPLICATION_INHIBIT_SUSPEND;
-  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (inhibit_idle)))
+  if (gtk_check_button_get_active (GTK_CHECK_BUTTON (inhibit_idle)))
     flags |= GTK_APPLICATION_INHIBIT_IDLE;
 
   toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (button)));
diff --git a/tests/testtextview2.c b/tests/testtextview2.c
index 97ab974a2b..16353ac366 100644
--- a/tests/testtextview2.c
+++ b/tests/testtextview2.c
@@ -147,7 +147,7 @@ update_mark_exists (void)
   pos = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (position_spin));
   gtk_text_buffer_get_iter_at_offset (buffer, &iter, pos);
 
-  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (mark_check)))
+  if (gtk_check_button_get_active (GTK_CHECK_BUTTON (mark_check)))
     gtk_text_buffer_add_mark (buffer, the_mark, &iter);
   else 
     gtk_text_buffer_delete_mark (buffer, the_mark);
@@ -156,7 +156,7 @@ update_mark_exists (void)
 static void
 update_mark_visible (void)
 {
-  gtk_text_mark_set_visible (the_mark, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (mark_visible)));
+  gtk_text_mark_set_visible (the_mark, gtk_check_button_get_active (GTK_CHECK_BUTTON (mark_visible)));
 }
 
 static void
diff --git a/testsuite/gtk/focus-chain/widget-factory.ui b/testsuite/gtk/focus-chain/widget-factory.ui
index c4b6ef8886..157a897c2f 100644
--- a/testsuite/gtk/focus-chain/widget-factory.ui
+++ b/testsuite/gtk/focus-chain/widget-factory.ui
@@ -38,7 +38,7 @@
             <attribute name="target">highcontrast-inverse</attribute>
           </item>
         </section>
-      </submenu> 
+      </submenu>
       <item>
         <attribute name="label" translatable="yes">Slide Pages</attribute>
         <attribute name="action">win.transition</attribute>
@@ -700,7 +700,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
                                   </object>
                                 </child>
                                 <child>
-                                  <object class="GtkRadioButton" id="radiobutton3">
+                                  <object class="GtkCheckButton" id="radiobutton3">
                                     <property name="label" translatable="yes">radiobutton</property>
                                     <property name="inconsistent">1</property>
                                     <property name="group">radiobutton1</property>
@@ -732,7 +732,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
                                   </object>
                                 </child>
                                 <child>
-                                  <object class="GtkRadioButton" id="radiobutton6">
+                                  <object class="GtkCheckButton" id="radiobutton6">
                                     <property name="label" translatable="yes">radiobutton</property>
                                     <property name="sensitive">0</property>
                                     <property name="inconsistent">1</property>


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