* plugins/class-gen/element-editor.c: Fixed typo.
[anjuta-git-plugin.git] / libanjuta / anjuta-preferences.h
blob9d46ef4e398b14650caa5d1d8a7860e561c96b61
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3 * preferences.h
4 * Copyright (C) 2000 - 2003 Naba Kumar <naba@gnome.org>
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 2 of the License, or
9 * (at your option) any later version.
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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #ifndef _ANJUTA_PREFERENCES_H_
21 #define _ANJUTA_PREFERENCES_H_
23 #include <gnome.h>
24 #include <glade/glade.h>
25 #include <gconf/gconf-client.h>
27 #include <libanjuta/anjuta-preferences-dialog.h>
29 G_BEGIN_DECLS
31 typedef enum
33 ANJUTA_PROPERTY_OBJECT_TYPE_TOGGLE,
34 ANJUTA_PROPERTY_OBJECT_TYPE_SPIN,
35 ANJUTA_PROPERTY_OBJECT_TYPE_ENTRY,
36 ANJUTA_PROPERTY_OBJECT_TYPE_MENU,
37 ANJUTA_PROPERTY_OBJECT_TYPE_TEXT,
38 ANJUTA_PROPERTY_OBJECT_TYPE_COLOR,
39 ANJUTA_PROPERTY_OBJECT_TYPE_FONT
40 } AnjutaPropertyObjectType;
42 typedef enum
44 ANJUTA_PROPERTY_DATA_TYPE_BOOL,
45 ANJUTA_PROPERTY_DATA_TYPE_INT,
46 ANJUTA_PROPERTY_DATA_TYPE_TEXT,
47 ANJUTA_PROPERTY_DATA_TYPE_COLOR,
48 ANJUTA_PROPERTY_DATA_TYPE_FONT
49 } AnjutaPropertyDataType;
51 typedef enum
53 ANJUTA_PREFERENCES_FILTER_NONE = 0,
54 ANJUTA_PREFERENCES_FILTER_PROJECT = 1
55 } AnjutaPreferencesFilterType;
57 typedef struct _AnjutaProperty AnjutaProperty;
59 /* Get functions. Add more get functions for AnjutaProperty, if required */
60 /* Gets the widget associated with the property */
61 GtkWidget* anjuta_property_get_widget (AnjutaProperty *prop);
63 #define ANJUTA_TYPE_PREFERENCES (anjuta_preferences_get_type ())
64 #define ANJUTA_PREFERENCES(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ANJUTA_TYPE_PREFERENCES, AnjutaPreferences))
65 #define ANJUTA_PREFERENCES_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), ANJUTA_TYPE_PREFERENCES, AnjutaPreferencesClass))
66 #define ANJUTA_IS_PREFERENCES(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ANJUTA_TYPE_PREFERENCES))
67 #define ANJUTA_IS_PREFERENCES_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ANJUTA_TYPE_PREFERENCES))
69 typedef struct _AnjutaPreferences AnjutaPreferences;
70 typedef struct _AnjutaPreferencesClass AnjutaPreferencesClass;
71 typedef struct _AnjutaPreferencesPriv AnjutaPreferencesPriv;
73 struct _AnjutaPreferences
75 AnjutaPreferencesDialog parent;
77 /*< private >*/
78 AnjutaPreferencesPriv *priv;
81 struct _AnjutaPreferencesClass
83 AnjutaPreferencesDialogClass parent;
86 typedef gboolean (*AnjutaPreferencesCallback) (AnjutaPreferences *pr,
87 const gchar *key,
88 gpointer data);
90 GType anjuta_preferences_get_type (void);
92 GtkWidget *anjuta_preferences_new (void);
94 void anjuta_preferences_add_page (AnjutaPreferences* pr, GladeXML *gxml,
95 const gchar* glade_widget_name,
96 const gchar* title,
97 const gchar *icon_filename);
100 * Registers all properties defined for widgets below the 'parent' widget
101 * in the given gxml glade UI tree
103 void anjuta_preferences_register_all_properties_from_glade_xml (AnjutaPreferences* pr,
104 GladeXML *gxml,
105 GtkWidget *parent);
106 gboolean
107 anjuta_preferences_register_property_from_string (AnjutaPreferences *pr,
108 GtkWidget *object,
109 const gchar *property_desc);
111 gboolean
112 anjuta_preferences_register_property_raw (AnjutaPreferences *pr, GtkWidget *object,
113 const gchar *key,
114 const gchar *default_value,
115 guint flags,
116 AnjutaPropertyObjectType object_type,
117 AnjutaPropertyDataType data_type);
119 gboolean
120 anjuta_preferences_register_property_custom (AnjutaPreferences *pr,
121 GtkWidget *object,
122 const gchar *key,
123 const gchar *default_value,
124 AnjutaPropertyDataType data_type,
125 guint flags,
126 void (*set_property) (AnjutaProperty *prop, const gchar *value),
127 gchar * (*get_property) (AnjutaProperty *));
129 void anjuta_preferences_reset_defaults (AnjutaPreferences *pr);
131 gboolean
132 anjuta_preferences_load_gconf (AnjutaPreferences *pr);
134 gboolean
135 anjuta_preferences_save (AnjutaPreferences *pr, FILE *stream);
137 /* Save excluding the filtered properties. This will save only those
138 * properties which DOES NOT have the flags set to values given by the filter.
140 gboolean
141 anjuta_preferences_save_filtered (AnjutaPreferences *pr, FILE *stream,
142 AnjutaPreferencesFilterType filter);
143 gboolean
144 anjuta_preferences_save_gconf (AnjutaPreferences *pr,
145 AnjutaPreferencesFilterType filter);
149 /* Calls the callback function for each of the properties with the flags
150 * matching with the given filter
152 void anjuta_preferences_foreach (AnjutaPreferences *pr,
153 AnjutaPreferencesFilterType filter,
154 AnjutaPreferencesCallback callback,
155 gpointer data);
157 /* This will transfer all the properties values from the main
158 properties database to the parent session properties database */
159 void anjuta_preferences_sync_to_session (AnjutaPreferences *pr);
161 /* Sets the value (string) of a key */
162 void anjuta_preferences_set (AnjutaPreferences *pr,
163 const gchar *key,
164 const gchar *value);
166 /* Sets the list of a key */
167 void anjuta_preferences_set_list (AnjutaPreferences *pr, const gchar *key,
168 GConfValueType list_type, GSList *list);
170 /* Sets the pair of a key */
171 gboolean anjuta_preferences_set_pair (AnjutaPreferences *pr, const gchar *key,
172 GConfValueType car_type, GConfValueType cdr_type,
173 gconstpointer address_of_car,
174 gconstpointer address_of_cdr);
176 /* Sets the value (int) of a key */
177 void anjuta_preferences_set_int (AnjutaPreferences *pr,
178 const gchar *key,
179 const gint value);
181 /* Gets the value (string) of a key */
182 /* Must free the return string */
183 gchar * anjuta_preferences_get (AnjutaPreferences *pr,
184 const gchar *key);
186 /* Gets the list of a key */
187 GSList *anjuta_preferences_get_list (AnjutaPreferences *pr, const gchar *key,
188 GConfValueType list_type);
190 /* Gets the pair of a key */
191 gboolean anjuta_preferences_get_pair (AnjutaPreferences *pr, const gchar *key,
192 GConfValueType car_type, GConfValueType cdr_type,
193 gpointer car_retloc, gpointer cdr_retloc);
195 /* Gets the value (int) of a key. If not found, 0 is returned */
196 gint anjuta_preferences_get_int (AnjutaPreferences *pr,
197 const gchar *key);
199 /* Gets the value (int) of a key. If not found, the default_value is returned */
200 gint anjuta_preferences_get_int_with_default (AnjutaPreferences* pr,
201 const gchar *key,
202 gint default_value);
204 gchar * anjuta_preferences_default_get (AnjutaPreferences *pr,
205 const gchar *key);
207 /* Gets the value (int) of a key */
208 gint anjuta_preferences_default_get_int (AnjutaPreferences *pr,
209 const gchar *key);
210 /* Key notifications */
211 guint anjuta_preferences_notify_add (AnjutaPreferences *pr,
212 const gchar *key,
213 GConfClientNotifyFunc func,
214 gpointer data,
215 GFreeFunc destroy_notify);
216 void anjuta_preferences_notify_remove (AnjutaPreferences *pr, guint notify_id);
218 const gchar* anjuta_preferences_get_prefix (AnjutaPreferences *pr);
220 gboolean anjuta_preferences_dir_exists (AnjutaPreferences *pr, const gchar *dir);
222 void anjuta_preferences_add_dir (AnjutaPreferences *pr, const gchar *dir,
223 GConfClientPreloadType preload);
225 void anjuta_preferences_remove_dir (AnjutaPreferences *pr, const gchar *dir);
227 G_END_DECLS
229 #endif