Updated Spanish translation
[anjuta.git] / libanjuta / anjuta-preferences.h
blob5c5199d600f245b9fe6f906878f13c688d0f6de8
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 <gtk/gtk.h>
24 #include <glib/gi18n.h>
25 #include <gdk/gdkkeysyms.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 ANJUTA_PROPERTY_OBJECT_TYPE_FOLDER
43 } AnjutaPropertyObjectType;
45 typedef enum
47 ANJUTA_PROPERTY_DATA_TYPE_BOOL,
48 ANJUTA_PROPERTY_DATA_TYPE_INT,
49 ANJUTA_PROPERTY_DATA_TYPE_TEXT,
50 ANJUTA_PROPERTY_DATA_TYPE_COLOR,
51 ANJUTA_PROPERTY_DATA_TYPE_FONT
52 } AnjutaPropertyDataType;
54 typedef struct _AnjutaProperty AnjutaProperty;
56 /* Get functions. Add more get functions for AnjutaProperty, if required */
57 /* Gets the widget associated with the property */
58 GtkWidget* anjuta_property_get_widget (AnjutaProperty *prop);
60 #define ANJUTA_TYPE_PREFERENCES (anjuta_preferences_get_type ())
61 #define ANJUTA_PREFERENCES(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ANJUTA_TYPE_PREFERENCES, AnjutaPreferences))
62 #define ANJUTA_PREFERENCES_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), ANJUTA_TYPE_PREFERENCES, AnjutaPreferencesClass))
63 #define ANJUTA_IS_PREFERENCES(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ANJUTA_TYPE_PREFERENCES))
64 #define ANJUTA_IS_PREFERENCES_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ANJUTA_TYPE_PREFERENCES))
66 typedef struct _AnjutaPreferences AnjutaPreferences;
67 typedef struct _AnjutaPreferencesClass AnjutaPreferencesClass;
68 typedef struct _AnjutaPreferencesPriv AnjutaPreferencesPriv;
70 struct _AnjutaPreferences
72 GObject parent;
74 /*< private >*/
75 AnjutaPreferencesPriv *priv;
78 struct _AnjutaPreferencesClass
80 GObjectClass parent;
83 typedef gboolean (*AnjutaPreferencesCallback) (AnjutaPreferences *pr,
84 const gchar *key,
85 gpointer data);
87 GType anjuta_preferences_get_type (void);
89 AnjutaPreferences *anjuta_preferences_new (AnjutaPluginManager *plugin_manager);
90 AnjutaPreferences *anjuta_preferences_default (void);
92 void anjuta_preferences_add_from_builder (AnjutaPreferences* pr,GtkBuilder *builder,
93 const gchar* glade_widget_name,
94 const gchar* title,
95 const gchar *icon_filename);
97 void anjuta_preferences_remove_page (AnjutaPreferences *pr,
98 const gchar *page_name);
101 * Registers all properties defined for widgets below the 'parent' widget
102 * in the given gtkbuilder UI tree
104 void anjuta_preferences_register_all_properties_from_builder_xml (AnjutaPreferences* pr,
105 GtkBuilder* builder,
106 GtkWidget *parent);
107 gboolean
108 anjuta_preferences_register_property_from_string (AnjutaPreferences *pr,
109 GtkWidget *object,
110 const gchar *property_desc);
112 gboolean
113 anjuta_preferences_register_property_raw (AnjutaPreferences *pr, GtkWidget *object,
114 const gchar *key,
115 const gchar *default_value,
116 guint flags,
117 AnjutaPropertyObjectType object_type,
118 AnjutaPropertyDataType data_type);
120 gboolean
121 anjuta_preferences_register_property_custom (AnjutaPreferences *pr,
122 GtkWidget *object,
123 const gchar *key,
124 const gchar *default_value,
125 AnjutaPropertyDataType data_type,
126 guint flags,
127 void (*set_property) (AnjutaProperty *prop, const gchar *value),
128 gchar * (*get_property) (AnjutaProperty *));
130 void anjuta_preferences_reset_defaults (AnjutaPreferences *pr);
132 /* Calls the callback function for each of the properties with the flags
133 * matching with the given filter
135 void anjuta_preferences_foreach (AnjutaPreferences *pr,
136 AnjutaPreferencesCallback callback,
137 gpointer data);
139 /* This will transfer all the properties values from the main
140 properties database to the parent session properties database */
141 void anjuta_preferences_sync_to_session (AnjutaPreferences *pr);
143 /* Sets the value (string) of a key */
144 void anjuta_preferences_set (AnjutaPreferences *pr,
145 const gchar *key,
146 const gchar *value);
148 /* Sets the value (int) of a key */
149 void anjuta_preferences_set_int (AnjutaPreferences *pr,
150 const gchar *key,
151 const gint value);
153 void anjuta_preferences_set_bool (AnjutaPreferences *pr,
154 const gchar *key,
155 const gboolean value);
157 /* Gets the value (string) of a key */
158 /* Must free the return string */
159 gchar * anjuta_preferences_get (AnjutaPreferences *pr,
160 const gchar *key);
162 /* Gets the value (int) of a key. If not found, 0 is returned */
163 gint anjuta_preferences_get_int (AnjutaPreferences *pr,
164 const gchar *key);
166 gboolean anjuta_preferences_get_bool (AnjutaPreferences *pr,
167 const gchar *key);
169 /* Gets the value (int) of a key. If not found, the default_value is returned */
170 gint anjuta_preferences_get_int_with_default (AnjutaPreferences* pr,
171 const gchar *key,
172 gint default_value);
174 gint anjuta_preferences_get_bool_with_default (AnjutaPreferences* pr,
175 const gchar *key,
176 gint default_value);
178 gchar * anjuta_preferences_default_get (AnjutaPreferences *pr,
179 const gchar *key);
181 /* Gets the value (int) of a key */
182 gint anjuta_preferences_default_get_int (AnjutaPreferences *pr,
183 const gchar *key);
185 gint anjuta_preferences_default_get_bool (AnjutaPreferences *pr,
186 const gchar *key);
188 /* Dialog methods */
189 GtkWidget *anjuta_preferences_get_dialog (AnjutaPreferences *pr);
190 gboolean anjuta_preferences_is_dialog_created (AnjutaPreferences *pr);
192 /* Key notifications */
194 typedef void (*AnjutaPreferencesNotify) (AnjutaPreferences *pr,
195 const gchar* key,
196 const gchar* value,
197 gpointer data);
198 typedef void (*AnjutaPreferencesNotifyInt) (AnjutaPreferences *pr,
199 const gchar* key,
200 gint value,
201 gpointer data);
202 typedef void (*AnjutaPreferencesNotifyBool) (AnjutaPreferences *pr,
203 const gchar* key,
204 gboolean value,
205 gpointer data);
207 guint anjuta_preferences_notify_add_int (AnjutaPreferences *pr,
208 const gchar *key,
209 AnjutaPreferencesNotifyInt func,
210 gpointer data,
211 GFreeFunc destroy_notify);
213 guint anjuta_preferences_notify_add_string (AnjutaPreferences *pr,
214 const gchar *key,
215 AnjutaPreferencesNotify func,
216 gpointer data,
217 GFreeFunc destroy_notify);
219 guint anjuta_preferences_notify_add_bool (AnjutaPreferences *pr,
220 const gchar *key,
221 AnjutaPreferencesNotifyBool func,
222 gpointer data,
223 GFreeFunc destroy_notify);
225 void anjuta_preferences_notify_remove (AnjutaPreferences *pr, guint notify_id);
227 const gchar* anjuta_preferences_get_prefix (AnjutaPreferences *pr);
229 G_END_DECLS
231 #endif