Use g_*list_free_full() instead of g_*list_foreach()
[geany-mirror.git] / doc / stash-gui-example.c
blobf3521d9d21383414d86da71cc20fa9413611b4b2
1 gboolean want_handle;
2 StashGroup *group = ...;
4 /* Add the stash setting first so we can load it from disk if we want.
5 * Effectively, stash_group_add_boolean() is called for you.
6 * We need to use either a widget pointer or a widget name, and as we
7 * haven't created the widget yet we'll use a name - check_handle. */
8 stash_group_add_toggle_button(group, &want_handle, "handle", TRUE, "check_handle");
10 /* here we could load the setting from disk */
12 ...
13 /* Later we create a dialog holding the toggle button widget.
14 * (Note: a check button is a subclass of a toggle button). */
15 GtkWidget *dialog = ...;
16 GtkWidget *check_button = gtk_check_button_new_with_label(_("Handle"));
18 /* pack the widget into the dialog */
19 gtk_container_add(GTK_CONTAINER(dialog->vbox), check_button);
21 /* Now we set a name to lookup the widget from the dialog.
22 * We must remember to pass 'dialog' as an argument to Stash later. */
23 ui_hookup_widget(dialog, check_button, "check_handle");
25 ...
26 /* At some point we want to display the dialog.
27 * First we apply the want_handle boolean variable to the widget */
28 stash_group_display(group, dialog);
30 /* now display the dialog */
31 gtk_widget_show_all(dialog);
33 /* let the user manipulate widgets */
34 ...
35 /* Now synchronize the want_handle variable */
36 stash_group_update(group, dialog);