testgaction: Add more widgetry

Add some toggle and check buttons to test that they
work as expected as GtkActionables.
This commit is contained in:
Matthias Clasen 2021-06-10 08:10:25 -04:00
parent c7ad8d29e9
commit 28990285e2

View File

@ -118,6 +118,7 @@ int main (int argc, char **argv)
GtkWidget *button1 = gtk_button_new_with_label ("Change Label Text");
GtkWidget *menu;
GSimpleActionGroup *action_group;
GtkWidget *box1;
action_group = g_simple_action_group_new ();
@ -148,6 +149,50 @@ int main (int argc, char **argv)
gtk_actionable_set_action_name (GTK_ACTIONABLE (button1), "win.change-label-button");
gtk_box_append (GTK_BOX (box), button1);
box1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
button1 = gtk_toggle_button_new_with_label ("Toggle");
gtk_actionable_set_action_name (GTK_ACTIONABLE (button1), "win.toggle-menu-item");
gtk_box_append (GTK_BOX (box1), button1);
button1 = gtk_check_button_new_with_label ("Check");
gtk_actionable_set_action_name (GTK_ACTIONABLE (button1), "win.toggle-menu-item");
gtk_box_append (GTK_BOX (box1), button1);
gtk_box_append (GTK_BOX (box), box1);
box1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
button1 = gtk_toggle_button_new_with_label ("Radio 1");
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button1), "win.radio::1");
gtk_box_append (GTK_BOX (box1), button1);
button1 = gtk_toggle_button_new_with_label ("Radio 2");
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button1), "win.radio::2");
gtk_box_append (GTK_BOX (box1), button1);
button1 = gtk_toggle_button_new_with_label ("Radio 3");
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button1), "win.radio::3");
gtk_box_append (GTK_BOX (box1), button1);
gtk_box_append (GTK_BOX (box), box1);
box1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
button1 = gtk_check_button_new_with_label ("Radio 1");
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button1), "win.radio::1");
gtk_box_append (GTK_BOX (box1), button1);
button1 = gtk_check_button_new_with_label ("Radio 2");
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button1), "win.radio::2");
gtk_box_append (GTK_BOX (box1), button1);
button1 = gtk_check_button_new_with_label ("Radio 3");
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button1), "win.radio::3");
gtk_box_append (GTK_BOX (box1), button1);
gtk_box_append (GTK_BOX (box), box1);
gtk_window_set_child (GTK_WINDOW (window), box);
gtk_widget_show (window);