File: stash-gui-example.c

package info (click to toggle)
geany 1.37.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 27,828 kB
  • sloc: ansic: 97,030; cpp: 60,187; vhdl: 5,924; sh: 4,596; makefile: 1,384; cs: 1,233; javascript: 1,023; f90: 537; sql: 503; python: 483; fortran: 389; php: 251; ruby: 163; asm: 131; java: 130; perl: 119; cobol: 88; erlang: 73; xml: 66; ada: 50; lisp: 48; tcl: 42; pascal: 15; haskell: 6
file content (36 lines) | stat: -rw-r--r-- 1,308 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
gboolean want_handle;
StashGroup *group = ...;

/* Add the stash setting first so we can load it from disk if we want.
 * Effectively, stash_group_add_boolean() is called for you.
 * We need to use either a widget pointer or a widget name, and as we
 * haven't created the widget yet we'll use a name - check_handle. */
stash_group_add_toggle_button(group, &want_handle, "handle", TRUE, "check_handle");

/* here we could load the setting from disk */

...
/* Later we create a dialog holding the toggle button widget.
 * (Note: a check button is a subclass of a toggle button). */
GtkWidget *dialog = ...;
GtkWidget *check_button = gtk_check_button_new_with_label(_("Handle"));

/* pack the widget into the dialog */
gtk_container_add(GTK_CONTAINER(dialog->vbox), check_button);

/* Now we set a name to lookup the widget from the dialog.
 * We must remember to pass 'dialog' as an argument to Stash later. */
ui_hookup_widget(dialog, check_button, "check_handle");

...
/* At some point we want to display the dialog.
 * First we apply the want_handle boolean variable to the widget */
stash_group_display(group, dialog);

/* now display the dialog */
gtk_widget_show_all(dialog);

/* let the user manipulate widgets */
...
/* Now synchronize the want_handle variable */
stash_group_update(group, dialog);