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.
10  *
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.
15  *
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
19  */
20 #ifndef _ANJUTA_PREFERENCES_H_
21 #define _ANJUTA_PREFERENCES_H_
22 
23 #include <gtk/gtk.h>
24 #include <glib/gi18n.h>
25 #include <gdk/gdkkeysyms.h>
26 
27 #include <libanjuta/anjuta-preferences-dialog.h>
28 #include <libanjuta/anjuta-plugin-manager.h>
29 
30 G_BEGIN_DECLS
31 
32 typedef struct _AnjutaProperty AnjutaProperty;
33 
34 /* Get functions. Add more get functions for AnjutaProperty, if required */
35 /* Gets the widget associated with the property */
36 GtkWidget* anjuta_property_get_widget (AnjutaProperty *prop);
37 
38 #define ANJUTA_TYPE_PREFERENCES        (anjuta_preferences_get_type ())
39 #define ANJUTA_PREFERENCES(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), ANJUTA_TYPE_PREFERENCES, AnjutaPreferences))
40 #define ANJUTA_PREFERENCES_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST((k), ANJUTA_TYPE_PREFERENCES, AnjutaPreferencesClass))
41 #define ANJUTA_IS_PREFERENCES(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), ANJUTA_TYPE_PREFERENCES))
42 #define ANJUTA_IS_PREFERENCES_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ANJUTA_TYPE_PREFERENCES))
43 
44 typedef struct _AnjutaPreferences        AnjutaPreferences;
45 typedef struct _AnjutaPreferencesClass   AnjutaPreferencesClass;
46 typedef struct _AnjutaPreferencesPriv    AnjutaPreferencesPriv;
47 
48 struct _AnjutaPreferences
49 {
50 	GObject parent;
51 
52 	/*< private >*/
53 	AnjutaPreferencesPriv *priv;
54 };
55 
56 struct _AnjutaPreferencesClass
57 {
58 	GObjectClass parent;
59 };
60 
61 typedef gboolean (*AnjutaPreferencesCallback) (AnjutaPreferences *pr,
62                                                const gchar *key,
63                                                gpointer data);
64 
65 GType anjuta_preferences_get_type (void);
66 
67 AnjutaPreferences *anjuta_preferences_new (AnjutaPluginManager *plugin_manager, const gchar *common_schema_id);
68 AnjutaPreferences *anjuta_preferences_default (void);
69 
70 void anjuta_preferences_add_from_builder (AnjutaPreferences *pr,
71                                           GtkBuilder *builder,
72                                           GSettings *settings,
73                                           const gchar *glade_widget_name,
74                                           const gchar *stitle,
75                                           const gchar *icon_filename);
76 
77 void anjuta_preferences_remove_page (AnjutaPreferences *pr,
78                                      const gchar *page_name);
79 
80 /*
81  * Registers all properties defined for widgets below the 'parent' widget
82  * in the given gtkbuilder UI tree
83  */
84 void anjuta_preferences_register_all_properties_from_builder_xml (AnjutaPreferences* pr,
85                                                                   GtkBuilder *builder,
86                                                                   GSettings *settings,
87                                                                   GtkWidget *parent);
88 gboolean
89 anjuta_preferences_register_property (AnjutaPreferences *pr,
90                                       GSettings *settings,
91                                       GtkWidget *object,
92                                       const gchar *key);
93 
94 /* Dialog methods */
95 GtkWidget *anjuta_preferences_get_dialog (AnjutaPreferences *pr);
96 gboolean anjuta_preferences_is_dialog_created (AnjutaPreferences *pr);
97 
98 G_END_DECLS
99 
100 #endif
101