Added initial Spanish translation
[anjuta-git-plugin.git] / libanjuta / anjuta-preferences.h
blob2553a8a8419ec36a5553eda04526067700e28263
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>
28 #include <libanjuta/anjuta-plugin-manager.h>
30 G_BEGIN_DECLS
32 typedef enum
34 ANJUTA_PROPERTY_OBJECT_TYPE_TOGGLE,
35 ANJUTA_PROPERTY_OBJECT_TYPE_SPIN,
36 ANJUTA_PROPERTY_OBJECT_TYPE_ENTRY,
37 ANJUTA_PROPERTY_OBJECT_TYPE_MENU,
38 ANJUTA_PROPERTY_OBJECT_TYPE_TEXT,
39 ANJUTA_PROPERTY_OBJECT_TYPE_COLOR,
40 ANJUTA_PROPERTY_OBJECT_TYPE_FONT
41 } AnjutaPropertyObjectType;
43 typedef enum
45 ANJUTA_PROPERTY_DATA_TYPE_BOOL,
46 ANJUTA_PROPERTY_DATA_TYPE_INT,
47 ANJUTA_PROPERTY_DATA_TYPE_TEXT,
48 ANJUTA_PROPERTY_DATA_TYPE_COLOR,
49 ANJUTA_PROPERTY_DATA_TYPE_FONT
50 } AnjutaPropertyDataType;
52 typedef enum
54 ANJUTA_PREFERENCES_FILTER_NONE = 0,
55 ANJUTA_PREFERENCES_FILTER_PROJECT = 1
56 } AnjutaPreferencesFilterType;
58 typedef struct _AnjutaProperty AnjutaProperty;
60 /* Get functions. Add more get functions for AnjutaProperty, if required */
61 /* Gets the widget associated with the property */
62 GtkWidget* anjuta_property_get_widget (AnjutaProperty *prop);
64 #define ANJUTA_TYPE_PREFERENCES (anjuta_preferences_get_type ())
65 #define ANJUTA_PREFERENCES(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ANJUTA_TYPE_PREFERENCES, AnjutaPreferences))
66 #define ANJUTA_PREFERENCES_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), ANJUTA_TYPE_PREFERENCES, AnjutaPreferencesClass))
67 #define ANJUTA_IS_PREFERENCES(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ANJUTA_TYPE_PREFERENCES))
68 #define ANJUTA_IS_PREFERENCES_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ANJUTA_TYPE_PREFERENCES))
70 typedef struct _AnjutaPreferences AnjutaPreferences;
71 typedef struct _AnjutaPreferencesClass AnjutaPreferencesClass;
72 typedef struct _AnjutaPreferencesPriv AnjutaPreferencesPriv;
74 struct _AnjutaPreferences
76 GObject parent;
78 /*< private >*/
79 AnjutaPreferencesPriv *priv;
82 struct _AnjutaPreferencesClass
84 GObjectClass parent;
87 typedef gboolean (*AnjutaPreferencesCallback) (AnjutaPreferences *pr,
88 const gchar *key,
89 gpointer data);
91 GType anjuta_preferences_get_type (void);
93 AnjutaPreferences *anjuta_preferences_new (AnjutaPluginManager *plugin_manager);
95 void anjuta_preferences_add_page (AnjutaPreferences* pr, GladeXML *gxml,
96 const gchar* glade_widget_name,
97 const gchar* title,
98 const gchar *icon_filename);
99 void anjuta_preferences_remove_page (AnjutaPreferences *pr,
100 const gchar *page_name);
103 * Registers all properties defined for widgets below the 'parent' widget
104 * in the given gxml glade UI tree
106 void anjuta_preferences_register_all_properties_from_glade_xml (AnjutaPreferences* pr,
107 GladeXML *gxml,
108 GtkWidget *parent);
109 gboolean
110 anjuta_preferences_register_property_from_string (AnjutaPreferences *pr,
111 GtkWidget *object,
112 const gchar *property_desc);
114 gboolean
115 anjuta_preferences_register_property_raw (AnjutaPreferences *pr, GtkWidget *object,
116 const gchar *key,
117 const gchar *default_value,
118 guint flags,
119 AnjutaPropertyObjectType object_type,
120 AnjutaPropertyDataType data_type);
122 gboolean
123 anjuta_preferences_register_property_custom (AnjutaPreferences *pr,
124 GtkWidget *object,
125 const gchar *key,
126 const gchar *default_value,
127 AnjutaPropertyDataType data_type,
128 guint flags,
129 void (*set_property) (AnjutaProperty *prop, const gchar *value),
130 gchar * (*get_property) (AnjutaProperty *));
132 void anjuta_preferences_reset_defaults (AnjutaPreferences *pr);
134 gboolean
135 anjuta_preferences_load_gconf (AnjutaPreferences *pr);
137 gboolean
138 anjuta_preferences_save (AnjutaPreferences *pr, FILE *stream);
140 /* Save excluding the filtered properties. This will save only those
141 * properties which DOES NOT have the flags set to values given by the filter.
143 gboolean
144 anjuta_preferences_save_filtered (AnjutaPreferences *pr, FILE *stream,
145 AnjutaPreferencesFilterType filter);
146 gboolean
147 anjuta_preferences_save_gconf (AnjutaPreferences *pr,
148 AnjutaPreferencesFilterType filter);
152 /* Calls the callback function for each of the properties with the flags
153 * matching with the given filter
155 void anjuta_preferences_foreach (AnjutaPreferences *pr,
156 AnjutaPreferencesFilterType filter,
157 AnjutaPreferencesCallback callback,
158 gpointer data);
160 /* This will transfer all the properties values from the main
161 properties database to the parent session properties database */
162 void anjuta_preferences_sync_to_session (AnjutaPreferences *pr);
164 /* Sets the value (string) of a key */
165 void anjuta_preferences_set (AnjutaPreferences *pr,
166 const gchar *key,
167 const gchar *value);
169 /* Sets the list of a key */
170 void anjuta_preferences_set_list (AnjutaPreferences *pr, const gchar *key,
171 GConfValueType list_type, GSList *list);
173 /* Sets the pair of a key */
174 gboolean anjuta_preferences_set_pair (AnjutaPreferences *pr, const gchar *key,
175 GConfValueType car_type, GConfValueType cdr_type,
176 gconstpointer address_of_car,
177 gconstpointer address_of_cdr);
179 /* Sets the value (int) of a key */
180 void anjuta_preferences_set_int (AnjutaPreferences *pr,
181 const gchar *key,
182 const gint value);
184 /* Gets the value (string) of a key */
185 /* Must free the return string */
186 gchar * anjuta_preferences_get (AnjutaPreferences *pr,
187 const gchar *key);
189 /* Gets the list of a key */
190 GSList *anjuta_preferences_get_list (AnjutaPreferences *pr, const gchar *key,
191 GConfValueType list_type);
193 /* Gets the pair of a key */
194 gboolean anjuta_preferences_get_pair (AnjutaPreferences *pr, const gchar *key,
195 GConfValueType car_type, GConfValueType cdr_type,
196 gpointer car_retloc, gpointer cdr_retloc);
198 /* Gets the value (int) of a key. If not found, 0 is returned */
199 gint anjuta_preferences_get_int (AnjutaPreferences *pr,
200 const gchar *key);
202 /* Gets the value (int) of a key. If not found, the default_value is returned */
203 gint anjuta_preferences_get_int_with_default (AnjutaPreferences* pr,
204 const gchar *key,
205 gint default_value);
207 gchar * anjuta_preferences_default_get (AnjutaPreferences *pr,
208 const gchar *key);
210 /* Gets the value (int) of a key */
211 gint anjuta_preferences_default_get_int (AnjutaPreferences *pr,
212 const gchar *key);
214 /* Dialog methods */
215 GtkWidget *anjuta_preferences_get_dialog (AnjutaPreferences *pr);
217 /* Key notifications */
218 guint anjuta_preferences_notify_add (AnjutaPreferences *pr,
219 const gchar *key,
220 GConfClientNotifyFunc func,
221 gpointer data,
222 GFreeFunc destroy_notify);
223 void anjuta_preferences_notify_remove (AnjutaPreferences *pr, guint notify_id);
225 const gchar* anjuta_preferences_get_prefix (AnjutaPreferences *pr);
227 gboolean anjuta_preferences_dir_exists (AnjutaPreferences *pr, const gchar *dir);
229 void anjuta_preferences_add_dir (AnjutaPreferences *pr, const gchar *dir,
230 GConfClientPreloadType preload);
232 void anjuta_preferences_remove_dir (AnjutaPreferences *pr, const gchar *dir);
234 G_END_DECLS
236 #endif