Updated Spanish translation
[anjuta-git-plugin.git] / libanjuta / anjuta-preferences.h
blobdebf875305e46b6b4e9c24c3de21ad45f90e7f67
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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_COMBO,
38 ANJUTA_PROPERTY_OBJECT_TYPE_TEXT,
39 ANJUTA_PROPERTY_OBJECT_TYPE_COLOR,
40 ANJUTA_PROPERTY_OBJECT_TYPE_FONT,
41 ANJUTA_PROPERTY_OBJECT_TYPE_FILE
42 } AnjutaPropertyObjectType;
44 typedef enum
46 ANJUTA_PROPERTY_DATA_TYPE_BOOL,
47 ANJUTA_PROPERTY_DATA_TYPE_INT,
48 ANJUTA_PROPERTY_DATA_TYPE_TEXT,
49 ANJUTA_PROPERTY_DATA_TYPE_COLOR,
50 ANJUTA_PROPERTY_DATA_TYPE_FONT
51 } AnjutaPropertyDataType;
53 typedef enum
55 ANJUTA_PREFERENCES_FILTER_NONE = 0,
56 ANJUTA_PREFERENCES_FILTER_PROJECT = 1
57 } AnjutaPreferencesFilterType;
59 typedef struct _AnjutaProperty AnjutaProperty;
61 /* Get functions. Add more get functions for AnjutaProperty, if required */
62 /* Gets the widget associated with the property */
63 GtkWidget* anjuta_property_get_widget (AnjutaProperty *prop);
65 #define ANJUTA_TYPE_PREFERENCES (anjuta_preferences_get_type ())
66 #define ANJUTA_PREFERENCES(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ANJUTA_TYPE_PREFERENCES, AnjutaPreferences))
67 #define ANJUTA_PREFERENCES_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), ANJUTA_TYPE_PREFERENCES, AnjutaPreferencesClass))
68 #define ANJUTA_IS_PREFERENCES(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ANJUTA_TYPE_PREFERENCES))
69 #define ANJUTA_IS_PREFERENCES_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ANJUTA_TYPE_PREFERENCES))
71 typedef struct _AnjutaPreferences AnjutaPreferences;
72 typedef struct _AnjutaPreferencesClass AnjutaPreferencesClass;
73 typedef struct _AnjutaPreferencesPriv AnjutaPreferencesPriv;
75 struct _AnjutaPreferences
77 GObject parent;
79 /*< private >*/
80 AnjutaPreferencesPriv *priv;
83 struct _AnjutaPreferencesClass
85 GObjectClass parent;
88 typedef gboolean (*AnjutaPreferencesCallback) (AnjutaPreferences *pr,
89 const gchar *key,
90 gpointer data);
92 GType anjuta_preferences_get_type (void);
94 AnjutaPreferences *anjuta_preferences_new (AnjutaPluginManager *plugin_manager);
96 void anjuta_preferences_add_page (AnjutaPreferences* pr, GladeXML *gxml,
97 const gchar* glade_widget_name,
98 const gchar* title,
99 const gchar *icon_filename);
100 void anjuta_preferences_remove_page (AnjutaPreferences *pr,
101 const gchar *page_name);
104 * Registers all properties defined for widgets below the 'parent' widget
105 * in the given gxml glade UI tree
107 void anjuta_preferences_register_all_properties_from_glade_xml (AnjutaPreferences* pr,
108 GladeXML *gxml,
109 GtkWidget *parent);
110 gboolean
111 anjuta_preferences_register_property_from_string (AnjutaPreferences *pr,
112 GtkWidget *object,
113 const gchar *property_desc);
115 gboolean
116 anjuta_preferences_register_property_raw (AnjutaPreferences *pr, GtkWidget *object,
117 const gchar *key,
118 const gchar *default_value,
119 guint flags,
120 AnjutaPropertyObjectType object_type,
121 AnjutaPropertyDataType data_type);
123 gboolean
124 anjuta_preferences_register_property_custom (AnjutaPreferences *pr,
125 GtkWidget *object,
126 const gchar *key,
127 const gchar *default_value,
128 AnjutaPropertyDataType data_type,
129 guint flags,
130 void (*set_property) (AnjutaProperty *prop, const gchar *value),
131 gchar * (*get_property) (AnjutaProperty *));
133 void anjuta_preferences_reset_defaults (AnjutaPreferences *pr);
135 gboolean
136 anjuta_preferences_load_gconf (AnjutaPreferences *pr);
138 gboolean
139 anjuta_preferences_save (AnjutaPreferences *pr, FILE *stream);
141 /* Save excluding the filtered properties. This will save only those
142 * properties which DOES NOT have the flags set to values given by the filter.
144 gboolean
145 anjuta_preferences_save_filtered (AnjutaPreferences *pr, FILE *stream,
146 AnjutaPreferencesFilterType filter);
147 gboolean
148 anjuta_preferences_save_gconf (AnjutaPreferences *pr,
149 AnjutaPreferencesFilterType filter);
153 /* Calls the callback function for each of the properties with the flags
154 * matching with the given filter
156 void anjuta_preferences_foreach (AnjutaPreferences *pr,
157 AnjutaPreferencesFilterType filter,
158 AnjutaPreferencesCallback callback,
159 gpointer data);
161 /* This will transfer all the properties values from the main
162 properties database to the parent session properties database */
163 void anjuta_preferences_sync_to_session (AnjutaPreferences *pr);
165 /* Sets the value (string) of a key */
166 void anjuta_preferences_set (AnjutaPreferences *pr,
167 const gchar *key,
168 const gchar *value);
170 /* Sets the list of a key */
171 void anjuta_preferences_set_list (AnjutaPreferences *pr, const gchar *key,
172 GConfValueType list_type, GSList *list);
174 /* Sets the pair of a key */
175 gboolean anjuta_preferences_set_pair (AnjutaPreferences *pr, const gchar *key,
176 GConfValueType car_type, GConfValueType cdr_type,
177 gconstpointer address_of_car,
178 gconstpointer address_of_cdr);
180 /* Sets the value (int) of a key */
181 void anjuta_preferences_set_int (AnjutaPreferences *pr,
182 const gchar *key,
183 const gint value);
185 /* Gets the value (string) of a key */
186 /* Must free the return string */
187 gchar * anjuta_preferences_get (AnjutaPreferences *pr,
188 const gchar *key);
190 /* Gets the list of a key */
191 GSList *anjuta_preferences_get_list (AnjutaPreferences *pr, const gchar *key,
192 GConfValueType list_type);
194 /* Gets the pair of a key */
195 gboolean anjuta_preferences_get_pair (AnjutaPreferences *pr, const gchar *key,
196 GConfValueType car_type, GConfValueType cdr_type,
197 gpointer car_retloc, gpointer cdr_retloc);
199 /* Gets the value (int) of a key. If not found, 0 is returned */
200 gint anjuta_preferences_get_int (AnjutaPreferences *pr,
201 const gchar *key);
203 /* Gets the value (int) of a key. If not found, the default_value is returned */
204 gint anjuta_preferences_get_int_with_default (AnjutaPreferences* pr,
205 const gchar *key,
206 gint default_value);
208 gchar * anjuta_preferences_default_get (AnjutaPreferences *pr,
209 const gchar *key);
211 /* Gets the value (int) of a key */
212 gint anjuta_preferences_default_get_int (AnjutaPreferences *pr,
213 const gchar *key);
215 /* Dialog methods */
216 GtkWidget *anjuta_preferences_get_dialog (AnjutaPreferences *pr);
218 /* Key notifications */
219 guint anjuta_preferences_notify_add (AnjutaPreferences *pr,
220 const gchar *key,
221 GConfClientNotifyFunc func,
222 gpointer data,
223 GFreeFunc destroy_notify);
224 void anjuta_preferences_notify_remove (AnjutaPreferences *pr, guint notify_id);
226 const gchar* anjuta_preferences_get_prefix (AnjutaPreferences *pr);
228 gboolean anjuta_preferences_dir_exists (AnjutaPreferences *pr, const gchar *dir);
230 void anjuta_preferences_add_dir (AnjutaPreferences *pr, const gchar *dir,
231 GConfClientPreloadType preload);
233 void anjuta_preferences_remove_dir (AnjutaPreferences *pr, const gchar *dir);
235 G_END_DECLS
237 #endif