Clean up uses of gtk_toggle_button_get/set_active

Replace all uses on check buttons by the corresponding
check button api.
This commit is contained in:
Matthias Clasen 2020-08-30 19:36:27 -04:00
parent cfade230ce
commit 2c5c938f0d
25 changed files with 88 additions and 89 deletions

View File

@ -1166,15 +1166,15 @@ font_features_reset_features (void)
{ {
FeatureItem *item = l->data; FeatureItem *item = l->data;
if (GTK_IS_RADIO_BUTTON (item->feat)) if (GTK_IS_CHECK_BUTTON (item->feat))
{ {
if (strcmp (item->name, "xxxx") == 0) if (strcmp (item->name, "xxxx") == 0)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item->feat), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), TRUE);
} else
else if (GTK_IS_CHECK_BUTTON (item->feat)) {
{ gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item->feat), FALSE); set_inconsistent (GTK_CHECK_BUTTON (item->feat), TRUE);
set_inconsistent (GTK_CHECK_BUTTON (item->feat), TRUE); }
} }
} }
} }

View File

@ -59,7 +59,7 @@ update_image (void)
hintstyle = CAIRO_HINT_STYLE_DEFAULT; hintstyle = CAIRO_HINT_STYLE_DEFAULT;
cairo_font_options_set_hint_style (fopt, hintstyle); cairo_font_options_set_hint_style (fopt, hintstyle);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hint_metrics))) if (gtk_check_button_get_active (GTK_CHECK_BUTTON (hint_metrics)))
hintmetrics = CAIRO_HINT_METRICS_ON; hintmetrics = CAIRO_HINT_METRICS_ON;
else else
hintmetrics = CAIRO_HINT_METRICS_OFF; hintmetrics = CAIRO_HINT_METRICS_OFF;
@ -69,7 +69,7 @@ update_image (void)
cairo_font_options_destroy (fopt); cairo_font_options_destroy (fopt);
pango_context_changed (context); pango_context_changed (context);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (text_radio))) if (gtk_check_button_get_active (GTK_CHECK_BUTTON (text_radio)))
{ {
layout = pango_layout_new (context); layout = pango_layout_new (context);
pango_layout_set_font_description (layout, desc); pango_layout_set_font_description (layout, desc);
@ -107,7 +107,7 @@ update_image (void)
cr = cairo_create (surface); cr = cairo_create (surface);
cairo_set_line_width (cr, 1); cairo_set_line_width (cr, 1);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (show_grid))) if (gtk_check_button_get_active (GTK_CHECK_BUTTON (show_grid)))
{ {
int i; int i;
cairo_set_source_rgba (cr, 0.2, 0, 0, 0.2); cairo_set_source_rgba (cr, 0.2, 0, 0, 0.2);
@ -125,7 +125,7 @@ update_image (void)
} }
} }
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (show_extents))) if (gtk_check_button_get_active (GTK_CHECK_BUTTON (show_extents)))
{ {
cairo_set_source_rgba (cr, 0, 0, 1, 1); cairo_set_source_rgba (cr, 0, 0, 1, 1);

View File

@ -23,8 +23,8 @@ row_activated (GtkListBox *list,
} }
else if (gtk_widget_is_ancestor (check, GTK_WIDGET (row))) else if (gtk_widget_is_ancestor (check, GTK_WIDGET (row)))
{ {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), gtk_check_button_set_active (GTK_CHECK_BUTTON (check),
!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check))); !gtk_check_button_get_active (GTK_CHECK_BUTTON (check)));
} }
else if (gtk_widget_is_ancestor (image, GTK_WIDGET (row))) else if (gtk_widget_is_ancestor (image, GTK_WIDGET (row)))
{ {

View File

@ -75,7 +75,7 @@ create_pane_options (GtkPaned *paned,
check_button = gtk_check_button_new_with_mnemonic ("_Shrink"); check_button = gtk_check_button_new_with_mnemonic ("_Shrink");
gtk_grid_attach (GTK_GRID (table), check_button, 0, 2, 1, 1); gtk_grid_attach (GTK_GRID (table), check_button, 0, 2, 1, 1);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (check_button), TRUE);
g_signal_connect (check_button, "toggled", g_signal_connect (check_button, "toggled",
G_CALLBACK (toggle_shrink), child1); G_CALLBACK (toggle_shrink), child1);
@ -84,13 +84,13 @@ create_pane_options (GtkPaned *paned,
check_button = gtk_check_button_new_with_mnemonic ("_Resize"); check_button = gtk_check_button_new_with_mnemonic ("_Resize");
gtk_grid_attach (GTK_GRID (table), check_button, 1, 1, 1, 1); gtk_grid_attach (GTK_GRID (table), check_button, 1, 1, 1, 1);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (check_button), TRUE);
g_signal_connect (check_button, "toggled", g_signal_connect (check_button, "toggled",
G_CALLBACK (toggle_resize), child2); G_CALLBACK (toggle_resize), child2);
check_button = gtk_check_button_new_with_mnemonic ("_Shrink"); check_button = gtk_check_button_new_with_mnemonic ("_Shrink");
gtk_grid_attach (GTK_GRID (table), check_button, 1, 2, 1, 1); gtk_grid_attach (GTK_GRID (table), check_button, 1, 2, 1, 1);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (check_button), TRUE);
g_signal_connect (check_button, "toggled", g_signal_connect (check_button, "toggled",
G_CALLBACK (toggle_shrink), child2); G_CALLBACK (toggle_shrink), child2);

View File

@ -152,7 +152,7 @@ do_sizegroup (GtkWidget *do_widget)
check_button = gtk_check_button_new_with_mnemonic ("_Enable grouping"); check_button = gtk_check_button_new_with_mnemonic ("_Enable grouping");
gtk_box_append (GTK_BOX (vbox), check_button); gtk_box_append (GTK_BOX (vbox), check_button);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (check_button), TRUE);
g_signal_connect (check_button, "toggled", g_signal_connect (check_button, "toggled",
G_CALLBACK (toggle_grouping), size_group); G_CALLBACK (toggle_grouping), size_group);
} }

View File

@ -667,7 +667,7 @@ testcase_save_clicked_cb (GtkWidget *button,
png_file = g_build_filename (source_dir, png_file_name, NULL); png_file = g_build_filename (source_dir, png_file_name, NULL);
g_free (png_file_name); g_free (png_file_name);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->testcase_cairo_checkbutton))) if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->testcase_cairo_checkbutton)))
texture = create_cairo_texture (self); texture = create_cairo_texture (self);
else else
texture = create_texture (self); texture = create_texture (self);

View File

@ -378,10 +378,10 @@ configure_plugins (GSimpleAction *action,
dialog = (GtkWidget *)gtk_builder_get_object (builder, "plugin-dialog"); dialog = (GtkWidget *)gtk_builder_get_object (builder, "plugin-dialog");
check = (GtkWidget *)gtk_builder_get_object (builder, "red-plugin"); check = (GtkWidget *)gtk_builder_get_object (builder, "red-plugin");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), plugin_enabled ("red")); gtk_check_button_set_active (GTK_CHECK_BUTTON (check), plugin_enabled ("red"));
g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), (char *) "red"); g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), (char *) "red");
check = (GtkWidget *)gtk_builder_get_object (builder, "black-plugin"); check = (GtkWidget *)gtk_builder_get_object (builder, "black-plugin");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), plugin_enabled ("black")); gtk_check_button_set_active (GTK_CHECK_BUTTON (check), plugin_enabled ("black"));
g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), (char *) "black"); g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), (char *) "black");
g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL); g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);

View File

@ -8001,8 +8001,8 @@ gtk_file_chooser_widget_set_choice (GtkFileChooser *chooser,
} }
} }
} }
else if (GTK_IS_TOGGLE_BUTTON (widget)) else if (GTK_IS_CHECK_BUTTON (widget))
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), g_str_equal (option, "true")); gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), g_str_equal (option, "true"));
} }
static const char * static const char *
@ -8024,8 +8024,8 @@ gtk_file_chooser_widget_get_choice (GtkFileChooser *chooser,
return NULL; return NULL;
} }
else if (GTK_IS_TOGGLE_BUTTON (widget)) else if (GTK_IS_CHECK_BUTTON (widget))
return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)) ? "true" : "false"; return gtk_check_button_get_active (GTK_CHECK_BUTTON (widget)) ? "true" : "false";
return NULL; return NULL;
} }

View File

@ -26,7 +26,7 @@
#include "gtkbutton.h" #include "gtkbutton.h"
#include "gtkscrolledwindow.h" #include "gtkscrolledwindow.h"
#include "gtktogglebutton.h" #include "gtkcheckbutton.h"
#include "gtklabel.h" #include "gtklabel.h"
#include "gtkgrid.h" #include "gtkgrid.h"
#include "gtkcelllayout.h" #include "gtkcelllayout.h"
@ -779,11 +779,11 @@ gtk_page_setup_unix_dialog_new (const char *title,
static GtkPageOrientation static GtkPageOrientation
get_orientation (GtkPageSetupUnixDialog *dialog) get_orientation (GtkPageSetupUnixDialog *dialog)
{ {
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->portrait_radio))) if (gtk_check_button_get_active (GTK_CHECK_BUTTON (dialog->portrait_radio)))
return GTK_PAGE_ORIENTATION_PORTRAIT; return GTK_PAGE_ORIENTATION_PORTRAIT;
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->landscape_radio))) if (gtk_check_button_get_active (GTK_CHECK_BUTTON (dialog->landscape_radio)))
return GTK_PAGE_ORIENTATION_LANDSCAPE; return GTK_PAGE_ORIENTATION_LANDSCAPE;
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->reverse_landscape_radio))) if (gtk_check_button_get_active (GTK_CHECK_BUTTON (dialog->reverse_landscape_radio)))
return GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE; return GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE;
return GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT; return GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT;
} }
@ -795,16 +795,16 @@ set_orientation (GtkPageSetupUnixDialog *dialog,
switch (orientation) switch (orientation)
{ {
case GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT: case GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->reverse_portrait_radio), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (dialog->reverse_portrait_radio), TRUE);
break; break;
case GTK_PAGE_ORIENTATION_PORTRAIT: case GTK_PAGE_ORIENTATION_PORTRAIT:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->portrait_radio), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (dialog->portrait_radio), TRUE);
break; break;
case GTK_PAGE_ORIENTATION_LANDSCAPE: case GTK_PAGE_ORIENTATION_LANDSCAPE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->landscape_radio), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (dialog->landscape_radio), TRUE);
break; break;
case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE: case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->reverse_landscape_radio), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (dialog->reverse_landscape_radio), TRUE);
break; break;
default: default:
break; break;

View File

@ -562,7 +562,7 @@ store_auth_info_toggled (GtkCheckButton *chkbtn,
gpointer user_data) gpointer user_data)
{ {
gboolean *data = (gboolean *) user_data; gboolean *data = (gboolean *) user_data;
*data = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (chkbtn)); *data = gtk_check_button_get_active (GTK_CHECK_BUTTON (chkbtn));
} }
static void static void
@ -670,7 +670,6 @@ request_password (GtkPrintBackend *backend,
gtk_widget_set_size_request (GTK_WIDGET (label), 320, -1); gtk_widget_set_size_request (GTK_WIDGET (label), 320, -1);
g_free (markup); g_free (markup);
/* Packing */ /* Packing */
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_box_append (GTK_BOX (content_area), main_box); gtk_box_append (GTK_BOX (content_area), main_box);
@ -719,7 +718,7 @@ request_password (GtkPrintBackend *backend,
chkbtn = gtk_check_button_new_with_mnemonic (_("_Remember password")); chkbtn = gtk_check_button_new_with_mnemonic (_("_Remember password"));
gtk_widget_set_margin_top (chkbtn, 6); gtk_widget_set_margin_top (chkbtn, 6);
gtk_widget_set_margin_bottom (chkbtn, 6); gtk_widget_set_margin_bottom (chkbtn, 6);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkbtn), FALSE); gtk_check_button_set_active (GTK_CHECK_BUTTON (chkbtn), FALSE);
gtk_box_append (GTK_BOX (vbox), chkbtn); gtk_box_append (GTK_BOX (vbox), chkbtn);
g_signal_connect (chkbtn, "toggled", g_signal_connect (chkbtn, "toggled",
G_CALLBACK (store_auth_info_toggled), G_CALLBACK (store_auth_info_toggled),

View File

@ -1123,9 +1123,9 @@ update_widgets (GtkPrinterOptionWidget *widget)
{ {
case GTK_PRINTER_OPTION_TYPE_BOOLEAN: case GTK_PRINTER_OPTION_TYPE_BOOLEAN:
if (g_ascii_strcasecmp (source->value, "True") == 0) if (g_ascii_strcasecmp (source->value, "True") == 0)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->check), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (priv->check), TRUE);
else else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->check), FALSE); gtk_check_button_set_active (GTK_CHECK_BUTTON (priv->check), FALSE);
break; break;
case GTK_PRINTER_OPTION_TYPE_PICKONE: case GTK_PRINTER_OPTION_TYPE_PICKONE:
combo_box_set (priv->combo, source->value); combo_box_set (priv->combo, source->value);

View File

@ -6591,7 +6591,7 @@ warn_response (GtkDialog *dialog,
display = gtk_inspector_window_get_inspected_display (GTK_INSPECTOR_WINDOW (inspector_window)); display = gtk_inspector_window_get_inspected_display (GTK_INSPECTOR_WINDOW (inspector_window));
check = g_object_get_data (G_OBJECT (dialog), "check"); check = g_object_get_data (G_OBJECT (dialog), "check");
remember = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)); remember = gtk_check_button_get_active (GTK_CHECK_BUTTON (check));
gtk_window_destroy (GTK_WINDOW (dialog)); gtk_window_destroy (GTK_WINDOW (dialog));
g_object_set_data (G_OBJECT (inspector_window), "warning_dialog", NULL); g_object_set_data (G_OBJECT (inspector_window), "warning_dialog", NULL);

View File

@ -29,7 +29,7 @@
#include "gtktextview.h" #include "gtktextview.h"
#include "gtkmessagedialog.h" #include "gtkmessagedialog.h"
#include "gtkfilechooserdialog.h" #include "gtkfilechooserdialog.h"
#include "gtktogglebutton.h" #include "gtkcheckbutton.h"
#include "gtklabel.h" #include "gtklabel.h"
#include "gtktooltip.h" #include "gtktooltip.h"
#include "gtktextiter.h" #include "gtktextiter.h"
@ -112,7 +112,7 @@ update_flag (GtkWidget *widget,
guint *flags, guint *flags,
guint flag) guint flag)
{ {
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) if (gtk_check_button_get_active (GTK_CHECK_BUTTON (widget)))
*flags = *flags | flag; *flags = *flags | flag;
else else
*flags = *flags & ~flag; *flags = *flags & ~flag;

View File

@ -498,7 +498,7 @@ flags_modified (GtkCheckButton *button, ObjectProperty *p)
int i; int i;
GValue val = G_VALUE_INIT; GValue val = G_VALUE_INIT;
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)); active = gtk_check_button_get_active (button);
i = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "index")); i = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "index"));
fclass = G_FLAGS_CLASS (g_type_class_peek (p->spec->value_type)); fclass = G_FLAGS_CLASS (g_type_class_peek (p->spec->value_type));

View File

@ -93,7 +93,7 @@
</object> </object>
</child> </child>
<child> <child>
<object class="GtkRadioButton" id="portrait_radio"> <object class="GtkCheckButton" id="portrait_radio">
<property name="hexpand">1</property> <property name="hexpand">1</property>
<property name="active">1</property> <property name="active">1</property>
<child> <child>
@ -118,7 +118,7 @@
</object> </object>
</child> </child>
<child> <child>
<object class="GtkRadioButton" id="reverse_portrait_radio"> <object class="GtkCheckButton" id="reverse_portrait_radio">
<property name="hexpand">1</property> <property name="hexpand">1</property>
<property name="active">1</property> <property name="active">1</property>
<property name="group">portrait_radio</property> <property name="group">portrait_radio</property>
@ -144,7 +144,7 @@
</object> </object>
</child> </child>
<child> <child>
<object class="GtkRadioButton" id="landscape_radio"> <object class="GtkCheckButton" id="landscape_radio">
<property name="hexpand">1</property> <property name="hexpand">1</property>
<property name="active">1</property> <property name="active">1</property>
<property name="group">portrait_radio</property> <property name="group">portrait_radio</property>
@ -170,7 +170,7 @@
</object> </object>
</child> </child>
<child> <child>
<object class="GtkRadioButton" id="reverse_landscape_radio"> <object class="GtkCheckButton" id="reverse_landscape_radio">
<property name="hexpand">1</property> <property name="hexpand">1</property>
<property name="group">portrait_radio</property> <property name="group">portrait_radio</property>
<child> <child>

View File

@ -134,7 +134,7 @@ flag_toggled_cb (GtkCheckButton *button,
} *data = user_data; } *data = user_data;
g_object_set (G_OBJECT (data->calendar), data->prop_name, g_object_set (G_OBJECT (data->calendar), data->prop_name,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)), gtk_check_button_get_active (GTK_CHECK_BUTTON (button)),
NULL); NULL);
} }
@ -255,7 +255,7 @@ create_calendar(void)
gtk_box_append (GTK_BOX (vbox), toggle); gtk_box_append (GTK_BOX (vbox), toggle);
g_object_get (G_OBJECT (calendar), flags[i].prop_name, &value, NULL); g_object_get (G_OBJECT (calendar), flags[i].prop_name, &value, NULL);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), value); gtk_check_button_set_active (GTK_CHECK_BUTTON (toggle), value);
g_signal_connect (toggle, "toggled", G_CALLBACK (flag_toggled_cb), &flags[i]); g_signal_connect (toggle, "toggled", G_CALLBACK (flag_toggled_cb), &flags[i]);
} }

View File

@ -124,51 +124,51 @@ orientation_changed (GtkComboBox *combo,
} }
static void static void
align_cell_2_toggled (GtkToggleButton *toggle, align_cell_2_toggled (GtkCheckButton *toggle,
GtkIconView *iconview) GtkIconView *iconview)
{ {
GtkCellArea *area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (iconview)); GtkCellArea *area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (iconview));
gboolean align = gtk_toggle_button_get_active (toggle); gboolean align = gtk_check_button_get_active (toggle);
gtk_cell_area_cell_set (area, cell_2, "align", align, NULL); gtk_cell_area_cell_set (area, cell_2, "align", align, NULL);
} }
static void static void
align_cell_3_toggled (GtkToggleButton *toggle, align_cell_3_toggled (GtkCheckButton *toggle,
GtkIconView *iconview) GtkIconView *iconview)
{ {
GtkCellArea *area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (iconview)); GtkCellArea *area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (iconview));
gboolean align = gtk_toggle_button_get_active (toggle); gboolean align = gtk_check_button_get_active (toggle);
gtk_cell_area_cell_set (area, cell_3, "align", align, NULL); gtk_cell_area_cell_set (area, cell_3, "align", align, NULL);
} }
static void static void
expand_cell_1_toggled (GtkToggleButton *toggle, expand_cell_1_toggled (GtkCheckButton *toggle,
GtkIconView *iconview) GtkIconView *iconview)
{ {
GtkCellArea *area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (iconview)); GtkCellArea *area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (iconview));
gboolean expand = gtk_toggle_button_get_active (toggle); gboolean expand = gtk_check_button_get_active (toggle);
gtk_cell_area_cell_set (area, cell_1, "expand", expand, NULL); gtk_cell_area_cell_set (area, cell_1, "expand", expand, NULL);
} }
static void static void
expand_cell_2_toggled (GtkToggleButton *toggle, expand_cell_2_toggled (GtkCheckButton *toggle,
GtkIconView *iconview) GtkIconView *iconview)
{ {
GtkCellArea *area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (iconview)); GtkCellArea *area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (iconview));
gboolean expand = gtk_toggle_button_get_active (toggle); gboolean expand = gtk_check_button_get_active (toggle);
gtk_cell_area_cell_set (area, cell_2, "expand", expand, NULL); gtk_cell_area_cell_set (area, cell_2, "expand", expand, NULL);
} }
static void static void
expand_cell_3_toggled (GtkToggleButton *toggle, expand_cell_3_toggled (GtkCheckButton *toggle,
GtkIconView *iconview) GtkIconView *iconview)
{ {
GtkCellArea *area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (iconview)); GtkCellArea *area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (iconview));
gboolean expand = gtk_toggle_button_get_active (toggle); gboolean expand = gtk_check_button_get_active (toggle);
gtk_cell_area_cell_set (area, cell_3, "expand", expand, NULL); gtk_cell_area_cell_set (area, cell_3, "expand", expand, NULL);
} }
@ -210,14 +210,14 @@ simple_cell_area (void)
G_CALLBACK (orientation_changed), iconview); G_CALLBACK (orientation_changed), iconview);
widget = gtk_check_button_new_with_label ("Align 2nd Cell"); widget = gtk_check_button_new_with_label ("Align 2nd Cell");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), FALSE);
gtk_box_append (GTK_BOX (vbox), widget); gtk_box_append (GTK_BOX (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled", g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (align_cell_2_toggled), iconview); G_CALLBACK (align_cell_2_toggled), iconview);
widget = gtk_check_button_new_with_label ("Align 3rd Cell"); widget = gtk_check_button_new_with_label ("Align 3rd Cell");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), TRUE);
gtk_box_append (GTK_BOX (vbox), widget); gtk_box_append (GTK_BOX (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled", g_signal_connect (G_OBJECT (widget), "toggled",
@ -225,21 +225,21 @@ simple_cell_area (void)
widget = gtk_check_button_new_with_label ("Expand 1st Cell"); widget = gtk_check_button_new_with_label ("Expand 1st Cell");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), FALSE);
gtk_box_append (GTK_BOX (vbox), widget); gtk_box_append (GTK_BOX (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled", g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (expand_cell_1_toggled), iconview); G_CALLBACK (expand_cell_1_toggled), iconview);
widget = gtk_check_button_new_with_label ("Expand 2nd Cell"); widget = gtk_check_button_new_with_label ("Expand 2nd Cell");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), TRUE);
gtk_box_append (GTK_BOX (vbox), widget); gtk_box_append (GTK_BOX (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled", g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (expand_cell_2_toggled), iconview); G_CALLBACK (expand_cell_2_toggled), iconview);
widget = gtk_check_button_new_with_label ("Expand 3rd Cell"); widget = gtk_check_button_new_with_label ("Expand 3rd Cell");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), FALSE);
gtk_box_append (GTK_BOX (vbox), widget); gtk_box_append (GTK_BOX (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled", g_signal_connect (G_OBJECT (widget), "toggled",
@ -394,11 +394,11 @@ focus_iconview (gboolean color_bg, GtkCellRenderer **focus, GtkCellRenderer **si
} }
static void static void
focus_sibling_toggled (GtkToggleButton *toggle, focus_sibling_toggled (GtkCheckButton *toggle,
GtkIconView *iconview) GtkIconView *iconview)
{ {
GtkCellArea *area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (iconview)); GtkCellArea *area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (iconview));
gboolean active = gtk_toggle_button_get_active (toggle); gboolean active = gtk_check_button_get_active (toggle);
if (active) if (active)
gtk_cell_area_add_focus_sibling (area, focus_renderer, sibling_renderer); gtk_cell_area_add_focus_sibling (area, focus_renderer, sibling_renderer);
@ -445,7 +445,7 @@ focus_cell_area (void)
G_CALLBACK (orientation_changed), iconview); G_CALLBACK (orientation_changed), iconview);
widget = gtk_check_button_new_with_label ("Focus Sibling"); widget = gtk_check_button_new_with_label ("Focus Sibling");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (widget), TRUE);
gtk_box_append (GTK_BOX (vbox), widget); gtk_box_append (GTK_BOX (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled", g_signal_connect (G_OBJECT (widget), "toggled",

View File

@ -30,10 +30,10 @@ on_shortcuts_inhibit_change (GdkSurface *surface, GParamSpec *pspec, gpointer da
gtk_check_button_set_inconsistent (GTK_CHECK_BUTTON (button), FALSE); gtk_check_button_set_inconsistent (GTK_CHECK_BUTTON (button), FALSE);
button_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)); button_active = gtk_check_button_get_active (GTK_CHECK_BUTTON (button));
if (button_active != shortcuts_inhibited) if (button_active != shortcuts_inhibited)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), shortcuts_inhibited); gtk_check_button_set_active (GTK_CHECK_BUTTON (button), shortcuts_inhibited);
} }
static void static void
@ -41,7 +41,7 @@ on_button_toggle (GtkWidget *button, gpointer data)
{ {
GdkSurface *surface = GDK_SURFACE (data); GdkSurface *surface = GDK_SURFACE (data);
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) if (!gtk_check_button_get_active (GTK_CHECK_BUTTON (button)))
{ {
gdk_toplevel_restore_system_shortcuts (GDK_TOPLEVEL (surface)); gdk_toplevel_restore_system_shortcuts (GDK_TOPLEVEL (surface));
return; return;

View File

@ -238,8 +238,8 @@ single_click_clicked (GtkButton *check, gpointer data)
{ {
GtkListBox *list = data; GtkListBox *list = data;
g_print ("single: %d\n", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check))); g_print ("single: %d\n", gtk_check_button_get_active (GTK_CHECK_BUTTON (check)));
gtk_list_box_set_activate_on_single_click (list, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check))); gtk_list_box_set_activate_on_single_click (list, gtk_check_button_get_active (GTK_CHECK_BUTTON (check)));
} }
int int
@ -278,7 +278,7 @@ main (int argc, char *argv[])
gtk_box_append (GTK_BOX (vbox), combo); gtk_box_append (GTK_BOX (vbox), combo);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), gtk_list_box_get_selection_mode (GTK_LIST_BOX (list))); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), gtk_list_box_get_selection_mode (GTK_LIST_BOX (list)));
check = gtk_check_button_new_with_label ("single click mode"); check = gtk_check_button_new_with_label ("single click mode");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), gtk_list_box_get_activate_on_single_click (GTK_LIST_BOX (list))); gtk_check_button_set_active (GTK_CHECK_BUTTON (check), gtk_list_box_get_activate_on_single_click (GTK_LIST_BOX (list)));
g_signal_connect (check, "toggled", G_CALLBACK (single_click_clicked), list); g_signal_connect (check, "toggled", G_CALLBACK (single_click_clicked), list);
gtk_box_append (GTK_BOX (vbox), check); gtk_box_append (GTK_BOX (vbox), check);

View File

@ -180,10 +180,10 @@ update_clicked (GtkButton *button, GtkLockButton *lockbutton)
permission = gtk_lock_button_get_permission (lockbutton); permission = gtk_lock_button_get_permission (lockbutton);
allowed = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (allowed_button)); allowed = gtk_check_button_get_active (GTK_CHECK_BUTTON (allowed_button));
can_acquire = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (can_acquire_button)); can_acquire = gtk_check_button_get_active (GTK_CHECK_BUTTON (can_acquire_button));
can_release = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (can_release_button)); can_release = gtk_check_button_get_active (GTK_CHECK_BUTTON (can_release_button));
success = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (success_button)); success = gtk_check_button_get_active (GTK_CHECK_BUTTON (success_button));
g_permission_impl_update (permission, allowed, can_acquire, can_release); g_permission_impl_update (permission, allowed, can_acquire, can_release);
g_test_permission_set_success (G_TEST_PERMISSION (permission), success); g_test_permission_set_success (G_TEST_PERMISSION (permission), success);
} }
@ -202,9 +202,9 @@ permission_changed (GPermission *permission,
"can-release", &can_release, "can-release", &can_release,
NULL); NULL);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (allowed_button), allowed); gtk_check_button_set_active (GTK_CHECK_BUTTON (allowed_button), allowed);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (can_acquire_button), can_acquire); gtk_check_button_set_active (GTK_CHECK_BUTTON (can_acquire_button), can_acquire);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (can_release_button), can_release); gtk_check_button_set_active (GTK_CHECK_BUTTON (can_release_button), can_release);
gtk_widget_set_sensitive (content, allowed); gtk_widget_set_sensitive (content, allowed);
} }

View File

@ -150,7 +150,7 @@ main (int argc, char *argv[])
g_object_bind_property (check, "active", popover, "autohide", G_BINDING_SYNC_CREATE); g_object_bind_property (check, "active", popover, "autohide", G_BINDING_SYNC_CREATE);
g_object_bind_property (check, "active", popover1, "autohide", G_BINDING_SYNC_CREATE); g_object_bind_property (check, "active", popover1, "autohide", G_BINDING_SYNC_CREATE);
g_object_bind_property (check, "active", popover2, "autohide", G_BINDING_SYNC_CREATE); g_object_bind_property (check, "active", popover2, "autohide", G_BINDING_SYNC_CREATE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (check), TRUE);
gtk_grid_attach (GTK_GRID (grid), label , 1, 3, 1, 1); gtk_grid_attach (GTK_GRID (grid), label , 1, 3, 1, 1);
gtk_grid_attach (GTK_GRID (grid), check, 2, 3, 1, 1); gtk_grid_attach (GTK_GRID (grid), check, 2, 3, 1, 1);

View File

@ -59,11 +59,11 @@ update_selected (GtkWidget *widget)
if (gtk_list_box_row_is_selected (GTK_LIST_BOX_ROW (row))) if (gtk_list_box_row_is_selected (GTK_LIST_BOX_ROW (row)))
{ {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (row->check), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (row->check), TRUE);
gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_SELECTED); gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_SELECTED);
} }
else else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (row->check), FALSE); gtk_check_button_set_active (GTK_CHECK_BUTTON (row->check), FALSE);
} }
static void static void

View File

@ -20,14 +20,14 @@ set_visible_child_name (GtkWidget *button, gpointer data)
static void static void
toggle_hhomogeneous (GtkWidget *button, gpointer data) toggle_hhomogeneous (GtkWidget *button, gpointer data)
{ {
gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)); gboolean active = gtk_check_button_get_active (GTK_CHECK_BUTTON (button));
gtk_stack_set_hhomogeneous (GTK_STACK (stack), active); gtk_stack_set_hhomogeneous (GTK_STACK (stack), active);
} }
static void static void
toggle_vhomogeneous (GtkWidget *button, gpointer data) toggle_vhomogeneous (GtkWidget *button, gpointer data)
{ {
gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)); gboolean active = gtk_check_button_get_active (GTK_CHECK_BUTTON (button));
gtk_stack_set_vhomogeneous (GTK_STACK (stack), active); gtk_stack_set_vhomogeneous (GTK_STACK (stack), active);
} }
@ -215,14 +215,14 @@ main (int argc,
g_signal_connect (button, "clicked", (GCallback) set_visible_child_name, (gpointer) "3"); g_signal_connect (button, "clicked", (GCallback) set_visible_child_name, (gpointer) "3");
button = gtk_check_button_new (); button = gtk_check_button_new ();
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), gtk_check_button_set_active (GTK_CHECK_BUTTON (button),
gtk_stack_get_hhomogeneous (GTK_STACK (stack))); gtk_stack_get_hhomogeneous (GTK_STACK (stack)));
gtk_box_append (GTK_BOX (hbox), button); gtk_box_append (GTK_BOX (hbox), button);
g_signal_connect (button, "clicked", (GCallback) toggle_hhomogeneous, NULL); g_signal_connect (button, "clicked", (GCallback) toggle_hhomogeneous, NULL);
button = gtk_check_button_new_with_label ("homogeneous"); button = gtk_check_button_new_with_label ("homogeneous");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), gtk_check_button_set_active (GTK_CHECK_BUTTON (button),
gtk_stack_get_vhomogeneous (GTK_STACK (stack))); gtk_stack_get_vhomogeneous (GTK_STACK (stack)));
gtk_box_append (GTK_BOX (hbox), button); gtk_box_append (GTK_BOX (hbox), button);
g_signal_connect (button, "clicked", (GCallback) toggle_vhomogeneous, NULL); g_signal_connect (button, "clicked", (GCallback) toggle_vhomogeneous, NULL);

View File

@ -209,7 +209,7 @@ create_control (GtkWidget *box, int number, int cntl, CallbackData *data)
} }
checkbutton = gtk_check_button_new_with_label (name); checkbutton = gtk_check_button_new_with_label (name);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), cntl == CNTL_FIXED); gtk_check_button_set_active (GTK_CHECK_BUTTON (checkbutton), cntl == CNTL_FIXED);
gtk_box_append (GTK_BOX (box), checkbutton); gtk_box_append (GTK_BOX (box), checkbutton);
g_signal_connect (G_OBJECT (checkbutton), "toggled", callback, data); g_signal_connect (G_OBJECT (checkbutton), "toggled", callback, data);

View File

@ -30,7 +30,7 @@ show_dialog (void)
max_width_chars = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (max_width_chars_spin)); max_width_chars = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (max_width_chars_spin));
default_width = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (default_width_spin)); default_width = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (default_width_spin));
default_height = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (default_height_spin)); default_height = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (default_height_spin));
resizable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (resizable_check)); resizable = gtk_check_button_get_active (GTK_CHECK_BUTTON (resizable_check));
dialog = gtk_dialog_new_with_buttons ("Test", GTK_WINDOW (window), dialog = gtk_dialog_new_with_buttons ("Test", GTK_WINDOW (window),
GTK_DIALOG_MODAL, GTK_DIALOG_MODAL,