![]() |
![]() |
![]() |
Anjuta Developers Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
#include <libanjuta/anjuta-preferences.h> struct AnjutaPreferences; gboolean (*AnjutaPreferencesCallback) (AnjutaPreferences *pr
,const gchar *key
,gpointer data
); struct AnjutaPreferencesClass; AnjutaPreferencesPriv; AnjutaProperty; enum AnjutaPropertyDataType; enum AnjutaPropertyObjectType; void anjuta_preferences_add_from_builder (AnjutaPreferences *pr
,GtkBuilder *builder
,GSettings *settings
,const gchar *glade_widget_name
,const gchar *stitle
,const gchar *icon_filename
); AnjutaPreferences * anjuta_preferences_default (void
); GtkWidget * anjuta_preferences_get_dialog (AnjutaPreferences *pr
); gboolean anjuta_preferences_is_dialog_created (AnjutaPreferences *pr
); AnjutaPreferences * anjuta_preferences_new (AnjutaPluginManager *plugin_manager
); void anjuta_preferences_register_all_properties_from_builder_xml (AnjutaPreferences *pr
,GtkBuilder *builder
,GSettings *settings
,GtkWidget *parent
); gboolean anjuta_preferences_register_property_from_string (AnjutaPreferences *pr
,GSettings *settings
,GtkWidget *object
,const gchar *property_desc
); gboolean anjuta_preferences_register_property_raw (AnjutaPreferences *pr
,GSettings *settings
,GtkWidget *object
,const gchar *key
,const gchar *default_value
,guint flags
,AnjutaPropertyObjectType object_type
,AnjutaPropertyDataType data_type
); void anjuta_preferences_remove_page (AnjutaPreferences *pr
,const gchar *page_name
); GtkWidget * anjuta_property_get_widget (AnjutaProperty *prop
);
AnjutaPreferences is a way to let plugins register their preferences. There are mainly two ways a plugin could register its preferences in Anjuta.
First is to not use AnjutaPreferences at all. Simply register a
preferences page in AnjutaPreferencesDialog using the function
anjuta_preferences_dialog_add_page()
. The plugin should take
care of loading, saving and widgets synchronization of the
preferences values. This can be done using GSettings bindings
for example.
Second is to use anjuta_preferences_add_page()
, which will
automatically register the preferences keys and values from
a glade xml file. The glade xml file contains a preferences
page of the plugin. The widget names in the page are
given in a particular way (see anjuta_preferences_add_page()
) to
let it know property key details. The preference dialog will automatically
setup the bindings between GSettings and the widgets.
gboolean (*AnjutaPreferencesCallback) (AnjutaPreferences *pr
,const gchar *key
,gpointer data
);
typedef enum { ANJUTA_PROPERTY_DATA_TYPE_BOOL, ANJUTA_PROPERTY_DATA_TYPE_INT, ANJUTA_PROPERTY_DATA_TYPE_TEXT, ANJUTA_PROPERTY_DATA_TYPE_COLOR, ANJUTA_PROPERTY_DATA_TYPE_FONT } AnjutaPropertyDataType;
typedef enum { ANJUTA_PROPERTY_OBJECT_TYPE_TOGGLE, ANJUTA_PROPERTY_OBJECT_TYPE_SPIN, ANJUTA_PROPERTY_OBJECT_TYPE_ENTRY, ANJUTA_PROPERTY_OBJECT_TYPE_COMBO, ANJUTA_PROPERTY_OBJECT_TYPE_COLOR, ANJUTA_PROPERTY_OBJECT_TYPE_FONT, ANJUTA_PROPERTY_OBJECT_TYPE_FILE, ANJUTA_PROPERTY_OBJECT_TYPE_FOLDER } AnjutaPropertyObjectType;
void anjuta_preferences_add_from_builder (AnjutaPreferences *pr
,GtkBuilder *builder
,GSettings *settings
,const gchar *glade_widget_name
,const gchar *stitle
,const gchar *icon_filename
);
AnjutaPreferences * anjuta_preferences_default (void
);
Get the default instace of anjuta preferences
Returns : |
A AnjutaPreferences object. |
gboolean anjuta_preferences_is_dialog_created
(AnjutaPreferences *pr
);
AnjutaPreferences * anjuta_preferences_new (AnjutaPluginManager *plugin_manager
);
Creates a new AnjutaPreferences object
|
AnjutaPluginManager to be used |
Returns : |
A AnjutaPreferences object. |
void anjuta_preferences_register_all_properties_from_builder_xml (AnjutaPreferences *pr
,GtkBuilder *builder
,GSettings *settings
,GtkWidget *parent
);
This will register all the properties names of the format described above without considering the UI. Useful if you have the widgets shown elsewhere but you want them to be part of preferences system.
|
a AnjutaPreferences Object |
|
GtkBuilder object containing the properties widgets. |
|
Parent widget in the builder object |
gboolean anjuta_preferences_register_property_from_string (AnjutaPreferences *pr
,GSettings *settings
,GtkWidget *object
,const gchar *property_desc
);
This registers only one widget. The widget could be shown elsewhere. the property_description should be of the form described before.
|
a AnjutaPreferences object |
|
Widget to register |
|
Property description (see anjuta_preferences_add_page() ) |
Returns : |
TRUE if sucessful. |
gboolean anjuta_preferences_register_property_raw (AnjutaPreferences *pr
,GSettings *settings
,GtkWidget *object
,const gchar *key
,const gchar *default_value
,guint flags
,AnjutaPropertyObjectType object_type
,AnjutaPropertyDataType data_type
);
This also registers only one widget, but instead of supplying the property parameters as a single parsable string (as done in anjuta_preferences_register_property_from_string), it takes them separately.
|
a AnjutaPreferences object |
|
the GSettings object associated with that property |
|
Widget to register |
|
Property key |
|
Default value of the key |
|
Flags |
|
Object type of widget |
|
Data type of the property |
Returns : |
TRUE if sucessful. |
void anjuta_preferences_remove_page (AnjutaPreferences *pr
,const gchar *page_name
);
GtkWidget * anjuta_property_get_widget (AnjutaProperty *prop
);
Gets the widget associated with the property.
|
an AnjutaProperty reference |
Returns : |
a GtkWidget object associated with the property. |