/soc/2015/akronix/master: bff04969c626: Ported PurplePrefsUiOps ...

Abel 'Akronix' Serrano Juste akronix5 at gmail.com
Thu Jul 2 15:29:08 EDT 2015


Changeset: bff04969c626dafcc918c55737b818921f032471
Author:	 Abel 'Akronix' Serrano Juste <akronix5 at gmail.com>
Date:	 2015-07-02 21:22 +0200
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/soc/2015/akronix/master/rev/bff04969c626

Description:

Ported PurplePrefsUiOps struct from instantbird

diffstat:

 libpurple/prefs.c |   2 +
 libpurple/prefs.h |  68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 0 deletions(-)

diffs (97 lines):

diff --git a/libpurple/prefs.c b/libpurple/prefs.c
--- a/libpurple/prefs.c
+++ b/libpurple/prefs.c
@@ -40,6 +40,8 @@
 #include "win32dep.h"
 #endif
 
+static PurplePrefsUiOps *prefs_ui_ops = NULL;
+
 struct pref_cb {
 	PurplePrefCallback func;
 	gpointer data;
diff --git a/libpurple/prefs.h b/libpurple/prefs.h
--- a/libpurple/prefs.h
+++ b/libpurple/prefs.h
@@ -62,6 +62,49 @@ typedef enum _PurplePrefType
 typedef void (*PurplePrefCallback) (const char *name, PurplePrefType type,
 		gconstpointer val, gpointer data);
 
+
+/** @copydoc _PurplePrefsUiOps */
+typedef struct _PurplePrefsUiOps PurplePrefsUiOps;
+
+/**  Prefs UI operations;
+ *  UIs should implement this if they want to set and handle
+ * user preferences themselves, rather than using libpurple handlers.
+ *
+ * @see @ref ui-ops
+ */
+struct _PurplePrefsUiOps
+{
+	void (*add_none)(const char *name);
+	void (*add_bool)(const char *name, gboolean value);
+	void (*add_int)(const char *name, int value);
+	void (*add_string)(const char *name, const char *value);
+
+	void (*set_bool)(const char *name, gboolean value);
+	void (*set_int)(const char *name, int value);
+	void (*set_string)(const char *name, const char *value);
+
+	gboolean (*get_bool)(const char *name);
+	int (*get_int)(const char *name);
+	const char *(*get_string)(const char *name);
+
+	PurplePrefType (*get_type)(const char *name);
+	GList *(*get_children_names)(const char *name);
+
+	gboolean (*exists)(const char *name);
+	void (*remove)(const char *name);
+
+	void (*save)(void);
+
+	void *(*add_observer)(const char *name, gpointer data);
+	void (*remove_observer)(const char *name, void *observer);
+
+	void (*_purple_reserved1)(void);
+	void (*_purple_reserved2)(void);
+	void (*_purple_reserved3)(void);
+	void (*_purple_reserved4)(void);
+};
+
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -362,6 +405,31 @@ gboolean purple_prefs_load(void);
  */
 void purple_prefs_update_old(void);
 
+/**
+ * Call the callback of the observer
+ */
+void purple_prefs_observe(gpointer data);
+
+/*@}*/
+
+/**************************************************************************/
+/** @name UI Registration Functions                                       */
+/**************************************************************************/
+/*@{*/
+/**
+ * Sets the UI operations structure to be used for preferences.
+ *
+ * @param ops The UI operations structure.
+ */
+void purple_prefs_set_ui_ops(PurplePrefsUiOps *ops);
+
+/**
+ * Returns the UI operations structure used for preferences.
+ *
+ * @return The UI operations structure in use.
+ */
+PurplePrefsUiOps *purple_prefs_get_ui_ops(void);
+
 /*@}*/
 
 #ifdef __cplusplus



More information about the Commits mailing list