Debian Codegraph @

geanygendoc/src/ggd-options.h

raw
1 /*
2 *
3 * GeanyGenDoc, a Geany plugin to ease generation of source code documentation
4 * Copyright (C) 2010-2011 Colomban Wendling <[email protected]>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #ifndef H_GGD_OPTIONS
22 #define H_GGD_OPTIONS
23
24 #include <glib.h>
25 #include <gtk/gtk.h>
26
27 #include "ggd-macros.h"
28
29 G_BEGIN_DECLS
30 GGD_BEGIN_PLUGIN_API
31
32 #if GTK_CHECK_VERSION(3, 0, 0)
33 # define GtkObject GtkWidget
34 # define GTK_OBJECT GTK_WIDGET
35 #endif
36
37
38 /**
39 * GgdOptGroup:
40 *
41 * Opaque object representing a group of options.
42 */
43 typedef struct _GgdOptGroup GgdOptGroup;
44
45
46 GgdOptGroup *ggd_opt_group_new (const gchar *section);
47 void ggd_opt_group_free (GgdOptGroup *group,
48 gboolean free_opts);
49 void ggd_opt_group_add_boolean (GgdOptGroup *group,
50 gboolean *optvar,
51 const gchar *key);
52 void ggd_opt_group_add_string (GgdOptGroup *group,
53 gchar **optvar,
54 const gchar *key);
55 void ggd_opt_group_sync_to_proxies (GgdOptGroup *group);
56 void ggd_opt_group_sync_from_proxies (GgdOptGroup *group);
57 gboolean ggd_opt_group_set_proxy_full (GgdOptGroup *group,
58 gpointer optvar,
59 gboolean check_type,
60 GType type_check,
61 GObject *proxy,
62 const gchar *prop);
63 gboolean ggd_opt_group_set_proxy_gtkobject_full (GgdOptGroup *group,
64 gpointer optvar,
65 gboolean check_type,
66 GType type_check,
67 GtkObject *proxy,
68 const gchar *prop);
69 void ggd_opt_group_remove_proxy (GgdOptGroup *group,
70 gpointer optvar);
71 void ggd_opt_group_load_from_key_file (GgdOptGroup *group,
72 GKeyFile *key_file);
73 gboolean ggd_opt_group_load_from_file (GgdOptGroup *group,
74 const gchar *filename,
75 GError **error);
76 void ggd_opt_group_write_to_key_file (GgdOptGroup *group,
77 GKeyFile *key_file);
78 gboolean ggd_opt_group_write_to_file (GgdOptGroup *group,
79 const gchar *filename,
80 GError **error);
81
82 #define ggd_opt_group_set_proxy(group, optvar, proxy, prop) \
83 (ggd_opt_group_set_proxy_full (group, optvar, FALSE, 0, proxy, prop))
84
85 #define ggd_opt_group_set_proxy_gtkentry(group, optvar, proxy) \
86 (ggd_opt_group_set_proxy_gtkobject_full (group, optvar, TRUE, G_TYPE_STRING, \
87 GTK_OBJECT (proxy), "text"))
88 #define ggd_opt_group_set_proxy_gtktogglebutton(group, optvar, proxy) \
89 (ggd_opt_group_set_proxy_gtkobject_full (group, optvar, TRUE, G_TYPE_BOOLEAN,\
90 GTK_OBJECT (proxy), "active"))
91
92
93 GGD_END_PLUGIN_API
94 G_END_DECLS
95
96 #endif /* guard */