changeset 5441:e150a0cf4d6e

[gaim-migrate @ 5823] this would be helpful committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 18 May 2003 21:54:11 +0000
parents 7e8524b5ff98
children 702071b23c06
files src/prefs.h
diffstat 1 files changed, 182 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/prefs.h	Sun May 18 21:54:11 2003 +0000
@@ -0,0 +1,182 @@
+/**
+ * @file prefs.h Prefs API
+ *
+ * gaim
+ *
+ * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifndef _PREFS_H_
+#define _PREFS_H_
+
+/**
+ * Pref data types.
+ */
+typedef enum _GaimPrefType
+{
+	GAIM_PREF_NONE,
+	GAIM_PREF_BOOLEAN,
+	GAIM_PREF_INT,
+	GAIM_PREF_STRING
+} GaimPrefType;
+
+/**
+ * Pref change callback type
+ */
+
+typedef void (*GaimPrefCallback) (const char *name, GaimPrefType type,
+		gpointer val, gpointer data);
+
+/**************************************************************************/
+/** @name Prefs API                                                       */
+/**************************************************************************/
+/*@{*/
+
+/**
+ * Initialize core prefs
+ */
+void gaim_prefs_init();
+
+/**
+ * Add a new typeless pref.
+ *
+ * @param name  The name of the pref
+ */
+void gaim_prefs_add_none(const char *name);
+
+/**
+ * Add a new boolean pref.
+ *
+ * @param name  The name of the pref
+ * @param value The initial value to set
+ */
+void gaim_prefs_add_bool(const char *name, gboolean value);
+
+/**
+ * Add a new integer pref.
+ *
+ * @param name  The name of the pref
+ * @param value The initial value to set
+ */
+void gaim_prefs_add_int(const char *name, int value);
+
+/**
+ * Add a new string pref.
+ *
+ * @param name  The name of the pref
+ * @param value The initial value to set
+ */
+void gaim_prefs_add_string(const char *name, const char *value);
+
+/**
+ * Remove a pref.
+ *
+ * @param name The name of the pref
+ */
+void gaim_prefs_remove(const char *name);
+
+/**
+ * Remove all prefs.
+ */
+void gaim_prefs_destroy();
+
+/**
+ * Set raw pref value
+ *
+ * @param name  The name of the pref
+ * @param value The value to set
+ */
+void gaim_prefs_set_generic(const char *name, gpointer value);
+
+/**
+ * Set boolean pref value
+ *
+ * @param name  The name of the pref
+ * @param value The value to set
+ */
+void gaim_prefs_set_bool(const char *name, gboolean value);
+
+/**
+ * Set integer pref value
+ *
+ * @param name  The name of the pref
+ * @param value The value to set
+ */
+void gaim_prefs_set_int(const char *name, int value);
+
+/**
+ * Set string pref value
+ *
+ * @param name  The name of the pref
+ * @param value The value to set
+ */
+void gaim_prefs_set_string(const char *name, char *value);
+
+/**
+ * Get boolean pref value
+ *
+ * @param name The name of the pref
+ * @return The value of the pref
+ */
+gboolean gaim_prefs_get_bool(const char *name);
+
+/**
+ * Get integer pref value
+ *
+ * @param name The name of the pref
+ * @return The value of the pref
+ */
+int gaim_prefs_get_int(const char *name);
+
+/**
+ * Get string pref value
+ *
+ * @param name The name of the pref
+ * @return The value of the pref
+ */
+char *gaim_prefs_get_string(const char *name);
+
+/**
+ * Add a callback to a pref (and its children)
+ */
+guint gaim_prefs_connect_callback(const char *name, GaimPrefCallback cb,
+		gpointer data);
+
+/**
+ * Remove a callback to a pref
+ */
+void gaim_prefs_disconnect_callback(guint callback_id);
+
+/**
+ * Read preferences
+ */
+void gaim_prefs_load();
+
+/**
+ * Write preferences
+ */
+void gaim_prefs_save();
+
+/**
+ * Force an immediate write of preferences
+ */
+void gaim_prefs_sync();
+
+/*@}*/
+
+#endif /* _PREFS_H_ */