forked from AuroraMiddleware/gtk
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:
parent
51b398b960
commit
1375fb4464
@ -19,13 +19,11 @@
|
|||||||
</style>
|
</style>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="text_radio">
|
<object class="GtkRadioButton" id="text_radio">
|
||||||
<property name="draw-indicator">0</property>
|
|
||||||
<property name="label">Text</property>
|
<property name="label">Text</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="grid_radio">
|
<object class="GtkRadioButton" id="grid_radio">
|
||||||
<property name="draw-indicator">0</property>
|
|
||||||
<property name="label">Grid</property>
|
<property name="label">Grid</property>
|
||||||
<property name="group">text_radio</property>
|
<property name="group">text_radio</property>
|
||||||
</object>
|
</object>
|
||||||
|
@ -28,13 +28,11 @@
|
|||||||
</style>
|
</style>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="normal_radio">
|
<object class="GtkRadioButton" id="normal_radio">
|
||||||
<property name="draw-indicator">0</property>
|
|
||||||
<property name="label" translatable="yes">Normal</property>
|
<property name="label" translatable="yes">Normal</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="symbolic_radio">
|
<object class="GtkRadioButton" id="symbolic_radio">
|
||||||
<property name="draw-indicator">0</property>
|
|
||||||
<property name="label" translatable="yes">Symbolic</property>
|
<property name="label" translatable="yes">Symbolic</property>
|
||||||
<property name="group">normal_radio</property>
|
<property name="group">normal_radio</property>
|
||||||
<signal name="notify::active" handler="symbolic_toggled" swapped="yes" after="yes"/>
|
<signal name="notify::active" handler="symbolic_toggled" swapped="yes" after="yes"/>
|
||||||
|
@ -687,8 +687,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="radiobutton1">
|
<object class="GtkCheckButton" id="radiobutton1">
|
||||||
<property name="label" translatable="yes">radiobutton</property>
|
<property name="label" translatable="yes">checkbutton</property>
|
||||||
<property name="active">1</property>
|
<property name="active">1</property>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="column">1</property>
|
<property name="column">1</property>
|
||||||
@ -697,8 +697,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="radiobutton2">
|
<object class="GtkCheckButton">
|
||||||
<property name="label" translatable="yes">radiobutton</property>
|
<property name="label" translatable="yes">checkbutton</property>
|
||||||
<property name="group">radiobutton1</property>
|
<property name="group">radiobutton1</property>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="column">1</property>
|
<property name="column">1</property>
|
||||||
@ -707,8 +707,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="radiobutton3">
|
<object class="GtkCheckButton" id="radiobutton3">
|
||||||
<property name="label" translatable="yes">radiobutton</property>
|
<property name="label" translatable="yes">checkbutton</property>
|
||||||
<property name="inconsistent">1</property>
|
<property name="inconsistent">1</property>
|
||||||
<property name="group">radiobutton1</property>
|
<property name="group">radiobutton1</property>
|
||||||
<layout>
|
<layout>
|
||||||
@ -718,8 +718,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="radiobutton4">
|
<object class="GtkCheckButton" id="radiobutton4">
|
||||||
<property name="label" translatable="yes">radiobutton</property>
|
<property name="label" translatable="yes">checkbutton</property>
|
||||||
<property name="sensitive">0</property>
|
<property name="sensitive">0</property>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="column">1</property>
|
<property name="column">1</property>
|
||||||
@ -728,8 +728,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="radiobutton5">
|
<object class="GtkCheckButton" id="radiobutton5">
|
||||||
<property name="label" translatable="yes">radiobutton</property>
|
<property name="label" translatable="yes">checkbutton</property>
|
||||||
<property name="sensitive">0</property>
|
<property name="sensitive">0</property>
|
||||||
<property name="group">radiobutton3</property>
|
<property name="group">radiobutton3</property>
|
||||||
<layout>
|
<layout>
|
||||||
@ -739,7 +739,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="radiobutton6">
|
<object class="GtkCheckButton" id="radiobutton6">
|
||||||
<property name="label" translatable="yes">radiobutton</property>
|
<property name="label" translatable="yes">radiobutton</property>
|
||||||
<property name="sensitive">0</property>
|
<property name="sensitive">0</property>
|
||||||
<property name="inconsistent">1</property>
|
<property name="inconsistent">1</property>
|
||||||
@ -2228,7 +2228,6 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
</style>
|
</style>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="grid_button">
|
<object class="GtkRadioButton" id="grid_button">
|
||||||
<property name="draw-indicator">0</property>
|
|
||||||
<property name="active">1</property>
|
<property name="active">1</property>
|
||||||
<property name="icon-name">view-grid-symbolic</property>
|
<property name="icon-name">view-grid-symbolic</property>
|
||||||
</object>
|
</object>
|
||||||
@ -2236,7 +2235,6 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="list_button">
|
<object class="GtkRadioButton" id="list_button">
|
||||||
<property name="active">1</property>
|
<property name="active">1</property>
|
||||||
<property name="draw-indicator">0</property>
|
|
||||||
<property name="group">grid_button</property>
|
<property name="group">grid_button</property>
|
||||||
<property name="icon-name">view-list-symbolic</property>
|
<property name="icon-name">view-list-symbolic</property>
|
||||||
</object>
|
</object>
|
||||||
@ -2889,6 +2887,7 @@ bad things might happen.</property>
|
|||||||
<property name="use-underline">1</property>
|
<property name="use-underline">1</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<action-widgets>
|
<action-widgets>
|
||||||
<action-widget response="cancel">cancel_info_dialog</action-widget>
|
<action-widget response="cancel">cancel_info_dialog</action-widget>
|
||||||
<action-widget response="ok">doit_info_dialog</action-widget>
|
<action-widget response="ok">doit_info_dialog</action-widget>
|
||||||
|
@ -24,21 +24,18 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "gtkcheckbuttonprivate.h"
|
#include "gtkactionhelperprivate.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 "gtkradiobutton.h"
|
|
||||||
#include "gtkbuiltiniconprivate.h"
|
|
||||||
#include "gtkboxlayout.h"
|
#include "gtkboxlayout.h"
|
||||||
|
#include "gtkbuiltiniconprivate.h"
|
||||||
|
#include "gtkcssnodeprivate.h"
|
||||||
|
#include "gtkcssnumbervalueprivate.h"
|
||||||
|
#include "gtkgestureclick.h"
|
||||||
|
#include "gtkintl.h"
|
||||||
|
#include "gtklabel.h"
|
||||||
|
#include "gtkprivate.h"
|
||||||
|
#include "gtkradiobutton.h"
|
||||||
|
#include "gtkstylecontextprivate.h"
|
||||||
|
#include "gtkwidgetprivate.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:gtkcheckbutton
|
* SECTION:gtkcheckbutton
|
||||||
@ -46,33 +43,20 @@
|
|||||||
* @Title: GtkCheckButton
|
* @Title: GtkCheckButton
|
||||||
* @See_also: #GtkButton, #GtkToggleButton, #GtkRadioButton
|
* @See_also: #GtkButton, #GtkToggleButton, #GtkRadioButton
|
||||||
*
|
*
|
||||||
* A #GtkCheckButton places a discrete #GtkToggleButton next to a widget,
|
* A #GtkCheckButton places a label next to an indicator.
|
||||||
* (usually a #GtkLabel). See the section on #GtkToggleButton widgets for
|
|
||||||
* more information about toggle/check buttons.
|
|
||||||
*
|
|
||||||
* The important signal ( #GtkToggleButton::toggled ) is also inherited from
|
|
||||||
* #GtkToggleButton.
|
|
||||||
*
|
*
|
||||||
* # CSS nodes
|
* # CSS nodes
|
||||||
*
|
*
|
||||||
* |[<!-- language="plain" -->
|
* |[<!-- language="plain" -->
|
||||||
* checkbutton
|
* checkbutton[.text-button]
|
||||||
* ├── check
|
* ├── check
|
||||||
* ╰── <child>
|
* ╰── [label]
|
||||||
* ]|
|
* ]|
|
||||||
*
|
*
|
||||||
* A GtkCheckButton with indicator (see gtk_check_button_set_draw_indicator()) has a
|
* A #GtkCheckButton has a main node with name checkbutton. If the
|
||||||
* main CSS node with name checkbutton and a subnode with name check.
|
* #GtkCheckButton:label property is set, it contains a label child.
|
||||||
*
|
* The indicator node is named check when no group is set, and radio
|
||||||
* |[<!-- language="plain" -->
|
* if the checkbutton is grouped together with other checkbuttons.
|
||||||
* 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
|
* # Accessibility
|
||||||
*
|
*
|
||||||
@ -81,55 +65,83 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GtkWidget *indicator_widget;
|
GtkWidget *indicator_widget;
|
||||||
|
GtkWidget *label_widget;
|
||||||
|
|
||||||
guint draw_indicator : 1;
|
guint inconsistent: 1;
|
||||||
guint inconsistent : 1;
|
guint active: 1;
|
||||||
|
guint use_underline: 1;
|
||||||
|
|
||||||
|
GtkCheckButton *group_next;
|
||||||
|
GtkCheckButton *group_prev;
|
||||||
|
|
||||||
|
GtkActionHelper *action_helper;
|
||||||
} GtkCheckButtonPrivate;
|
} GtkCheckButtonPrivate;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_DRAW_INDICATOR,
|
PROP_ACTIVE,
|
||||||
|
PROP_GROUP,
|
||||||
|
PROP_LABEL,
|
||||||
PROP_INCONSISTENT,
|
PROP_INCONSISTENT,
|
||||||
NUM_PROPERTIES
|
PROP_USE_UNDERLINE,
|
||||||
|
|
||||||
|
/* actionable properties */
|
||||||
|
PROP_ACTION_NAME,
|
||||||
|
PROP_ACTION_TARGET,
|
||||||
|
LAST_PROP = PROP_ACTION_NAME
|
||||||
};
|
};
|
||||||
|
|
||||||
static GParamSpec *props[NUM_PROPERTIES] = { NULL, };
|
enum {
|
||||||
|
TOGGLED,
|
||||||
|
LAST_SIGNAL
|
||||||
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkCheckButton, gtk_check_button, GTK_TYPE_TOGGLE_BUTTON)
|
static void gtk_check_button_actionable_iface_init (GtkActionableInterface *iface);
|
||||||
|
|
||||||
|
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
|
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;
|
|
||||||
|
|
||||||
if (!priv->indicator_widget)
|
|
||||||
return;
|
|
||||||
|
|
||||||
state = gtk_widget_get_state_flags (widget);
|
|
||||||
|
|
||||||
gtk_widget_set_state_flags (priv->indicator_widget, state, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_check_button_state_flags_changed (GtkWidget *widget,
|
|
||||||
GtkStateFlags previous_state_flags)
|
|
||||||
{
|
|
||||||
gtk_check_button_update_node_state (widget);
|
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_check_button_parent_class)->state_flags_changed (widget, previous_state_flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_check_button_finalize (GObject *object)
|
|
||||||
{
|
{
|
||||||
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (object));
|
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (object));
|
||||||
|
|
||||||
g_clear_pointer (&priv->indicator_widget, gtk_widget_unparent);
|
g_clear_pointer (&priv->indicator_widget, gtk_widget_unparent);
|
||||||
|
g_clear_pointer (&priv->label_widget, gtk_widget_unparent);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gtk_check_button_parent_class)->finalize (object);
|
gtk_check_button_set_group (GTK_CHECK_BUTTON (object), NULL);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (gtk_check_button_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_check_button_set_action_name (GtkActionable *actionable,
|
||||||
|
const char *action_name)
|
||||||
|
{
|
||||||
|
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_action_helper_set_action_name (priv->action_helper, action_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_check_button_set_action_target_value (GtkActionable *actionable,
|
||||||
|
GVariant *action_target)
|
||||||
|
{
|
||||||
|
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_action_helper_set_action_target_value (priv->action_helper, action_target);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -140,14 +152,26 @@ gtk_check_button_set_property (GObject *object,
|
|||||||
{
|
{
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_DRAW_INDICATOR:
|
case PROP_ACTIVE:
|
||||||
gtk_check_button_set_draw_indicator (GTK_CHECK_BUTTON (object),
|
gtk_check_button_set_active (GTK_CHECK_BUTTON (object), g_value_get_boolean (value));
|
||||||
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;
|
break;
|
||||||
case PROP_INCONSISTENT:
|
case PROP_INCONSISTENT:
|
||||||
gtk_check_button_set_inconsistent (GTK_CHECK_BUTTON (object),
|
gtk_check_button_set_inconsistent (GTK_CHECK_BUTTON (object), g_value_get_boolean (value));
|
||||||
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;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
@ -161,20 +185,93 @@ gtk_check_button_get_property (GObject *object,
|
|||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
|
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (object));
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_DRAW_INDICATOR:
|
case PROP_ACTIVE:
|
||||||
g_value_set_boolean (value, gtk_check_button_get_draw_indicator (GTK_CHECK_BUTTON (object)));
|
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;
|
break;
|
||||||
case PROP_INCONSISTENT:
|
case PROP_INCONSISTENT:
|
||||||
g_value_set_boolean (value, gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (object)));
|
g_value_set_boolean (value, gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (object)));
|
||||||
break;
|
break;
|
||||||
|
case PROP_USE_UNDERLINE:
|
||||||
|
g_value_set_boolean (value, gtk_check_button_get_use_underline (GTK_CHECK_BUTTON (object)));
|
||||||
|
break;
|
||||||
|
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:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
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);
|
||||||
|
|
||||||
|
if (priv->active && priv->group_prev)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gtk_check_button_set_active (self, !priv->active);
|
||||||
|
|
||||||
|
if (priv->action_helper)
|
||||||
|
gtk_action_helper_activate (priv->action_helper);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_accessible_state (GtkCheckButton *check_button)
|
update_accessible_state (GtkCheckButton *check_button)
|
||||||
{
|
{
|
||||||
@ -184,7 +281,7 @@ update_accessible_state (GtkCheckButton *check_button)
|
|||||||
|
|
||||||
if (priv->inconsistent)
|
if (priv->inconsistent)
|
||||||
checked_state = GTK_ACCESSIBLE_TRISTATE_MIXED;
|
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;
|
checked_state = GTK_ACCESSIBLE_TRISTATE_TRUE;
|
||||||
else
|
else
|
||||||
checked_state = GTK_ACCESSIBLE_TRISTATE_FALSE;
|
checked_state = GTK_ACCESSIBLE_TRISTATE_FALSE;
|
||||||
@ -194,15 +291,128 @@ update_accessible_state (GtkCheckButton *check_button)
|
|||||||
-1);
|
-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)
|
static GtkCheckButton *
|
||||||
G_OBJECT_CLASS (gtk_check_button_parent_class)->notify (object, pspec);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GtkCheckButton *
|
||||||
|
get_group_first (GtkCheckButton *self)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
|
||||||
|
return group_first;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GtkCheckButton *
|
||||||
|
get_group_active_button (GtkCheckButton *self)
|
||||||
|
{
|
||||||
|
GtkCheckButton *iter;
|
||||||
|
|
||||||
|
for (iter = get_group_first (self); iter; iter = get_group_next (iter))
|
||||||
|
{
|
||||||
|
if (gtk_check_button_get_active (iter))
|
||||||
|
return iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_check_button_focus (GtkWidget *widget,
|
||||||
|
GtkDirectionType direction)
|
||||||
|
{
|
||||||
|
GtkCheckButton *self = GTK_CHECK_BUTTON (widget);
|
||||||
|
GtkCheckButton *active_button;
|
||||||
|
|
||||||
|
active_button = get_group_active_button (self);
|
||||||
|
|
||||||
|
if (gtk_widget_is_focus (widget))
|
||||||
|
{
|
||||||
|
GtkCheckButton *iter;
|
||||||
|
GPtrArray *child_array;
|
||||||
|
GtkWidget *new_focus = NULL;
|
||||||
|
guint index;
|
||||||
|
gboolean found;
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
if (direction == GTK_DIR_TAB_FORWARD ||
|
||||||
|
direction == GTK_DIR_TAB_BACKWARD)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
child_array = g_ptr_array_new ();
|
||||||
|
for (iter = get_group_first (self); iter; iter = get_group_next (iter))
|
||||||
|
g_ptr_array_add (child_array, iter);
|
||||||
|
|
||||||
|
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_check_button_set_active (GTK_CHECK_BUTTON (new_focus), TRUE);
|
||||||
|
if (active_button && active_button != (GtkCheckButton *)new_focus)
|
||||||
|
gtk_check_button_set_active (GTK_CHECK_BUTTON (active_button), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_ptr_array_free (child_array, TRUE);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (active_button && active_button != self)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
gtk_widget_grab_focus (widget);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -211,18 +421,29 @@ gtk_check_button_class_init (GtkCheckButtonClass *class)
|
|||||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||||
|
|
||||||
object_class->notify = gtk_check_button_notify;
|
object_class->dispose = gtk_check_button_dispose;
|
||||||
object_class->finalize = gtk_check_button_finalize;
|
|
||||||
object_class->set_property = gtk_check_button_set_property;
|
object_class->set_property = gtk_check_button_set_property;
|
||||||
object_class->get_property = gtk_check_button_get_property;
|
object_class->get_property = gtk_check_button_get_property;
|
||||||
|
|
||||||
widget_class->state_flags_changed = gtk_check_button_state_flags_changed;
|
widget_class->focus = gtk_check_button_focus;
|
||||||
|
|
||||||
props[PROP_DRAW_INDICATOR] =
|
props[PROP_ACTIVE] =
|
||||||
g_param_spec_boolean ("draw-indicator",
|
g_param_spec_boolean ("active",
|
||||||
P_("Draw Indicator"),
|
P_("Active"),
|
||||||
P_("If the indicator part of the button is displayed"),
|
P_("If the toggle button should be pressed in"),
|
||||||
TRUE,
|
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);
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||||
|
|
||||||
props[PROP_INCONSISTENT] =
|
props[PROP_INCONSISTENT] =
|
||||||
@ -232,7 +453,32 @@ gtk_check_button_class_init (GtkCheckButtonClass *class)
|
|||||||
FALSE,
|
FALSE,
|
||||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
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);
|
||||||
|
|
||||||
|
g_object_class_install_properties (object_class, LAST_PROP, props);
|
||||||
|
|
||||||
|
g_object_class_override_property (object_class, PROP_ACTION_NAME, "action-name");
|
||||||
|
g_object_class_override_property (object_class, PROP_ACTION_TARGET, "action-target");
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkCheckButton::toggled:
|
||||||
|
*
|
||||||
|
* Emitted when the buttons's #GtkCheckButton:active flag changes.
|
||||||
|
*/
|
||||||
|
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_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
|
||||||
gtk_widget_class_set_css_name (widget_class, I_("checkbutton"));
|
gtk_widget_class_set_css_name (widget_class, I_("checkbutton"));
|
||||||
@ -240,60 +486,29 @@ gtk_check_button_class_init (GtkCheckButtonClass *class)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
draw_indicator_changed (GtkCheckButton *check_button)
|
gtk_check_button_init (GtkCheckButton *self)
|
||||||
{
|
{
|
||||||
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (check_button);
|
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
|
||||||
GtkCssNode *widget_node;
|
GtkGesture *gesture;
|
||||||
|
|
||||||
widget_node = gtk_widget_get_css_node (GTK_WIDGET (check_button));
|
gtk_widget_set_receives_default (GTK_WIDGET (self), FALSE);
|
||||||
|
|
||||||
if (priv->draw_indicator)
|
|
||||||
{
|
|
||||||
priv->indicator_widget = gtk_builtin_icon_new ("check");
|
priv->indicator_widget = gtk_builtin_icon_new ("check");
|
||||||
gtk_widget_set_halign (priv->indicator_widget, GTK_ALIGN_CENTER);
|
gtk_widget_set_halign (priv->indicator_widget, GTK_ALIGN_CENTER);
|
||||||
gtk_widget_set_valign (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_set_parent (priv->indicator_widget, GTK_WIDGET (self));
|
||||||
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"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
update_accessible_state (self);
|
||||||
gtk_check_button_init (GtkCheckButton *check_button)
|
|
||||||
{
|
|
||||||
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (check_button);
|
|
||||||
|
|
||||||
gtk_widget_set_receives_default (GTK_WIDGET (check_button), FALSE);
|
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), self);
|
||||||
|
g_signal_connect (gesture, "released", G_CALLBACK (click_released_cb), self);
|
||||||
|
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture), GTK_PHASE_CAPTURE);
|
||||||
|
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
|
||||||
|
|
||||||
gtk_widget_remove_css_class (GTK_WIDGET (check_button), "toggle");
|
gtk_widget_set_focusable (GTK_WIDGET (self), 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -303,20 +518,20 @@ gtk_check_button_init (GtkCheckButton *check_button)
|
|||||||
*
|
*
|
||||||
* Returns: a #GtkWidget.
|
* Returns: a #GtkWidget.
|
||||||
*/
|
*/
|
||||||
GtkWidget*
|
GtkWidget *
|
||||||
gtk_check_button_new (void)
|
gtk_check_button_new (void)
|
||||||
{
|
{
|
||||||
return g_object_new (GTK_TYPE_CHECK_BUTTON, NULL);
|
return g_object_new (GTK_TYPE_CHECK_BUTTON, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_check_button_new_with_label:
|
* gtk_check_button_new_with_label:
|
||||||
* @label: the text for the check button.
|
* @label: (nullable): the text for the check button.
|
||||||
*
|
*
|
||||||
* Creates a new #GtkCheckButton with a #GtkLabel to the right of it.
|
* Creates a new #GtkCheckButton with a #GtkLabel next to it, if
|
||||||
|
* @label is non-%NULL.
|
||||||
*
|
*
|
||||||
* Returns: a #GtkWidget.
|
* Returns: a new #GtkCheckButton
|
||||||
*/
|
*/
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
gtk_check_button_new_with_label (const char *label)
|
gtk_check_button_new_with_label (const char *label)
|
||||||
@ -326,11 +541,10 @@ gtk_check_button_new_with_label (const char *label)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_check_button_new_with_mnemonic:
|
* gtk_check_button_new_with_mnemonic:
|
||||||
* @label: The text of the button, with an underscore in front of the
|
* @label: (nullable): The text of the button, with an underscore in front of the
|
||||||
* mnemonic character
|
* mnemonic character
|
||||||
*
|
*
|
||||||
* Creates a new #GtkCheckButton containing a label. The label
|
* Creates a new #GtkCheckButton containing a label. Underscores
|
||||||
* will be created using gtk_label_new_with_mnemonic(), so underscores
|
|
||||||
* in @label indicate the mnemonic for the check button.
|
* in @label indicate the mnemonic for the check button.
|
||||||
*
|
*
|
||||||
* Returns: a new #GtkCheckButton
|
* Returns: a new #GtkCheckButton
|
||||||
@ -344,60 +558,6 @@ gtk_check_button_new_with_mnemonic (const char *label)
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkCssNode *
|
|
||||||
gtk_check_button_get_indicator_node (GtkCheckButton *check_button)
|
|
||||||
{
|
|
||||||
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (check_button);
|
|
||||||
|
|
||||||
return gtk_widget_get_css_node (priv->indicator_widget);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gtk_check_button_set_draw_indicator:
|
|
||||||
* @check_button: a #GtkCheckButton
|
|
||||||
* @draw_indicator: Whether or not to draw the indicator part of the button
|
|
||||||
*
|
|
||||||
* Sets whether the indicator part of the button is drawn. This is important for
|
|
||||||
* cases where the check button should have the functionality of a check button,
|
|
||||||
* but the visuals of a regular button, like in a #GtkStackSwitcher.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gtk_check_button_set_draw_indicator (GtkCheckButton *check_button,
|
|
||||||
gboolean draw_indicator)
|
|
||||||
{
|
|
||||||
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (check_button);
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CHECK_BUTTON (check_button));
|
|
||||||
|
|
||||||
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]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gtk_check_button_get_draw_indicator:
|
|
||||||
* @check_button: a #GtkCheckButton
|
|
||||||
*
|
|
||||||
* Returns Whether or not the indicator part of the button gets drawn.
|
|
||||||
*
|
|
||||||
* Returns: The value of the GtkCheckButton:draw-indicator property.
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gtk_check_button_get_draw_indicator (GtkCheckButton *check_button)
|
|
||||||
{
|
|
||||||
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (check_button);
|
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_CHECK_BUTTON (check_button), FALSE);
|
|
||||||
|
|
||||||
return priv->draw_indicator;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_check_button_set_inconsistent:
|
* gtk_check_button_set_inconsistent:
|
||||||
* @check_button: a #GtkCheckButton
|
* @check_button: a #GtkCheckButton
|
||||||
@ -426,9 +586,15 @@ gtk_check_button_set_inconsistent (GtkCheckButton *check_button,
|
|||||||
priv->inconsistent = inconsistent;
|
priv->inconsistent = inconsistent;
|
||||||
|
|
||||||
if (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
|
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);
|
update_accessible_state (check_button);
|
||||||
|
|
||||||
@ -453,3 +619,277 @@ gtk_check_button_get_inconsistent (GtkCheckButton *check_button)
|
|||||||
|
|
||||||
return priv->inconsistent;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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().
|
||||||
|
*
|
||||||
|
* Setting #GtkCheckButton:active to %TRUE will add the `:checked:` state to
|
||||||
|
* both the checkbutton and the indicator CSS node.
|
||||||
|
*/
|
||||||
|
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 */
|
||||||
|
}
|
||||||
|
|
||||||
|
priv->active = setting;
|
||||||
|
update_accessible_state (self);
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_ACTIVE]);
|
||||||
|
g_signal_emit (self, signals[TOGGLED], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_check_button_get_label:
|
||||||
|
* @self: a #GtkCheckButton
|
||||||
|
*
|
||||||
|
* Returns the label of the checkbutton.
|
||||||
|
*
|
||||||
|
* Returns: (nullable) (transfer none): The label @self shows next to the indicator.
|
||||||
|
* If no label is shown, %NULL will be returned.
|
||||||
|
*/
|
||||||
|
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), "");
|
||||||
|
|
||||||
|
if (priv->label_widget)
|
||||||
|
return gtk_label_get_label (GTK_LABEL (priv->label_widget));
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_check_button_set_label:
|
||||||
|
* @self: a #GtkCheckButton
|
||||||
|
* @label: (nullable): The text shown next to the indicator, or %NULL
|
||||||
|
* to show no text
|
||||||
|
*
|
||||||
|
* Sets the text of @self. If #GtkCheckButton:use-underline is %TRUE,
|
||||||
|
* the underscore in @label is interpreted as mnemonic indicator,
|
||||||
|
* see gtk_check_button_set_use_underline() for details on this behavior.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
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));
|
||||||
|
|
||||||
|
if (label == NULL || label[0] == '\0')
|
||||||
|
{
|
||||||
|
g_clear_pointer (&priv->label_widget, gtk_widget_unparent);
|
||||||
|
gtk_widget_remove_css_class (GTK_WIDGET (self), "text-button");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!priv->label_widget)
|
||||||
|
{
|
||||||
|
priv->label_widget = gtk_label_new (NULL);
|
||||||
|
gtk_widget_set_hexpand (priv->label_widget, TRUE);
|
||||||
|
gtk_label_set_xalign (GTK_LABEL (priv->label_widget), 0.0f);
|
||||||
|
gtk_label_set_use_underline (GTK_LABEL (priv->label_widget), priv->use_underline);
|
||||||
|
gtk_widget_insert_after (priv->label_widget, GTK_WIDGET (self), priv->indicator_widget);
|
||||||
|
}
|
||||||
|
gtk_widget_add_css_class (GTK_WIDGET (self), "text-button");
|
||||||
|
gtk_label_set_label (GTK_LABEL (priv->label_widget), label);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, label,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_LABEL]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_check_button_set_group:
|
||||||
|
* @self: a #GtkCheckButton
|
||||||
|
* @group: (nullable) (transfer none): another #GtkCheckButton to
|
||||||
|
* form a group with
|
||||||
|
*
|
||||||
|
* Adds @self to the group of @group. In a group of multiple check buttons,
|
||||||
|
* only one button can be active at a time.
|
||||||
|
*
|
||||||
|
* Setting the group of a check button also changes the css name of the
|
||||||
|
* indicator widget's CSS node to 'radio'.
|
||||||
|
*
|
||||||
|
* The behavior of a checkbutton in a group is also commonly known as a 'radio button'.
|
||||||
|
*/
|
||||||
|
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 (!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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priv->group_next == group)
|
||||||
|
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().
|
||||||
|
*
|
||||||
|
* If @setting is %TRUE, an underscore character in @self's label indicates
|
||||||
|
* a mnemonic accelerator key. This behavior is similar to #GtkLabel: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;
|
||||||
|
if (priv->label_widget)
|
||||||
|
gtk_label_set_use_underline (GTK_LABEL (priv->label_widget), priv->use_underline);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_USE_UNDERLINE]);
|
||||||
|
}
|
||||||
|
@ -48,15 +48,16 @@ typedef struct _GtkCheckButtonClass GtkCheckButtonClass;
|
|||||||
|
|
||||||
struct _GtkCheckButton
|
struct _GtkCheckButton
|
||||||
{
|
{
|
||||||
GtkToggleButton toggle_button;
|
GtkWidget parent_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkCheckButtonClass
|
struct _GtkCheckButtonClass
|
||||||
{
|
{
|
||||||
GtkToggleButtonClass parent_class;
|
GtkWidgetClass parent_class;
|
||||||
|
|
||||||
|
void (* toggled) (GtkCheckButton *check_button);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
|
|
||||||
gpointer padding[8];
|
gpointer padding[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -64,22 +65,36 @@ struct _GtkCheckButtonClass
|
|||||||
GDK_AVAILABLE_IN_ALL
|
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
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkWidget* gtk_check_button_new (void);
|
GtkWidget * gtk_check_button_new (void);
|
||||||
GDK_AVAILABLE_IN_ALL
|
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
|
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);
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
|
||||||
gboolean gtk_check_button_get_draw_indicator (GtkCheckButton *check_button);
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_check_button_set_inconsistent (GtkCheckButton *check_button,
|
void gtk_check_button_set_inconsistent (GtkCheckButton *check_button,
|
||||||
gboolean inconsistent);
|
gboolean inconsistent);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gboolean gtk_check_button_get_inconsistent (GtkCheckButton *check_button);
|
gboolean gtk_check_button_get_inconsistent (GtkCheckButton *check_button);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
gboolean gtk_check_button_get_active (GtkCheckButton *self);
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GTK_CHECK_BUTTON_H__ */
|
#endif /* __GTK_CHECK_BUTTON_H__ */
|
||||||
|
@ -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__ */
|
|
@ -1340,10 +1340,17 @@ set_inconsistent (GtkCheckButton *button,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
feat_clicked (GtkWidget *feat,
|
feat_pressed (GtkGestureClick *gesture,
|
||||||
gpointer data)
|
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 (button == GDK_BUTTON_PRIMARY)
|
||||||
|
{
|
||||||
|
g_signal_handlers_block_by_func (feat, feat_pressed, NULL);
|
||||||
|
|
||||||
if (gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (feat)))
|
if (gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (feat)))
|
||||||
{
|
{
|
||||||
@ -1351,20 +1358,13 @@ feat_clicked (GtkWidget *feat,
|
|||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (feat), TRUE);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (feat), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_signal_handlers_unblock_by_func (feat, feat_clicked, NULL);
|
g_signal_handlers_unblock_by_func (feat, feat_pressed, NULL);
|
||||||
}
|
}
|
||||||
|
else if (button == GDK_BUTTON_SECONDARY)
|
||||||
static void
|
{
|
||||||
feat_pressed (GtkGesture *gesture,
|
gboolean inconsistent = gtk_check_button_get_inconsistent (GTK_CHECK_BUTTON (feat));
|
||||||
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);
|
set_inconsistent (GTK_CHECK_BUTTON (feat), !inconsistent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
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
|
static void
|
||||||
add_check_group (GtkFontChooserWidget *fontchooser,
|
add_check_group (GtkFontChooserWidget *fontchooser,
|
||||||
const char *title,
|
const char *title,
|
||||||
@ -1581,9 +1591,8 @@ add_check_group (GtkFontChooserWidget *fontchooser,
|
|||||||
|
|
||||||
feat = gtk_check_button_new_with_label (get_feature_display_name (tag));
|
feat = gtk_check_button_new_with_label (get_feature_display_name (tag));
|
||||||
set_inconsistent (GTK_CHECK_BUTTON (feat), TRUE);
|
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_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 ();
|
gesture = gtk_gesture_click_new ();
|
||||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
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",
|
g_string_append_printf (s, "%s\"%s\" %d",
|
||||||
s->len > 0 ? ", " : "", item->name,
|
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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "gtkradiobutton.h"
|
#include "gtkradiobutton.h"
|
||||||
|
|
||||||
#include "gtkwidgetprivate.h"
|
#include "gtkwidgetprivate.h"
|
||||||
#include "gtkcheckbuttonprivate.h"
|
|
||||||
#include "gtklabel.h"
|
#include "gtklabel.h"
|
||||||
#include "gtkmarshalers.h"
|
#include "gtkmarshalers.h"
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
@ -40,7 +39,7 @@
|
|||||||
* @Title: GtkRadioButton
|
* @Title: GtkRadioButton
|
||||||
* @See_also: #GtkComboBox
|
* @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
|
* as its position in the object hierarchy reflects. It is only when multiple
|
||||||
* radio buttons are grouped together that they become a different user
|
* radio buttons are grouped together that they become a different user
|
||||||
* interface component in their own right.
|
* interface component in their own right.
|
||||||
@ -134,12 +133,12 @@ typedef struct _GtkRadioButtonClass GtkRadioButtonClass;
|
|||||||
|
|
||||||
struct _GtkRadioButton
|
struct _GtkRadioButton
|
||||||
{
|
{
|
||||||
GtkCheckButton parent_instance;
|
GtkToggleButton parent_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkRadioButtonClass
|
struct _GtkRadioButtonClass
|
||||||
{
|
{
|
||||||
GtkCheckButtonClass parent_class;
|
GtkToggleButtonClass parent_class;
|
||||||
|
|
||||||
void (*group_changed) (GtkRadioButton *radio_button);
|
void (*group_changed) (GtkRadioButton *radio_button);
|
||||||
};
|
};
|
||||||
@ -164,96 +163,9 @@ static GParamSpec *radio_button_props[LAST_PROP] = { NULL, };
|
|||||||
static guint signals[N_SIGNALS] = { 0 };
|
static guint signals[N_SIGNALS] = { 0 };
|
||||||
|
|
||||||
static void gtk_radio_button_dispose (GObject *object);
|
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_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_class_init (GtkRadioButtonClass *class)
|
|
||||||
{
|
|
||||||
GObjectClass *gobject_class;
|
|
||||||
GtkButtonClass *button_class;
|
|
||||||
GtkWidgetClass *widget_class;
|
|
||||||
|
|
||||||
gobject_class = G_OBJECT_CLASS (class);
|
|
||||||
widget_class = (GtkWidgetClass*) class;
|
|
||||||
button_class = (GtkButtonClass*) class;
|
|
||||||
|
|
||||||
gobject_class->dispose = gtk_radio_button_dispose;
|
|
||||||
gobject_class->set_property = gtk_radio_button_set_property;
|
|
||||||
gobject_class->get_property = gtk_radio_button_get_property;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GtkRadioButton:group:
|
|
||||||
*
|
|
||||||
* Sets a new group for a radio button.
|
|
||||||
*/
|
|
||||||
radio_button_props[PROP_GROUP] =
|
|
||||||
g_param_spec_object ("group",
|
|
||||||
P_("Group"),
|
|
||||||
P_("The radio button whose group this widget belongs to."),
|
|
||||||
GTK_TYPE_RADIO_BUTTON,
|
|
||||||
GTK_PARAM_WRITABLE);
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GtkRadioButton::group-changed:
|
|
||||||
* @button: the object which received the signal
|
|
||||||
*
|
|
||||||
* Emitted when the group of radio buttons that a radio button belongs
|
|
||||||
* to changes. This is emitted when a radio button switches from
|
|
||||||
* being alone to being part of a group of 2 or more buttons, or
|
|
||||||
* vice-versa, and when a button is moved from one group of 2 or
|
|
||||||
* more buttons to a different one, but not when the composition
|
|
||||||
* of the group that a button belongs to changes.
|
|
||||||
*/
|
|
||||||
signals[GROUP_CHANGED] = g_signal_new (I_("group-changed"),
|
|
||||||
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
||||||
G_SIGNAL_RUN_FIRST,
|
|
||||||
G_STRUCT_OFFSET (GtkRadioButtonClass, group_changed),
|
|
||||||
NULL, NULL,
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
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
|
static void
|
||||||
gtk_radio_button_set_property (GObject *object,
|
gtk_radio_button_set_property (GObject *object,
|
||||||
@ -299,6 +211,74 @@ gtk_radio_button_get_property (GObject *object,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_radio_button_class_init (GtkRadioButtonClass *class)
|
||||||
|
{
|
||||||
|
GObjectClass *gobject_class;
|
||||||
|
GtkButtonClass *button_class;
|
||||||
|
GtkWidgetClass *widget_class;
|
||||||
|
|
||||||
|
gobject_class = G_OBJECT_CLASS (class);
|
||||||
|
widget_class = (GtkWidgetClass*) class;
|
||||||
|
button_class = (GtkButtonClass*) class;
|
||||||
|
|
||||||
|
gobject_class->dispose = gtk_radio_button_dispose;
|
||||||
|
gobject_class->set_property = gtk_radio_button_set_property;
|
||||||
|
gobject_class->get_property = gtk_radio_button_get_property;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkRadioButton:group:
|
||||||
|
*
|
||||||
|
* Sets a new group for a radio button.
|
||||||
|
*/
|
||||||
|
radio_button_props[PROP_GROUP] =
|
||||||
|
g_param_spec_object ("group",
|
||||||
|
P_("Group"),
|
||||||
|
P_("The radio button whose group this widget belongs to."),
|
||||||
|
GTK_TYPE_RADIO_BUTTON,
|
||||||
|
GTK_PARAM_WRITABLE);
|
||||||
|
|
||||||
|
g_object_class_install_properties (gobject_class, LAST_PROP, radio_button_props);
|
||||||
|
|
||||||
|
button_class->clicked = gtk_radio_button_clicked;
|
||||||
|
|
||||||
|
class->group_changed = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkRadioButton::group-changed:
|
||||||
|
* @button: the object which received the signal
|
||||||
|
*
|
||||||
|
* Emitted when the group of radio buttons that a radio button belongs
|
||||||
|
* to changes. This is emitted when a radio button switches from
|
||||||
|
* being alone to being part of a group of 2 or more buttons, or
|
||||||
|
* vice-versa, and when a button is moved from one group of 2 or
|
||||||
|
* more buttons to a different one, but not when the composition
|
||||||
|
* of the group that a button belongs to changes.
|
||||||
|
*/
|
||||||
|
signals[GROUP_CHANGED] = g_signal_new (I_("group-changed"),
|
||||||
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
||||||
|
G_SIGNAL_RUN_FIRST,
|
||||||
|
G_STRUCT_OFFSET (GtkRadioButtonClass, group_changed),
|
||||||
|
NULL, NULL,
|
||||||
|
NULL,
|
||||||
|
G_TYPE_NONE, 0);
|
||||||
|
|
||||||
|
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_RADIO);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_radio_button_init (GtkRadioButton *self)
|
||||||
|
{
|
||||||
|
GtkRadioButtonPrivate *priv = gtk_radio_button_get_instance_private (self);
|
||||||
|
GtkWidget *widget = GTK_WIDGET (self);
|
||||||
|
|
||||||
|
gtk_widget_set_receives_default (widget, FALSE);
|
||||||
|
|
||||||
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self), TRUE);
|
||||||
|
|
||||||
|
priv->group = g_slist_prepend (NULL, self);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_radio_button_set_group:
|
* gtk_radio_button_set_group:
|
||||||
* @radio_button: a #GtkRadioButton.
|
* @radio_button: a #GtkRadioButton.
|
||||||
@ -633,96 +613,6 @@ gtk_radio_button_dispose (GObject *object)
|
|||||||
G_OBJECT_CLASS (gtk_radio_button_parent_class)->dispose (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
|
static void
|
||||||
gtk_radio_button_clicked (GtkButton *button)
|
gtk_radio_button_clicked (GtkButton *button)
|
||||||
{
|
{
|
||||||
|
@ -419,12 +419,13 @@ strv_changed (GObject *object, GParamSpec *pspec, gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bool_modified (GtkToggleButton *tb, ObjectProperty *p)
|
bool_modified (GtkCheckButton *cb,
|
||||||
|
ObjectProperty *p)
|
||||||
{
|
{
|
||||||
GValue val = G_VALUE_INIT;
|
GValue val = G_VALUE_INIT;
|
||||||
|
|
||||||
g_value_init (&val, G_TYPE_BOOLEAN);
|
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);
|
set_property_value (p->obj, p->spec, &val);
|
||||||
g_value_unset (&val);
|
g_value_unset (&val);
|
||||||
}
|
}
|
||||||
@ -432,17 +433,17 @@ bool_modified (GtkToggleButton *tb, ObjectProperty *p)
|
|||||||
static void
|
static void
|
||||||
bool_changed (GObject *object, GParamSpec *pspec, gpointer data)
|
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;
|
GValue val = G_VALUE_INIT;
|
||||||
|
|
||||||
g_value_init (&val, G_TYPE_BOOLEAN);
|
g_value_init (&val, G_TYPE_BOOLEAN);
|
||||||
get_property_value (object, pspec, &val);
|
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));
|
block_controller (G_OBJECT (cb));
|
||||||
gtk_toggle_button_set_active (tb, g_value_get_boolean (&val));
|
gtk_check_button_set_active (cb, g_value_get_boolean (&val));
|
||||||
unblock_controller (G_OBJECT (tb));
|
unblock_controller (G_OBJECT (cb));
|
||||||
}
|
}
|
||||||
|
|
||||||
g_value_unset (&val);
|
g_value_unset (&val);
|
||||||
@ -583,7 +584,7 @@ flags_changed (GObject *object, GParamSpec *pspec, gpointer data)
|
|||||||
for (child = gtk_widget_get_first_child (box), i = 0;
|
for (child = gtk_widget_get_first_child (box), i = 0;
|
||||||
child != NULL;
|
child != NULL;
|
||||||
child = gtk_widget_get_next_sibling (child), i++)
|
child = gtk_widget_get_next_sibling (child), i++)
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (child),
|
gtk_check_button_set_active (GTK_CHECK_BUTTON (child),
|
||||||
(fclass->values[i].value & flags) != 0);
|
(fclass->values[i].value & flags) != 0);
|
||||||
|
|
||||||
for (child = gtk_widget_get_first_child (box);
|
for (child = gtk_widget_get_first_child (box);
|
||||||
|
@ -2272,8 +2272,7 @@ switch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkbutton,
|
checkbutton {
|
||||||
radiobutton {
|
|
||||||
border-spacing: 4px;
|
border-spacing: 4px;
|
||||||
border-radius: $button_radius;
|
border-radius: $button_radius;
|
||||||
transition: $focus_transition;
|
transition: $focus_transition;
|
||||||
|
@ -279,10 +279,10 @@ items_changed (GtkComboBox *box,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
homogeneous_toggled (GtkToggleButton *button,
|
homogeneous_toggled (GtkCheckButton *button,
|
||||||
GtkFlowBox *flowbox)
|
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);
|
gtk_flow_box_set_homogeneous (flowbox, state);
|
||||||
}
|
}
|
||||||
@ -327,10 +327,10 @@ filter_func (GtkFlowBoxChild *child, gpointer user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
filter_toggled (GtkToggleButton *button,
|
filter_toggled (GtkCheckButton *button,
|
||||||
GtkFlowBox *flowbox)
|
GtkFlowBox *flowbox)
|
||||||
{
|
{
|
||||||
gboolean state = gtk_toggle_button_get_active (button);
|
gboolean state = gtk_check_button_get_active (button);
|
||||||
|
|
||||||
if (state)
|
if (state)
|
||||||
gtk_flow_box_set_filter_func (flowbox, filter_func, NULL, NULL);
|
gtk_flow_box_set_filter_func (flowbox, filter_func, NULL, NULL);
|
||||||
@ -351,10 +351,10 @@ sort_func (GtkFlowBoxChild *a,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sort_toggled (GtkToggleButton *button,
|
sort_toggled (GtkCheckButton *button,
|
||||||
GtkFlowBox *flowbox)
|
GtkFlowBox *flowbox)
|
||||||
{
|
{
|
||||||
gboolean state = gtk_toggle_button_get_active (button);
|
gboolean state = gtk_check_button_get_active (button);
|
||||||
|
|
||||||
if (state)
|
if (state)
|
||||||
gtk_flow_box_set_sort_func (flowbox, sort_func, NULL, NULL);
|
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);
|
gtk_box_append (GTK_BOX (vbox), expander);
|
||||||
|
|
||||||
widget = gtk_check_button_new_with_label ("Homogeneous");
|
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_widget_set_tooltip_text (widget, "Set whether the items should be displayed at the same size");
|
||||||
gtk_box_append (GTK_BOX (flowbox_cntl), widget);
|
gtk_box_append (GTK_BOX (flowbox_cntl), widget);
|
||||||
@ -418,7 +418,7 @@ create_window (void)
|
|||||||
G_CALLBACK (homogeneous_toggled), flowbox);
|
G_CALLBACK (homogeneous_toggled), flowbox);
|
||||||
|
|
||||||
widget = gtk_check_button_new_with_label ("Activate on single click");
|
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",
|
g_object_bind_property (widget, "active",
|
||||||
flowbox, "activate-on-single-click",
|
flowbox, "activate-on-single-click",
|
||||||
G_BINDING_SYNC_CREATE);
|
G_BINDING_SYNC_CREATE);
|
||||||
@ -541,7 +541,7 @@ create_window (void)
|
|||||||
/* filtering and sorting */
|
/* filtering and sorting */
|
||||||
|
|
||||||
widget = gtk_check_button_new_with_label ("Filter");
|
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_widget_set_tooltip_text (widget, "Set whether some items should be filtered out");
|
||||||
gtk_box_append (GTK_BOX (flowbox_cntl), widget);
|
gtk_box_append (GTK_BOX (flowbox_cntl), widget);
|
||||||
@ -550,7 +550,7 @@ create_window (void)
|
|||||||
G_CALLBACK (filter_toggled), flowbox);
|
G_CALLBACK (filter_toggled), flowbox);
|
||||||
|
|
||||||
widget = gtk_check_button_new_with_label ("Sort");
|
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_widget_set_tooltip_text (widget, "Set whether items should be sorted");
|
||||||
gtk_box_append (GTK_BOX (flowbox_cntl), widget);
|
gtk_box_append (GTK_BOX (flowbox_cntl), widget);
|
||||||
|
@ -21,13 +21,13 @@ inhibitor_toggled (GtkToggleButton *button, GtkApplication *app)
|
|||||||
reason = gtk_editable_get_text (GTK_EDITABLE (inhibit_entry));
|
reason = gtk_editable_get_text (GTK_EDITABLE (inhibit_entry));
|
||||||
|
|
||||||
flags = 0;
|
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;
|
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;
|
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;
|
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;
|
flags |= GTK_APPLICATION_INHIBIT_IDLE;
|
||||||
|
|
||||||
toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (button)));
|
toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (button)));
|
||||||
|
@ -147,7 +147,7 @@ update_mark_exists (void)
|
|||||||
pos = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (position_spin));
|
pos = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (position_spin));
|
||||||
gtk_text_buffer_get_iter_at_offset (buffer, &iter, pos);
|
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);
|
gtk_text_buffer_add_mark (buffer, the_mark, &iter);
|
||||||
else
|
else
|
||||||
gtk_text_buffer_delete_mark (buffer, the_mark);
|
gtk_text_buffer_delete_mark (buffer, the_mark);
|
||||||
@ -156,7 +156,7 @@ update_mark_exists (void)
|
|||||||
static void
|
static void
|
||||||
update_mark_visible (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
|
static void
|
||||||
|
@ -19,7 +19,7 @@ check_button_checked (void)
|
|||||||
|
|
||||||
gtk_test_accessible_assert_state (button, GTK_ACCESSIBLE_STATE_CHECKED, GTK_ACCESSIBLE_TRISTATE_FALSE);
|
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);
|
gtk_test_accessible_assert_state (button, GTK_ACCESSIBLE_STATE_CHECKED, GTK_ACCESSIBLE_TRISTATE_TRUE);
|
||||||
|
|
||||||
|
@ -5,10 +5,10 @@ window.background:dir(ltr)
|
|||||||
checkbutton.text-button:dir(ltr)
|
checkbutton.text-button:dir(ltr)
|
||||||
check:dir(ltr)
|
check:dir(ltr)
|
||||||
label:dir(ltr)
|
label:dir(ltr)
|
||||||
radiobutton.text-button:dir(ltr):checked
|
checkbutton.text-button:dir(ltr):checked
|
||||||
radio:dir(ltr):checked
|
radio:dir(ltr):checked
|
||||||
label:dir(ltr)
|
label:dir(ltr)
|
||||||
radiobutton.text-button:dir(ltr)
|
checkbutton.text-button:dir(ltr)
|
||||||
radio:dir(ltr)
|
radio:dir(ltr)
|
||||||
label:dir(ltr)
|
label:dir(ltr)
|
||||||
switch:dir(ltr):checked
|
switch:dir(ltr):checked
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="button3">
|
<object class="GtkCheckButton" id="button3">
|
||||||
<property name="label" translatable="yes">Hello World!</property>
|
<property name="label" translatable="yes">Hello World!</property>
|
||||||
<property name="can_focus">1</property>
|
<property name="can_focus">1</property>
|
||||||
<property name="active">1</property>
|
<property name="active">1</property>
|
||||||
@ -40,7 +40,7 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="button4">
|
<object class="GtkCheckButton" id="button4">
|
||||||
<property name="label" translatable="yes">Hello World!</property>
|
<property name="label" translatable="yes">Hello World!</property>
|
||||||
<property name="group">button3</property>
|
<property name="group">button3</property>
|
||||||
<property name="can_focus">1</property>
|
<property name="can_focus">1</property>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
window.background:dir(ltr)
|
window.background:dir(ltr)
|
||||||
box.vertical:dir(ltr)
|
box.vertical:dir(ltr)
|
||||||
checkbutton:dir(ltr)
|
checkbutton.text-button:dir(ltr)
|
||||||
check:dir(ltr)
|
check:dir(ltr)
|
||||||
label:dir(ltr)
|
label:dir(ltr)
|
||||||
radiobutton:dir(ltr):checked
|
checkbutton.text-button:dir(ltr):checked
|
||||||
radio:dir(ltr):checked
|
check:dir(ltr):checked
|
||||||
label:dir(ltr)
|
label:dir(ltr)
|
||||||
|
@ -7,23 +7,16 @@
|
|||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCheckButton">
|
<object class="GtkCheckButton">
|
||||||
<child>
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="label">label</property>
|
<property name="label">label</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton">
|
<object class="GtkCheckButton">
|
||||||
<child>
|
<property name="active">1</property>
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="label">label</property>
|
<property name="label">label</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</interface>
|
</interface>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
window.background:dir(rtl)
|
window.background:dir(rtl)
|
||||||
box.vertical:dir(rtl)
|
box.vertical:dir(rtl)
|
||||||
checkbutton:dir(rtl)
|
checkbutton.text-button:dir(rtl)
|
||||||
check:dir(rtl)
|
check:dir(rtl)
|
||||||
label:dir(rtl)
|
label:dir(rtl)
|
||||||
radiobutton:dir(rtl):checked
|
checkbutton.text-button:dir(rtl):checked
|
||||||
radio:dir(rtl):checked
|
check:dir(rtl):checked
|
||||||
label:dir(rtl)
|
label:dir(rtl)
|
||||||
|
@ -7,23 +7,16 @@
|
|||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCheckButton">
|
<object class="GtkCheckButton">
|
||||||
<child>
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="label">label</property>
|
<property name="label">label</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton">
|
<object class="GtkCheckButton">
|
||||||
<child>
|
<property name="active">1</property>
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="label">label</property>
|
<property name="label">label</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</interface>
|
</interface>
|
||||||
|
@ -2202,7 +2202,7 @@ test_property_bindings (void)
|
|||||||
|
|
||||||
checkbutton = gtk_builder_get_object (builder, "checkbutton");
|
checkbutton = gtk_builder_get_object (builder, "checkbutton");
|
||||||
g_assert (GTK_IS_CHECK_BUTTON (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");
|
button = gtk_builder_get_object (builder, "button");
|
||||||
g_assert (GTK_IS_BUTTON (button));
|
g_assert (GTK_IS_BUTTON (button));
|
||||||
@ -2216,7 +2216,7 @@ test_property_bindings (void)
|
|||||||
g_assert (GTK_IS_BUTTON (button3));
|
g_assert (GTK_IS_BUTTON (button3));
|
||||||
g_assert (!gtk_widget_get_sensitive (GTK_WIDGET (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 (button)));
|
||||||
g_assert (gtk_widget_get_sensitive (GTK_WIDGET (button2)));
|
g_assert (gtk_widget_get_sensitive (GTK_WIDGET (button2)));
|
||||||
g_assert (gtk_widget_get_sensitive (GTK_WIDGET (button3)));
|
g_assert (gtk_widget_get_sensitive (GTK_WIDGET (button3)));
|
||||||
|
@ -10,6 +10,8 @@ GtkSpinButton GtkText
|
|||||||
GtkCheckButton
|
GtkCheckButton
|
||||||
GtkRadioButton
|
GtkRadioButton
|
||||||
GtkCheckButton
|
GtkCheckButton
|
||||||
|
GtkRadioButton
|
||||||
|
GtkCheckButton
|
||||||
GtkCheckButton
|
GtkCheckButton
|
||||||
GtkToggleButton
|
GtkToggleButton
|
||||||
GtkToggleButton
|
GtkToggleButton
|
||||||
|
@ -20,6 +20,8 @@ GtkCheckButton
|
|||||||
GtkCheckButton
|
GtkCheckButton
|
||||||
GtkRadioButton
|
GtkRadioButton
|
||||||
GtkCheckButton
|
GtkCheckButton
|
||||||
|
GtkRadioButton
|
||||||
|
GtkCheckButton
|
||||||
GtkSpinButton GtkText
|
GtkSpinButton GtkText
|
||||||
GtkToggleButton
|
GtkToggleButton
|
||||||
GtkToggleButton
|
GtkToggleButton
|
||||||
|
@ -700,7 +700,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="radiobutton3">
|
<object class="GtkCheckButton" id="radiobutton3">
|
||||||
<property name="label" translatable="yes">radiobutton</property>
|
<property name="label" translatable="yes">radiobutton</property>
|
||||||
<property name="inconsistent">1</property>
|
<property name="inconsistent">1</property>
|
||||||
<property name="group">radiobutton1</property>
|
<property name="group">radiobutton1</property>
|
||||||
@ -732,7 +732,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="radiobutton6">
|
<object class="GtkCheckButton" id="radiobutton6">
|
||||||
<property name="label" translatable="yes">radiobutton</property>
|
<property name="label" translatable="yes">radiobutton</property>
|
||||||
<property name="sensitive">0</property>
|
<property name="sensitive">0</property>
|
||||||
<property name="inconsistent">1</property>
|
<property name="inconsistent">1</property>
|
||||||
@ -2236,7 +2236,6 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
</style>
|
</style>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="grid_button">
|
<object class="GtkRadioButton" id="grid_button">
|
||||||
<property name="draw-indicator">0</property>
|
|
||||||
<property name="active">1</property>
|
<property name="active">1</property>
|
||||||
<property name="icon-name">view-grid-symbolic</property>
|
<property name="icon-name">view-grid-symbolic</property>
|
||||||
</object>
|
</object>
|
||||||
@ -2244,7 +2243,6 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="list_button">
|
<object class="GtkRadioButton" id="list_button">
|
||||||
<property name="active">1</property>
|
<property name="active">1</property>
|
||||||
<property name="draw-indicator">0</property>
|
|
||||||
<property name="group">grid_button</property>
|
<property name="group">grid_button</property>
|
||||||
<property name="icon-name">view-list-symbolic</property>
|
<property name="icon-name">view-list-symbolic</property>
|
||||||
</object>
|
</object>
|
||||||
|
@ -701,7 +701,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="radiobutton3">
|
<object class="GtkCheckButton" id="radiobutton3">
|
||||||
<property name="label" translatable="yes">radiobutton</property>
|
<property name="label" translatable="yes">radiobutton</property>
|
||||||
<property name="inconsistent">1</property>
|
<property name="inconsistent">1</property>
|
||||||
<property name="group">radiobutton1</property>
|
<property name="group">radiobutton1</property>
|
||||||
@ -733,7 +733,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="radiobutton6">
|
<object class="GtkCheckButton" id="radiobutton6">
|
||||||
<property name="label" translatable="yes">radiobutton</property>
|
<property name="label" translatable="yes">radiobutton</property>
|
||||||
<property name="sensitive">0</property>
|
<property name="sensitive">0</property>
|
||||||
<property name="inconsistent">1</property>
|
<property name="inconsistent">1</property>
|
||||||
@ -2237,7 +2237,6 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
</style>
|
</style>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="grid_button">
|
<object class="GtkRadioButton" id="grid_button">
|
||||||
<property name="draw-indicator">0</property>
|
|
||||||
<property name="active">1</property>
|
<property name="active">1</property>
|
||||||
<property name="icon-name">view-grid-symbolic</property>
|
<property name="icon-name">view-grid-symbolic</property>
|
||||||
</object>
|
</object>
|
||||||
@ -2245,7 +2244,6 @@ microphone-sensitivity-medium-symbolic</property>
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="list_button">
|
<object class="GtkRadioButton" id="list_button">
|
||||||
<property name="active">1</property>
|
<property name="active">1</property>
|
||||||
<property name="draw-indicator">0</property>
|
|
||||||
<property name="group">grid_button</property>
|
<property name="group">grid_button</property>
|
||||||
<property name="icon-name">view-list-symbolic</property>
|
<property name="icon-name">view-list-symbolic</property>
|
||||||
</object>
|
</object>
|
||||||
|
@ -4,51 +4,6 @@
|
|||||||
<object class="GtkWindow" id="window1">
|
<object class="GtkWindow" id="window1">
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkGrid" id="grid1">
|
<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>
|
<child>
|
||||||
<object class="GtkImage" id="image1">
|
<object class="GtkImage" id="image1">
|
||||||
<property name="width_request">16</property>
|
<property name="width_request">16</property>
|
||||||
|
@ -4,15 +4,6 @@
|
|||||||
<object class="GtkWindow" id="window1">
|
<object class="GtkWindow" id="window1">
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkGrid" id="grid1">
|
<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>
|
<child>
|
||||||
<object class="GtkSpinner" id="spinner1">
|
<object class="GtkSpinner" id="spinner1">
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
@ -23,42 +14,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</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>
|
<child>
|
||||||
<object class="GtkCheckButton" id="checkbutton1">
|
<object class="GtkCheckButton" id="checkbutton1">
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
@ -70,7 +25,7 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="radiobutton1">
|
<object class="GtkCheckButton" id="radiobutton1">
|
||||||
<property name="active">1</property>
|
<property name="active">1</property>
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
Loading…
Reference in New Issue
Block a user