2 * stash.h - this file is part of Geany, a fast and lightweight IDE
4 * Copyright 2008-2012 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
5 * Copyright 2008-2012 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #define GEANY_STASH_H 1
25 #include "gtkcompat.h"
29 /** Opaque type for a group of settings. */
30 typedef struct StashGroup StashGroup
;
32 /** Can be @c GtkWidget* or @c gchar* depending on whether the @a owner argument is used for
33 * stash_group_display() and stash_group_update(). */
34 typedef gconstpointer StashWidgetID
;
37 StashGroup
*stash_group_new(const gchar
*name
);
39 void stash_group_set_various(StashGroup
*group
, gboolean write_once
);
41 void stash_group_set_use_defaults(StashGroup
*group
, gboolean use_defaults
);
43 void stash_group_add_boolean(StashGroup
*group
, gboolean
*setting
,
44 const gchar
*key_name
, gboolean default_value
);
46 void stash_group_add_integer(StashGroup
*group
, gint
*setting
,
47 const gchar
*key_name
, gint default_value
);
49 void stash_group_add_string(StashGroup
*group
, gchar
**setting
,
50 const gchar
*key_name
, const gchar
*default_value
);
52 void stash_group_add_string_vector(StashGroup
*group
, gchar
***setting
,
53 const gchar
*key_name
, const gchar
**default_value
);
55 void stash_group_load_from_key_file(StashGroup
*group
, GKeyFile
*keyfile
);
57 void stash_group_save_to_key_file(StashGroup
*group
, GKeyFile
*keyfile
);
59 gboolean
stash_group_load_from_file(StashGroup
*group
, const gchar
*filename
);
61 gint
stash_group_save_to_file(StashGroup
*group
, const gchar
*filename
,
64 void stash_group_free_settings(StashGroup
*group
);
66 void stash_group_free(StashGroup
*group
);
69 /* *** GTK-related functions *** */
71 void stash_group_add_toggle_button(StashGroup
*group
, gboolean
*setting
,
72 const gchar
*key_name
, gboolean default_value
, StashWidgetID widget_id
);
74 void stash_group_add_radio_buttons(StashGroup
*group
, gint
*setting
,
75 const gchar
*key_name
, gint default_value
,
76 StashWidgetID widget_id
, gint enum_id
, ...) G_GNUC_NULL_TERMINATED
;
78 void stash_group_add_spin_button_integer(StashGroup
*group
, gint
*setting
,
79 const gchar
*key_name
, gint default_value
, StashWidgetID widget_id
);
81 void stash_group_add_combo_box(StashGroup
*group
, gint
*setting
,
82 const gchar
*key_name
, gint default_value
, StashWidgetID widget_id
);
84 void stash_group_add_combo_box_entry(StashGroup
*group
, gchar
**setting
,
85 const gchar
*key_name
, const gchar
*default_value
, StashWidgetID widget_id
);
87 void stash_group_add_entry(StashGroup
*group
, gchar
**setting
,
88 const gchar
*key_name
, const gchar
*default_value
, StashWidgetID widget_id
);
90 void stash_group_add_widget_property(StashGroup
*group
, gpointer setting
,
91 const gchar
*key_name
, gpointer default_value
, StashWidgetID widget_id
,
92 const gchar
*property_name
, GType type
);
94 void stash_group_display(StashGroup
*group
, GtkWidget
*owner
);
96 void stash_group_update(StashGroup
*group
, GtkWidget
*owner
);
98 void stash_tree_setup(GPtrArray
*group_array
, GtkTreeView
*tree
);
100 void stash_tree_display(GtkTreeView
*tree
);
102 void stash_tree_update(GtkTreeView
*tree
);
106 #endif /* GEANY_STASH_H */