summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-08-30 19:36:27 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-08-30 21:23:25 -0400
commit2c5c938f0d2bfdc60d351142eb4afa97d055986c (patch)
treec35fddc4cc1d05bf4c39d4249bd336e33d386512 /tests
parentcfade230ced9a28f1aefe4982790109406a6b578 (diff)
downloadgtk+-2c5c938f0d2bfdc60d351142eb4afa97d055986c.tar.gz
Clean up uses of gtk_toggle_button_get/set_active
Replace all uses on check buttons by the corresponding check button api.
Diffstat (limited to 'tests')
-rw-r--r--tests/testcalendar.c4
-rw-r--r--tests/testcellarea.c36
-rw-r--r--tests/testinhibitshortcuts.c6
-rw-r--r--tests/testlist.c6
-rw-r--r--tests/testlockbutton.c14
-rw-r--r--tests/testpopover.c2
-rw-r--r--tests/testselectionmode.c4
-rw-r--r--tests/teststack.c12
-rw-r--r--tests/testtreeedit.c2
-rw-r--r--tests/testwindowsize.c2
10 files changed, 44 insertions, 44 deletions
diff --git a/tests/testcalendar.c b/tests/testcalendar.c
index d9f5722b1c..387731d5a9 100644
--- a/tests/testcalendar.c
+++ b/tests/testcalendar.c
@@ -134,7 +134,7 @@ flag_toggled_cb (GtkCheckButton *button,
} *data = user_data;
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);
}
@@ -255,7 +255,7 @@ create_calendar(void)
gtk_box_append (GTK_BOX (vbox), toggle);
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]);
}
diff --git a/tests/testcellarea.c b/tests/testcellarea.c
index 7fdc444ac5..4e08983cea 100644
--- a/tests/testcellarea.c
+++ b/tests/testcellarea.c
@@ -124,51 +124,51 @@ orientation_changed (GtkComboBox *combo,
}
static void
-align_cell_2_toggled (GtkToggleButton *toggle,
+align_cell_2_toggled (GtkCheckButton *toggle,
GtkIconView *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);
}
static void
-align_cell_3_toggled (GtkToggleButton *toggle,
+align_cell_3_toggled (GtkCheckButton *toggle,
GtkIconView *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);
}
static void
-expand_cell_1_toggled (GtkToggleButton *toggle,
+expand_cell_1_toggled (GtkCheckButton *toggle,
GtkIconView *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);
}
static void
-expand_cell_2_toggled (GtkToggleButton *toggle,
+expand_cell_2_toggled (GtkCheckButton *toggle,
GtkIconView *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);
}
static void
-expand_cell_3_toggled (GtkToggleButton *toggle,
+expand_cell_3_toggled (GtkCheckButton *toggle,
GtkIconView *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);
}
@@ -210,14 +210,14 @@ simple_cell_area (void)
G_CALLBACK (orientation_changed), iconview);
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);
g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (align_cell_2_toggled), iconview);
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);
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");
- 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);
g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (expand_cell_1_toggled), iconview);
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);
g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (expand_cell_2_toggled), iconview);
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);
g_signal_connect (G_OBJECT (widget), "toggled",
@@ -394,11 +394,11 @@ focus_iconview (gboolean color_bg, GtkCellRenderer **focus, GtkCellRenderer **si
}
static void
-focus_sibling_toggled (GtkToggleButton *toggle,
+focus_sibling_toggled (GtkCheckButton *toggle,
GtkIconView *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)
gtk_cell_area_add_focus_sibling (area, focus_renderer, sibling_renderer);
@@ -445,7 +445,7 @@ focus_cell_area (void)
G_CALLBACK (orientation_changed), iconview);
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);
g_signal_connect (G_OBJECT (widget), "toggled",
diff --git a/tests/testinhibitshortcuts.c b/tests/testinhibitshortcuts.c
index caecf43751..62d59047c5 100644
--- a/tests/testinhibitshortcuts.c
+++ b/tests/testinhibitshortcuts.c
@@ -30,10 +30,10 @@ on_shortcuts_inhibit_change (GdkSurface *surface, GParamSpec *pspec, gpointer da
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)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), shortcuts_inhibited);
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (button), shortcuts_inhibited);
}
static void
@@ -41,7 +41,7 @@ on_button_toggle (GtkWidget *button, gpointer 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));
return;
diff --git a/tests/testlist.c b/tests/testlist.c
index 285aaa74da..44cdbc9c9c 100644
--- a/tests/testlist.c
+++ b/tests/testlist.c
@@ -238,8 +238,8 @@ single_click_clicked (GtkButton *check, gpointer data)
{
GtkListBox *list = data;
- g_print ("single: %d\n", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
- gtk_list_box_set_activate_on_single_click (list, 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_check_button_get_active (GTK_CHECK_BUTTON (check)));
}
int
@@ -278,7 +278,7 @@ main (int argc, char *argv[])
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)));
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);
gtk_box_append (GTK_BOX (vbox), check);
diff --git a/tests/testlockbutton.c b/tests/testlockbutton.c
index 9832bb53cf..ff7599b65f 100644
--- a/tests/testlockbutton.c
+++ b/tests/testlockbutton.c
@@ -180,10 +180,10 @@ update_clicked (GtkButton *button, GtkLockButton *lockbutton)
permission = gtk_lock_button_get_permission (lockbutton);
- allowed = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (allowed_button));
- can_acquire = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (can_acquire_button));
- can_release = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (can_release_button));
- success = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (success_button));
+ allowed = gtk_check_button_get_active (GTK_CHECK_BUTTON (allowed_button));
+ can_acquire = gtk_check_button_get_active (GTK_CHECK_BUTTON (can_acquire_button));
+ can_release = gtk_check_button_get_active (GTK_CHECK_BUTTON (can_release_button));
+ success = gtk_check_button_get_active (GTK_CHECK_BUTTON (success_button));
g_permission_impl_update (permission, allowed, can_acquire, can_release);
g_test_permission_set_success (G_TEST_PERMISSION (permission), success);
}
@@ -202,9 +202,9 @@ permission_changed (GPermission *permission,
"can-release", &can_release,
NULL);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (allowed_button), allowed);
- gtk_toggle_button_set_active (GTK_TOGGLE_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 (allowed_button), allowed);
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (can_acquire_button), can_acquire);
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (can_release_button), can_release);
gtk_widget_set_sensitive (content, allowed);
}
diff --git a/tests/testpopover.c b/tests/testpopover.c
index e9e0a1c580..cdd09de99b 100644
--- a/tests/testpopover.c
+++ b/tests/testpopover.c
@@ -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", popover1, "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), check, 2, 3, 1, 1);
diff --git a/tests/testselectionmode.c b/tests/testselectionmode.c
index b001e253c5..823663396a 100644
--- a/tests/testselectionmode.c
+++ b/tests/testselectionmode.c
@@ -59,11 +59,11 @@ update_selected (GtkWidget *widget)
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);
}
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
diff --git a/tests/teststack.c b/tests/teststack.c
index 70931fa20f..d1deaacf34 100644
--- a/tests/teststack.c
+++ b/tests/teststack.c
@@ -20,14 +20,14 @@ set_visible_child_name (GtkWidget *button, gpointer data)
static void
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);
}
static void
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);
}
@@ -215,14 +215,14 @@ main (int argc,
g_signal_connect (button, "clicked", (GCallback) set_visible_child_name, (gpointer) "3");
button = gtk_check_button_new ();
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
- gtk_stack_get_hhomogeneous (GTK_STACK (stack)));
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (button),
+ gtk_stack_get_hhomogeneous (GTK_STACK (stack)));
gtk_box_append (GTK_BOX (hbox), button);
g_signal_connect (button, "clicked", (GCallback) toggle_hhomogeneous, NULL);
button = gtk_check_button_new_with_label ("homogeneous");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
- gtk_stack_get_vhomogeneous (GTK_STACK (stack)));
+ gtk_check_button_set_active (GTK_CHECK_BUTTON (button),
+ gtk_stack_get_vhomogeneous (GTK_STACK (stack)));
gtk_box_append (GTK_BOX (hbox), button);
g_signal_connect (button, "clicked", (GCallback) toggle_vhomogeneous, NULL);
diff --git a/tests/testtreeedit.c b/tests/testtreeedit.c
index d47a35b5a6..984cc21355 100644
--- a/tests/testtreeedit.c
+++ b/tests/testtreeedit.c
@@ -209,7 +209,7 @@ create_control (GtkWidget *box, int number, int cntl, CallbackData *data)
}
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);
g_signal_connect (G_OBJECT (checkbutton), "toggled", callback, data);
diff --git a/tests/testwindowsize.c b/tests/testwindowsize.c
index 8e2a1afd02..e6539c7ae0 100644
--- a/tests/testwindowsize.c
+++ b/tests/testwindowsize.c
@@ -30,7 +30,7 @@ show_dialog (void)
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_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),
GTK_DIALOG_MODAL,