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.

Radiobutton && !draw-indicator => Togglebutton
Checkbutton && !draw-indicator => Togglebutton

Radiobutton && draw-indicator => CheckButton + group
This commit is contained in:
Timm Bäder 2020-08-07 05:45:30 +02:00
parent 51b398b960
commit 1375fb4464
28 changed files with 844 additions and 639 deletions

View File

@ -19,13 +19,11 @@
</style>
<child>
<object class="GtkRadioButton" id="text_radio">
<property name="draw-indicator">0</property>
<property name="label">Text</property>
</object>
</child>
<child>
<object class="GtkRadioButton" id="grid_radio">
<property name="draw-indicator">0</property>
<property name="label">Grid</property>
<property name="group">text_radio</property>
</object>

View File

@ -28,13 +28,11 @@
</style>
<child>
<object class="GtkRadioButton" id="normal_radio">
<property name="draw-indicator">0</property>
<property name="label" translatable="yes">Normal</property>
</object>
</child>
<child>
<object class="GtkRadioButton" id="symbolic_radio">
<property name="draw-indicator">0</property>
<property name="label" translatable="yes">Symbolic</property>
<property name="group">normal_radio</property>
<signal name="notify::active" handler="symbolic_toggled" swapped="yes" after="yes"/>

View File

@ -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">1</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>
@ -2228,7 +2228,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>
@ -2236,7 +2235,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>
@ -2889,6 +2887,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>

File diff suppressed because it is too large Load Diff

View File

@ -48,37 +48,52 @@ typedef struct _GtkCheckButtonClass GtkCheckButtonClass;
struct _GtkCheckButton
{
GtkToggleButton toggle_button;
GtkWidget parent_instance;
};
struct _GtkCheckButtonClass
{
GtkToggleButtonClass parent_class;
GtkWidgetClass parent_class;
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);
GtkWidget * gtk_check_button_new (void);
GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_check_button_new_with_label (const char *label);
GtkWidget * gtk_check_button_new_with_label (const char *label);
GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_check_button_new_with_mnemonic (const char *label);
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);
void gtk_check_button_set_inconsistent (GtkCheckButton *check_button,
gboolean inconsistent);
GDK_AVAILABLE_IN_ALL
gboolean gtk_check_button_get_draw_indicator (GtkCheckButton *check_button);
gboolean gtk_check_button_get_inconsistent (GtkCheckButton *check_button);
GDK_AVAILABLE_IN_ALL
void gtk_check_button_set_inconsistent (GtkCheckButton *check_button,
gboolean inconsistent);
gboolean gtk_check_button_get_active (GtkCheckButton *self);
GDK_AVAILABLE_IN_ALL
gboolean gtk_check_button_get_inconsistent (GtkCheckButton *check_button);
void gtk_check_button_set_active (GtkCheckButton *self,
gboolean setting);
GDK_AVAILABLE_IN_ALL
const char * gtk_check_button_get_label (GtkCheckButton *self);
GDK_AVAILABLE_IN_ALL
void gtk_check_button_set_label (GtkCheckButton *self,
const char *label);
GDK_AVAILABLE_IN_ALL
void gtk_check_button_set_group (GtkCheckButton *self,
GtkCheckButton *group);
GDK_AVAILABLE_IN_ALL
gboolean gtk_check_button_get_use_underline (GtkCheckButton *self);
GDK_AVAILABLE_IN_ALL
void gtk_check_button_set_use_underline (GtkCheckButton *self,
gboolean setting);
G_END_DECLS

View File

@ -1,40 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2015 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* 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/.
*/
#ifndef __GTK_CHECK_BUTTON_PRIVATE_H__
#define __GTK_CHECK_BUTTON_PRIVATE_H__
#include "gtkcheckbutton.h"
#include "gtkcssnodeprivate.h"
G_BEGIN_DECLS
GtkCssNode *gtk_check_button_get_indicator_node (GtkCheckButton *check_button);
G_END_DECLS
#endif /* __GTK_CHECK_BUTTON_PRIVATE_H__ */

View File

@ -146,7 +146,7 @@
* To create a closure expression, use the <closure> element. The `type` and `function`
* attributes specify what function to use for the closure, the content of the element
* contains the expressions for the parameters.
*
*
* Example:
* |[
* <closure type='gchararray' function='combine_args_somehow'>

View File

@ -1340,31 +1340,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_block_by_func (feat, feat_pressed, NULL);
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);
}
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);
}
g_signal_handlers_unblock_by_func (feat, feat_clicked, NULL);
}
static void
feat_pressed (GtkGesture *gesture,
int n_press,
double x,
double y,
GtkWidget *feat)
{
gboolean inconsistent;
inconsistent = gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (feat));
set_inconsistent (GTK_CHECK_BUTTON (feat), !inconsistent);
}
static char *
@ -1545,6 +1545,16 @@ update_feature_example (FeatureItem *item,
}
}
static void
font_feature_toggled_cb (GtkCheckButton *check_button,
gpointer user_data)
{
GtkFontChooserWidget *fontchooser = user_data;
set_inconsistent (check_button, FALSE);
update_font_features (fontchooser);
}
static void
add_check_group (GtkFontChooserWidget *fontchooser,
const char *title,
@ -1581,9 +1591,8 @@ add_check_group (GtkFontChooserWidget *fontchooser,
feat = gtk_check_button_new_with_label (get_feature_display_name (tag));
set_inconsistent (GTK_CHECK_BUTTON (feat), TRUE);
g_signal_connect_swapped (feat, "notify::active", G_CALLBACK (update_font_features), fontchooser);
g_signal_connect (feat, "toggled", G_CALLBACK (font_feature_toggled_cb), 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);
@ -1825,7 +1834,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)));
}
}

View File

@ -27,7 +27,6 @@
#include "gtkradiobutton.h"
#include "gtkwidgetprivate.h"
#include "gtkcheckbuttonprivate.h"
#include "gtklabel.h"
#include "gtkmarshalers.h"
#include "gtkprivate.h"
@ -40,7 +39,7 @@
* @Title: GtkRadioButton
* @See_also: #GtkComboBox
*
* A single radio button performs the same basic function as a #GtkCheckButton,
* A single radio button performs the same basic function as a #GtkToggleButton,
* as its position in the object hierarchy reflects. It is only when multiple
* radio buttons are grouped together that they become a different user
* interface component in their own right.
@ -134,12 +133,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);
};
@ -164,19 +163,53 @@ static GParamSpec *radio_button_props[LAST_PROP] = { NULL, };
static guint signals[N_SIGNALS] = { 0 };
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)
@ -207,8 +240,6 @@ gtk_radio_button_class_init (GtkRadioButtonClass *class)
g_object_class_install_properties (gobject_class, LAST_PROP, radio_button_props);
widget_class->focus = gtk_radio_button_focus;
button_class->clicked = gtk_radio_button_clicked;
class->group_changed = NULL;
@ -232,7 +263,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 +271,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;
}
}
/**
@ -633,96 +613,6 @@ gtk_radio_button_dispose (GObject *object)
G_OBJECT_CLASS (gtk_radio_button_parent_class)->dispose (object);
}
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;
/* 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);
/* Find the currently active button in the group */
tmp_slist = priv->group;
while (tmp_slist)
{
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tmp_slist->data)) &&
gtk_widget_get_visible (tmp_slist->data))
selected_button = tmp_slist->data;
tmp_slist = tmp_slist->next;
}
if (gtk_widget_is_focus (widget))
{
GPtrArray *child_array;
GtkWidget *new_focus = NULL;
GSList *l;
guint index;
gboolean found;
guint i;
if (direction == GTK_DIR_TAB_FORWARD ||
direction == GTK_DIR_TAB_BACKWARD)
return FALSE;
child_array = g_ptr_array_sized_new (g_slist_length (priv->group));
for (l = priv->group; l; l = l->next)
g_ptr_array_add (child_array, l->data);
gtk_widget_focus_sort (widget, direction, child_array);
found = g_ptr_array_find (child_array, widget, &index);
if (found)
{
/* Start at the *next* widget in the list */
if (index < child_array->len - 1)
index ++;
}
else
{
/* Search from the start of the list */
index = 0;
}
for (i = index; i < child_array->len; i ++)
{
GtkWidget *child = g_ptr_array_index (child_array, i);
if (gtk_widget_get_mapped (child) && gtk_widget_is_sensitive (child))
{
new_focus = child;
break;
}
}
if (new_focus)
{
gtk_widget_grab_focus (new_focus);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (new_focus), TRUE);
if (selected_button && selected_button != (GtkRadioButton *)new_focus)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (selected_button), FALSE);
}
g_ptr_array_free (child_array, TRUE);
return TRUE;
}
else
{
if (selected_button && selected_button != radio_button)
return FALSE;
gtk_widget_grab_focus (widget);
return TRUE;
}
}
static void
gtk_radio_button_clicked (GtkButton *button)
{

View File

@ -419,12 +419,13 @@ strv_changed (GObject *object, GParamSpec *pspec, gpointer data)
}
static void
bool_modified (GtkToggleButton *tb, ObjectProperty *p)
bool_modified (GtkCheckButton *cb,
ObjectProperty *p)
{
GValue val = G_VALUE_INIT;
g_value_init (&val, G_TYPE_BOOLEAN);
g_value_set_boolean (&val, gtk_toggle_button_get_active (tb));
g_value_set_boolean (&val, gtk_check_button_get_active (cb));
set_property_value (p->obj, p->spec, &val);
g_value_unset (&val);
}
@ -432,17 +433,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);
@ -583,8 +584,8 @@ flags_changed (GObject *object, GParamSpec *pspec, gpointer data)
for (child = gtk_widget_get_first_child (box), i = 0;
child != NULL;
child = gtk_widget_get_next_sibling (child), i++)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (child),
(fclass->values[i].value & flags) != 0);
gtk_check_button_set_active (GTK_CHECK_BUTTON (child),
(fclass->values[i].value & flags) != 0);
for (child = gtk_widget_get_first_child (box);
child != NULL;

View File

@ -2272,8 +2272,7 @@ switch {
}
}
checkbutton,
radiobutton {
checkbutton {
border-spacing: 4px;
border-radius: $button_radius;
transition: $focus_transition;

View File

@ -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);

View File

@ -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)));

View File

@ -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

View File

@ -19,7 +19,7 @@ check_button_checked (void)
gtk_test_accessible_assert_state (button, GTK_ACCESSIBLE_STATE_CHECKED, GTK_ACCESSIBLE_TRISTATE_FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (button), TRUE);
gtk_test_accessible_assert_state (button, GTK_ACCESSIBLE_STATE_CHECKED, GTK_ACCESSIBLE_TRISTATE_TRUE);

View File

@ -5,10 +5,10 @@ window.background:dir(ltr)
checkbutton.text-button:dir(ltr)
check:dir(ltr)
label:dir(ltr)
radiobutton.text-button:dir(ltr):checked
checkbutton.text-button:dir(ltr):checked
radio:dir(ltr):checked
label:dir(ltr)
radiobutton.text-button:dir(ltr)
checkbutton.text-button:dir(ltr)
radio:dir(ltr)
label:dir(ltr)
switch:dir(ltr):checked

View File

@ -28,7 +28,7 @@
</object>
</child>
<child>
<object class="GtkRadioButton" id="button3">
<object class="GtkCheckButton" id="button3">
<property name="label" translatable="yes">Hello World!</property>
<property name="can_focus">1</property>
<property name="active">1</property>
@ -40,7 +40,7 @@
</object>
</child>
<child>
<object class="GtkRadioButton" id="button4">
<object class="GtkCheckButton" id="button4">
<property name="label" translatable="yes">Hello World!</property>
<property name="group">button3</property>
<property name="can_focus">1</property>

View File

@ -1,8 +1,8 @@
window.background:dir(ltr)
box.vertical:dir(ltr)
checkbutton:dir(ltr)
checkbutton.text-button:dir(ltr)
check:dir(ltr)
label:dir(ltr)
radiobutton:dir(ltr):checked
radio:dir(ltr):checked
checkbutton.text-button:dir(ltr):checked
check:dir(ltr):checked
label:dir(ltr)

View File

@ -7,20 +7,13 @@
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton">
<child>
<object class="GtkLabel">
<property name="label">label</property>
</object>
</child>
<property name="label">label</property>
</object>
</child>
<child>
<object class="GtkRadioButton">
<child>
<object class="GtkLabel">
<property name="label">label</property>
</object>
</child>
<object class="GtkCheckButton">
<property name="active">1</property>
<property name="label">label</property>
</object>
</child>
</object>

View File

@ -1,8 +1,8 @@
window.background:dir(rtl)
box.vertical:dir(rtl)
checkbutton:dir(rtl)
checkbutton.text-button:dir(rtl)
check:dir(rtl)
label:dir(rtl)
radiobutton:dir(rtl):checked
radio:dir(rtl):checked
checkbutton.text-button:dir(rtl):checked
check:dir(rtl):checked
label:dir(rtl)

View File

@ -7,20 +7,13 @@
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton">
<child>
<object class="GtkLabel">
<property name="label">label</property>
</object>
</child>
<property name="label">label</property>
</object>
</child>
<child>
<object class="GtkRadioButton">
<child>
<object class="GtkLabel">
<property name="label">label</property>
</object>
</child>
<object class="GtkCheckButton">
<property name="active">1</property>
<property name="label">label</property>
</object>
</child>
</object>

View File

@ -2199,10 +2199,10 @@ test_property_bindings (void)
GObject *checkbutton, *button, *button2, *button3, *window;
builder = builder_new_from_string (buffer, -1, NULL);
checkbutton = gtk_builder_get_object (builder, "checkbutton");
g_assert (GTK_IS_CHECK_BUTTON (checkbutton));
g_assert (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton)));
g_assert (!gtk_check_button_get_active (GTK_CHECK_BUTTON (checkbutton)));
button = gtk_builder_get_object (builder, "button");
g_assert (GTK_IS_BUTTON (button));
@ -2216,7 +2216,7 @@ test_property_bindings (void)
g_assert (GTK_IS_BUTTON (button3));
g_assert (!gtk_widget_get_sensitive (GTK_WIDGET (button3)));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (checkbutton), TRUE);
g_assert (gtk_widget_get_sensitive (GTK_WIDGET (button)));
g_assert (gtk_widget_get_sensitive (GTK_WIDGET (button2)));
g_assert (gtk_widget_get_sensitive (GTK_WIDGET (button3)));

View File

@ -10,6 +10,8 @@ GtkSpinButton GtkText
GtkCheckButton
GtkRadioButton
GtkCheckButton
GtkRadioButton
GtkCheckButton
GtkCheckButton
GtkToggleButton
GtkToggleButton

View File

@ -20,6 +20,8 @@ GtkCheckButton
GtkCheckButton
GtkRadioButton
GtkCheckButton
GtkRadioButton
GtkCheckButton
GtkSpinButton GtkText
GtkToggleButton
GtkToggleButton

View File

@ -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>
@ -2236,7 +2236,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>
@ -2244,7 +2243,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>

View File

@ -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>
@ -701,7 +701,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>
@ -733,7 +733,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>
@ -2237,7 +2237,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>
@ -2245,7 +2244,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>

View File

@ -4,51 +4,6 @@
<object class="GtkWindow" id="window1">
<child>
<object class="GtkGrid" id="grid1">
<child>
<object class="GtkLabel" id="label1">
<property name="label" translatable="yes">Spinner</property>
<layout>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="label" translatable="yes">Check</property>
<layout>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="label" translatable="yes">Option</property>
<layout>
<property name="column">0</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="label" translatable="yes">Arrow</property>
<layout>
<property name="column">0</property>
<property name="row">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label5">
<property name="label" translatable="yes">Expander</property>
<layout>
<property name="column">0</property>
<property name="row">4</property>
</layout>
</object>
</child>
<child>
<object class="GtkImage" id="image1">
<property name="width_request">16</property>

View File

@ -4,15 +4,6 @@
<object class="GtkWindow" id="window1">
<child>
<object class="GtkGrid" id="grid1">
<child>
<object class="GtkLabel" id="label1">
<property name="label" translatable="yes">Spinner</property>
<layout>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkSpinner" id="spinner1">
<property name="halign">center</property>
@ -23,42 +14,6 @@
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="label" translatable="yes">Check</property>
<layout>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="label" translatable="yes">Option</property>
<layout>
<property name="column">0</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="label" translatable="yes">Arrow</property>
<layout>
<property name="column">0</property>
<property name="row">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label5">
<property name="label" translatable="yes">Expander</property>
<layout>
<property name="column">0</property>
<property name="row">4</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton1">
<property name="halign">center</property>
@ -70,7 +25,7 @@
</object>
</child>
<child>
<object class="GtkRadioButton" id="radiobutton1">
<object class="GtkCheckButton" id="radiobutton1">
<property name="active">1</property>
<property name="halign">center</property>
<property name="valign">center</property>