anjuta r4829 - in branches/preferences_singleton: . libanjuta manuals/anjuta-manual/C plugins/file-manager plugins/tools/scripts po scripts



Author: jhs
Date: Wed Mar  4 16:45:21 2009
New Revision: 4829
URL: http://svn.gnome.org/viewvc/anjuta?rev=4829&view=rev

Log:
Created new branch for cleaned preferences which is now a singleton


Added:
   branches/preferences_singleton/
      - copied from r4819, /trunk/
   branches/preferences_singleton/ChangeLog
      - copied unchanged from r4828, /trunk/ChangeLog
   branches/preferences_singleton/configure.in
      - copied unchanged from r4828, /trunk/configure.in
   branches/preferences_singleton/libanjuta/Makefile.am
      - copied unchanged from r4822, /trunk/libanjuta/Makefile.am
   branches/preferences_singleton/libanjuta/anjuta-preferences.c
      - copied, changed from r4821, /trunk/libanjuta/anjuta-preferences.c
   branches/preferences_singleton/libanjuta/e-splash.c
      - copied unchanged from r4827, /trunk/libanjuta/e-splash.c
   branches/preferences_singleton/manuals/anjuta-manual/C/projects.xml
      - copied unchanged from r4821, /trunk/manuals/anjuta-manual/C/projects.xml
   branches/preferences_singleton/plugins/file-manager/plugin.c
      - copied unchanged from r4825, /trunk/plugins/file-manager/plugin.c
   branches/preferences_singleton/plugins/tools/scripts/Makefile.am
      - copied unchanged from r4828, /trunk/plugins/tools/scripts/Makefile.am
   branches/preferences_singleton/po/ChangeLog
      - copied unchanged from r4822, /trunk/po/ChangeLog
   branches/preferences_singleton/po/POTFILES.in
      - copied unchanged from r4822, /trunk/po/POTFILES.in
   branches/preferences_singleton/scripts/build-schemas.mk
      - copied unchanged from r4828, /trunk/scripts/build-schemas.mk
Modified:
   branches/preferences_singleton/libanjuta/anjuta-preferences.h

Copied: branches/preferences_singleton/libanjuta/anjuta-preferences.c (from r4821, /trunk/libanjuta/anjuta-preferences.c)
==============================================================================
--- /trunk/libanjuta/anjuta-preferences.c	(original)
+++ branches/preferences_singleton/libanjuta/anjuta-preferences.c	Wed Mar  4 16:45:21 2009
@@ -74,6 +74,9 @@
 #include <libanjuta/anjuta-debug.h>
 #include <libanjuta/interfaces/ianjuta-preferences.h>
 
+/* AnjutaPreferences is a singleton */
+static AnjutaPreferences* default_preferences = NULL;
+
 struct _AnjutaProperty
 {
 	GtkWidget                *object;
@@ -103,6 +106,8 @@
 	GtkWidget           *prefs_dialog;
 	AnjutaPluginManager *plugin_manager;
 	gboolean             is_showing;
+
+	GHashTable			*notifications;
 };
 
 /* Internal structure for anjuta_preferences_foreach */
@@ -114,6 +119,8 @@
 	gpointer callback_data;
 };
 
+/* Data for notifications */
+
 #define PREFERENCE_PROPERTY_PREFIX "preferences_"
 #define GCONF_KEY_PREFIX "/apps/anjuta/preferences"
 
@@ -148,71 +155,102 @@
 }
 
 /**
- * anjuta_preferences_get_list:
+ * anjuta_preferences_get_int:
  * @pr: A #AnjutaPreferences object
  * @key: Property key
- * @list_type: Type of each list element
  *
- * Gets the list of @key.
+ * Gets the value of @key as integer.
  *
- * Return value: Key list or NULL if the key is not defined.
+ * Return value: Key value as integer or 0 if the key is not defined.
  */
 #ifdef __GNUC__
 inline
 #endif
-GSList *
-anjuta_preferences_get_list (AnjutaPreferences *pr, const gchar *key,
-                             GConfValueType list_type)
+gint
+anjuta_preferences_get_int (AnjutaPreferences *pr, const gchar *key)
 {
-	g_return_val_if_fail (ANJUTA_IS_PREFERENCES (pr), NULL);
-	g_return_val_if_fail (key != NULL, NULL);
-
-	return gconf_client_get_list(pr->priv->gclient, build_key (key), list_type, NULL);
+	gint ret_val;
+	GConfValue *value;
+	
+	g_return_val_if_fail (ANJUTA_IS_PREFERENCES (pr), 0);
+	g_return_val_if_fail (key != NULL, 0);
+	
+	ret_val = 0;
+	value = gconf_client_get (pr->priv->gclient, build_key (key), NULL);
+	if (value)
+	{
+		switch (value->type)
+		{
+			case GCONF_VALUE_INT:
+				ret_val = gconf_value_get_int (value);
+				break;
+			default:
+				g_warning ("Invalid gconf type for key: %s", key);
+		}
+		gconf_value_free (value);
+	}
+	else
+		DEBUG_PRINT ("The preference key %s is not defined", key);
+	return ret_val;
 }
 
 /**
- * anjuta_preferences_get_pair:
+ * anjuta_preferences_get_int:
  * @pr: A #AnjutaPreferences object
  * @key: Property key
- * @car_type: Desired type of the pair's first field (car).
- * @cdr_type: Desired type of the pair's second field (cdr).
- * @car_retloc: Address of a return location for the car.
- * @cdr_retloc: Address of a return location for the cdr.
  *
- * Gets the pair of @key.
+ * Gets the value of @key as integer.
  *
- * Return value: TRUE or FALSE.
+ * Return value: Key value as integer or 0 if the key is not defined.
  */
 #ifdef __GNUC__
 inline
 #endif
-gboolean
-anjuta_preferences_get_pair (AnjutaPreferences *pr, const gchar *key,
-                             GConfValueType car_type, GConfValueType cdr_type,
-                             gpointer car_retloc, gpointer cdr_retloc)
+gint
+anjuta_preferences_get_bool (AnjutaPreferences *pr, const gchar *key)
 {
-	g_return_val_if_fail (ANJUTA_IS_PREFERENCES (pr), FALSE);
-	g_return_val_if_fail (key != NULL, FALSE);
-
-	return gconf_client_get_pair(pr->priv->gclient, build_key (key),
-                                 car_type, cdr_type,
-                                 car_retloc, cdr_retloc, NULL);
+	gboolean ret_val;
+	GConfValue *value;
+	
+	g_return_val_if_fail (ANJUTA_IS_PREFERENCES (pr), 0);
+	g_return_val_if_fail (key != NULL, 0);
+	
+	ret_val = FALSE;
+	value = gconf_client_get (pr->priv->gclient, build_key (key), NULL);
+	if (value)
+	{
+		switch (value->type)
+		{
+			case GCONF_VALUE_BOOL:
+				ret_val = gconf_value_get_bool (value);
+				break;
+			default:
+				g_warning ("Invalid gconf type for key: %s", key);
+		}
+		gconf_value_free (value);
+	}
+	else
+		DEBUG_PRINT ("The preference key %s is not defined", key);
+	return ret_val;
 }
 
 /**
- * anjuta_preferences_get_int:
+ * anjuta_preferences_get_int_with_default:
  * @pr: A #AnjutaPreferences object
  * @key: Property key
+ * @default_value: Default value to return if the key is not defined.
  *
  * Gets the value of @key as integer.
  *
- * Return value: Key value as integer or 0 if the key is not defined.
+ * Return value: Key value as integer or @default_value if the
+ * key is not defined.
  */
 #ifdef __GNUC__
 inline
 #endif
 gint
-anjuta_preferences_get_int (AnjutaPreferences *pr, const gchar *key)
+anjuta_preferences_get_int_with_default (AnjutaPreferences *pr,
+										 const gchar *key, gint default_value)
 {
 	gint ret_val;
 	GConfValue *value;
@@ -220,7 +258,7 @@
 	g_return_val_if_fail (ANJUTA_IS_PREFERENCES (pr), 0);
 	g_return_val_if_fail (key != NULL, 0);
 	
-	ret_val = 0;
+	ret_val = default_value;
 	value = gconf_client_get (pr->priv->gclient, build_key (key), NULL);
 	if (value)
 	{
@@ -237,8 +275,6 @@
 		}
 		gconf_value_free (value);
 	}
-	/* else
-		g_warning ("The preference key %s is not defined", key); */
 	return ret_val;
 }
 
@@ -257,10 +293,10 @@
 inline
 #endif
 gint
-anjuta_preferences_get_int_with_default (AnjutaPreferences *pr,
-										 const gchar *key, gint default_value)
+anjuta_preferences_get_bool_with_default (AnjutaPreferences *pr,
+                                          const gchar *key, gboolean default_value)
 {
-	gint ret_val;
+	gboolean ret_val;
 	GConfValue *value;
 	
 	g_return_val_if_fail (ANJUTA_IS_PREFERENCES (pr), 0);
@@ -272,9 +308,6 @@
 	{
 		switch (value->type)
 		{
-			case GCONF_VALUE_INT:
-				ret_val = gconf_value_get_int (value);
-				break;
 			case GCONF_VALUE_BOOL:
 				ret_val = gconf_value_get_bool (value);
 				break;
@@ -354,6 +387,39 @@
 }
 
 /**
+ * anjuta_preferences_default_get_int:
+ * @pr: A #AnjutaPreferences object
+ * @key: Property key
+ *
+ * Gets the default value of @key as integer. The default value of the key
+ * is the value defined in System defaults (generally installed during 
+ * program installation).
+ *
+ * Return value: Default key value as integer or 0 if the key is not defined.
+ */
+#ifdef __GNUC__
+inline
+#endif
+gboolean
+anjuta_preferences_default_get_bool (AnjutaPreferences *pr, const gchar *key)
+{
+	GConfValue *val;
+	gint ret;
+	GError *err = NULL;
+	
+	g_return_val_if_fail (ANJUTA_IS_PREFERENCES (pr), 0);
+	g_return_val_if_fail (key != NULL, 0);
+	val = gconf_client_get_default_from_schema (pr->priv->gclient, build_key (key), &err);
+	if (err) {
+		g_error_free (err);
+		return 0;
+	}
+	ret = gconf_value_get_bool (val);
+	gconf_value_free (val);
+	return ret;
+}
+
+/**
  * anjuta_preferences_set:
  * @pr: A #AnjutaPreferences object.
  * @key: Property key.
@@ -382,61 +448,52 @@
 }
 
 /**
- * anjuta_preferences_set_list:
+ * anjuta_preferences_set_int:
  * @pr: A #AnjutaPreferences object.
  * @key: Property key.
- * @list_type: Type of each element.
- * @list: New value of the key.
+ * @value: Integer value of the key.
  *
- * Sets a list in current session.
+ * Sets the value of @key in current session.
  */
 #ifdef __GNUC__
 inline
 #endif
 void
-anjuta_preferences_set_list (AnjutaPreferences *pr, const gchar *key,
-					         GConfValueType list_type, GSList *list)
+anjuta_preferences_set_int (AnjutaPreferences *pr, const gchar *key,
+							gint value)
 {
+	GConfValue *gvalue;
+	
 	g_return_if_fail (ANJUTA_IS_PREFERENCES (pr));
 	g_return_if_fail (key != NULL);
-
-	gconf_client_set_list(pr->priv->gclient, build_key (key), 
-		                      list_type, list, NULL);
-}
-
-/**
- * anjuta_preferences_set_pair:
- * @pr: A #AnjutaPreferences object.
- * @key: Property key.
- * @car_type: Type of the pair's first field (car).
- * @cdr_type: Type of the pair's second field (cdr).
- * @address_of_car: Address of the car.
- * @address_of_cdr: Address of the cdr.
- *
- */
-#ifdef __GNUC__
-inline
-#endif
-gboolean
-anjuta_preferences_set_pair (AnjutaPreferences *pr, const gchar *key,
-					         GConfValueType car_type, GConfValueType cdr_type,
-                             gconstpointer address_of_car,
-                             gconstpointer address_of_cdr)
-{
-	g_return_val_if_fail (ANJUTA_IS_PREFERENCES (pr), FALSE);
-	g_return_val_if_fail (key != NULL, FALSE);
-
-	return gconf_client_set_pair (pr->priv->gclient, build_key (key),
-                                  car_type, cdr_type,
-                                  address_of_car, address_of_cdr,
-                                  NULL);
+	
+	gvalue = gconf_client_get (pr->priv->gclient, build_key (key), NULL);
+	if (gvalue)
+	{
+		switch (gvalue->type)
+		{
+			case GCONF_VALUE_INT:
+				gconf_client_set_int (pr->priv->gclient, build_key (key),
+									  value, NULL);
+				break;
+			default:
+				g_warning ("Invalid gconf type for key: %s", key);
+		}
+		gconf_value_free (gvalue);
+	}
+	else
+	{
+		DEBUG_PRINT ("The preference key %s is not defined", key);
+		gconf_client_set_int (pr->priv->gclient, build_key (key),
+							  value, NULL);
+	}
 }
 
 /**
- * anjuta_preferences_set_int:
+ * anjuta_preferences_set_bool:
  * @pr: A #AnjutaPreferences object.
  * @key: Property key.
- * @value: Integer value of the key.
+ * @value: Boolean value of the key.
  *
  * Sets the value of @key in current session.
  */
@@ -444,8 +501,8 @@
 inline
 #endif
 void
-anjuta_preferences_set_int (AnjutaPreferences *pr, const gchar *key,
-							gint value)
+anjuta_preferences_set_bool (AnjutaPreferences *pr, const gchar *key,
+							 gboolean value)
 {
 	GConfValue *gvalue;
 	
@@ -461,10 +518,6 @@
 				gconf_client_set_bool (pr->priv->gclient, build_key (key),
 									   value, NULL);
 				break;
-			case GCONF_VALUE_INT:
-				gconf_client_set_int (pr->priv->gclient, build_key (key),
-									  value, NULL);
-				break;
 			default:
 				g_warning ("Invalid gconf type for key: %s", key);
 		}
@@ -472,9 +525,9 @@
 	}
 	else
 	{
-		/* g_warning ("The preference key %s is not defined", key); */
-		gconf_client_set_int (pr->priv->gclient, build_key (key),
-							  value, NULL);
+		DEBUG_PRINT ("The preference key %s is not defined", key);
+		gconf_client_set_bool (pr->priv->gclient, build_key (key),
+		                       value, NULL);
 	}
 }
 
@@ -1701,6 +1754,10 @@
 	pr->priv->properties = g_hash_table_new_full (g_str_hash, g_str_equal,
 												  g_free, 
 												  (GDestroyNotify) property_destroy);
+	pr->priv->notifications = g_hash_table_new_full (g_int_hash,
+	                                                 g_int_equal,
+	                                                 NULL, 
+	                                                 NULL);
 	
 	pr->priv->gclient = gconf_client_get_default();
 	gconf_client_add_dir (pr->priv->gclient, GCONF_KEY_PREFIX,
@@ -1740,12 +1797,84 @@
 anjuta_preferences_new (AnjutaPluginManager *plugin_manager)
 {
 	AnjutaPreferences *pr;
+
+	if (!default_preferences)
+	{
+		pr = g_object_new (ANJUTA_TYPE_PREFERENCES, NULL);
+		pr->priv->plugin_manager = g_object_ref (plugin_manager);
+		default_preferences = pr;
+		return pr;
+	}
+	else
+		return default_preferences;
 	
-	pr = g_object_new (ANJUTA_TYPE_PREFERENCES, NULL);
-	pr->priv->plugin_manager = g_object_ref (plugin_manager);
-	
-	return pr;
-	
+}
+
+/**
+ * anjuta_preferences_default:
+ * 
+ * Get the default instace of anjuta preferences
+ * 
+ * Return value: A #AnjutaPreferences object.
+ */
+AnjutaPreferences *anjuta_preferences_default ()
+{
+	return default_preferences;
+}
+
+static void
+gconf_notify (GConfEngine* conf,
+              guint id,
+              GConfEntry* entry,
+              gpointer user_data)
+{
+	AnjutaPreferences* prefs = anjuta_preferences_default();
+	gpointer notify =
+		g_hash_table_lookup (prefs->priv->notifications,
+		                     GUINT_TO_POINTER(id));
+	if (entry->value)
+	{
+		switch (entry->value->type)
+		{
+			case GCONF_VALUE_INT:
+			{
+				AnjutaPreferencesNotifyInt int_func = notify;
+				int_func (prefs, gconf_value_get_int (entry->value), user_data);
+				break;
+			}
+			case GCONF_VALUE_STRING:
+			{
+				AnjutaPreferencesNotify str_func = notify;
+				str_func (prefs, gconf_value_get_string (entry->value), user_data);
+				break;
+			}
+			case GCONF_VALUE_BOOL:
+			{
+				AnjutaPreferencesNotifyBool bool_func = notify;
+				bool_func (prefs, gconf_value_get_bool (entry->value), user_data);
+				break;
+			}
+			default:
+				g_warning ("Notification for unknown type of key: %s", entry->key);
+		}
+	}
+}
+
+guint 
+anjuta_preferences_notify_add_int (AnjutaPreferences *pr,
+                                   const gchar *key,
+                                   AnjutaPreferencesNotifyInt func,
+                                   gpointer data,
+                                   GFreeFunc destroy_notify)
+{
+	guint id;
+	id = gconf_client_notify_add (pr->priv->gclient,
+	                              build_key (key),
+	                              (GConfClientNotifyFunc) gconf_notify, data, destroy_notify, NULL);
+	g_hash_table_insert (pr->priv->notifications,
+	                     GUINT_TO_POINTER (id),
+	                     func);
+	return id;
 }
 
 /**
@@ -1762,18 +1891,41 @@
  *
  * Return value: Notify ID.
  */
-guint
+guint 
 anjuta_preferences_notify_add (AnjutaPreferences *pr,
-							   const gchar *key,
-							   GConfClientNotifyFunc func,
-							   gpointer data,
-							   GFreeFunc destroy_notify)
-{
-	return gconf_client_notify_add (pr->priv->gclient,
-									build_key (key),
-									func, data, destroy_notify, NULL);
+                                      const gchar *key,
+                                      AnjutaPreferencesNotify func,
+                                      gpointer data,
+                                      GFreeFunc destroy_notify)
+{
+	guint id;
+	id = gconf_client_notify_add (pr->priv->gclient,
+	                              build_key (key),
+	                              (GConfClientNotifyFunc)gconf_notify, data, destroy_notify, NULL);
+	g_hash_table_insert (pr->priv->notifications,
+	                     GUINT_TO_POINTER (id),
+	                     func);
+	return id;
+}
+
+guint 
+anjuta_preferences_notify_add_bool (AnjutaPreferences *pr,
+                                    const gchar *key,
+                                    AnjutaPreferencesNotifyBool func,
+                                    gpointer data,
+                                    GFreeFunc destroy_notify)
+{
+	guint id;
+	id = gconf_client_notify_add (pr->priv->gclient,
+	                              build_key (key),
+	                              (GConfClientNotifyFunc)gconf_notify, data, destroy_notify, NULL);
+	g_hash_table_insert (pr->priv->notifications,
+	                     GUINT_TO_POINTER (id),
+	                     func);
+	return id;
 }
 
+
 /**
  * anjuta_preferences_notify_remove:
  * @pr: A #AnjutaPreferences object.
@@ -1800,63 +1952,3 @@
 {
 	return PREFERENCE_PROPERTY_PREFIX;
 }
-
-/**
- * anjuta_preferences_dir_exists:
- * @pr: A #AnjutaPreferences object.
- * @dir: Directory to checkfor.
- *
- * Return value: TRUE if dir exists.
- */
-#ifdef __GNUC__
-inline
-#endif
-gboolean
-anjuta_preferences_dir_exists (AnjutaPreferences *pr, const gchar *dir)
-{
-	g_return_val_if_fail (ANJUTA_IS_PREFERENCES (pr), FALSE);
-	g_return_val_if_fail (dir != NULL, FALSE);
-
-	return gconf_client_dir_exists(pr->priv->gclient, build_key (dir), NULL);
-}
-
-/**
- * anjuta_preferences_add_dir:
- * @pr: A #AnjutaPreferences object.
- * @dir: Directory to add to the list.
- * @preload: Degree of preload.
- *
- * Add a directory to the list of directories the GConfClient.
- */
-#ifdef __GNUC__
-inline
-#endif
-void
-anjuta_preferences_add_dir (AnjutaPreferences *pr, const gchar *dir, 
-                               GConfClientPreloadType preload)
-{
-	g_return_if_fail (ANJUTA_IS_PREFERENCES (pr));
-	g_return_if_fail (dir != NULL);
-
-	gconf_client_add_dir(pr->priv->gclient, build_key (dir), 
-	                     preload, NULL);
-}
-
-/**
- * anjuta_preferences_remove_dir:
- * @pr: A #AnjutaPreferences object.
- * @dir: Directory to remove from the list.
- *
- * Remove a directory from the list of directories.
- */
-#ifdef __GNUC__
-inline
-#endif
-void
-anjuta_preferences_remove_dir (AnjutaPreferences *pr, const gchar *dir)
-{
-	g_return_if_fail (ANJUTA_IS_PREFERENCES (pr));
-	g_return_if_fail (dir != NULL);
-
-	gconf_client_remove_dir(pr->priv->gclient, build_key (dir), NULL);
-}

Modified: branches/preferences_singleton/libanjuta/anjuta-preferences.h
==============================================================================
--- /trunk/libanjuta/anjuta-preferences.h	(original)
+++ branches/preferences_singleton/libanjuta/anjuta-preferences.h	Wed Mar  4 16:45:21 2009
@@ -22,7 +22,6 @@
 
 #include <gnome.h>
 #include <glade/glade.h>
-#include <gconf/gconf-client.h>
 
 #include <libanjuta/anjuta-preferences-dialog.h>
 #include <libanjuta/anjuta-plugin-manager.h>
@@ -76,7 +75,7 @@
 struct _AnjutaPreferences
 {
 	GObject parent;
-	
+
 	/*< private >*/
 	AnjutaPreferencesPriv *priv;
 };
@@ -87,49 +86,50 @@
 };
 
 typedef gboolean (*AnjutaPreferencesCallback) (AnjutaPreferences *pr,
-											   const gchar *key,
-											   gpointer data);
+                                               const gchar *key,
+                                               gpointer data);
 
 GType anjuta_preferences_get_type (void);
 
 AnjutaPreferences *anjuta_preferences_new (AnjutaPluginManager *plugin_manager);
+AnjutaPreferences *anjuta_preferences_default (void);
 
 void anjuta_preferences_add_page (AnjutaPreferences* pr, GladeXML *gxml,
-								  const gchar* glade_widget_name,
-								  const gchar* title,
-								  const gchar *icon_filename);
+                                  const gchar* glade_widget_name,
+                                  const gchar* title,
+                                  const gchar *icon_filename);
 void anjuta_preferences_remove_page (AnjutaPreferences *pr, 
-									 const gchar *page_name);
+                                     const gchar *page_name);
 
 /*
  * Registers all properties defined for widgets below the 'parent' widget
  * in the given gxml glade UI tree
  */
 void anjuta_preferences_register_all_properties_from_glade_xml (AnjutaPreferences* pr,
-																GladeXML *gxml,
-																GtkWidget *parent);
+                                                                GladeXML *gxml,
+                                                                GtkWidget *parent);
 gboolean
 anjuta_preferences_register_property_from_string (AnjutaPreferences *pr,
-												  GtkWidget *object,
-												  const gchar *property_desc);
+                                                  GtkWidget *object,
+                                                  const gchar *property_desc);
 
 gboolean
 anjuta_preferences_register_property_raw (AnjutaPreferences *pr, GtkWidget *object,
-										  const gchar *key,
-										  const gchar *default_value,
-										  guint flags,
-										  AnjutaPropertyObjectType object_type,
-										  AnjutaPropertyDataType  data_type);
+                                          const gchar *key,
+                                          const gchar *default_value,
+                                          guint flags,
+                                          AnjutaPropertyObjectType object_type,
+                                          AnjutaPropertyDataType  data_type);
 
 gboolean
 anjuta_preferences_register_property_custom (AnjutaPreferences *pr,
-											 GtkWidget *object,
-										     const gchar *key,
-										     const gchar *default_value,
-											 AnjutaPropertyDataType data_type,
-										     guint flags,
-		void    (*set_property) (AnjutaProperty *prop, const gchar *value),
-		gchar * (*get_property) (AnjutaProperty *));
+                                             GtkWidget *object,
+                                             const gchar *key,
+                                             const gchar *default_value,
+                                             AnjutaPropertyDataType data_type,
+                                             guint flags,
+                                             void    (*set_property) (AnjutaProperty *prop, const gchar *value),
+                                             gchar * (*get_property) (AnjutaProperty *));
 
 void anjuta_preferences_reset_defaults (AnjutaPreferences *pr);
 
@@ -144,10 +144,10 @@
  */
 gboolean 
 anjuta_preferences_save_filtered (AnjutaPreferences *pr, FILE *stream,
-										   AnjutaPreferencesFilterType filter);
+                                  AnjutaPreferencesFilterType filter);
 gboolean 
 anjuta_preferences_save_gconf (AnjutaPreferences *pr,
-										   AnjutaPreferencesFilterType filter);
+                               AnjutaPreferencesFilterType filter);
 
 
 
@@ -155,84 +155,96 @@
  * matching with the given filter 
  */
 void anjuta_preferences_foreach (AnjutaPreferences *pr,
-								 AnjutaPreferencesFilterType filter,
-								 AnjutaPreferencesCallback callback,
-								 gpointer data);
+                                 AnjutaPreferencesFilterType filter,
+                                 AnjutaPreferencesCallback callback,
+                                 gpointer data);
 
 /* This will transfer all the properties values from the main
-properties database to the parent session properties database */
+ properties database to the parent session properties database */
 void anjuta_preferences_sync_to_session (AnjutaPreferences *pr);
 
 /* Sets the value (string) of a key */
 void anjuta_preferences_set (AnjutaPreferences *pr,
-									const gchar *key,
-									const gchar *value);
+                             const gchar *key,
+                             const gchar *value);
 
-/* Sets the list of a key */
-void anjuta_preferences_set_list (AnjutaPreferences *pr, const gchar *key,
-					                    GConfValueType list_type, GSList *list);
-										
-/* Sets the pair of a key */
-gboolean anjuta_preferences_set_pair (AnjutaPreferences *pr, const gchar *key,
-					         GConfValueType car_type, GConfValueType cdr_type,
-                             gconstpointer address_of_car,
-                             gconstpointer address_of_cdr);
-							 
 /* Sets the value (int) of a key */
 void anjuta_preferences_set_int (AnjutaPreferences *pr,
-										const gchar *key,
-										const gint value);
+                                 const gchar *key,
+                                 const gint value);
+
+void anjuta_preferences_set_bool (AnjutaPreferences *pr,
+                                  const gchar *key,
+                                  const gboolean value);
 
 /* Gets the value (string) of a key */
 /* Must free the return string */
 gchar * anjuta_preferences_get (AnjutaPreferences *pr,
-									   const gchar *key);
-
-/* Gets the list of a key */
-GSList *anjuta_preferences_get_list (AnjutaPreferences *pr, const gchar *key,
-                                           GConfValueType list_type);
-
-/* Gets the pair of a key */
-gboolean anjuta_preferences_get_pair (AnjutaPreferences *pr, const gchar *key,
-                             GConfValueType car_type, GConfValueType cdr_type,
-                             gpointer car_retloc, gpointer cdr_retloc);										   
+                                const gchar *key);
 
 /* Gets the value (int) of a key. If not found, 0 is returned */
 gint anjuta_preferences_get_int (AnjutaPreferences *pr,
-										const gchar *key);
+                                 const gchar *key);
+
+gboolean anjuta_preferences_get_bool (AnjutaPreferences *pr,
+                                      const gchar *key);
 
 /* Gets the value (int) of a key. If not found, the default_value is returned */
 gint anjuta_preferences_get_int_with_default (AnjutaPreferences* pr,
-													 const gchar *key,
-													 gint default_value);
+                                              const gchar *key,
+                                              gint default_value);
+
+gint anjuta_preferences_get_bool_with_default (AnjutaPreferences* pr,
+                                               const gchar *key,
+                                               gint default_value);
 
 gchar * anjuta_preferences_default_get (AnjutaPreferences *pr,
-											   const gchar *key);
+                                        const gchar *key);
 
 /* Gets the value (int) of a key */
 gint anjuta_preferences_default_get_int (AnjutaPreferences *pr,
-												const gchar *key);
+                                         const gchar *key);
+
+gint anjuta_preferences_default_get_bool (AnjutaPreferences *pr,
+                                          const gchar *key);
 
 /* Dialog methods */
 GtkWidget *anjuta_preferences_get_dialog (AnjutaPreferences *pr);
 gboolean anjuta_preferences_is_dialog_created (AnjutaPreferences *pr);
 
 /* Key notifications */
-guint anjuta_preferences_notify_add (AnjutaPreferences *pr,
-									 const gchar *key,
-									 GConfClientNotifyFunc func,
-									 gpointer data,
-									 GFreeFunc destroy_notify);
-void anjuta_preferences_notify_remove (AnjutaPreferences *pr, guint notify_id);
 
-const gchar* anjuta_preferences_get_prefix (AnjutaPreferences *pr);
+typedef void (*AnjutaPreferencesNotify) (AnjutaPreferences *pr,
+                                        const gchar* value,
+                                        gpointer data);
+typedef void (*AnjutaPreferencesNotifyInt) (AnjutaPreferences *pr,
+                                           gint value,
+                                           gpointer data);
+typedef void (*AnjutaPreferencesNotifyBool) (AnjutaPreferences *pr,
+                                            gboolean value,
+                                            gpointer data);
+
+guint anjuta_preferences_notify_add_int (AnjutaPreferences *pr,
+                                         const gchar *key,
+                                         AnjutaPreferencesNotifyInt func,
+                                         gpointer data,
+                                         GFreeFunc destroy_notify);
 
-gboolean anjuta_preferences_dir_exists (AnjutaPreferences *pr, const gchar *dir);
+guint anjuta_preferences_notify_add (AnjutaPreferences *pr,
+                                     const gchar *key,
+                                     AnjutaPreferencesNotify func,
+                                     gpointer data,
+                                     GFreeFunc destroy_notify);
+
+guint anjuta_preferences_notify_add_bool (AnjutaPreferences *pr,
+                                          const gchar *key,
+                                          AnjutaPreferencesNotifyBool func,
+                                          gpointer data,
+                                          GFreeFunc destroy_notify);
 
-void anjuta_preferences_add_dir (AnjutaPreferences *pr, const gchar *dir, 
-                                       GConfClientPreloadType preload);
+void anjuta_preferences_notify_remove (AnjutaPreferences *pr, guint notify_id);
 
-void anjuta_preferences_remove_dir (AnjutaPreferences *pr, const gchar *dir);
+const gchar* anjuta_preferences_get_prefix (AnjutaPreferences *pr);
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]