[evolution-data-server] Improve libedataserver API docs (not done yet).
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Improve libedataserver API docs (not done yet).
- Date: Mon, 14 Mar 2011 02:25:30 +0000 (UTC)
commit bc03fbc9b6c84814eade4b2f4157a918a1d55a4e
Author: Matthew Barnes <mbarnes redhat com>
Date: Sun Mar 13 15:29:45 2011 -0400
Improve libedataserver API docs (not done yet).
.../libedataserver/libedataserver-sections.txt | 6 +
docs/reference/libedataserver/libedataserver.types | 4 +
.../libedataserver/tmpl/e-account-list.sgml | 34 +-
docs/reference/libedataserver/tmpl/e-account.sgml | 22 +-
docs/reference/libedataserver/tmpl/e-memory.sgml | 12 +-
docs/reference/libedataserver/tmpl/e-proxy.sgml | 9 +-
.../libedataserver/tmpl/e-soap-message.sgml | 2 -
docs/reference/libedataserver/tmpl/e-source.sgml | 10 +-
.../libedataserver/tmpl/e-xml-hash-utils.sgml | 2 +-
libedataserver/e-account-list.c | 133 ++++--
libedataserver/e-account-list.h | 100 +++--
libedataserver/e-account.h | 116 +++---
libedataserver/e-categories.h | 6 +-
libedataserver/e-data-server-util.c | 83 +++-
libedataserver/e-debug-log.h | 51 ++-
libedataserver/e-flag.h | 3 +
libedataserver/e-iterator.h | 100 +++--
libedataserver/e-list-iterator.h | 46 ++-
libedataserver/e-list.h | 102 +++--
libedataserver/e-memory.c | 164 ++++---
libedataserver/e-memory.h | 16 +-
libedataserver/e-proxy.h | 5 +-
libedataserver/e-sexp.h | 10 +-
libedataserver/e-soap-message.h | 183 +++++---
libedataserver/e-soap-response.c | 53 ++-
libedataserver/e-soap-response.h | 116 +++--
libedataserver/e-source-group.h | 165 ++++---
libedataserver/e-source-list.c | 139 +++++-
libedataserver/e-source-list.h | 134 ++++---
libedataserver/e-source.c | 485 +++++++++++++++-----
libedataserver/e-source.h | 159 ++++---
libedataserver/e-time-utils.c | 46 ++-
libedataserver/e-time-utils.h | 79 ++--
libedataserver/e-uid.h | 2 +-
libedataserver/e-url.h | 50 ++-
libedataserver/e-xml-hash-utils.c | 72 ++-
libedataserver/e-xml-hash-utils.h | 64 ++--
libedataserver/e-xml-utils.c | 46 ++-
libedataserver/e-xml-utils.h | 17 +-
libedataserver/libedataserver-private.h | 13 +-
40 files changed, 1813 insertions(+), 1046 deletions(-)
---
diff --git a/docs/reference/libedataserver/libedataserver-sections.txt b/docs/reference/libedataserver/libedataserver-sections.txt
index 3dbc7e5..586417a 100644
--- a/docs/reference/libedataserver/libedataserver-sections.txt
+++ b/docs/reference/libedataserver/libedataserver-sections.txt
@@ -27,6 +27,7 @@ E_IS_ACCOUNT
E_TYPE_ACCOUNT
E_ACCOUNT_CLASS
E_IS_ACCOUNT_CLASS
+E_ACCOUNT_GET_CLASS
EAccountClass
<SUBSECTION Private>
e_account_get_type
@@ -55,6 +56,7 @@ E_IS_ACCOUNT_LIST
E_TYPE_ACCOUNT_LIST
E_ACCOUNT_LIST_CLASS
E_IS_ACCOUNT_LIST_CLASS
+E_ACCOUNT_LIST_GET_CLASS
EAccountListClass
<SUBSECTION Private>
EAccountListPrivate
@@ -158,6 +160,7 @@ E_IS_LIST_ITERATOR
E_TYPE_LIST_ITERATOR
E_LIST_ITERATOR_CLASS
E_IS_LIST_ITERATOR_CLASS
+E_LIST_ITERATOR_GET_CLASS
EListIteratorClass
<SUBSECTION Private>
e_list_iterator_get_type
@@ -219,6 +222,7 @@ E_IS_SOURCE_GROUP
E_TYPE_SOURCE_GROUP
E_SOURCE_GROUP_CLASS
E_IS_SOURCE_GROUP_CLASS
+E_SOURCE_GROUP_GET_CLASS
ESourceGroupClass
<SUBSECTION Private>
ESourceGroupPrivate
@@ -254,6 +258,7 @@ E_IS_SOURCE_LIST
E_TYPE_SOURCE_LIST
E_SOURCE_LIST_CLASS
E_IS_SOURCE_LIST_CLASS
+E_SOURCE_LIST_GET_CLASS
ESourceListClass
<SUBSECTION Private>
ESourceListPrivate
@@ -300,6 +305,7 @@ E_IS_SOURCE
E_TYPE_SOURCE
E_SOURCE_CLASS
E_IS_SOURCE_CLASS
+E_SOURCE_GET_CLASS
ESourceClass
<SUBSECTION Private>
ESourcePrivate
diff --git a/docs/reference/libedataserver/libedataserver.types b/docs/reference/libedataserver/libedataserver.types
index c8f023f..0e6957f 100644
--- a/docs/reference/libedataserver/libedataserver.types
+++ b/docs/reference/libedataserver/libedataserver.types
@@ -3,6 +3,8 @@
#include <libedataserver/e-iterator.h>
#include <libedataserver/e-list.h>
#include <libedataserver/e-list-iterator.h>
+#include <libedataserver/e-proxy.h>
+#include <libedataserver/e-soap-message.h>
#include <libedataserver/e-source.h>
#include <libedataserver/e-source-group.h>
#include <libedataserver/e-source-list.h>
@@ -12,6 +14,8 @@ e_account_list_get_type
e_iterator_get_type
e_list_get_type
e_list_iterator_get_type
+e_proxy_get_type
+e_soap_message_get_type
e_source_get_type
e_source_group_get_type
e_source_list_get_type
diff --git a/docs/reference/libedataserver/tmpl/e-account-list.sgml b/docs/reference/libedataserver/tmpl/e-account-list.sgml
index 2d9d2aa..7d45b7d 100644
--- a/docs/reference/libedataserver/tmpl/e-account-list.sgml
+++ b/docs/reference/libedataserver/tmpl/e-account-list.sgml
@@ -66,7 +66,7 @@ EAccountList
</para>
- gconf:
+ client:
@Returns:
@@ -76,7 +76,7 @@ EAccountList
</para>
@account_list:
- gconf:
+ client:
<!-- ##### FUNCTION e_account_list_save ##### -->
@@ -92,8 +92,8 @@ EAccountList
</para>
- Param1:
- Param2:
+ account_list:
+ account:
<!-- ##### FUNCTION e_account_list_change ##### -->
@@ -101,8 +101,8 @@ EAccountList
</para>
- Param1:
- Param2:
+ account_list:
+ account:
<!-- ##### FUNCTION e_account_list_remove ##### -->
@@ -110,8 +110,8 @@ EAccountList
</para>
- Param1:
- Param2:
+ account_list:
+ account:
<!-- ##### FUNCTION e_account_list_get_default ##### -->
@@ -119,7 +119,7 @@ EAccountList
</para>
- Param1:
+ account_list:
@Returns:
@@ -128,8 +128,8 @@ EAccountList
</para>
- Param1:
- Param2:
+ account_list:
+ account:
<!-- ##### FUNCTION e_account_list_find ##### -->
@@ -137,7 +137,7 @@ EAccountList
</para>
- Param1:
+ account_list:
@type:
@key:
@Returns:
@@ -148,7 +148,7 @@ EAccountList
</para>
- Param1:
+ account_list:
<!-- ##### FUNCTION e_account_list_remove_account_proxies ##### -->
@@ -156,8 +156,8 @@ EAccountList
</para>
- Param1:
- Param2:
+ account_list:
+ account:
<!-- ##### FUNCTION e_account_list_account_has_proxies ##### -->
@@ -165,8 +165,8 @@ EAccountList
</para>
- Param1:
- Param2:
+ account_list:
+ account:
@Returns:
diff --git a/docs/reference/libedataserver/tmpl/e-account.sgml b/docs/reference/libedataserver/tmpl/e-account.sgml
index ee9e52f..ba4f8ab 100644
--- a/docs/reference/libedataserver/tmpl/e-account.sgml
+++ b/docs/reference/libedataserver/tmpl/e-account.sgml
@@ -173,7 +173,7 @@ EAccount
</para>
- Param1:
+ account:
@type:
@Returns:
@@ -183,7 +183,7 @@ EAccount
</para>
- Param1:
+ account:
@type:
@Returns:
@@ -193,7 +193,7 @@ EAccount
</para>
- Param1:
+ account:
@type:
@Returns:
@@ -203,9 +203,9 @@ EAccount
</para>
- Param1:
+ account:
@type:
- Param3:
+ v_string:
<!-- ##### FUNCTION e_account_set_int ##### -->
@@ -213,9 +213,9 @@ EAccount
</para>
- Param1:
+ account:
@type:
- Param3:
+ v_int:
<!-- ##### FUNCTION e_account_set_bool ##### -->
@@ -223,9 +223,9 @@ EAccount
</para>
- Param1:
+ account:
@type:
- Param3:
+ v_bool:
<!-- ##### FUNCTION e_account_writable ##### -->
@@ -233,7 +233,7 @@ EAccount
</para>
- ea:
+ account:
@type:
@Returns:
@@ -243,7 +243,7 @@ EAccount
</para>
- ea:
+ account:
@protocol:
@option:
@Returns:
diff --git a/docs/reference/libedataserver/tmpl/e-memory.sgml b/docs/reference/libedataserver/tmpl/e-memory.sgml
index 4ea1a85..7bc9f73 100644
--- a/docs/reference/libedataserver/tmpl/e-memory.sgml
+++ b/docs/reference/libedataserver/tmpl/e-memory.sgml
@@ -41,7 +41,7 @@ e-memory
</para>
- m:
+ memchunk:
@Returns:
@@ -50,7 +50,7 @@ e-memory
</para>
- m:
+ memchunk:
@Returns:
@@ -59,7 +59,7 @@ e-memory
</para>
- m:
+ memchunk:
@mem:
@@ -68,7 +68,7 @@ e-memory
</para>
- m:
+ memchunk:
<!-- ##### FUNCTION e_memchunk_clean ##### -->
@@ -76,7 +76,7 @@ e-memory
</para>
- m:
+ memchunk:
<!-- ##### FUNCTION e_memchunk_destroy ##### -->
@@ -84,6 +84,6 @@ e-memory
</para>
- m:
+ memchunk:
diff --git a/docs/reference/libedataserver/tmpl/e-proxy.sgml b/docs/reference/libedataserver/tmpl/e-proxy.sgml
index a6f5a5e..c7d7eaf 100644
--- a/docs/reference/libedataserver/tmpl/e-proxy.sgml
+++ b/docs/reference/libedataserver/tmpl/e-proxy.sgml
@@ -25,8 +25,13 @@ EProxy
</para>
- parent:
- priv:
+
+<!-- ##### SIGNAL EProxy::changed ##### -->
+<para>
+
+</para>
+
+ eproxy: the object which received the signal.
<!-- ##### FUNCTION e_proxy_new ##### -->
<para>
diff --git a/docs/reference/libedataserver/tmpl/e-soap-message.sgml b/docs/reference/libedataserver/tmpl/e-soap-message.sgml
index c6fcb11..104791c 100644
--- a/docs/reference/libedataserver/tmpl/e-soap-message.sgml
+++ b/docs/reference/libedataserver/tmpl/e-soap-message.sgml
@@ -25,8 +25,6 @@ ESoapMessage
</para>
- parent:
- priv:
<!-- ##### FUNCTION e_soap_message_new ##### -->
<para>
diff --git a/docs/reference/libedataserver/tmpl/e-source.sgml b/docs/reference/libedataserver/tmpl/e-source.sgml
index ec60c8f..f672b72 100644
--- a/docs/reference/libedataserver/tmpl/e-source.sgml
+++ b/docs/reference/libedataserver/tmpl/e-source.sgml
@@ -250,7 +250,7 @@ ESource
</para>
@source:
- property:
+ property_name:
@Returns:
@@ -260,8 +260,8 @@ ESource
</para>
@source:
- property:
- value:
+ property_name:
+ property_value:
<!-- ##### FUNCTION e_source_foreach_property ##### -->
@@ -271,7 +271,7 @@ ESource
@source:
@func:
- data:
+ user_data:
<!-- ##### FUNCTION e_source_get_duped_property ##### -->
@@ -280,7 +280,7 @@ ESource
</para>
@source:
- property:
+ property_name:
@Returns:
diff --git a/docs/reference/libedataserver/tmpl/e-xml-hash-utils.sgml b/docs/reference/libedataserver/tmpl/e-xml-hash-utils.sgml
index 3a2b4f5..62f9d57 100644
--- a/docs/reference/libedataserver/tmpl/e-xml-hash-utils.sgml
+++ b/docs/reference/libedataserver/tmpl/e-xml-hash-utils.sgml
@@ -45,7 +45,7 @@ Functions for manipulating xml as a hash table.
@hash:
@type:
- root_node:
+ root_name:
@Returns:
diff --git a/libedataserver/e-account-list.c b/libedataserver/e-account-list.c
index 5abccdd..8427731 100644
--- a/libedataserver/e-account-list.c
+++ b/libedataserver/e-account-list.c
@@ -26,7 +26,7 @@
#include <string.h>
-struct EAccountListPrivate {
+struct _EAccountListPrivate {
GConfClient *gconf;
guint notify_id;
};
@@ -210,9 +210,9 @@ free_func (gpointer data, gpointer closure)
/**
* e_account_list_new:
- * @gconf: a #GConfClient
+ * @client: a #GConfClient
*
- * Reads the list of accounts from @gconf and listens for changes.
+ * Reads the list of accounts from @client and listens for changes.
* Will emit %account_added, %account_changed, and %account_removed
* signals according to notifications from GConf.
*
@@ -327,86 +327,107 @@ e_account_list_remove_account_proxies (EAccountList *accounts, EAccount *account
e_account_list_save (accounts);
}
-gint
-e_account_list_account_has_proxies (EAccountList *accounts, EAccount *account)
+gboolean
+e_account_list_account_has_proxies (EAccountList *account_list,
+ EAccount *account)
{
- if (e_account_list_find (accounts, E_ACCOUNT_FIND_PARENT_UID, account->uid))
- return TRUE;
+ const EAccount *parent;
- return FALSE;
+ g_return_val_if_fail (E_IS_ACCOUNT_LIST (account_list), FALSE);
+ g_return_val_if_fail (E_IS_ACCOUNT (account), FALSE);
+
+ parent = e_account_list_find (
+ account_list, E_ACCOUNT_FIND_PARENT_UID, account->uid);
+
+ return (parent != NULL);
}
/**
* e_account_list_add:
- * @accounts:
- * @account:
+ * @account_list: an #EAccountList
+ * @account: an #EAccount
*
- * Add an account to the account list. Will emit the account-changed
- * event.
+ * Adds @account to @account_list and emits the
+ * #EAccountList::account-added signal.
**/
void
-e_account_list_add (EAccountList *accounts, EAccount *account)
+e_account_list_add (EAccountList *account_list,
+ EAccount *account)
{
+ g_return_if_fail (E_IS_ACCOUNT_LIST (account_list));
+ g_return_if_fail (E_IS_ACCOUNT (account));
+
/* FIXME: should we check for duplicate accounts? */
- e_list_append ((EList *)accounts, account);
- g_signal_emit (accounts, signals[ACCOUNT_ADDED], 0, account);
+ e_list_append (E_LIST (account_list), account);
+ g_signal_emit (account_list, signals[ACCOUNT_ADDED], 0, account);
}
/**
* e_account_list_change:
- * @accounts:
- * @account:
+ * @account_list: an #EAccountList
+ * @account: an #EAccount
*
- * Signal that the details of an account have changed.
+ * Emits the #EAccountList::account-changed signal.
**/
void
-e_account_list_change (EAccountList *accounts, EAccount *account)
+e_account_list_change (EAccountList *account_list,
+ EAccount *account)
{
- /* maybe the account should do this itself ... */
- g_signal_emit (accounts, signals[ACCOUNT_CHANGED], 0, account);
+ g_return_if_fail (E_IS_ACCOUNT_LIST (account_list));
+ g_return_if_fail (E_IS_ACCOUNT (account));
+
+ g_signal_emit (account_list, signals[ACCOUNT_CHANGED], 0, account);
}
/**
* e_account_list_remove:
- * @accounts:
- * @account:
+ * @account_list: an #EAccountList
+ * @account: an #EAccount
*
- * Remove an account from the account list, and emit the
- * account-removed signal. If the account was the default account,
- * then reset the default to the first account.
+ * Removes @account from @account list, and emits the
+ * #EAccountList::account-removed signal. If @account was the default
+ * account, then the first account in @account_list becomes the new default.
**/
void
-e_account_list_remove (EAccountList *accounts, EAccount *account)
+e_account_list_remove (EAccountList *account_list,
+ EAccount *account)
{
- if (account == e_account_list_get_default (accounts))
- gconf_client_unset (accounts->priv->gconf, "/apps/evolution/mail/default_account", NULL);
+ g_return_if_fail (E_IS_ACCOUNT_LIST (account_list));
+ g_return_if_fail (E_IS_ACCOUNT (account));
+
+ if (account == e_account_list_get_default (account_list))
+ gconf_client_unset (
+ account_list->priv->gconf,
+ "/apps/evolution/mail/default_account", NULL);
/* not sure if need to ref but no harm */
g_object_ref (account);
- e_list_remove ((EList *) accounts, account);
- g_signal_emit (accounts, signals[ACCOUNT_REMOVED], 0, account);
+ e_list_remove ((EList *) account_list, account);
+ g_signal_emit (account_list, signals[ACCOUNT_REMOVED], 0, account);
g_object_unref (account);
}
/**
* e_account_list_get_default:
- * @accounts:
+ * @account_list: an #EAccountList
*
- * Get the default account. If no default is specified, or the default
+ * Get the default #EAccount. If no default is specified, or the default
* has become stale, then the first account is made the default.
*
- * Returns: The account or NULL if no accounts are defined.
+ * Returns: the default #EAccount, or %NULL if no accounts are defined.
**/
const EAccount *
-e_account_list_get_default (EAccountList *accounts)
+e_account_list_get_default (EAccountList *account_list)
{
gchar *uid;
EIterator *it;
const EAccount *account = NULL;
- uid = gconf_client_get_string (accounts->priv->gconf, "/apps/evolution/mail/default_account", NULL);
- it = e_list_get_iterator ((EList *)accounts);
+ uid = gconf_client_get_string (
+ account_list->priv->gconf,
+ "/apps/evolution/mail/default_account", NULL);
+ it = e_list_get_iterator (E_LIST (account_list));
if (uid) {
for (;e_iterator_is_valid (it);e_iterator_next (it)) {
@@ -422,7 +443,10 @@ e_account_list_get_default (EAccountList *accounts)
/* no uid or uid not found, @it will be at the first account */
if (account == NULL && e_iterator_is_valid (it)) {
account = (const EAccount *) e_iterator_get (it);
- gconf_client_set_string (accounts->priv->gconf, "/apps/evolution/mail/default_account", account->uid, NULL);
+ gconf_client_set_string (
+ account_list->priv->gconf,
+ "/apps/evolution/mail/default_account",
+ account->uid, NULL);
}
g_object_unref (it);
@@ -433,34 +457,43 @@ e_account_list_get_default (EAccountList *accounts)
/**
* e_account_list_set_default:
- * @accounts:
- * @account:
+ * @account_list: an #EAccountList
+ * @account: an #EAccount
*
- * Set the account @account to be the default account.
+ * Set the @account to be the default account in @account_list.
**/
void
-e_account_list_set_default (EAccountList *accounts, EAccount *account)
+e_account_list_set_default (EAccountList *account_list,
+ EAccount *account)
{
- gconf_client_set_string (accounts->priv->gconf, "/apps/evolution/mail/default_account", account->uid, NULL);
+ g_return_if_fail (E_IS_ACCOUNT_LIST (account_list));
+ g_return_if_fail (E_IS_ACCOUNT (account));
+
+ gconf_client_set_string (
+ account_list->priv->gconf,
+ "/apps/evolution/mail/default_account",
+ account->uid, NULL);
}
/**
* e_account_list_find:
- * @accounts:
- * @type: Type of search.
- * @key: Search key.
+ * @account_list: an #EAccountList
+ * @type: type of search
+ * @key: the search key
*
- * Perform a search of the account list on a single key.
+ * Perform a search of @account_list on a single key.
*
* @type must be set from one of the following search types:
* E_ACCOUNT_FIND_NAME - Find an account by account name.
* E_ACCOUNT_FIND_ID_NAME - Find an account by the owner's identity name.
* E_ACCOUNT_FIND_ID_ADDRESS - Find an account by the owner's identity address.
*
- * Returns: The account or NULL if it doesn't exist.
+ * Returns: The account or %NULL if it doesn't exist.
**/
const EAccount *
-e_account_list_find (EAccountList *accounts, e_account_find_t type, const gchar *key)
+e_account_list_find (EAccountList *account_list,
+ e_account_find_t type,
+ const gchar *key)
{
EIterator *it;
const EAccount *account = NULL;
@@ -471,7 +504,7 @@ e_account_list_find (EAccountList *accounts, e_account_find_t type, const gchar
if (!key)
return NULL;
- for (it = e_list_get_iterator ((EList *)accounts);
+ for (it = e_list_get_iterator ((EList *)account_list);
e_iterator_is_valid (it);
e_iterator_next (it)) {
gint found = 0;
diff --git a/libedataserver/e-account-list.h b/libedataserver/e-account-list.h
index f1d7149..ebba9ee 100644
--- a/libedataserver/e-account-list.h
+++ b/libedataserver/e-account-list.h
@@ -24,15 +24,30 @@
#include "e-account.h"
#include <gconf/gconf-client.h>
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_ACCOUNT_LIST \
+ (e_account_list_get_type ())
+#define E_ACCOUNT_LIST(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_ACCOUNT_LIST, EAccountList))
+#define E_ACCOUNT_LIST_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_ACCOUNT_LIST, EAccountListClass))
+#define E_IS_ACCOUNT_LIST(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_ACCOUNT_LIST))
+#define E_IS_ACCOUNT_LIST_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_ACCOUNT_LIST))
+#define E_ACCOUNT_LIST_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_ACCOUNT_LIST, EAccountListClass))
-#define E_TYPE_ACCOUNT_LIST (e_account_list_get_type ())
-#define E_ACCOUNT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_ACCOUNT_LIST, EAccountList))
-#define E_ACCOUNT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_ACCOUNT_LIST, EAccountListClass))
-#define E_IS_ACCOUNT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_ACCOUNT_LIST))
-#define E_IS_ACCOUNT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_ACCOUNT_LIST))
+G_BEGIN_DECLS
-typedef struct EAccountListPrivate EAccountListPrivate;
+typedef struct _EAccountList EAccountList;
+typedef struct _EAccountListClass EAccountListClass;
+typedef struct _EAccountListPrivate EAccountListPrivate;
/* search options for the find command */
typedef enum _e_account_find_t {
@@ -43,40 +58,53 @@ typedef enum _e_account_find_t {
E_ACCOUNT_FIND_PARENT_UID
} e_account_find_t;
-typedef struct _EAccountList {
- EList parent_object;
-
+/**
+ * EAccountList:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
+struct _EAccountList {
+ EList parent;
EAccountListPrivate *priv;
-} EAccountList;
+};
-typedef struct {
+struct _EAccountListClass {
EListClass parent_class;
/* signals */
- void (*account_added) (EAccountList *, EAccount *);
- void (*account_changed) (EAccountList *, EAccount *);
- void (*account_removed) (EAccountList *, EAccount *);
-} EAccountListClass;
-
-GType e_account_list_get_type (void);
-
-EAccountList *e_account_list_new (GConfClient *gconf);
-void e_account_list_construct (EAccountList *account_list,
- GConfClient *gconf);
-
-void e_account_list_save (EAccountList *account_list);
-
-void e_account_list_add (EAccountList *, EAccount *);
-void e_account_list_change (EAccountList *, EAccount *);
-void e_account_list_remove (EAccountList *, EAccount *);
-
-const EAccount *e_account_list_get_default (EAccountList *);
-void e_account_list_set_default (EAccountList *, EAccount *);
-const EAccount *e_account_list_find (EAccountList *, e_account_find_t type, const gchar *key);
-
-void e_account_list_prune_proxies (EAccountList *);
-void e_account_list_remove_account_proxies (EAccountList *, EAccount *);
-gint e_account_list_account_has_proxies (EAccountList *, EAccount *);
+ void (*account_added) (EAccountList *account_list,
+ EAccount *account);
+ void (*account_changed) (EAccountList *account_list,
+ EAccount *account);
+ void (*account_removed) (EAccountList *account_list,
+ EAccount *account);
+};
+
+GType e_account_list_get_type (void) G_GNUC_CONST;
+EAccountList * e_account_list_new (GConfClient *client);
+void e_account_list_construct (EAccountList *account_list,
+ GConfClient *client);
+void e_account_list_save (EAccountList *account_list);
+void e_account_list_add (EAccountList *account_list,
+ EAccount *account);
+void e_account_list_change (EAccountList *account_list,
+ EAccount *account);
+void e_account_list_remove (EAccountList *account_list,
+ EAccount *account);
+const EAccount *e_account_list_get_default (EAccountList *account_list);
+void e_account_list_set_default (EAccountList *account_list,
+ EAccount *account);
+const EAccount *e_account_list_find (EAccountList *account_list,
+ e_account_find_t type,
+ const gchar *key);
+void e_account_list_prune_proxies (EAccountList *account_list);
+void e_account_list_remove_account_proxies
+ (EAccountList *account_list,
+ EAccount *account);
+gboolean e_account_list_account_has_proxies
+ (EAccountList *account_list,
+ EAccount *account);
G_END_DECLS
diff --git a/libedataserver/e-account.h b/libedataserver/e-account.h
index a9d5a6b..921920c 100644
--- a/libedataserver/e-account.h
+++ b/libedataserver/e-account.h
@@ -17,18 +17,34 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef __E_ACCOUNT__
-#define __E_ACCOUNT__
+#ifndef E_ACCOUNT_H
+#define E_ACCOUNT_H
#include <glib-object.h>
+/* Standard GObject macros */
+#define E_TYPE_ACCOUNT \
+ (e_account_get_type ())
+#define E_ACCOUNT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_ACCOUNT, EAccount))
+#define E_ACCOUNT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_ACCOUNT, EAccountClass))
+#define E_IS_ACCOUNT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_ACCOUNT))
+#define E_IS_ACCOUNT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_ACCOUNT))
+#define E_ACCOUNT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_ACCOUNT, EAccountClass))
+
G_BEGIN_DECLS
-#define E_TYPE_ACCOUNT (e_account_get_type ())
-#define E_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_ACCOUNT, EAccount))
-#define E_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_ACCOUNT, EAccountClass))
-#define E_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_ACCOUNT))
-#define E_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_ACCOUNT))
+typedef struct _EAccount EAccount;
+typedef struct _EAccountClass EAccountClass;
typedef enum _e_account_item_t {
E_ACCOUNT_NAME,
@@ -106,8 +122,8 @@ typedef struct _EAccountService {
gboolean get_password_canceled;
} EAccountService;
-typedef struct _EAccount {
- GObject parent_object;
+struct _EAccount {
+ GObject parent;
gchar *name;
gchar *uid;
@@ -142,55 +158,45 @@ typedef struct _EAccount {
gboolean smime_sign_default;
gboolean smime_encrypt_to_self;
gboolean smime_encrypt_default;
-} EAccount;
+};
-typedef struct {
+struct _EAccountClass {
GObjectClass parent_class;
- void (*changed)(EAccount *, gint field);
-} EAccountClass;
-
-GType e_account_get_type (void);
-
-EAccount *e_account_new (void);
-
-EAccount *e_account_new_from_xml (const gchar *xml);
-
-gboolean e_account_set_from_xml (EAccount *account,
- const gchar *xml);
-
-void e_account_import (EAccount *dest,
- EAccount *src);
-
-gchar *e_account_to_xml (EAccount *account);
-
-gchar *e_account_uid_from_xml (const gchar *xml);
-
-const gchar *e_account_get_string (EAccount *,
- e_account_item_t type);
-
-gint e_account_get_int (EAccount *,
- e_account_item_t type);
-
-gboolean e_account_get_bool (EAccount *,
- e_account_item_t type);
-
-void e_account_set_string (EAccount *,
- e_account_item_t type, const gchar *);
-
-void e_account_set_int (EAccount *,
- e_account_item_t type, gint);
-
-void e_account_set_bool (EAccount *,
- e_account_item_t type, gboolean);
-
-gboolean e_account_writable (EAccount *ea,
- e_account_item_t type);
-
-gboolean e_account_writable_option (EAccount *ea,
- const gchar *protocol,
- const gchar *option);
+ void (*changed) (EAccount *account,
+ gint field);
+};
+
+GType e_account_get_type (void) G_GNUC_CONST;
+EAccount * e_account_new (void);
+EAccount * e_account_new_from_xml (const gchar *xml);
+gboolean e_account_set_from_xml (EAccount *account,
+ const gchar *xml);
+void e_account_import (EAccount *dest,
+ EAccount *src);
+gchar * e_account_to_xml (EAccount *account);
+gchar * e_account_uid_from_xml (const gchar *xml);
+const gchar * e_account_get_string (EAccount *account,
+ e_account_item_t type);
+gint e_account_get_int (EAccount *account,
+ e_account_item_t type);
+gboolean e_account_get_bool (EAccount *account,
+ e_account_item_t type);
+void e_account_set_string (EAccount *account,
+ e_account_item_t type,
+ const gchar *v_string);
+void e_account_set_int (EAccount *account,
+ e_account_item_t type,
+ gint v_int);
+void e_account_set_bool (EAccount *account,
+ e_account_item_t type,
+ gboolean v_bool);
+gboolean e_account_writable (EAccount *account,
+ e_account_item_t type);
+gboolean e_account_writable_option (EAccount *account,
+ const gchar *protocol,
+ const gchar *option);
G_END_DECLS
-#endif /* __E_ACCOUNT__ */
+#endif /* E_ACCOUNT_H */
diff --git a/libedataserver/e-categories.h b/libedataserver/e-categories.h
index 9f01a55..4bc048a 100644
--- a/libedataserver/e-categories.h
+++ b/libedataserver/e-categories.h
@@ -17,8 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef __E_CATEGORIES__
-#define __E_CATEGORIES__
+#ifndef E_CATEGORIES_H
+#define E_CATEGORIES_H
#include <glib-object.h>
@@ -47,4 +47,4 @@ void e_categories_unregister_change_listener
G_END_DECLS
-#endif
+#endif /* E_CATEGORIES_H */
diff --git a/libedataserver/e-data-server-util.c b/libedataserver/e-data-server-util.c
index 8a278df..0c62df7 100644
--- a/libedataserver/e-data-server-util.c
+++ b/libedataserver/e-data-server-util.c
@@ -354,6 +354,16 @@ e_util_utf8_strstrcasedecomp (const gchar *haystack,
return NULL;
}
+/**
+ * e_util_utf8_strcasecmp:
+ * @s1: a UTF-8 string
+ * @s2: another UTF-8 string
+ *
+ * Compares two UTF-8 strings using approximate case-insensitive ordering.
+ *
+ * Returns: < 0 if @s1 compares before @s2, 0 if they compare equal,
+ * > 0 if @s1 compares after @s2
+ **/
gint
e_util_utf8_strcasecmp (const gchar *s1,
const gchar *s2)
@@ -379,8 +389,11 @@ e_util_utf8_strcasecmp (const gchar *s1,
/**
* e_util_utf8_remove_accents:
+ * @str: a UTF-8 string, or %NULL
+ *
+ * Returns a newly-allocated copy of @str with accents removed.
*
- * Returns newly allocates string, copy of 'str', without accents.
+ * Returns: a newly-allocated string
*
* Since: 2.28
**/
@@ -390,7 +403,7 @@ e_util_utf8_remove_accents (const gchar *str)
gchar *res;
gint i, j;
- if (!str)
+ if (str == NULL)
return NULL;
res = g_utf8_normalize (str, -1, G_NORMALIZE_NFD);
@@ -413,10 +426,12 @@ e_util_utf8_remove_accents (const gchar *str)
/**
* e_util_utf8_make_valid:
+ * @str: a UTF-8 string
*
- * Returns newly allocates string, copy of 'str', which
- * is UTF8 valid string. Invalid letters are replaced
- * with question marks U+FFFD.
+ * Returns a newly-allocated copy of @str, with invalid characters
+ * replaced by Unicode replacement characters (U+FFFD).
+ *
+ * Returns: a newly-allocated string
*
* Since: 3.0
**/
@@ -484,22 +499,46 @@ e_util_utf8_make_valid (const gchar *str)
/**
* e_util_ensure_gdbus_string:
- * @str: What to convert, if NULL, then returns empty string.
- * @gdbus_str: In case that 'str' is not valid UTF8 string
- * and new memory allocated, then it is returned in this
- * variable, and its value should be freed with g_free().
- * It cannot be NULL.
- *
- * Returns string usable for GDBus, or more precisely GVariant,
- * which requires UTF8 encoded strings for a transfer.
- * If the str is not UTF8 valid, then new string is allocated
- * and returned in gdbus_str, on which is supposed to be called
- * g_free().
+ * @str: a possibly invalid UTF-8 string, or %NULL
+ * @gdbus_str: return location for the corrected string
+ *
+ * If @str is a valid UTF-8 string, the function returns @str and does
+ * not set @gdbus_str.
+ *
+ * If @str is an invalid UTF-8 string, the function calls
+ * e_util_utf8_make_valid() and points @gdbus_str to the newly-allocated,
+ * valid UTF-8 string, and also returns it. The caller should free the
+ * string pointed to by @gdbus_str with g_free().
+ *
+ * If @str is %NULL, the function returns an empty string and does not
+ * set @gdbus_str.
+ *
+ * Admittedly, the function semantics are a little awkward. The example
+ * below illustrates the easiest way to cope with the @gdbus_str argument:
+ *
+ * <informalexample>
+ * <programlisting>
+ * const gchar *trusted_utf8;
+ * gchar *allocated = NULL;
+ *
+ * trusted_utf8 = e_util_ensure_gdbus_string (untrusted_utf8, &allocated);
+ *
+ * Do stuff with trusted_utf8, then clear it.
+ *
+ * trusted_utf8 = NULL;
+ *
+ * g_free (allocated);
+ * allocated = NULL;
+ * </programlisting>
+ * </informalexample>
+ *
+ * Returns: a valid UTF-8 string
*
* Since: 3.0
**/
const gchar *
-e_util_ensure_gdbus_string (const gchar *str, gchar **gdbus_str)
+e_util_ensure_gdbus_string (const gchar *str,
+ gchar **gdbus_str)
{
g_return_val_if_fail (gdbus_str != NULL, NULL);
@@ -838,12 +877,12 @@ static gint default_dbus_timeout = DEFAULT_EDS_DBUS_TIMEOUT;
/**
* e_data_server_util_set_dbus_call_timeout:
- * @timeout_msec: Default timeout for DBus calls in miliseconds.
+ * @timeout_msec: default timeout for D-Bus calls in miliseconds
*
- * Sets default timeout, in miliseconds, for calls of g_dbus_proxy_call()
+ * Sets default timeout, in milliseconds, for calls of g_dbus_proxy_call()
* family functions.
*
- * -1 means the default value as set by DBus itself.
+ * -1 means the default value as set by D-Bus itself.
* G_MAXINT means no timeout at all.
*
* Default value is set also by configure option --with-dbus-call-timeout=ms
@@ -860,7 +899,9 @@ e_data_server_util_set_dbus_call_timeout (gint timeout_msec)
/**
* e_data_server_util_get_dbus_call_timeout:
*
- * Returns value set by e_data_server_util_set_dbus_call_timeout()
+ * Returns the value set by e_data_server_util_set_dbus_call_timeout().
+ *
+ * Returns: the D-Bus call timeout in milliseconds
*
* Since: 3.0
**/
diff --git a/libedataserver/e-debug-log.h b/libedataserver/e-debug-log.h
index 552803a..1862a1a 100644
--- a/libedataserver/e-debug-log.h
+++ b/libedataserver/e-debug-log.h
@@ -31,42 +31,49 @@
*
* Since: 2.32
**/
-#define E_DEBUG_LOG_DOMAIN_USER "USER" /* always enabled */
+#define E_DEBUG_LOG_DOMAIN_USER "USER" /* always enabled */
/**
* E_DEBUG_LOG_DOMAIN_GLOG:
*
* Since: 2.32
**/
-#define E_DEBUG_LOG_DOMAIN_GLOG "GLog" /* used for GLog messages; don't use it yourself */
+#define E_DEBUG_LOG_DOMAIN_GLOG "GLog" /* used for GLog messages; don't use it yourself */
/**
* E_DEBUG_LOG_DOMAIN_CAL_QUERIES:
*
* Since: 2.32
**/
-#define E_DEBUG_LOG_DOMAIN_CAL_QUERIES "CalQueries" /* used for calendar queries analysis */
-
-void e_debug_log (gboolean is_milestone, const gchar *domain, const gchar *format, ...);
-
-void e_debug_logv (gboolean is_milestone, const gchar *domain, const gchar *format, va_list args);
-
-gboolean e_debug_log_load_configuration (const gchar *filename, GError **error);
-
-void e_debug_log_enable_domains (const gchar **domains, gint n_domains);
-void e_debug_log_disable_domains (const gchar **domains, gint n_domains);
-
-gboolean e_debug_log_is_domain_enabled (const gchar *domain);
-
-gboolean e_debug_log_dump (const gchar *filename, GError **error);
-
-gboolean e_debug_log_dump_to_dated_file (GError **error);
-
-void e_debug_log_set_max_lines (gint num_lines);
-gint e_debug_log_get_max_lines (void);
+#define E_DEBUG_LOG_DOMAIN_CAL_QUERIES "CalQueries" /* used for calendar queries analysis */
+
+G_BEGIN_DECLS
+
+void e_debug_log (gboolean is_milestone,
+ const gchar *domain,
+ const gchar *format,
+ ...);
+void e_debug_logv (gboolean is_milestone,
+ const gchar *domain,
+ const gchar *format,
+ va_list args);
+gboolean e_debug_log_load_configuration (const gchar *filename,
+ GError **error);
+void e_debug_log_enable_domains (const gchar **domains,
+ gint n_domains);
+void e_debug_log_disable_domains (const gchar **domains,
+ gint n_domains);
+gboolean e_debug_log_is_domain_enabled (const gchar *domain);
+gboolean e_debug_log_dump (const gchar *filename,
+ GError **error);
+gboolean e_debug_log_dump_to_dated_file (GError **error);
+void e_debug_log_set_max_lines (gint num_lines);
+gint e_debug_log_get_max_lines (void);
/* For testing only */
-void e_debug_log_clear (void);
+void e_debug_log_clear (void);
+
+G_END_DECLS
#endif /* E_DEBUG_LOG_H */
diff --git a/libedataserver/e-flag.h b/libedataserver/e-flag.h
index 4bab8f2..10d2fb1 100644
--- a/libedataserver/e-flag.h
+++ b/libedataserver/e-flag.h
@@ -30,6 +30,9 @@ G_BEGIN_DECLS
/**
* EFlag:
*
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ *
* Since: 1.12
**/
typedef struct _EFlag EFlag;
diff --git a/libedataserver/e-iterator.h b/libedataserver/e-iterator.h
index f1ebd54..9da8274 100644
--- a/libedataserver/e-iterator.h
+++ b/libedataserver/e-iterator.h
@@ -6,69 +6,83 @@
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*/
-#ifndef __E_ITERATOR_H__
-#define __E_ITERATOR_H__
+#ifndef E_ITERATOR_H
+#define E_ITERATOR_H
#include <stdio.h>
#include <time.h>
-#include <glib.h>
#include <glib-object.h>
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_ITERATOR \
+ (e_iterator_get_type ())
+#define E_ITERATOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_ITERATOR, EIterator))
+#define E_ITERATOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_ITERATOR, EIteratorClass))
+#define E_IS_ITERATOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_ITERATOR))
+#define E_IS_ITERATOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_ITERATOR))
+#define E_ITERATOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_ITERATOR, EIteratorClass))
-#define E_TYPE_ITERATOR (e_iterator_get_type ())
-#define E_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_ITERATOR, EIterator))
-#define E_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_ITERATOR, EIteratorClass))
-#define E_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_ITERATOR))
-#define E_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_ITERATOR))
-#define E_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_ITERATOR, EIteratorClass))
+G_BEGIN_DECLS
typedef struct _EIterator EIterator;
typedef struct _EIteratorClass EIteratorClass;
+/**
+ * EIterator:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
struct _EIterator {
- GObject object;
+ GObject parent;
};
struct _EIteratorClass {
GObjectClass parent_class;
/* Signals */
- void (*invalidate) (EIterator *iterator);
+ void (*invalidate) (EIterator *iterator);
- /* Virtual functions */
- gconstpointer (*get) (EIterator *iterator);
- void (*reset) (EIterator *iterator);
- void (*last) (EIterator *iterator);
- gboolean (*next) (EIterator *iterator);
- gboolean (*prev) (EIterator *iterator);
- void (*remove) (EIterator *iterator);
- void (*insert) (EIterator *iterator,
- gconstpointer object,
- gboolean before);
- void (*set) (EIterator *iterator,
- gconstpointer object);
- gboolean (*is_valid) (EIterator *iterator);
+ /* Methods */
+ gconstpointer (*get) (EIterator *iterator);
+ void (*reset) (EIterator *iterator);
+ void (*last) (EIterator *iterator);
+ gboolean (*next) (EIterator *iterator);
+ gboolean (*prev) (EIterator *iterator);
+ void (*remove) (EIterator *iterator);
+ void (*insert) (EIterator *iterator,
+ gconstpointer object,
+ gboolean before);
+ void (*set) (EIterator *iterator,
+ gconstpointer object);
+ gboolean (*is_valid) (EIterator *iterator);
};
-const void *e_iterator_get (EIterator *iterator);
-void e_iterator_reset (EIterator *iterator);
-void e_iterator_last (EIterator *iterator);
-gboolean e_iterator_next (EIterator *iterator);
-gboolean e_iterator_prev (EIterator *iterator);
-void e_iterator_delete (EIterator *iterator);
-void e_iterator_insert (EIterator *iterator,
- gconstpointer object,
- gboolean before);
-void e_iterator_set (EIterator *iterator,
- gconstpointer object);
-gboolean e_iterator_is_valid (EIterator *iterator);
-
-void e_iterator_invalidate (EIterator *iterator);
-
-/* Standard Glib function */
-GType e_iterator_get_type (void);
+GType e_iterator_get_type (void) G_GNUC_CONST;
+gconstpointer e_iterator_get (EIterator *iterator);
+void e_iterator_reset (EIterator *iterator);
+void e_iterator_last (EIterator *iterator);
+gboolean e_iterator_next (EIterator *iterator);
+gboolean e_iterator_prev (EIterator *iterator);
+void e_iterator_delete (EIterator *iterator);
+void e_iterator_insert (EIterator *iterator,
+ gconstpointer object,
+ gboolean before);
+void e_iterator_set (EIterator *iterator,
+ gconstpointer object);
+gboolean e_iterator_is_valid (EIterator *iterator);
+void e_iterator_invalidate (EIterator *iterator);
G_END_DECLS
-#endif /* __E_ITERATOR_H__ */
+#endif /* E_ITERATOR_H */
diff --git a/libedataserver/e-list-iterator.h b/libedataserver/e-list-iterator.h
index 0c57026..767cab7 100644
--- a/libedataserver/e-list-iterator.h
+++ b/libedataserver/e-list-iterator.h
@@ -6,44 +6,54 @@
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*/
-#ifndef __E_LIST_ITERATOR_H__
-#define __E_LIST_ITERATOR_H__
+#ifndef E_LIST_ITERATOR_H
+#define E_LIST_ITERATOR_H
#include <stdio.h>
#include <time.h>
-#include <glib.h>
#include <glib-object.h>
-#include <libedataserver/e-iterator.h>
#include <libedataserver/e-list.h>
+#include <libedataserver/e-iterator.h>
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_LIST_ITERATOR \
+ (e_list_iterator_get_type ())
+#define E_LIST_ITERATOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_LIST_ITERATOR, EListIterator))
+#define E_LIST_ITERATOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_LIST_ITERATOR, EListIteratorClass))
+#define E_IS_LIST_ITERATOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_LIST_ITERATOR))
+#define E_IS_LIST_ITERATOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_LIST_ITERATOR))
+#define E_LIST_ITERATOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_LIST_ITERATOR, EListIteratorClass))
-#define E_TYPE_LIST_ITERATOR (e_list_iterator_get_type ())
-#define E_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_LIST_ITERATOR, EListIterator))
-#define E_LIST_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_LIST_ITERATOR, EListIteratorClass))
-#define E_IS_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_LIST_ITERATOR))
-#define E_IS_LIST_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_LIST_ITERATOR))
+G_BEGIN_DECLS
typedef struct _EListIterator EListIterator;
typedef struct _EListIteratorClass EListIteratorClass;
struct _EListIterator {
- EIterator parent;
+ EIterator parent;
- EList *list;
- GList *iterator;
+ EList *list;
+ GList *iterator;
};
struct _EListIteratorClass {
EIteratorClass parent_class;
};
-EIterator *e_list_iterator_new (EList *list);
-
-/* Standard Glib function */
-GType e_list_iterator_get_type (void);
+GType e_list_iterator_get_type (void) G_GNUC_CONST;
+EIterator * e_list_iterator_new (EList *list);
G_END_DECLS
-#endif /* __E_LIST_ITERATOR_H__ */
+#endif /* E_LIST_ITERATOR_H */
diff --git a/libedataserver/e-list.h b/libedataserver/e-list.h
index dd3d537..90297b8 100644
--- a/libedataserver/e-list.h
+++ b/libedataserver/e-list.h
@@ -6,69 +6,81 @@
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*/
-#ifndef __E_LIST_H__
-#define __E_LIST_H__
-
-typedef struct _EList EList;
-typedef struct _EListClass EListClass;
+#ifndef E_LIST_H
+#define E_LIST_H
#include <stdio.h>
#include <time.h>
-#include <glib.h>
#include <glib-object.h>
-#include <libedataserver/e-list-iterator.h>
+#include <libedataserver/e-iterator.h>
+
+/* Standard GObject macros */
+#define E_TYPE_LIST \
+ (e_list_get_type ())
+#define E_LIST(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_LIST, EList))
+#define E_LIST_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_LIST, EListClass))
+#define E_IS_LIST(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_LIST))
+#define E_IS_LIST_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_LIST))
+#define E_LIST_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_LIST, EListClass))
G_BEGIN_DECLS
-#define E_TYPE_LIST (e_list_get_type ())
-#define E_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_LIST, EList))
-#define E_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_LIST, EListClass))
-#define E_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_LIST))
-#define E_IS_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_LIST))
-#define E_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_LIST, EListClass))
+typedef struct _EList EList;
+typedef struct _EListClass EListClass;
-typedef gpointer (*EListCopyFunc) (gconstpointer data, gpointer closure);
-typedef void (*EListFreeFunc) (gpointer data, gpointer closure);
+typedef gpointer (*EListCopyFunc) (gconstpointer data,
+ gpointer closure);
+typedef void (*EListFreeFunc) (gpointer data,
+ gpointer closure);
struct _EList {
- GObject object;
- GList *list;
- GList *iterators;
- EListCopyFunc copy;
- EListFreeFunc free;
- void *closure;
+ GObject parent;
+
+ GList *list;
+ GList *iterators;
+ EListCopyFunc copy;
+ EListFreeFunc free;
+ gpointer closure;
};
struct _EListClass {
GObjectClass parent_class;
};
-EList *e_list_new (EListCopyFunc copy,
- EListFreeFunc free,
- void *closure);
-void e_list_construct (EList *list,
- EListCopyFunc copy,
- EListFreeFunc free,
- void *closure);
-EList *e_list_duplicate (EList *list);
-EIterator *e_list_get_iterator (EList *list);
-void e_list_append (EList *list,
- const void *data);
-void e_list_remove (EList *list,
- const void *data);
-gint e_list_length (EList *list);
+GType e_list_get_type (void) G_GNUC_CONST;
+EList * e_list_new (EListCopyFunc copy,
+ EListFreeFunc free,
+ gpointer closure);
+void e_list_construct (EList *list,
+ EListCopyFunc copy,
+ EListFreeFunc free,
+ gpointer closure);
+EList * e_list_duplicate (EList *list);
+EIterator * e_list_get_iterator (EList *list);
+void e_list_append (EList *list,
+ gconstpointer data);
+void e_list_remove (EList *list,
+ gconstpointer data);
+gint e_list_length (EList *list);
/* For iterators to call. */
-void e_list_remove_link (EList *list,
- GList *link);
-void e_list_remove_iterator (EList *list,
- EIterator *iterator);
-void e_list_invalidate_iterators (EList *list,
- EIterator *skip);
-
-/* Standard Glib function */
-GType e_list_get_type (void);
+void e_list_remove_link (EList *list,
+ GList *link);
+void e_list_remove_iterator (EList *list,
+ EIterator *iterator);
+void e_list_invalidate_iterators (EList *list,
+ EIterator *skip);
G_END_DECLS
-#endif /* __E_LIST_H__ */
+#endif /* E_LIST_H */
diff --git a/libedataserver/e-memory.c b/libedataserver/e-memory.c
index 0eda140..1e2e914 100644
--- a/libedataserver/e-memory.c
+++ b/libedataserver/e-memory.c
@@ -59,128 +59,148 @@ typedef struct _MemChunkFreeNode {
guint atoms;
} MemChunkFreeNode;
-typedef struct _EMemChunk {
+struct _EMemChunk {
guint blocksize; /* number of atoms in a block */
guint atomsize; /* size of each atom */
GPtrArray *blocks; /* blocks of raw memory */
struct _MemChunkFreeNode *free;
-} MemChunk;
+};
/**
* e_memchunk_new:
- * @atomcount: The number of atoms stored in a single malloc'd block of memory.
- * @atomsize: The size of each allocation.
+ * @atomcount: the number of atoms stored in a single malloc'd block of memory
+ * @atomsize: the size of each allocation
*
- * Create a new memchunk header. Memchunks are an efficient way to allocate
- * and deallocate identical sized blocks of memory quickly, and space efficiently.
+ * Create a new #EMemChunk header. Memchunks are an efficient way to
+ * allocate and deallocate identical sized blocks of memory quickly, and
+ * space efficiently.
*
- * e_memchunks are effectively the same as gmemchunks, only faster (much), and
- * they use less memory overhead for housekeeping.
+ * e_memchunks are effectively the same as gmemchunks, only faster (much),
+ * and they use less memory overhead for housekeeping.
*
- * Returns: The new header.
+ * Returns: a new #EMemChunk
**/
-MemChunk *e_memchunk_new (gint atomcount, gint atomsize)
+EMemChunk *
+e_memchunk_new (gint atomcount, gint atomsize)
{
- MemChunk *m = g_malloc (sizeof (*m));
+ EMemChunk *memchunk = g_malloc (sizeof (*memchunk));
- m->blocksize = atomcount;
- m->atomsize = MAX (atomsize, sizeof (MemChunkFreeNode));
- m->blocks = g_ptr_array_new ();
- m->free = NULL;
+ memchunk->blocksize = atomcount;
+ memchunk->atomsize = MAX (atomsize, sizeof (MemChunkFreeNode));
+ memchunk->blocks = g_ptr_array_new ();
+ memchunk->free = NULL;
- return m;
+ return memchunk;
}
/**
- * memchunk_alloc:
- * @m:
+ * e_memchunk_alloc:
+ * @memchunk: an #EMemChunk
+ *
+ * Allocate a new atom size block of memory from an #EMemChunk.
+ * Free the returned atom with e_memchunk_free().
*
- * Allocate a new atom size block of memory from a memchunk.
+ * Returns: an allocated block of memory
**/
-gpointer e_memchunk_alloc (MemChunk *m)
+gpointer
+e_memchunk_alloc (EMemChunk *memchunk)
{
gchar *b;
MemChunkFreeNode *f;
gpointer mem;
- f = m->free;
+ f = memchunk->free;
if (f) {
f->atoms--;
if (f->atoms > 0) {
- mem = ((gchar *)f) + (f->atoms*m->atomsize);
+ mem = ((gchar *)f) + (f->atoms * memchunk->atomsize);
} else {
mem = f;
- m->free = m->free->next;
+ memchunk->free = memchunk->free->next;
}
return mem;
} else {
- b = g_malloc (m->blocksize * m->atomsize);
- g_ptr_array_add (m->blocks, b);
- f = (MemChunkFreeNode *)&b[m->atomsize];
- f->atoms = m->blocksize-1;
+ b = g_malloc (memchunk->blocksize * memchunk->atomsize);
+ g_ptr_array_add (memchunk->blocks, b);
+ f = (MemChunkFreeNode *) &b[memchunk->atomsize];
+ f->atoms = memchunk->blocksize-1;
f->next = NULL;
- m->free = f;
+ memchunk->free = f;
return b;
}
}
-gpointer e_memchunk_alloc0 (EMemChunk *m)
+/**
+ * e_memchunk_alloc0:
+ * @memchunk: an #EMemChunk
+ *
+ * Allocate a new atom size block of memory from an #EMemChunk,
+ * and fill the memory with zeros. Free the returned atom with
+ * e_memchunk_free().
+ *
+ * Returns: an allocated block of memory
+ **/
+gpointer
+e_memchunk_alloc0 (EMemChunk *memchunk)
{
gpointer mem;
- mem = e_memchunk_alloc (m);
- memset (mem, 0, m->atomsize);
+ mem = e_memchunk_alloc (memchunk);
+ memset (mem, 0, memchunk->atomsize);
return mem;
}
/**
* e_memchunk_free:
- * @m:
- * @mem: Address of atom to free.
+ * @memchunk: an #EMemChunk
+ * @mem: address of atom to free
*
* Free a single atom back to the free pool of atoms in the given
* memchunk.
**/
void
-e_memchunk_free (MemChunk *m, gpointer mem)
+e_memchunk_free (EMemChunk *memchunk,
+ gpointer mem)
{
MemChunkFreeNode *f;
- /* put the location back in the free list. If we knew if the preceeding or following
- cells were free, we could merge the free nodes, but it doesn't really add much */
+ /* Put the location back in the free list. If we knew if the
+ * preceeding or following cells were free, we could merge the
+ * free nodes, but it doesn't really add much. */
f = mem;
- f->next = m->free;
- m->free = f;
+ f->next = memchunk->free;
+ memchunk->free = f;
f->atoms = 1;
- /* we could store the free list sorted - we could then do the above, and also
- probably improve the locality of reference properties for the allocator */
- /* and it would simplify some other algorithms at that, but slow this one down
- significantly */
+ /* We could store the free list sorted - we could then do the above,
+ * and also probably improve the locality of reference properties for
+ * the allocator. (And it would simplify some other algorithms at
+ * that, but slow this one down significantly.) */
}
/**
* e_memchunk_empty:
- * @m:
+ * @memchunk: an #EMemChunk
*
* Clean out the memchunk buffers. Marks all allocated memory as free blocks,
* but does not give it back to the system. Can be used if the memchunk
* is to be used repeatedly.
**/
void
-e_memchunk_empty (MemChunk *m)
+e_memchunk_empty (EMemChunk *memchunk)
{
- gint i;
MemChunkFreeNode *f, *h = NULL;
+ gint i;
- for (i=0;i<m->blocks->len;i++) {
- f = (MemChunkFreeNode *)m->blocks->pdata[i];
- f->atoms = m->blocksize;
+ for (i = 0; i < memchunk->blocks->len; i++) {
+ f = (MemChunkFreeNode *) memchunk->blocks->pdata[i];
+ f->atoms = memchunk->blocksize;
f->next = h;
h = f;
}
- m->free = h;
+
+ memchunk->free = h;
}
struct _cleaninfo {
@@ -190,7 +210,9 @@ struct _cleaninfo {
gint size; /* just so tree_search has it, sigh */
};
-static gint tree_compare (struct _cleaninfo *a, struct _cleaninfo *b)
+static gint
+tree_compare (struct _cleaninfo *a,
+ struct _cleaninfo *b)
{
if (a->base < b->base)
return -1;
@@ -199,7 +221,9 @@ static gint tree_compare (struct _cleaninfo *a, struct _cleaninfo *b)
return 0;
}
-static gint tree_search (struct _cleaninfo *a, gchar *mem)
+static gint
+tree_search (struct _cleaninfo *a,
+ gchar *mem)
{
if (a->base <= mem) {
if (mem < &a->base[a->size])
@@ -211,7 +235,7 @@ static gint tree_search (struct _cleaninfo *a, gchar *mem)
/**
* e_memchunk_clean:
- * @m:
+ * @memchunk: an #EMemChunk
*
* Scan all empty blocks and check for blocks which can be free'd
* back to the system.
@@ -221,24 +245,24 @@ static gint tree_search (struct _cleaninfo *a, gchar *mem)
* greater than atomcount).
**/
void
-e_memchunk_clean (MemChunk *m)
+e_memchunk_clean (EMemChunk *memchunk)
{
GTree *tree;
gint i;
MemChunkFreeNode *f;
struct _cleaninfo *ci, *hi = NULL;
- f = m->free;
- if (m->blocks->len == 0 || f == NULL)
+ f = memchunk->free;
+ if (memchunk->blocks->len == 0 || f == NULL)
return;
/* first, setup the tree/list so we can map free block addresses to block addresses */
tree = g_tree_new ((GCompareFunc)tree_compare);
- for (i=0;i<m->blocks->len;i++) {
+ for (i = 0; i < memchunk->blocks->len; i++) {
ci = alloca (sizeof (*ci));
ci->count = 0;
- ci->base = m->blocks->pdata[i];
- ci->size = m->blocksize * m->atomsize;
+ ci->base = memchunk->blocks->pdata[i];
+ ci->size = memchunk->blocksize * memchunk->atomsize;
g_tree_insert (tree, ci, ci);
ci->next = hi;
hi = ci;
@@ -258,17 +282,17 @@ e_memchunk_clean (MemChunk *m)
/* if any nodes are all free, free & unlink them */
ci = hi;
while (ci) {
- if (ci->count == m->blocksize) {
+ if (ci->count == memchunk->blocksize) {
MemChunkFreeNode *prev = NULL;
- f = m->free;
+ f = memchunk->free;
while (f) {
if (tree_search (ci, (gpointer) f) == 0) {
/* prune this node from our free-node list */
if (prev)
prev->next = f->next;
else
- m->free = f->next;
+ memchunk->free = f->next;
} else {
prev = f;
}
@@ -276,7 +300,7 @@ e_memchunk_clean (MemChunk *m)
f = f->next;
}
- g_ptr_array_remove_fast (m->blocks, ci->base);
+ g_ptr_array_remove_fast (memchunk->blocks, ci->base);
g_free (ci->base);
}
ci = ci->next;
@@ -287,22 +311,24 @@ e_memchunk_clean (MemChunk *m)
/**
* e_memchunk_destroy:
- * @m:
+ * @memchunk: an #EMemChunk
*
* Free the memchunk header, and all associated memory.
**/
void
-e_memchunk_destroy (MemChunk *m)
+e_memchunk_destroy (EMemChunk *memchunk)
{
gint i;
- if (m == NULL)
+ if (memchunk == NULL)
return;
- for (i=0;i<m->blocks->len;i++)
- g_free (m->blocks->pdata[i]);
- g_ptr_array_free (m->blocks, TRUE);
- g_free (m);
+ for (i = 0; i < memchunk->blocks->len; i++)
+ g_free (memchunk->blocks->pdata[i]);
+
+ g_ptr_array_free (memchunk->blocks, TRUE);
+
+ g_free (memchunk);
}
#if 0
diff --git a/libedataserver/e-memory.h b/libedataserver/e-memory.h
index e7810af..f223349 100644
--- a/libedataserver/e-memory.h
+++ b/libedataserver/e-memory.h
@@ -30,13 +30,15 @@ G_BEGIN_DECLS
/* this is like gmemchunk, only faster and less overhead (only 4 bytes for every atomcount allocations) */
typedef struct _EMemChunk EMemChunk;
-EMemChunk *e_memchunk_new (gint atomcount, gint atomsize);
-gpointer e_memchunk_alloc (EMemChunk *m);
-gpointer e_memchunk_alloc0 (EMemChunk *m);
-void e_memchunk_free (EMemChunk *m, gpointer mem);
-void e_memchunk_empty (EMemChunk *m);
-void e_memchunk_clean (EMemChunk *m);
-void e_memchunk_destroy (EMemChunk *m);
+EMemChunk * e_memchunk_new (gint atomcount,
+ gint atomsize);
+gpointer e_memchunk_alloc (EMemChunk *memchunk);
+gpointer e_memchunk_alloc0 (EMemChunk *memchunk);
+void e_memchunk_free (EMemChunk *memchunk,
+ gpointer mem);
+void e_memchunk_empty (EMemChunk *memchunk);
+void e_memchunk_clean (EMemChunk *memchunk);
+void e_memchunk_destroy (EMemChunk *memchunk);
G_END_DECLS
diff --git a/libedataserver/e-proxy.h b/libedataserver/e-proxy.h
index 62920c9..fb1cd3d 100644
--- a/libedataserver/e-proxy.h
+++ b/libedataserver/e-proxy.h
@@ -54,6 +54,9 @@ typedef struct _EProxyPrivate EProxyPrivate;
/**
* EProxy:
*
+ * Contains only private data that should be read and manipulated using the
+ * function below.
+ *
* Since: 2.24
**/
struct _EProxy {
@@ -68,7 +71,7 @@ struct _EProxyClass {
void (*changed) (EProxy *proxy);
};
-GType e_proxy_get_type (void);
+GType e_proxy_get_type (void) G_GNUC_CONST;
EProxy * e_proxy_new (void);
void e_proxy_setup_proxy (EProxy *proxy);
SoupURI * e_proxy_peek_uri_for (EProxy *proxy,
diff --git a/libedataserver/e-sexp.h b/libedataserver/e-sexp.h
index a522944..ae4ab64 100644
--- a/libedataserver/e-sexp.h
+++ b/libedataserver/e-sexp.h
@@ -14,24 +14,24 @@
#include <glib-object.h>
#endif
-G_BEGIN_DECLS
-
#ifdef E_SEXP_IS_G_OBJECT
#define E_TYPE_SEXP (e_sexp_get_type ())
#define E_SEXP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SEXP, ESExp))
-#define E_SEXP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SEXP, ESExpClass))
+#define E_SEXP_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST ((cls), E_TYPE_SEXP, ESExpClass))
#define IS_E_SEXP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SEXP))
-#define IS_E_SEXP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_SEXP))
+#define IS_E_SEXP_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE ((cls), E_TYPE_SEXP))
#define E_SEXP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_SEXP, ESExpClass))
#else
#define E_TYPE_SEXP (0)
#define E_SEXP(obj) ((struct _ESExp *) (obj))
-#define E_SEXP_CLASS(klass) ((struct _ESExpClass *) (klass))
+#define E_SEXP_CLASS(cls) ((struct _ESExpClass *) (cls))
#define IS_E_SEXP(obj) (1)
#define IS_E_SEXP_CLASS(obj) (1)
#define E_SEXP_GET_CLASS(obj) (NULL)
#endif
+G_BEGIN_DECLS
+
typedef struct _ESExp ESExp;
typedef struct _ESExpClass ESExpClass;
diff --git a/libedataserver/e-soap-message.h b/libedataserver/e-soap-message.h
index bc92009..ce2da28 100644
--- a/libedataserver/e-soap-message.h
+++ b/libedataserver/e-soap-message.h
@@ -4,96 +4,133 @@
*/
#ifndef E_SOAP_MESSAGE_H
-#define E_SOAP_MESSAGE_H 1
+#define E_SOAP_MESSAGE_H
#include <time.h>
#include <libxml/tree.h>
#include <libsoup/soup-message.h>
#include "e-soap-response.h"
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_SOAP_MESSAGE \
+ (e_soap_message_get_type ())
+#define E_SOAP_MESSAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SOAP_MESSAGE, ESoapMessage))
+#define E_SOAP_MESSAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SOAP_MESSAGE, ESoapMessageClass))
+#define E_IS_SOAP_MESSAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SOAP_MESSAGE))
+#define E_IS_SOAP_MESSAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SOAP_MESSAGE))
+#define E_SOAP_MESSAGE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SOAP_MESSAGE, ESoapMessageClass))
-#define E_TYPE_SOAP_MESSAGE (e_soap_message_get_type ())
-#define E_SOAP_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SOAP_MESSAGE, ESoapMessage))
-#define E_SOAP_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SOAP_MESSAGE, ESoapMessageClass))
-#define E_IS_SOAP_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SOAP_MESSAGE))
-#define E_IS_SOAP_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_SOAP_MESSAGE))
-#define E_SOAP_MESSAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_SOAP_MESSAGE, ESoapMessageClass))
+G_BEGIN_DECLS
+typedef struct _ESoapMessage ESoapMessage;
+typedef struct _ESoapMessageClass ESoapMessageClass;
typedef struct _ESoapMessagePrivate ESoapMessagePrivate;
-typedef struct {
+/**
+ * ESoapMessage:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
+struct _ESoapMessage {
SoupMessage parent;
-
ESoapMessagePrivate *priv;
-} ESoapMessage;
+};
-typedef struct {
+struct _ESoapMessageClass {
SoupMessageClass parent_class;
-} ESoapMessageClass;
-
-GType e_soap_message_get_type (void);
-
-ESoapMessage *e_soap_message_new (const gchar *method, const gchar *uri_string,
- gboolean standalone, const gchar *xml_encoding,
- const gchar *env_prefix, const gchar *env_uri);
-ESoapMessage *e_soap_message_new_from_uri (const gchar *method, SoupURI *uri,
- gboolean standalone, const gchar *xml_encoding,
- const gchar *env_prefix, const gchar *env_uri);
-
-void e_soap_message_start_envelope (ESoapMessage *msg);
-void e_soap_message_end_envelope (ESoapMessage *msg);
-void e_soap_message_start_body (ESoapMessage *msg);
-void e_soap_message_end_body (ESoapMessage *msg);
-void e_soap_message_start_element (ESoapMessage *msg,
- const gchar *name,
- const gchar *prefix,
- const gchar *ns_uri);
-void e_soap_message_end_element (ESoapMessage *msg);
-void e_soap_message_start_fault (ESoapMessage *msg,
+};
+
+GType e_soap_message_get_type (void) G_GNUC_CONST;
+ESoapMessage * e_soap_message_new (const gchar *method,
+ const gchar *uri_string,
+ gboolean standalone,
+ const gchar *xml_encoding,
+ const gchar *env_prefix,
+ const gchar *env_uri);
+ESoapMessage * e_soap_message_new_from_uri (const gchar *method,
+ SoupURI *uri,
+ gboolean standalone,
+ const gchar *xml_encoding,
+ const gchar *env_prefix,
+ const gchar *env_uri);
+void e_soap_message_start_envelope (ESoapMessage *msg);
+void e_soap_message_end_envelope (ESoapMessage *msg);
+void e_soap_message_start_body (ESoapMessage *msg);
+void e_soap_message_end_body (ESoapMessage *msg);
+void e_soap_message_start_element (ESoapMessage *msg,
+ const gchar *name,
+ const gchar *prefix,
+ const gchar *ns_uri);
+void e_soap_message_end_element (ESoapMessage *msg);
+void e_soap_message_start_fault (ESoapMessage *msg,
const gchar *faultcode,
const gchar *faultstring,
const gchar *faultfactor);
-void e_soap_message_end_fault (ESoapMessage *msg);
-void e_soap_message_start_fault_detail (ESoapMessage *msg);
-void e_soap_message_end_fault_detail (ESoapMessage *msg);
-void e_soap_message_start_header (ESoapMessage *msg);
-void e_soap_message_end_header (ESoapMessage *msg);
-void e_soap_message_start_header_element (ESoapMessage *msg,
- const gchar *name,
- gboolean must_understand,
- const gchar *actor_uri,
- const gchar *prefix,
- const gchar *ns_uri);
-void e_soap_message_end_header_element (ESoapMessage *msg);
-void e_soap_message_write_int (ESoapMessage *msg, glong i);
-void e_soap_message_write_double (ESoapMessage *msg, gdouble d);
-void e_soap_message_write_base64 (ESoapMessage *msg, const gchar *string, gint len);
-void e_soap_message_write_time (ESoapMessage *msg, const time_t *timeval);
-void e_soap_message_write_string (ESoapMessage *msg, const gchar *string);
-void e_soap_message_write_buffer (ESoapMessage *msg, const gchar *buffer, gint len);
-void e_soap_message_set_element_type (ESoapMessage *msg, const gchar *xsi_type);
-void e_soap_message_set_null (ESoapMessage *msg);
-void e_soap_message_add_attribute (ESoapMessage *msg,
- const gchar *name,
- const gchar *value,
- const gchar *prefix,
- const gchar *ns_uri);
-void e_soap_message_add_namespace (ESoapMessage *msg,
- const gchar *prefix,
- const gchar *ns_uri);
-void e_soap_message_set_default_namespace (ESoapMessage *msg,
- const gchar *ns_uri);
-void e_soap_message_set_encoding_style (ESoapMessage *msg, const gchar *enc_style);
-void e_soap_message_reset (ESoapMessage *msg);
-void e_soap_message_persist (ESoapMessage *msg);
-
-const gchar *e_soap_message_get_namespace_prefix (ESoapMessage *msg, const gchar *ns_uri);
-
-xmlDocPtr e_soap_message_get_xml_doc (ESoapMessage *msg);
-
-ESoapResponse *e_soap_message_parse_response (ESoapMessage *msg);
+void e_soap_message_end_fault (ESoapMessage *msg);
+void e_soap_message_start_fault_detail
+ (ESoapMessage *msg);
+void e_soap_message_end_fault_detail (ESoapMessage *msg);
+void e_soap_message_start_header (ESoapMessage *msg);
+void e_soap_message_end_header (ESoapMessage *msg);
+void e_soap_message_start_header_element
+ (ESoapMessage *msg,
+ const gchar *name,
+ gboolean must_understand,
+ const gchar *actor_uri,
+ const gchar *prefix,
+ const gchar *ns_uri);
+void e_soap_message_end_header_element
+ (ESoapMessage *msg);
+void e_soap_message_write_int (ESoapMessage *msg,
+ glong i);
+void e_soap_message_write_double (ESoapMessage *msg,
+ gdouble d);
+void e_soap_message_write_base64 (ESoapMessage *msg,
+ const gchar *string,
+ gint len);
+void e_soap_message_write_time (ESoapMessage *msg,
+ const time_t *timeval);
+void e_soap_message_write_string (ESoapMessage *msg,
+ const gchar *string);
+void e_soap_message_write_buffer (ESoapMessage *msg,
+ const gchar *buffer,
+ gint len);
+void e_soap_message_set_element_type (ESoapMessage *msg,
+ const gchar *xsi_type);
+void e_soap_message_set_null (ESoapMessage *msg);
+void e_soap_message_add_attribute (ESoapMessage *msg,
+ const gchar *name,
+ const gchar *value,
+ const gchar *prefix,
+ const gchar *ns_uri);
+void e_soap_message_add_namespace (ESoapMessage *msg,
+ const gchar *prefix,
+ const gchar *ns_uri);
+void e_soap_message_set_default_namespace
+ (ESoapMessage *msg,
+ const gchar *ns_uri);
+void e_soap_message_set_encoding_style
+ (ESoapMessage *msg,
+ const gchar *enc_style);
+void e_soap_message_reset (ESoapMessage *msg);
+void e_soap_message_persist (ESoapMessage *msg);
+const gchar * e_soap_message_get_namespace_prefix
+ (ESoapMessage *msg,
+ const gchar *ns_uri);
+xmlDocPtr e_soap_message_get_xml_doc (ESoapMessage *msg);
+ESoapResponse * e_soap_message_parse_response (ESoapMessage *msg);
G_END_DECLS
-#endif
+#endif /* E_SOAP_MESSAGE_H */
diff --git a/libedataserver/e-soap-response.c b/libedataserver/e-soap-response.c
index 1440286..3211e2e 100644
--- a/libedataserver/e-soap-response.c
+++ b/libedataserver/e-soap-response.c
@@ -122,13 +122,13 @@ parse_parameters (ESoapResponsePrivate *priv, xmlNodePtr xml_method)
/**
* e_soap_response_from_string:
- * @response: the #ESoapResponse object.
- * @xmlstr: XML string to parse.
+ * @response: an #ESoapResponse
+ * @xmlstr: XML string to parse
*
* Parses the string contained in @xmlstr and sets all properties from
* it in the @response object.
*
- * Returns: %TRUE if successful, %FALSE otherwise.
+ * Returns: %TRUE if successful, %FALSE otherwise
*
* Since: 3.0
*/
@@ -195,11 +195,11 @@ e_soap_response_from_string (ESoapResponse *response, const gchar *xmlstr)
/**
* e_soap_response_get_method_name:
- * @response: the #ESoapResponse object.
+ * @response: an #ESoapResponse
*
* Gets the method name from the SOAP response.
*
- * Returns: the method name.
+ * Returns: the method name
*
* Since: 3.0
*/
@@ -217,15 +217,16 @@ e_soap_response_get_method_name (ESoapResponse *response)
/**
* e_soap_response_set_method_name:
- * @response: the #ESoapResponse object.
- * @method_name: the method name to set.
+ * @response: an #ESoapResponse object
+ * @method_name: the method name to set
*
* Sets the method name on the given #ESoapResponse.
*
* Since: 3.0
*/
void
-e_soap_response_set_method_name (ESoapResponse *response, const gchar *method_name)
+e_soap_response_set_method_name (ESoapResponse *response,
+ const gchar *method_name)
{
ESoapResponsePrivate *priv;
@@ -444,7 +445,7 @@ e_soap_parameter_get_property (ESoapParameter *param, const gchar *prop_name)
/**
* e_soap_response_get_parameters:
- * @response: the #ESoapResponse object.
+ * @response: an #ESoapResponse
*
* Returns the list of parameters received in the SOAP response.
*
@@ -465,12 +466,12 @@ e_soap_response_get_parameters (ESoapResponse *response)
/**
* e_soap_response_get_first_parameter:
- * @response: the #ESoapResponse object.
+ * @response: an #ESoapResponse
*
* Retrieves the first parameter contained in the SOAP response.
*
- * Returns: a #ESoapParameter representing the first
- * parameter, or %NULL if there are no parameters.
+ * Returns: a #ESoapParameter representing the first parameter, or
+ * %NULL if there are no parameters
*
* Since: 3.0
*/
@@ -487,14 +488,14 @@ e_soap_response_get_first_parameter (ESoapResponse *response)
/**
* e_soap_response_get_first_parameter_by_name:
- * @response: the #ESoapResponse object.
- * @name: the name of the parameter to look for.
+ * @response: an #ESoapResponse
+ * @name: the name of the parameter to look for
*
* Retrieves the first parameter contained in the SOAP response whose
* name is @name.
*
- * Returns: a #ESoapParameter representing the first parameter
- * with the given name, or %NULL.
+ * Returns: a #ESoapParameter representing the first parameter with
+ * the given name, or %NULL
*
* Since: 3.0
*/
@@ -521,13 +522,13 @@ e_soap_response_get_first_parameter_by_name (ESoapResponse *response,
/**
* e_soap_response_get_next_parameter:
- * @response: the #ESoapResponse object.
- * @from: the parameter to start from.
+ * @response: an #ESoapResponse
+ * @from: the parameter to start from
*
* Retrieves the parameter following @from in the #ESoapResponse
* object.
*
- * Returns: a #ESoapParameter representing the parameter.
+ * Returns: a #ESoapParameter representing the parameter
*
* Since: 3.0
*/
@@ -551,14 +552,14 @@ e_soap_response_get_next_parameter (ESoapResponse *response,
/**
* e_soap_response_get_next_parameter_by_name:
- * @response: the #ESoapResponse object.
- * @from: the parameter to start from.
- * @name: the name of the parameter to look for.
+ * @response: an #ESoapResponse
+ * @from: the parameter to start from
+ * @name: the name of the parameter to look for
*
* Retrieves the first parameter following @from in the
* #ESoapResponse object whose name matches @name.
*
- * Returns: a #ESoapParameter representing the parameter.
+ * Returns: a #ESoapParameter representing the parameter
*
* Since: 3.0
*/
@@ -599,6 +600,12 @@ soup_xml_real_node (xmlNode *node)
/**
* e_soap_response_dump_response:
+ * @response: an #ESoapResponse
+ * @buffer: an open file stream
+ *
+ * This is a debugging utility. Dumps the contents of @reponse to a file.
+ *
+ * Returns: 0 on success, -1 on failure
*
* Since: 3.0
**/
diff --git a/libedataserver/e-soap-response.h b/libedataserver/e-soap-response.h
index dab7b3d..7631f62 100644
--- a/libedataserver/e-soap-response.h
+++ b/libedataserver/e-soap-response.h
@@ -9,63 +9,87 @@
#include <glib-object.h>
#include <libxml/tree.h>
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_SOAP_RESPONSE \
+ (e_soap_response_get_type ())
+#define E_SOAP_RESPONSE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SOAP_RESPONSE, ESoapResponse))
+#define E_SOAP_RESPONSE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SOAP_RESPONSE, ESoapResponseClass))
+#define E_IS_SOAP_RESPONSE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SOAP_RESPONSE))
+#define E_IS_SOAP_RESPONSE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SOAP_RESPONSE))
+#define E_SOAP_RESPONSE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SOAP_RESPONSE, ESoapResponseClass))
-#define E_TYPE_SOAP_RESPONSE (e_soap_response_get_type ())
-#define E_SOAP_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SOAP_RESPONSE, ESoapResponse))
-#define E_SOAP_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SOAP_RESPONSE, ESoapResponseClass))
-#define E_IS_SOAP_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SOAP_RESPONSE))
-#define E_IS_SOAP_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_SOAP_RESPONSE))
-#define E_SOAP_RESPONSE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_SOAP_RESPONSE, ESoapResponseClass))
+G_BEGIN_DECLS
+typedef struct _ESoapResponse ESoapResponse;
+typedef struct _ESoapResponseClass ESoapResponseClass;
typedef struct _ESoapResponsePrivate ESoapResponsePrivate;
-typedef struct {
+/**
+ * ESoapResponse:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
+struct _ESoapResponse {
GObject parent;
-
ESoapResponsePrivate *priv;
-} ESoapResponse;
+};
-typedef struct {
+struct _ESoapResponseClass {
GObjectClass parent_class;
-} ESoapResponseClass;
-
-GType e_soap_response_get_type (void);
-
-ESoapResponse *e_soap_response_new (void);
-ESoapResponse *e_soap_response_new_from_string (const gchar *xmlstr);
-
-gboolean e_soap_response_from_string (ESoapResponse *response, const gchar *xmlstr);
-
-const gchar *e_soap_response_get_method_name (ESoapResponse *response);
-void e_soap_response_set_method_name (ESoapResponse *response,
- const gchar *method_name);
+};
typedef xmlNode ESoapParameter;
-const gchar *e_soap_parameter_get_name (ESoapParameter *param);
-gint e_soap_parameter_get_int_value (ESoapParameter *param);
-gchar *e_soap_parameter_get_string_value (ESoapParameter *param);
-ESoapParameter *e_soap_parameter_get_first_child (ESoapParameter *param);
-ESoapParameter *e_soap_parameter_get_first_child_by_name (ESoapParameter *param,
- const gchar *name);
-ESoapParameter *e_soap_parameter_get_next_child (ESoapParameter *param);
-ESoapParameter *e_soap_parameter_get_next_child_by_name (ESoapParameter *param,
- const gchar *name);
-gchar *e_soap_parameter_get_property (ESoapParameter *param, const gchar *prop_name);
-
-const GList *e_soap_response_get_parameters (ESoapResponse *response);
-ESoapParameter *e_soap_response_get_first_parameter (ESoapResponse *response);
-ESoapParameter *e_soap_response_get_first_parameter_by_name (ESoapResponse *response,
- const gchar *name);
-ESoapParameter *e_soap_response_get_next_parameter (ESoapResponse *response,
- ESoapParameter *from);
-ESoapParameter *e_soap_response_get_next_parameter_by_name (ESoapResponse *response,
- ESoapParameter *from,
- const gchar *name);
-
-gint e_soap_response_dump_response (ESoapResponse *response, FILE *buffer);
+GType e_soap_response_get_type (void) G_GNUC_CONST;
+ESoapResponse * e_soap_response_new (void);
+ESoapResponse * e_soap_response_new_from_string (const gchar *xmlstr);
+gboolean e_soap_response_from_string (ESoapResponse *response,
+ const gchar *xmlstr);
+const gchar * e_soap_response_get_method_name (ESoapResponse *response);
+void e_soap_response_set_method_name (ESoapResponse *response,
+ const gchar *method_name);
+const gchar * e_soap_parameter_get_name (ESoapParameter *param);
+gint e_soap_parameter_get_int_value (ESoapParameter *param);
+gchar * e_soap_parameter_get_string_value
+ (ESoapParameter *param);
+ESoapParameter *e_soap_parameter_get_first_child
+ (ESoapParameter *param);
+ESoapParameter *e_soap_parameter_get_first_child_by_name
+ (ESoapParameter *param,
+ const gchar *name);
+ESoapParameter *e_soap_parameter_get_next_child (ESoapParameter *param);
+ESoapParameter *e_soap_parameter_get_next_child_by_name
+ (ESoapParameter *param,
+ const gchar *name);
+gchar * e_soap_parameter_get_property (ESoapParameter *param,
+ const gchar *prop_name);
+const GList * e_soap_response_get_parameters (ESoapResponse *response);
+ESoapParameter *e_soap_response_get_first_parameter
+ (ESoapResponse *response);
+ESoapParameter *e_soap_response_get_first_parameter_by_name
+ (ESoapResponse *response,
+ const gchar *name);
+ESoapParameter *e_soap_response_get_next_parameter
+ (ESoapResponse *response,
+ ESoapParameter *from);
+ESoapParameter *e_soap_response_get_next_parameter_by_name
+ (ESoapResponse *response,
+ ESoapParameter *from,
+ const gchar *name);
+gint e_soap_response_dump_response (ESoapResponse *response,
+ FILE *buffer);
G_END_DECLS
-#endif
+#endif /* E_SOAP_RESPONSE_H */
diff --git a/libedataserver/e-source-group.h b/libedataserver/e-source-group.h
index b74cdfd..0e91753 100644
--- a/libedataserver/e-source-group.h
+++ b/libedataserver/e-source-group.h
@@ -20,100 +20,111 @@
* Author: Ettore Perazzoli <ettore ximian com>
*/
-#ifndef _E_SOURCE_GROUP_H_
-#define _E_SOURCE_GROUP_H_
+#ifndef E_SOURCE_GROUP_H
+#define E_SOURCE_GROUP_H
-#include <glib-object.h>
#include <libxml/tree.h>
+#include <libedataserver/e-source.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SOURCE_GROUP \
+ (e_source_group_get_type ())
+#define E_SOURCE_GROUP(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SOURCE_GROUP, ESourceGroup))
+#define E_SOURCE_GROUP_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SOURCE_GROUP, ESourceGroupClass))
+#define E_IS_SOURCE_GROUP(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SOURCE_GROUP))
+#define E_IS_SOURCE_GROUP_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SOURCE_GROUP))
+#define E_SOURCE_GROUP_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SOURCE_GROUP, ESourceGroupClass))
G_BEGIN_DECLS
-#define E_TYPE_SOURCE_GROUP (e_source_group_get_type ())
-#define E_SOURCE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SOURCE_GROUP, ESourceGroup))
-#define E_SOURCE_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SOURCE_GROUP, ESourceGroupClass))
-#define E_IS_SOURCE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SOURCE_GROUP))
-#define E_IS_SOURCE_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_SOURCE_GROUP))
-
-typedef struct _ESourceGroup ESourceGroup;
+typedef struct _ESourceGroup ESourceGroup;
+typedef struct _ESourceGroupClass ESourceGroupClass;
typedef struct _ESourceGroupPrivate ESourceGroupPrivate;
-typedef struct _ESourceGroupClass ESourceGroupClass;
-
-#include "e-source.h"
+/**
+ * ESourceGroup:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
struct _ESourceGroup {
GObject parent;
-
ESourceGroupPrivate *priv;
};
struct _ESourceGroupClass {
GObjectClass parent_class;
- /* Signals. */
-
- void (* changed) (ESourceGroup *group);
-
- void (* source_removed) (ESourceGroup *source_list, ESource *source);
- void (* source_added) (ESourceGroup *source_list, ESource *source);
+ /* Signals */
+ void (*changed) (ESourceGroup *group);
+ void (*source_removed) (ESourceGroup *source_list,
+ ESource *source);
+ void (*source_added) (ESourceGroup *source_list,
+ ESource *source);
};
-GType e_source_group_get_type (void);
-
-ESourceGroup *e_source_group_new (const gchar *name,
- const gchar *base_uri);
-ESourceGroup *e_source_group_new_from_xml (const gchar *xml);
-ESourceGroup *e_source_group_new_from_xmldoc (xmlDocPtr doc);
-
-gboolean e_source_group_update_from_xml (ESourceGroup *group,
- const gchar *xml,
- gboolean *changed_return);
-gboolean e_source_group_update_from_xmldoc (ESourceGroup *group,
- xmlDocPtr doc,
- gboolean *changed_return);
-
-gchar *e_source_group_uid_from_xmldoc (xmlDocPtr doc);
-
-void e_source_group_set_name (ESourceGroup *group,
- const gchar *name);
-void e_source_group_set_base_uri (ESourceGroup *group,
- const gchar *base_uri);
-
-void e_source_group_set_readonly (ESourceGroup *group,
- gboolean readonly);
-
-const gchar *e_source_group_peek_uid (ESourceGroup *group);
-const gchar *e_source_group_peek_name (ESourceGroup *group);
-const gchar *e_source_group_peek_base_uri (ESourceGroup *group);
-gboolean e_source_group_get_readonly (ESourceGroup *group);
-
-GSList *e_source_group_peek_sources (ESourceGroup *group);
-ESource *e_source_group_peek_source_by_uid (ESourceGroup *group,
- const gchar *source_uid);
-ESource *e_source_group_peek_source_by_name (ESourceGroup *group,
- const gchar *source_name);
-
-gboolean e_source_group_add_source (ESourceGroup *group,
- ESource *source,
- gint position);
-gboolean e_source_group_remove_source (ESourceGroup *group,
- ESource *source);
-gboolean e_source_group_remove_source_by_uid (ESourceGroup *group,
- const gchar *uid);
-
-gchar *e_source_group_get_property (ESourceGroup *source,
- const gchar *property);
-void e_source_group_set_property (ESourceGroup *source,
- const gchar *property,
- const gchar *value);
-void e_source_group_foreach_property (ESourceGroup *source,
- GHFunc func,
- gpointer data);
-
-gchar *e_source_group_to_xml (ESourceGroup *group);
-
-gboolean e_source_group_equal (ESourceGroup *a, ESourceGroup *b);
-gboolean e_source_group_xmlstr_equal (const gchar *a, const gchar *b);
+GType e_source_group_get_type (void) G_GNUC_CONST;
+ESourceGroup * e_source_group_new (const gchar *name,
+ const gchar *base_uri);
+ESourceGroup * e_source_group_new_from_xml (const gchar *xml);
+ESourceGroup * e_source_group_new_from_xmldoc (xmlDocPtr doc);
+gboolean e_source_group_update_from_xml (ESourceGroup *group,
+ const gchar *xml,
+ gboolean *changed_return);
+gboolean e_source_group_update_from_xmldoc
+ (ESourceGroup *group,
+ xmlDocPtr doc,
+ gboolean *changed_return);
+gchar * e_source_group_uid_from_xmldoc (xmlDocPtr doc);
+void e_source_group_set_name (ESourceGroup *group,
+ const gchar *name);
+void e_source_group_set_base_uri (ESourceGroup *group,
+ const gchar *base_uri);
+void e_source_group_set_readonly (ESourceGroup *group,
+ gboolean readonly);
+const gchar * e_source_group_peek_uid (ESourceGroup *group);
+const gchar * e_source_group_peek_name (ESourceGroup *group);
+const gchar * e_source_group_peek_base_uri (ESourceGroup *group);
+gboolean e_source_group_get_readonly (ESourceGroup *group);
+GSList * e_source_group_peek_sources (ESourceGroup *group);
+ESource * e_source_group_peek_source_by_uid
+ (ESourceGroup *group,
+ const gchar *source_uid);
+ESource * e_source_group_peek_source_by_name
+ (ESourceGroup *group,
+ const gchar *source_name);
+gboolean e_source_group_add_source (ESourceGroup *group,
+ ESource *source,
+ gint position);
+gboolean e_source_group_remove_source (ESourceGroup *group,
+ ESource *source);
+gboolean e_source_group_remove_source_by_uid
+ (ESourceGroup *group,
+ const gchar *uid);
+gchar * e_source_group_get_property (ESourceGroup *source,
+ const gchar *property);
+void e_source_group_set_property (ESourceGroup *source,
+ const gchar *property,
+ const gchar *value);
+void e_source_group_foreach_property (ESourceGroup *source,
+ GHFunc func,
+ gpointer data);
+gchar * e_source_group_to_xml (ESourceGroup *group);
+gboolean e_source_group_equal (ESourceGroup *a,
+ ESourceGroup *b);
+gboolean e_source_group_xmlstr_equal (const gchar *a,
+ const gchar *b);
G_END_DECLS
-#endif /* _E_SOURCE_GROUP_H_ */
+#endif /* E_SOURCE_GROUP_H */
diff --git a/libedataserver/e-source-list.c b/libedataserver/e-source-list.c
index 690cb1d..33bd212 100644
--- a/libedataserver/e-source-list.c
+++ b/libedataserver/e-source-list.c
@@ -426,13 +426,20 @@ e_source_list_peek_group_by_uid (ESourceList *list,
/**
* e_source_list_peek_group_by_base_uri:
+ * @list: an #ESourceList
+ * @base_uri: a group base URI
*
- * Returns the first group which base uri begins with a base_uri.
+ * Returns the first #ESourceGroup having the given base URI.
+ * The base URI is usually just the URI scheme, such as "http://".
+ * If no such group is present in @list, the function returns %NULL.
+ *
+ * Returns: an #ESourceGroup with a matching base URI, or %NULL
*
* Since: 2.28
**/
ESourceGroup *
-e_source_list_peek_group_by_base_uri (ESourceList *list, const gchar *base_uri)
+e_source_list_peek_group_by_base_uri (ESourceList *list,
+ const gchar *base_uri)
{
GSList *p;
gint len;
@@ -625,19 +632,25 @@ e_source_list_peek_default_source (ESourceList *source_list)
gboolean
e_source_list_add_group (ESourceList *list,
- ESourceGroup *group,
- gint position)
+ ESourceGroup *group,
+ gint position)
{
+ const gchar *uid;
+
g_return_val_if_fail (E_IS_SOURCE_LIST (list), FALSE);
g_return_val_if_fail (E_IS_SOURCE_GROUP (group), FALSE);
- if (e_source_list_peek_group_by_uid (list, e_source_group_peek_uid (group)) != NULL)
+ uid = e_source_group_peek_uid (group);
+
+ if (e_source_list_peek_group_by_uid (list, uid) != NULL)
return FALSE;
- list->priv->groups = g_slist_insert (list->priv->groups, group, position);
- g_object_ref (group);
+ list->priv->groups = g_slist_insert (
+ list->priv->groups, g_object_ref (group), position);
- g_signal_connect (group, "changed", G_CALLBACK (group_changed_callback), list);
+ g_signal_connect (
+ group, "changed",
+ G_CALLBACK (group_changed_callback), list);
g_signal_emit (list, signals[GROUP_ADDED], 0, group);
g_signal_emit (list, signals[CHANGED], 0);
@@ -645,23 +658,50 @@ e_source_list_add_group (ESourceList *list,
return TRUE;
}
+/**
+ * e_source_list_remove_group:
+ * @list: an #ESourceList
+ * @group: an #ESourceGroup
+ *
+ * Removes the first #ESourceGroup with a unique ID matching @group
+ * (possibly @group itself) from @list. The function returns %TRUE if a
+ * matching group was found, otherwise %FALSE.
+ *
+ * Returns: %TRUE if an #ESourceGroup was removed, %FALSE otherwise
+ **/
gboolean
e_source_list_remove_group (ESourceList *list,
- ESourceGroup *group)
+ ESourceGroup *group)
{
+ const gchar *uid;
+
g_return_val_if_fail (E_IS_SOURCE_LIST (list), FALSE);
g_return_val_if_fail (E_IS_SOURCE_GROUP (group), FALSE);
- if (e_source_list_peek_group_by_uid (list, e_source_group_peek_uid (group)) == NULL)
+ uid = e_source_group_peek_uid (group);
+
+ if (e_source_list_peek_group_by_uid (list, uid) == NULL)
return FALSE;
remove_group (list, group);
+
return TRUE;
}
+/**
+ * e_source_list_remove_group_by_uid:
+ * @list: an #ESourceList
+ * @uid: the unique ID of an #ESourceGroup
+ *
+ * Removes the first #ESourceGroup with the given unique ID from @list.
+ * The function returns %TRUE if a matching group was found, otherwise
+ * %FALSE.
+ *
+ * Returns: %TRUE if an #ESourceGroup was removed, %FALSE otherwise
+ **/
gboolean
e_source_list_remove_group_by_uid (ESourceList *list,
- const gchar *uid)
+ const gchar *uid)
{
ESourceGroup *group;
@@ -678,15 +718,24 @@ e_source_list_remove_group_by_uid (ESourceList *list,
/**
* e_source_list_ensure_group:
+ * @list: an #ESourceList
+ * @name: a localized group name
+ * @base_uri: a group base URI
+ * @ret_it: whether to return the group
*
- * Ensures group with the @base_uri will exists in the @list and its name will be @name.
- * If ret_it will be TRUE the group will be also returned, in that case caller should
- * g_object_unref the group. Otherwise it returns NULL.
+ * Ensures an #ESourceGroup with the given base URI exists in @list, and
+ * renames its to the given name. If @ret_it is %TRUE, the matching group
+ * will be returned and should be unreferenced with g_object_unref().
+ *
+ * Returns: the matching #ESourceGroup if @ret_it is %TRUE, otherwise %NULL
*
* Since: 2.28
**/
ESourceGroup *
-e_source_list_ensure_group (ESourceList *list, const gchar *name, const gchar *base_uri, gboolean ret_it)
+e_source_list_ensure_group (ESourceList *list,
+ const gchar *name,
+ const gchar *base_uri,
+ gboolean ret_it)
{
ESourceGroup *group;
@@ -724,14 +773,20 @@ e_source_list_ensure_group (ESourceList *list, const gchar *name, const gchar *b
/**
* e_source_list_remove_group_by_base_uri:
+ * @list: an #ESourceList
+ * @base_uri: a group base URI
+ *
+ * Removes the first #ESourceGroup having the given base URI from @list.
+ * The base URI is usually just the URI scheme, such as "http://". The
+ * function returns %TRUE if a matching group was found, otherwise %FALSE.
*
- * Removes group with given base_uri.
- * Returns TRUE if group was found.
+ * Returns: %TRUE if an #ESourceGroup was removed, %FALSE otherwise
*
* Since: 2.28
**/
gboolean
-e_source_list_remove_group_by_base_uri (ESourceList *list, const gchar *base_uri)
+e_source_list_remove_group_by_base_uri (ESourceList *list,
+ const gchar *base_uri)
{
ESourceGroup *group;
@@ -746,9 +801,19 @@ e_source_list_remove_group_by_base_uri (ESourceList *list, const gchar *base_uri
return TRUE;
}
+/**
+ * e_source_list_remove_source_by_uid:
+ * @list: an #ESourceList
+ * @uid: the unique ID of an #ESource
+ *
+ * Removes the first #ESource with the given unique ID from @list. The
+ * function returns %TRUE if a matching source was found, otherwise %FALSE.
+ *
+ * Returns: %TRUE if an #ESource was removed, %FALSE otherwise
+ **/
gboolean
e_source_list_remove_source_by_uid (ESourceList *list,
- const gchar *uid)
+ const gchar *uid)
{
GSList *p;
@@ -767,9 +832,20 @@ e_source_list_remove_source_by_uid (ESourceList *list,
return FALSE;
}
+/**
+ * e_source_list_sync:
+ * @list: an #ESourceList
+ * @error: return location for a #GError, or %NULL
+ *
+ * Writes the contents of @list to GConf. If an error occurs, such as
+ * the GConf daemon not responding, the function sets @error and returns
+ * %FALSE.
+ *
+ * Returns: %TRUE on success, %FALSE on failure
+ **/
gboolean
e_source_list_sync (ESourceList *list,
- GError **error)
+ GError **error)
{
GSList *conf_list;
GSList *p;
@@ -779,15 +855,17 @@ e_source_list_sync (ESourceList *list,
conf_list = NULL;
for (p = list->priv->groups; p != NULL; p = p->next)
- conf_list = g_slist_prepend (conf_list, e_source_group_to_xml (E_SOURCE_GROUP (p->data)));
+ conf_list = g_slist_prepend (
+ conf_list, e_source_group_to_xml (
+ E_SOURCE_GROUP (p->data)));
conf_list = g_slist_reverse (conf_list);
if (!e_source_list_is_gconf_updated (list))
- retval = gconf_client_set_list (list->priv->gconf_client,
- list->priv->gconf_path,
- GCONF_VALUE_STRING,
- conf_list,
- error);
+ retval = gconf_client_set_list (
+ list->priv->gconf_client,
+ list->priv->gconf_path,
+ GCONF_VALUE_STRING,
+ conf_list, error);
else
retval = TRUE;
@@ -797,6 +875,15 @@ e_source_list_sync (ESourceList *list,
return retval;
}
+/**
+ * e_source_list_is_gconf_updated:
+ * @list: an #ESourceList
+ *
+ * Returns %TRUE if the GConf data for @list is up-to-date, %FALSE if
+ * e_source_list_sync() should be called.
+ *
+ * Returns: %TRUE if the GConf data for @list is up-to-date
+ **/
gboolean
e_source_list_is_gconf_updated (ESourceList *list)
{
diff --git a/libedataserver/e-source-list.h b/libedataserver/e-source-list.h
index 719a788..2f0b553 100644
--- a/libedataserver/e-source-list.h
+++ b/libedataserver/e-source-list.h
@@ -20,80 +20,104 @@
* Author: Ettore Perazzoli <ettore ximian com>
*/
-#ifndef _E_SOURCE_LIST_H_
-#define _E_SOURCE_LIST_H_
+#ifndef E_SOURCE_LIST_H
+#define E_SOURCE_LIST_H
#include <libxml/tree.h>
#include <gconf/gconf-client.h>
-
-#include "e-source-group.h"
+#include <libedataserver/e-source-group.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SOURCE_LIST \
+ (e_source_list_get_type ())
+#define E_SOURCE_LIST(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SOURCE_LIST, ESourceList))
+#define E_SOURCE_LIST_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SOURCE_LIST, ESourceListClass))
+#define E_IS_SOURCE_LIST(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SOURCE_LIST))
+#define E_IS_SOURCE_LIST_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SOURCE_LIST))
+#define E_SOURCE_LIST_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SOURCE_LIST, ESourceListClass))
G_BEGIN_DECLS
-#define E_TYPE_SOURCE_LIST (e_source_list_get_type ())
-#define E_SOURCE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SOURCE_LIST, ESourceList))
-#define E_SOURCE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SOURCE_LIST, ESourceListClass))
-#define E_IS_SOURCE_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SOURCE_LIST))
-#define E_IS_SOURCE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_SOURCE_LIST))
-
-typedef struct _ESourceList ESourceList;
+typedef struct _ESourceList ESourceList;
+typedef struct _ESourceListClass ESourceListClass;
typedef struct _ESourceListPrivate ESourceListPrivate;
-typedef struct _ESourceListClass ESourceListClass;
+/**
+ * ESourceList:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
struct _ESourceList {
GObject parent;
-
ESourceListPrivate *priv;
};
struct _ESourceListClass {
GObjectClass parent_class;
- /* Signals. */
-
- void (* changed) (ESourceList *source_list);
-
- void (* group_removed) (ESourceList *source_list, ESourceGroup *group);
- void (* group_added) (ESourceList *source_list, ESourceGroup *group);
+ /* Signals */
+ void (*changed) (ESourceList *source_list);
+ void (*group_removed) (ESourceList *source_list,
+ ESourceGroup *group);
+ void (*group_added) (ESourceList *source_list,
+ ESourceGroup *group);
};
-GType e_source_list_get_type (void);
-
-ESourceList *e_source_list_new (void);
-ESourceList *e_source_list_new_for_gconf (GConfClient *client,
- const gchar *path);
-ESourceList *e_source_list_new_for_gconf_default (const gchar *path);
-
-GSList *e_source_list_peek_groups (ESourceList *list);
-ESourceGroup *e_source_list_peek_group_by_uid (ESourceList *list,
+GType e_source_list_get_type (void) G_GNUC_CONST;
+ESourceList * e_source_list_new (void);
+ESourceList * e_source_list_new_for_gconf (GConfClient *client,
+ const gchar *path);
+ESourceList * e_source_list_new_for_gconf_default
+ (const gchar *path);
+GSList * e_source_list_peek_groups (ESourceList *list);
+ESourceGroup * e_source_list_peek_group_by_uid (ESourceList *list,
+ const gchar *uid);
+ESourceGroup * e_source_list_peek_group_by_base_uri
+ (ESourceList *list,
+ const gchar *base_uri);
+ESourceGroup * e_source_list_peek_group_by_properties
+ (ESourceList *list,
+ const gchar *property_name,
+ ...);
+ESource * e_source_list_peek_source_by_uid
+ (ESourceList *list,
const gchar *uid);
-ESourceGroup *e_source_list_peek_group_by_base_uri (ESourceList *list, const gchar *base_uri);
-ESourceGroup *e_source_list_peek_group_by_properties (ESourceList *list, const gchar *property_name, ...);
-
-ESource *e_source_list_peek_source_by_uid (ESourceList *list,
- const gchar *uid);
-ESource *e_source_list_peek_source_any (ESourceList *list);
-ESource *e_source_list_peek_default_source (ESourceList *list);
-
-gboolean e_source_list_add_group (ESourceList *list,
- ESourceGroup *group,
- gint position);
-gboolean e_source_list_remove_group (ESourceList *list,
- ESourceGroup *group);
-gboolean e_source_list_remove_group_by_uid (ESourceList *list,
- const gchar *uid);
-
-ESourceGroup *e_source_list_ensure_group (ESourceList *list, const gchar *name, const gchar *base_uri, gboolean ret_it);
-gboolean e_source_list_remove_group_by_base_uri (ESourceList *list, const gchar *base_uri);
-
-gboolean e_source_list_remove_source_by_uid (ESourceList *list,
- const gchar *uidj);
-
-gboolean e_source_list_sync (ESourceList *list,
- GError **error);
-
-gboolean e_source_list_is_gconf_updated (ESourceList *list);
+ESource * e_source_list_peek_source_any (ESourceList *list);
+ESource * e_source_list_peek_default_source
+ (ESourceList *list);
+gboolean e_source_list_add_group (ESourceList *list,
+ ESourceGroup *group,
+ gint position);
+gboolean e_source_list_remove_group (ESourceList *list,
+ ESourceGroup *group);
+gboolean e_source_list_remove_group_by_uid
+ (ESourceList *list,
+ const gchar *uid);
+ESourceGroup * e_source_list_ensure_group (ESourceList *list,
+ const gchar *name,
+ const gchar *base_uri,
+ gboolean ret_it);
+gboolean e_source_list_remove_group_by_base_uri
+ (ESourceList *list,
+ const gchar *base_uri);
+gboolean e_source_list_remove_source_by_uid
+ (ESourceList *list,
+ const gchar *uidj);
+gboolean e_source_list_sync (ESourceList *list,
+ GError **error);
+gboolean e_source_list_is_gconf_updated (ESourceList *list);
G_END_DECLS
-#endif /* _E_SOURCE_LIST_H_ */
+#endif /* E_SOURCE_LIST_H */
diff --git a/libedataserver/e-source.c b/libedataserver/e-source.c
index e5a8f54..8886892 100644
--- a/libedataserver/e-source.c
+++ b/libedataserver/e-source.c
@@ -20,17 +20,13 @@
* Author: Ettore Perazzoli <ettore ximian com>
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include "e-uid.h"
#include "e-source.h"
-#define ES_CLASS(obj) E_SOURCE_CLASS (G_OBJECT_GET_CLASS (obj))
+#include <config.h>
+#include <string.h>
-/* Private members. */
+#include <libedataserver/e-uid.h>
+#include <libedataserver/e-source-group.h>
struct _ESourcePrivate {
ESourceGroup *group;
@@ -47,12 +43,11 @@ struct _ESourcePrivate {
GHashTable *properties;
};
-/* Signals. */
-
enum {
CHANGED,
LAST_SIGNAL
};
+
static guint signals[LAST_SIGNAL] = { 0 };
/* Callbacks. */
@@ -155,53 +150,82 @@ set_color_spec (ESource *source,
return TRUE;
}
-/* Public methods. */
-
+/**
+ * e_source_new:
+ * @name: a display name for the source
+ * @relative_uri: a relative URI for the source
+ *
+ * Creates a new #ESource instance, and gives it a display name specified
+ * by @name and a relative URI specified by @relative_uri.
+ *
+ * Returns: a new #ESource
+ **/
ESource *
-e_source_new (const gchar *name,
- const gchar *relative_uri)
+e_source_new (const gchar *name,
+ const gchar *relative_uri)
{
ESource *source;
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (relative_uri != NULL, NULL);
- source = g_object_new (e_source_get_type (), NULL);
+ source = g_object_new (E_TYPE_SOURCE, NULL);
source->priv->uid = e_uid_new ();
e_source_set_name (source, name);
e_source_set_relative_uri (source, relative_uri);
+
return source;
}
+/**
+ * e_source_new_with_absolute_uri:
+ * @name: a display name for the source
+ * @absolute_uri: a custom absolute URI for the source
+ *
+ * Creates a new #ESource instance, and gives it a display name specified
+ * by @name and a custom absolute URI specified by @abolute_uri.
+ *
+ * Returns: a new #ESource
+ **/
ESource *
e_source_new_with_absolute_uri (const gchar *name,
- const gchar *absolute_uri)
+ const gchar *absolute_uri)
{
ESource *source;
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (absolute_uri != NULL, NULL);
- source = g_object_new (e_source_get_type (), NULL);
+ source = g_object_new (E_TYPE_SOURCE, NULL);
source->priv->uid = e_uid_new ();
e_source_set_name (source, name);
e_source_set_absolute_uri (source, absolute_uri);
+
return source;
}
+/**
+ * e_source_new_from_xml_node:
+ * @node: a pointer to the XML node to parse
+ *
+ * Creates a new #ESource instance from the XML specification in @node.
+ * If the XML specification is invalid, the function returns %NULL.
+ *
+ * Returns: a new #ESource, or %NULL
+ **/
ESource *
e_source_new_from_xml_node (xmlNodePtr node)
{
ESource *source;
xmlChar *uid;
- uid = xmlGetProp (node, (xmlChar*)"uid");
+ uid = xmlGetProp (node, (xmlChar *)"uid");
if (uid == NULL)
return NULL;
- source = g_object_new (e_source_get_type (), NULL);
+ source = g_object_new (E_TYPE_SOURCE, NULL);
source->priv->uid = g_strdup ((gchar *)uid);
xmlFree (uid);
@@ -226,8 +250,8 @@ import_properties (ESource *source,
if (!prop_node->name || strcmp ((gchar *)prop_node->name, "property"))
continue;
- name = xmlGetProp (prop_node, (xmlChar*)"name");
- value = xmlGetProp (prop_node, (xmlChar*)"value");
+ name = xmlGetProp (prop_node, (xmlChar *)"name");
+ value = xmlGetProp (prop_node, (xmlChar *)"value");
if (name && value)
g_hash_table_insert (priv->properties, g_strdup ((gchar *)name), g_strdup ((gchar *)value));
@@ -269,18 +293,22 @@ compare_str_hashes (GHashTable *table1, GHashTable *table2)
/**
* e_source_update_from_xml_node:
- * @source: An ESource.
- * @node: A pointer to the node to parse.
+ * @source: an #ESource.
+ * @node: a pointer to the XML node to parse
+ * @changed_return: return location for change confirmation, or %NULL
*
- * Update the ESource properties from @node.
+ * Update the #ESource attributes from @node. If @changed_return is
+ * non-%NULL, it will be set to %TRUE if any attributes were actually
+ * changed in the course of the update. This will also emit the
+ * #ESource::changed signal if any attributes were actually changed.
*
* Returns: %TRUE if the data in @node was recognized and parsed into
- * acceptable values for @source, %FALSE otherwise.
+ * acceptable values for @source, %FALSE otherwise
**/
gboolean
e_source_update_from_xml_node (ESource *source,
- xmlNodePtr node,
- gboolean *changed_return)
+ xmlNodePtr node,
+ gboolean *changed_return)
{
xmlChar *name;
xmlChar *relative_uri;
@@ -290,11 +318,11 @@ e_source_update_from_xml_node (ESource *source,
gboolean retval = FALSE;
gboolean changed = FALSE;
- name = xmlGetProp (node, (xmlChar*)"name");
- relative_uri = xmlGetProp (node, (xmlChar*)"relative_uri");
- absolute_uri = xmlGetProp (node, (xmlChar*)"uri");
- color_spec = xmlGetProp (node, (xmlChar*)"color_spec");
- color = xmlGetProp (node, (xmlChar*)"color"); /* obsolete */
+ name = xmlGetProp (node, (xmlChar *)"name");
+ relative_uri = xmlGetProp (node, (xmlChar *)"relative_uri");
+ absolute_uri = xmlGetProp (node, (xmlChar *)"uri");
+ color_spec = xmlGetProp (node, (xmlChar *)"color_spec");
+ color = xmlGetProp (node, (xmlChar *)"color"); /* obsolete */
if (name == NULL || (relative_uri == NULL && absolute_uri == NULL))
goto done;
@@ -385,7 +413,7 @@ e_source_update_from_xml_node (ESource *source,
retval = TRUE;
- done:
+done:
if (changed)
g_signal_emit (source, signals[CHANGED], 0);
@@ -407,29 +435,43 @@ e_source_update_from_xml_node (ESource *source,
}
/**
- * e_source_name_from_xml_node:
- * @node: A pointer to an XML node.
+ * e_source_uid_from_xml_node:
+ * @node: a pointer to an XML node
*
- * Assuming that @node is a valid ESource specification, retrieve the name of
- * the source from it.
+ * Assuming that @node is a valid #ESource specification, retrieve the
+ * source's unique identifier string from it. Free the returned string
+ * with g_free().
*
- * Returns: Name of the source in the specified @node. The caller must
- * free the string.
+ * Returns: the unique ID of the source specified by @node,
+ * or %NULL if @node is not a valid specification
**/
gchar *
e_source_uid_from_xml_node (xmlNodePtr node)
{
- xmlChar *uid = xmlGetProp (node, (xmlChar*)"uid");
- gchar *retval;
+ xmlChar *prop;
+ gchar *uid = NULL;
- if (uid == NULL)
- return NULL;
+ prop = xmlGetProp (node, (xmlChar *) "uid");
- retval = g_strdup ((gchar *)uid);
- xmlFree (uid);
- return retval;
+ if (prop != NULL) {
+ uid = g_strdup ((gchar *) prop);
+ xmlFree (prop);
+ }
+
+ return uid;
}
+/**
+ * e_source_build_absolute_uri:
+ * @source: an #ESource
+ *
+ * Builds an absolute URI string using the base URI of the #ESourceGroup
+ * to which @source belongs, and its own relative URI. This function
+ * ignores any custom absolute URIs set with e_source_set_absolute_uri().
+ * Free the returned string with g_free().
+ *
+ * Returns: a newly-allocated absolute URI string
+ **/
gchar *
e_source_build_absolute_uri (ESource *source)
{
@@ -459,9 +501,30 @@ e_source_build_absolute_uri (ESource *source)
return uri_str;
}
+/**
+ * e_source_set_group:
+ * @source: an #ESource
+ * @group: an #ESourceGroup
+ *
+ * If the read-only flag for @source is set, the function does nothing.
+ *
+ * Otherwise, sets the group membership for @source.
+ *
+ * <note>
+ * <para>
+ * If you want to add an #ESource to an #ESourceGroup, use
+ * e_source_group_add_source(). This function only notifies
+ * @source of its group membership, but makes no effort to
+ * verify that membership with @group.
+ * </para>
+ * </note>
+ *
+ * This will emit the #ESource::changed signal if the group membership
+ * actually changed.
+ **/
void
e_source_set_group (ESource *source,
- ESourceGroup *group)
+ ESourceGroup *group)
{
g_return_if_fail (E_IS_SOURCE (source));
g_return_if_fail (group == NULL || E_IS_SOURCE_GROUP (group));
@@ -473,16 +536,31 @@ e_source_set_group (ESource *source,
return;
if (source->priv->group != NULL)
- g_object_weak_unref (G_OBJECT (source->priv->group), (GWeakNotify) group_weak_notify, source);
+ g_object_weak_unref (
+ G_OBJECT (source->priv->group),
+ (GWeakNotify) group_weak_notify, source);
source->priv->group = group;
- if (group != NULL) {
- g_object_weak_ref (G_OBJECT (group), (GWeakNotify) group_weak_notify, source);
- }
+ if (group != NULL)
+ g_object_weak_ref (
+ G_OBJECT (group), (GWeakNotify)
+ group_weak_notify, source);
g_signal_emit (source, signals[CHANGED], 0);
}
+/**
+ * e_source_set_name:
+ * @source: an #ESource
+ * @name: a display name
+ *
+ * If the read-only flag for @source is set, the function does nothing.
+ *
+ * Otherwise, sets the display name for @source.
+ *
+ * This will emit the #ESource::changed signal if the display name
+ * actually changed.
+ **/
void
e_source_set_name (ESource *source,
const gchar *name)
@@ -503,9 +581,23 @@ e_source_set_name (ESource *source,
g_signal_emit (source, signals[CHANGED], 0);
}
+/**
+ * e_source_set_relative_uri:
+ * @source: an #ESource
+ * @relative_uri: a relative URI string
+ *
+ * If the read-only flag for @source is set, the function does nothing.
+ *
+ * Otherwise, sets the relative URI for @source. If @source is a member
+ * of an #ESourceGroup and has not been given a custom absolute URI, the
+ * function also generates a new absolute URI for @source.
+ *
+ * This will emit the #ESource::changed signal if the relative URI
+ * actually changed.
+ **/
void
e_source_set_relative_uri (ESource *source,
- const gchar *relative_uri)
+ const gchar *relative_uri)
{
gchar *absolute_uri, *old_abs_uri = NULL;
@@ -537,9 +629,21 @@ e_source_set_relative_uri (ESource *source,
g_signal_emit (source, signals[CHANGED], 0);
}
+/**
+ * e_source_set_absolute_uri:
+ * @source: an #ESource
+ * @absolute_uri: an absolute URI string, or %NULL
+ *
+ * Sets a custom absolute URI for @source. If @absolute_uri is %NULL, the
+ * custom absolute URI is cleared and @source will fall back to its relative
+ * URI plus the base URI of its containing #ESourceGroup.
+ *
+ * This will emit the #ESource::changed signal if the custom absolute URI
+ * actually changed.
+ **/
void
e_source_set_absolute_uri (ESource *source,
- const gchar *absolute_uri)
+ const gchar *absolute_uri)
{
g_return_if_fail (E_IS_SOURCE (source));
@@ -553,9 +657,21 @@ e_source_set_absolute_uri (ESource *source,
g_signal_emit (source, signals[CHANGED], 0);
}
+/**
+ * e_source_set_readonly:
+ * @source: an #ESource
+ * @readonly: a read-only flag
+ *
+ * Sets @source as being read-only (%TRUE) or writable (%FALSE).
+ * A read-only #ESource ignores attempts to change its display name,
+ * #ESourceGroup, relative URI or color.
+ *
+ * This will emit the #ESource::changed signal if the read-only state
+ * actually changed.
+ **/
void
-e_source_set_readonly (ESource *source,
- gboolean readonly)
+e_source_set_readonly (ESource *source,
+ gboolean readonly)
{
g_return_if_fail (E_IS_SOURCE (source));
@@ -570,18 +686,21 @@ e_source_set_readonly (ESource *source,
/**
* e_source_set_color_spec:
- * @source: an ESource
+ * @source: an #ESource
* @color_spec: a string specifying the color
*
* Store a textual representation of a color in @source. The @color_spec
* string should be parsable by #gdk_color_parse(), or %NULL to unset the
* color in @source.
*
+ * This will emit the #ESource::changed signal if the color representation
+ * actually changed.
+ *
* Since: 1.10
**/
void
e_source_set_color_spec (ESource *source,
- const gchar *color_spec)
+ const gchar *color_spec)
{
g_return_if_fail (E_IS_SOURCE (source));
@@ -589,6 +708,15 @@ e_source_set_color_spec (ESource *source,
g_signal_emit (source, signals[CHANGED], 0);
}
+/**
+ * e_source_peek_group:
+ * @source: an #ESource
+ *
+ * Returns the #ESourceGroup to which @source belongs, or %NULL if it
+ * does not belong to a group.
+ *
+ * Returns: the group to which the source belongs
+ **/
ESourceGroup *
e_source_peek_group (ESource *source)
{
@@ -597,6 +725,14 @@ e_source_peek_group (ESource *source)
return source->priv->group;
}
+/**
+ * e_source_peek_uid:
+ * @source: an #ESource
+ *
+ * Returns the unique identifier string for @source.
+ *
+ * Returns: the source's unique ID
+ **/
const gchar *
e_source_peek_uid (ESource *source)
{
@@ -605,6 +741,14 @@ e_source_peek_uid (ESource *source)
return source->priv->uid;
}
+/**
+ * e_source_peek_name:
+ * @source: an #ESource
+ *
+ * Returns the display name for @source.
+ *
+ * Returns: the source's display name
+ **/
const gchar *
e_source_peek_name (ESource *source)
{
@@ -613,6 +757,14 @@ e_source_peek_name (ESource *source)
return source->priv->name;
}
+/**
+ * e_source_peek_relative_uri:
+ * @source: an #ESource
+ *
+ * Returns the relative URI for @source.
+ *
+ * Returns: the source's relative URI
+ **/
const gchar *
e_source_peek_relative_uri (ESource *source)
{
@@ -621,6 +773,15 @@ e_source_peek_relative_uri (ESource *source)
return source->priv->relative_uri;
}
+/**
+ * e_source_peek_absolute_uri:
+ * @source: an #ESource
+ *
+ * Returns the absolute URI for @source if it has one, or else %NULL if
+ * it has only a relative URI. e_source_get_uri() may be more convenient.
+ *
+ * Returns: the source's own absolute URI, or %NULL
+ **/
const gchar *
e_source_peek_absolute_uri (ESource *source)
{
@@ -631,7 +792,7 @@ e_source_peek_absolute_uri (ESource *source)
/**
* e_source_peek_color_spec:
- * @source: an ESource
+ * @source: an #ESource
*
* Return the textual representation of the color for @source, or %NULL if it
* has none. The returned string should be parsable by #gdk_color_parse().
@@ -648,6 +809,14 @@ e_source_peek_color_spec (ESource *source)
return source->priv->color_spec;
}
+/**
+ * e_source_get_readonly:
+ * @source: an #ESource
+ *
+ * Returns the read-only flag for @source.
+ *
+ * Returns: %TRUE if the source is read-only, %FALSE if it's writable
+ **/
gboolean
e_source_get_readonly (ESource *source)
{
@@ -656,6 +825,17 @@ e_source_get_readonly (ESource *source)
return source->priv->readonly;
}
+/**
+ * e_source_get_uri:
+ * @source: an #ESource
+ *
+ * Returns a newly-allocated copy of an absolute URI for @source. If
+ * @source has no absolute URI of its own, the URI is constructed from
+ * the base URI of its #ESourceGroup and its relative URI. Free the
+ * returned string with g_free().
+ *
+ * Returns: a newly-allocated absolute URI string
+ **/
gchar *
e_source_get_uri (ESource *source)
{
@@ -675,18 +855,20 @@ e_source_get_uri (ESource *source)
}
static void
-property_dump_cb (const xmlChar *key, const xmlChar *value, xmlNodePtr root)
+property_dump_cb (const xmlChar *key,
+ const xmlChar *value,
+ xmlNodePtr root)
{
xmlNodePtr node;
- node = xmlNewChild (root, NULL, (xmlChar*)"property", NULL);
- xmlSetProp (node, (xmlChar*)"name", key);
- xmlSetProp (node, (xmlChar*)"value", value);
+ node = xmlNewChild (root, NULL, (xmlChar *)"property", NULL);
+ xmlSetProp (node, (xmlChar *)"name", key);
+ xmlSetProp (node, (xmlChar *)"value", value);
}
static xmlNodePtr
dump_common_to_xml_node (ESource *source,
- xmlNodePtr parent_node)
+ xmlNodePtr parent_node)
{
ESourcePrivate *priv;
xmlNodePtr node;
@@ -695,43 +877,60 @@ dump_common_to_xml_node (ESource *source,
priv = source->priv;
if (parent_node)
- node = xmlNewChild (parent_node, NULL, (xmlChar*)"source", NULL);
+ node = xmlNewChild (parent_node, NULL, (xmlChar *)"source", NULL);
else
- node = xmlNewNode (NULL, (xmlChar*)"source");
+ node = xmlNewNode (NULL, (xmlChar *)"source");
- xmlSetProp (node, (xmlChar*)"uid", (xmlChar*)e_source_peek_uid (source));
- xmlSetProp (node, (xmlChar*)"name", (xmlChar*)e_source_peek_name (source));
+ xmlSetProp (node, (xmlChar *)"uid", (xmlChar *)e_source_peek_uid (source));
+ xmlSetProp (node, (xmlChar *)"name", (xmlChar *)e_source_peek_name (source));
abs_uri = e_source_peek_absolute_uri (source);
/* do not store absolute uris for local:system sources */
relative_uri = e_source_peek_relative_uri (source);
if (abs_uri && !(relative_uri && g_str_equal (relative_uri, "system") &&
(g_str_has_prefix (abs_uri, "file:") || g_str_has_prefix (abs_uri, "local:"))))
- xmlSetProp (node, (xmlChar*)"uri", (xmlChar*)abs_uri);
+ xmlSetProp (node, (xmlChar *)"uri", (xmlChar *)abs_uri);
if (relative_uri)
- xmlSetProp (node, (xmlChar*)"relative_uri", (xmlChar*)relative_uri);
+ xmlSetProp (node, (xmlChar *)"relative_uri", (xmlChar *)relative_uri);
if (priv->color_spec != NULL)
- xmlSetProp (node, (xmlChar*)"color_spec", (xmlChar*)priv->color_spec);
+ xmlSetProp (node, (xmlChar *)"color_spec", (xmlChar *)priv->color_spec);
if (g_hash_table_size (priv->properties) != 0) {
xmlNodePtr properties_node;
- properties_node = xmlNewChild (node, NULL, (xmlChar*)"properties", NULL);
+ properties_node = xmlNewChild (node, NULL, (xmlChar *)"properties", NULL);
g_hash_table_foreach (priv->properties, (GHFunc) property_dump_cb, properties_node);
}
return node;
}
+/**
+ * e_source_dump_to_xml_node:
+ * @source: an #ESource
+ * @parent_node: location to add XML data
+ *
+ * Converts @source to an <structname>xmlNode</structname> structure
+ * and adds it as a child of @parent_node.
+ **/
void
e_source_dump_to_xml_node (ESource *source,
- xmlNodePtr parent_node)
+ xmlNodePtr parent_node)
{
g_return_if_fail (E_IS_SOURCE (source));
dump_common_to_xml_node (source, parent_node);
}
+/**
+ * e_source_to_standalone_xml:
+ * @source: an #ESource
+ *
+ * Converts @source to an XML string for permanent storage.
+ * Free the returned string with g_free().
+ *
+ * Returns: a newly-allocated XML string
+ **/
gchar *
e_source_to_standalone_xml (ESource *source)
{
@@ -744,13 +943,13 @@ e_source_to_standalone_xml (ESource *source)
g_return_val_if_fail (E_IS_SOURCE (source), NULL);
- doc = xmlNewDoc ((xmlChar*)"1.0");
+ doc = xmlNewDoc ((xmlChar *)"1.0");
node = dump_common_to_xml_node (source, NULL);
xmlDocSetRootElement (doc, node);
uri = e_source_get_uri (source);
- xmlSetProp (node, (xmlChar*)"uri", (xmlChar*)uri);
+ xmlSetProp (node, (xmlChar *)"uri", (xmlChar *)uri);
g_free (uri);
xmlDocDumpMemory (doc, &xml_buffer, &xml_buffer_size);
@@ -766,13 +965,12 @@ e_source_to_standalone_xml (ESource *source)
/**
* e_source_equal:
- * @a: An ESource
- * @b: Another ESource
+ * @a: an #ESource
+ * @b: another #ESource
*
* Compares if @a is equivalent to @b.
*
- * Returns: %TRUE if @a is equivalent to @b,
- * %FALSE otherwise.
+ * Returns: %TRUE if @a is equivalent to @b, %FALSE otherwise
*
* Since: 2.24
**/
@@ -824,13 +1022,12 @@ e_source_equal (ESource *a, ESource *b)
/**
* e_source_xmlstr_equal:
- * @a: XML representation of an ESource
- * @b: XML representation of another ESource
+ * @a: an XML representation of an #ESource
+ * @b: an XML representation of another #ESource
*
* Compares if @a is equivalent to @b.
*
- * Returns: %TRUE if @a is equivalent to @b,
- * %FALSE otherwise.
+ * Returns: %TRUE if @a is equivalent to @b, %FALSE otherwise
*
* Since: 2.24
**/
@@ -851,6 +1048,15 @@ e_source_xmlstr_equal (const gchar *a, const gchar *b)
return retval;
}
+/**
+ * e_source_new_from_standalone_xml:
+ * @xml: an XML representation of an #ESource
+ *
+ * Constructs an #ESource instance from an XML string representation,
+ * probably generated by e_source_to_standalone_xml().
+ *
+ * Returns: a new #ESource
+ **/
ESource *
e_source_new_from_standalone_xml (const gchar *xml)
{
@@ -858,7 +1064,7 @@ e_source_new_from_standalone_xml (const gchar *xml)
xmlNodePtr root;
ESource *source;
- doc = xmlParseDoc ((xmlChar*)xml);
+ doc = xmlParseDoc ((xmlChar *)xml);
if (doc == NULL)
return NULL;
@@ -872,69 +1078,127 @@ e_source_new_from_standalone_xml (const gchar *xml)
return source;
}
+/**
+ * e_source_get_property:
+ * @source: an #ESource
+ * @property_name: a custom property name
+ *
+ * Looks up the value of a custom #ESource property. If no such
+ * property name exists in @source, the function returns %NULL.
+ *
+ * Returns: the property value, or %NULL
+ **/
const gchar *
e_source_get_property (ESource *source,
- const gchar *property)
+ const gchar *property_name)
{
- ESourcePrivate *priv;
+ const gchar *property_value;
g_return_val_if_fail (E_IS_SOURCE (source), NULL);
- priv = source->priv;
+ g_return_val_if_fail (property_name != NULL, NULL);
+
+ property_value = g_hash_table_lookup (
+ source->priv->properties, property_name);
- return g_hash_table_lookup (priv->properties, property);
+ return property_value;
}
/**
* e_source_get_duped_property:
+ * @source: an #ESource
+ * @property_name: a custom property name
+ *
+ * Looks up the value of a custom #ESource property and returns a
+ * newly-allocated copy of the value. If no such property name exists
+ * in @source, the function returns %NULL. Free the returned value
+ * with g_free().
+ *
+ * Returns: a newly-allocated copy of the property value, or %NULL
*
* Since: 1.12
**/
gchar *
-e_source_get_duped_property (ESource *source, const gchar *property)
+e_source_get_duped_property (ESource *source,
+ const gchar *property_name)
{
- ESourcePrivate *priv;
+ const gchar *property_value;
g_return_val_if_fail (E_IS_SOURCE (source), NULL);
- priv = source->priv;
+ g_return_val_if_fail (property_name != NULL, NULL);
- return g_strdup (g_hash_table_lookup (priv->properties, property));
+ property_value = e_source_get_property (source, property_name);
+
+ return g_strdup (property_value);
}
+/**
+ * e_source_set_property:
+ * @source: an #ESource
+ * @property_name: a custom property name
+ * @property_value: a new value for the property, or %NULL
+ *
+ * Create a new custom #ESource property or replaces an existing one. If
+ * @property_value is %NULL, the property is removed from @source. This
+ * will also emit a #ESource::changed signal.
+ **/
void
e_source_set_property (ESource *source,
- const gchar *property,
- const gchar *value)
+ const gchar *property_name,
+ const gchar *property_value)
{
- ESourcePrivate *priv;
-
g_return_if_fail (E_IS_SOURCE (source));
- priv = source->priv;
+ g_return_if_fail (property_name != NULL);
- if (value)
- g_hash_table_replace (priv->properties, g_strdup (property), g_strdup (value));
+ if (property_value != NULL)
+ g_hash_table_replace (
+ source->priv->properties,
+ g_strdup (property_name),
+ g_strdup (property_value));
else
- g_hash_table_remove (priv->properties, property);
+ g_hash_table_remove (
+ source->priv->properties, property_name);
g_signal_emit (source, signals[CHANGED], 0);
}
+/**
+ * e_source_foreach_property:
+ * @source: an #ESource
+ * @func: the function to call for each property
+ * @user_data: user data to pass to the function
+ *
+ * Calls the given function for each property in @source. The function
+ * is passed the name and value of each property, and the given @user_data
+ * argument. The properties may not be modified while iterating over them.
+ **/
void
-e_source_foreach_property (ESource *source, GHFunc func, gpointer data)
+e_source_foreach_property (ESource *source,
+ GHFunc func,
+ gpointer user_data)
{
- ESourcePrivate *priv;
-
g_return_if_fail (E_IS_SOURCE (source));
- priv = source->priv;
+ g_return_if_fail (func != NULL);
- g_hash_table_foreach (priv->properties, func, data);
+ g_hash_table_foreach (source->priv->properties, func, user_data);
}
static void
-copy_property (const gchar *key, const gchar *value, ESource *new_source)
+copy_property (const gchar *key,
+ const gchar *value,
+ ESource *new_source)
{
e_source_set_property (new_source, key, value);
}
+/**
+ * e_source_copy:
+ * @source: an #ESource
+ *
+ * Creates a new #ESource instance from @source, such that passing @source
+ * and the newly created instance to e_source_equal() would return %TRUE.
+ *
+ * Returns: a newly-created #ESource
+ **/
ESource *
e_source_copy (ESource *source)
{
@@ -942,14 +1206,17 @@ e_source_copy (ESource *source)
g_return_val_if_fail (E_IS_SOURCE (source), NULL);
- new_source = g_object_new (e_source_get_type (), NULL);
+ new_source = g_object_new (E_TYPE_SOURCE, NULL);
new_source->priv->uid = g_strdup (e_source_peek_uid (source));
e_source_set_name (new_source, e_source_peek_name (source));
- new_source->priv->color_spec = g_strdup (source->priv->color_spec);
- new_source->priv->absolute_uri = g_strdup (e_source_peek_absolute_uri (source));
- new_source->priv->relative_uri = g_strdup (e_source_peek_relative_uri (source));
+ new_source->priv->color_spec =
+ g_strdup (source->priv->color_spec);
+ new_source->priv->absolute_uri =
+ g_strdup (e_source_peek_absolute_uri (source));
+ new_source->priv->relative_uri =
+ g_strdup (e_source_peek_relative_uri (source));
e_source_foreach_property (source, (GHFunc) copy_property, new_source);
diff --git a/libedataserver/e-source.h b/libedataserver/e-source.h
index ad68133..bcfea16 100644
--- a/libedataserver/e-source.h
+++ b/libedataserver/e-source.h
@@ -20,98 +20,111 @@
* Author: Ettore Perazzoli <ettore ximian com>
*/
-#ifndef _E_SOURCE_H_
-#define _E_SOURCE_H_
+#ifndef E_SOURCE_H
+#define E_SOURCE_H
#include <glib-object.h>
#include <libxml/tree.h>
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_SOURCE \
+ (e_source_get_type ())
+#define E_SOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SOURCE, ESource))
+#define E_SOURCE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SOURCE, ESourceClass))
+#define E_IS_SOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SOURCE))
+#define E_IS_SOURCE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SOURCE))
+#define E_SOURCE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SOURCE, ESourceClass))
-#define E_TYPE_SOURCE (e_source_get_type ())
-#define E_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SOURCE, ESource))
-#define E_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SOURCE, ESourceClass))
-#define E_IS_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SOURCE))
-#define E_IS_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_SOURCE))
+G_BEGIN_DECLS
-typedef struct _ESource ESource;
+typedef struct _ESource ESource;
+typedef struct _ESourceClass ESourceClass;
typedef struct _ESourcePrivate ESourcePrivate;
-typedef struct _ESourceClass ESourceClass;
-#include "e-source-group.h"
+/* Avoids a cyclic dependency. */
+struct _ESourceGroup;
+/**
+ * ESource:
+ *
+ * Contains only private data that should be read and manipulated using the
+ * functions below.
+ **/
struct _ESource {
GObject parent;
-
ESourcePrivate *priv;
};
struct _ESourceClass {
GObjectClass parent_class;
- /* Signals. */
- void (* changed) (ESource *source);
+ /* Signals */
+ void (*changed) (ESource *source);
};
-GType e_source_get_type (void);
-
-ESource *e_source_new (const gchar *name,
- const gchar *relative_uri);
-ESource *e_source_new_with_absolute_uri (const gchar *name,
- const gchar *absolute_uri);
-ESource *e_source_new_from_xml_node (xmlNodePtr node);
-ESource *e_source_new_from_standalone_xml (const gchar *xml);
-
-ESource *e_source_copy (ESource *source);
-
-gboolean e_source_update_from_xml_node (ESource *source,
- xmlNodePtr node,
- gboolean *changed_return);
-
-gchar *e_source_uid_from_xml_node (xmlNodePtr node);
-
-void e_source_set_group (ESource *source,
- ESourceGroup *group);
-void e_source_set_name (ESource *source,
- const gchar *name);
-void e_source_set_relative_uri (ESource *source,
- const gchar *relative_uri);
-void e_source_set_absolute_uri (ESource *source,
- const gchar *absolute_uri);
-void e_source_set_color_spec (ESource *source,
- const gchar *color_spec);
-void e_source_set_readonly (ESource *source,
- gboolean readonly);
-
-ESourceGroup *e_source_peek_group (ESource *source);
-const gchar *e_source_peek_uid (ESource *source);
-const gchar *e_source_peek_name (ESource *source);
-const gchar *e_source_peek_relative_uri (ESource *source);
-const gchar *e_source_peek_absolute_uri (ESource *source);
-const gchar *e_source_peek_color_spec (ESource *source);
-gboolean e_source_get_readonly (ESource *source);
-
-gchar *e_source_get_uri (ESource *source);
-
-void e_source_dump_to_xml_node (ESource *source,
- xmlNodePtr parent_node);
-gchar *e_source_to_standalone_xml (ESource *source);
-
-const gchar *e_source_get_property (ESource *source,
- const gchar *property);
-void e_source_set_property (ESource *source,
- const gchar *property,
- const gchar *value);
-void e_source_foreach_property (ESource *source,
- GHFunc func,
- gpointer data);
-
-gchar *e_source_get_duped_property (ESource *source, const gchar *property);
-gchar *e_source_build_absolute_uri (ESource *source);
-
-gboolean e_source_equal (ESource *a, ESource *b);
-gboolean e_source_xmlstr_equal (const gchar *a, const gchar *b);
+GType e_source_get_type (void) G_GNUC_CONST;
+ESource * e_source_new (const gchar *name,
+ const gchar *relative_uri);
+ESource * e_source_new_with_absolute_uri (const gchar *name,
+ const gchar *absolute_uri);
+ESource * e_source_new_from_xml_node (xmlNodePtr node);
+ESource * e_source_new_from_standalone_xml
+ (const gchar *xml);
+ESource * e_source_copy (ESource *source);
+gboolean e_source_update_from_xml_node (ESource *source,
+ xmlNodePtr node,
+ gboolean *changed_return);
+gchar * e_source_uid_from_xml_node (xmlNodePtr node);
+void e_source_set_group (ESource *source,
+ struct _ESourceGroup *group);
+void e_source_set_name (ESource *source,
+ const gchar *name);
+void e_source_set_relative_uri (ESource *source,
+ const gchar *relative_uri);
+void e_source_set_absolute_uri (ESource *source,
+ const gchar *absolute_uri);
+void e_source_set_color_spec (ESource *source,
+ const gchar *color_spec);
+void e_source_set_readonly (ESource *source,
+ gboolean readonly);
+struct _ESourceGroup *
+ e_source_peek_group (ESource *source);
+const gchar * e_source_peek_uid (ESource *source);
+const gchar * e_source_peek_name (ESource *source);
+const gchar * e_source_peek_relative_uri (ESource *source);
+const gchar * e_source_peek_absolute_uri (ESource *source);
+const gchar * e_source_peek_color_spec (ESource *source);
+gboolean e_source_get_readonly (ESource *source);
+gchar * e_source_get_uri (ESource *source);
+void e_source_dump_to_xml_node (ESource *source,
+ xmlNodePtr parent_node);
+gchar * e_source_to_standalone_xml (ESource *source);
+const gchar * e_source_get_property (ESource *source,
+ const gchar *property_name);
+void e_source_set_property (ESource *source,
+ const gchar *property_name,
+ const gchar *property_value);
+void e_source_foreach_property (ESource *source,
+ GHFunc func,
+ gpointer user_data);
+gchar * e_source_get_duped_property (ESource *source,
+ const gchar *property_name);
+gchar * e_source_build_absolute_uri (ESource *source);
+gboolean e_source_equal (ESource *a,
+ ESource *b);
+gboolean e_source_xmlstr_equal (const gchar *a,
+ const gchar *b);
G_END_DECLS
-#endif /* _E_SOURCE_H_ */
+#endif /* E_SOURCE_H */
diff --git a/libedataserver/e-time-utils.c b/libedataserver/e-time-utils.c
index 7a77696..0b342ec 100644
--- a/libedataserver/e-time-utils.c
+++ b/libedataserver/e-time-utils.c
@@ -1596,9 +1596,9 @@ has_correct_date (const struct tm *value)
* Since: 2.22
*/
ETimeParseStatus
-e_time_parse_date_and_time_ex (const gchar *value,
- struct tm *result,
- gboolean *two_digit_year)
+e_time_parse_date_and_time_ex (const gchar *value,
+ struct tm *result,
+ gboolean *two_digit_year)
{
struct tm *today_tm;
time_t t;
@@ -1724,9 +1724,25 @@ e_time_parse_date_and_time_ex (const gchar *value,
return status;
}
+/**
+ * e_time_parse_date_and_time:
+ * @value: the string to parse a date and time from
+ * @result: a #tm to store the result in
+ *
+ * Parses a string @value containing a date and a time and stores the
+ * result in @result. The date in @value is expected to be in a format
+ * like "Wed 3/13/00 14:20:00", though gettext() is used to support the
+ * appropriate local formats. There is also some leniency on the
+ * format of the string, e.g. the weekday can be skipped or 12-hour
+ * formats with am/pm can be used.
+ *
+ * Returns: E_TIME_PARSE_OK if the string was successfully parsed,
+ * E_TIME_PARSE_NONE if the string was empty, or
+ * E_TIME_PARSE_INVALID if the string could not be parsed.
+ */
ETimeParseStatus
-e_time_parse_date_and_time (const gchar *value,
- struct tm *result)
+e_time_parse_date_and_time (const gchar *value,
+ struct tm *result)
{
return e_time_parse_date_and_time_ex (value, result, NULL);
}
@@ -1747,7 +1763,9 @@ e_time_parse_date_and_time (const gchar *value,
* Since: 2.22
**/
ETimeParseStatus
-e_time_parse_date_ex (const gchar *value, struct tm *result, gboolean *two_digit_year)
+e_time_parse_date_ex (const gchar *value,
+ struct tm *result,
+ gboolean *two_digit_year)
{
const gchar *format[4];
ETimeParseStatus status;
@@ -1794,6 +1812,17 @@ e_time_parse_date_ex (const gchar *value, struct tm *result, gboolean *two_digit
return status;
}
+/**
+ * e_time_parse_date:
+ * @value: A date string.
+ * @result: Return value for the parsed date.
+ *
+ * Takes in a date string entered by the user and tries to convert it to
+ * a struct #tm.
+ *
+ * Returns: An #ETimeParseStatus result code indicating whether
+ * @value was an empty string, a valid date, or an invalid date.
+ **/
ETimeParseStatus
e_time_parse_date (const gchar *value, struct tm *result)
{
@@ -2028,6 +2057,11 @@ static gint _e_string_replace (gchar **str, const gchar *old, const gchar *new)
/**
* e_time_get_d_fmt_with_4digit_year:
*
+ * Retrieves a date format string with a 4-digit year (D_FMT on systems with
+ * nl_langinfo() available). Free the returned string with g_free().
+ *
+ * Returns: a newly-allocated date format string
+ *
* Since: 2.22
**/
gchar *
diff --git a/libedataserver/e-time-utils.h b/libedataserver/e-time-utils.h
index 6300e98..78a5a8d 100644
--- a/libedataserver/e-time-utils.h
+++ b/libedataserver/e-time-utils.h
@@ -8,12 +8,14 @@
* (C) 2001 Ximian, Inc.
*/
-#ifndef E_TIME_UTILS
-#define E_TIME_UTILS
+#ifndef E_TIME_UTILS_H
+#define E_TIME_UTILS_H
#include <time.h>
#include <glib.h>
+G_BEGIN_DECLS
+
/**
* ETimeParseStatus:
* @E_TIME_PARSE_OK: The time string was parsed successfully.
@@ -27,51 +29,60 @@ typedef enum {
} ETimeParseStatus;
/* Tries to parse a string containing a date and time. */
-ETimeParseStatus e_time_parse_date_and_time (const gchar *value,
- struct tm *result);
+ETimeParseStatus
+ e_time_parse_date_and_time (const gchar *value,
+ struct tm *result);
/* Tries to parse a string containing a date. */
-ETimeParseStatus e_time_parse_date (const gchar *value,
- struct tm *result);
-
-/* have same behavior like those functions above with two_digit_year set to NULL */
-ETimeParseStatus e_time_parse_date_and_time_ex (const gchar *value,
- struct tm *result,
- gboolean *two_digit_year);
+ETimeParseStatus
+ e_time_parse_date (const gchar *value,
+ struct tm *result);
-ETimeParseStatus e_time_parse_date_ex (const gchar *value,
- struct tm *result,
- gboolean *two_digit_year);
+/* Same behavior as the functions above with two_digit_year set to NULL. */
+ETimeParseStatus
+ e_time_parse_date_and_time_ex (const gchar *value,
+ struct tm *result,
+ gboolean *two_digit_year);
+ETimeParseStatus
+ e_time_parse_date_ex (const gchar *value,
+ struct tm *result,
+ gboolean *two_digit_year);
/* Tries to parse a string containing a time. */
-ETimeParseStatus e_time_parse_time (const gchar *value,
- struct tm *result);
+ETimeParseStatus
+ e_time_parse_time (const gchar *value,
+ struct tm *result);
/* Turns a struct tm into a string like "Wed 3/12/00 12:00:00 AM". */
-void e_time_format_date_and_time (struct tm *date_tm,
- gboolean use_24_hour_format,
- gboolean show_midnight,
- gboolean show_zero_seconds,
- gchar *buffer,
- gint buffer_size);
+void e_time_format_date_and_time (struct tm *date_tm,
+ gboolean use_24_hour_format,
+ gboolean show_midnight,
+ gboolean show_zero_seconds,
+ gchar *buffer,
+ gint buffer_size);
/* Formats a time from a struct tm, e.g. "01:59 PM". */
-void e_time_format_time (struct tm *date_tm,
- gboolean use_24_hour_format,
- gboolean show_zero_seconds,
- gchar *buffer,
- gint buffer_size);
+void e_time_format_time (struct tm *date_tm,
+ gboolean use_24_hour_format,
+ gboolean show_zero_seconds,
+ gchar *buffer,
+ gint buffer_size);
/* Like mktime(3), but assumes UTC instead of local timezone. */
-time_t e_mktime_utc (struct tm *tm);
+time_t e_mktime_utc (struct tm *tm);
/* Like localtime_r(3), but also returns an offset in minutes after UTC.
- (Calling gmtime with tt + offset would generate the same tm) */
-void e_localtime_with_offset (time_t tt, struct tm *tm, gint *offset);
+ * (Calling gmtime with tt + offset would generate the same tm) */
+void e_localtime_with_offset (time_t tt,
+ struct tm *tm,
+ gint *offset);
/* Returns format like %x, but always exchange all 'y' to 'Y'
- (force 4 digit year in format).
- Caller is responsible to g_free returned pointer. */
-gchar *e_time_get_d_fmt_with_4digit_year (void);
+ * (force 4 digit year in format).
+ * Caller is responsible to g_free returned pointer. */
+gchar * e_time_get_d_fmt_with_4digit_year
+ (void);
+
+G_END_DECLS
-#endif /* E_TIME_UTILS */
+#endif /* E_TIME_UTILS_H */
diff --git a/libedataserver/e-uid.h b/libedataserver/e-uid.h
index 5e38ea5..7286d73 100644
--- a/libedataserver/e-uid.h
+++ b/libedataserver/e-uid.h
@@ -27,7 +27,7 @@
G_BEGIN_DECLS
-gchar *e_uid_new (void);
+gchar * e_uid_new (void);
G_END_DECLS
diff --git a/libedataserver/e-url.h b/libedataserver/e-url.h
index 9acfb1f..168cbae 100644
--- a/libedataserver/e-url.h
+++ b/libedataserver/e-url.h
@@ -25,15 +25,14 @@
* USA.
*/
-#ifndef __E_URL_H__
-#define __E_URL_H__
+#ifndef E_URL_H
+#define E_URL_H
#include <glib.h>
G_BEGIN_DECLS
-gchar *e_url_shroud (const gchar *url);
-gboolean e_url_equal (const gchar *url1, const gchar *url2);
+typedef struct _EUri EUri;
/**
* EUri:
@@ -45,31 +44,36 @@ gboolean e_url_equal (const gchar *url1, const gchar *url2);
* @port: The port number.
* @path: The file path on the host.
* @params: Additional parameters.
- * @query:
- * @fragment:
+ * @query: The URI query.
+ * @fragment: The URI fragment.
*
* A structure representing a URI.
**/
-typedef struct {
- gchar *protocol;
- gchar *user;
- gchar *authmech;
- gchar *passwd;
- gchar *host;
- gint port;
- gchar *path;
+struct _EUri {
+ gchar *protocol;
+ gchar *user;
+ gchar *authmech;
+ gchar *passwd;
+ gchar *host;
+ gint port;
+ gchar *path;
GData *params;
- gchar *query;
- gchar *fragment;
-} EUri;
+ gchar *query;
+ gchar *fragment;
+};
-EUri *e_uri_new (const gchar *uri_string);
-void e_uri_free (EUri *uri);
-const gchar *e_uri_get_param (EUri *uri, const gchar *name);
-EUri *e_uri_copy (EUri *uri);
-gchar *e_uri_to_string (EUri *uri, gboolean show_password);
+EUri * e_uri_new (const gchar *uri_string);
+void e_uri_free (EUri *uri);
+const gchar * e_uri_get_param (EUri *uri,
+ const gchar *name);
+EUri * e_uri_copy (EUri *uri);
+gchar * e_uri_to_string (EUri *uri,
+ gboolean show_password);
+gchar * e_url_shroud (const gchar *url);
+gboolean e_url_equal (const gchar *url1,
+ const gchar *url2);
G_END_DECLS
-#endif /* __E_URL_H__ */
+#endif /* E_URL_H */
diff --git a/libedataserver/e-xml-hash-utils.c b/libedataserver/e-xml-hash-utils.c
index b7d280a..009c914 100644
--- a/libedataserver/e-xml-hash-utils.c
+++ b/libedataserver/e-xml-hash-utils.c
@@ -114,18 +114,19 @@ foreach_save_func (gpointer key, gpointer value, gpointer user_data)
/**
* e_xml_from_hash:
- * @hash: The #GHashTable to extract the XML from.
- * @type: The #EXmlHashType used to store the XML.
- * @root_name: The name to call the new #xmlDoc.
+ * @hash: The #GHashTable to extract the XML from
+ * @type: The #EXmlHashType used to store the XML
+ * @root_name: The name to call the new #xmlDoc
*
* Uses the key/value pair representation of an XML structure in @hash
- * to build an equivalent #xmlDoc. This is the reverse of
- * e_xml_to_hash().
+ * to build an equivalent #xmlDoc. This is the reverse of e_xml_to_hash().
*
- * Returns: The #xmlDoc created from the data in @hash.
+ * Returns: the #xmlDoc created from the data in @hash
**/
xmlDoc *
-e_xml_from_hash (GHashTable *hash, EXmlHashType type, const gchar *root_name)
+e_xml_from_hash (GHashTable *hash,
+ EXmlHashType type,
+ const gchar *root_name)
{
xmlDoc *doc;
struct save_data sd;
@@ -150,7 +151,7 @@ free_values (gpointer key, gpointer value, gpointer data)
/**
* e_xml_destroy_hash:
- * @hash: The #GHashTable to destroy.
+ * @hash: the #GHashTable to destroy
*
* Frees the memory used by @hash and its contents.
**/
@@ -173,7 +174,7 @@ struct EXmlHash {
/**
* e_xmlhash_new:
- * @filename: The name of an XML file.
+ * @filename: the name of an XML file
*
* Creates a new #EXmlHash from the file @filename. If @filename does
* not already exist, an empty #EXmlHash will be created.
@@ -210,14 +211,16 @@ e_xmlhash_new (const gchar *filename)
/**
* e_xmlhash_add:
- * @hash: The #EXmlHash to add an entry to.
- * @key: The key to use for the entry.
- * @data: The value of the new entry.
+ * @hash: the #EXmlHash to add an entry to
+ * @key: the key to use for the entry
+ * @data: the value of the new entry
*
* Adds a new key/value pair to the #EXmlHash @hash.
**/
void
-e_xmlhash_add (EXmlHash *hash, const gchar *key, const gchar *data)
+e_xmlhash_add (EXmlHash *hash,
+ const gchar *key,
+ const gchar *data)
{
g_return_if_fail (hash != NULL);
g_return_if_fail (key != NULL);
@@ -229,13 +232,14 @@ e_xmlhash_add (EXmlHash *hash, const gchar *key, const gchar *data)
/**
* e_xmlhash_remove:
- * @hash: The #EXmlHash to remove an entry from.
- * @key: The key of the entry to remove.
+ * @hash: the #EXmlHash to remove an entry from
+ * @key: the key of the entry to remove
*
* Remove the entry in @hash with key equal to @key, if it exists.
**/
void
-e_xmlhash_remove (EXmlHash *hash, const gchar *key)
+e_xmlhash_remove (EXmlHash *hash,
+ const gchar *key)
{
gpointer orig_key;
gpointer orig_value;
@@ -252,9 +256,9 @@ e_xmlhash_remove (EXmlHash *hash, const gchar *key)
/**
* e_xmlhash_compare:
- * @hash: The #EXmlHash to compare against.
- * @key: The key of the hash entry to compare with.
- * @compare_data: The data to compare against the hash entry.
+ * @hash: the #EXmlHash to compare against
+ * @key: the key of the hash entry to compare with
+ * @compare_data: the data to compare against the hash entry
*
* Compares the value with key equal to @key in @hash against
* @compare_data.
@@ -265,7 +269,9 @@ e_xmlhash_remove (EXmlHash *hash, const gchar *key)
* its key equal to @key.
**/
EXmlHashStatus
-e_xmlhash_compare (EXmlHash *hash, const gchar *key, const gchar *compare_data)
+e_xmlhash_compare (EXmlHash *hash,
+ const gchar *key,
+ const gchar *compare_data)
{
gchar *data;
gint rc;
@@ -300,14 +306,16 @@ foreach_hash_func (gpointer key, gpointer value, gpointer user_data)
/**
* e_xmlhash_foreach_key:
- * @hash: An #EXmlHash.
- * @func: The #EXmlHashFunc to execute on the data in @hash.
- * @user_data: The data to pass to @func.
+ * @hash: an #EXmlHash
+ * @func: the #EXmlHashFunc to execute on the data in @hash
+ * @user_data: the data to pass to @func
*
* Executes @func against each key/value pair in @hash.
**/
void
-e_xmlhash_foreach_key (EXmlHash *hash, EXmlHashFunc func, gpointer user_data)
+e_xmlhash_foreach_key (EXmlHash *hash,
+ EXmlHashFunc func,
+ gpointer user_data)
{
foreach_data_t data;
@@ -319,8 +327,19 @@ e_xmlhash_foreach_key (EXmlHash *hash, EXmlHashFunc func, gpointer user_data)
g_hash_table_foreach (hash->objects, foreach_hash_func, &data);
}
+/**
+ * e_xmlhash_foreach_key_remove:
+ * @hash: an #EXmlHash
+ * @func: the #EXmlHashFunc to execute on the data in @hash
+ * @user_data: the data to pass to @func
+ *
+ * Calls g_hash_table_foreach_remove() on @hash<!-- -->'s internal hash
+ * table. See g_hash_table_foreach_remove() for details.
+ **/
void
-e_xmlhash_foreach_key_remove (EXmlHash *hash, EXmlHashRemoveFunc func, gpointer user_data)
+e_xmlhash_foreach_key_remove (EXmlHash *hash,
+ EXmlHashRemoveFunc func,
+ gpointer user_data)
{
g_return_if_fail (hash != NULL);
g_return_if_fail (func != NULL);
@@ -342,7 +361,8 @@ e_xmlhash_write (EXmlHash *hash)
g_return_if_fail (hash != NULL);
- doc = e_xml_from_hash (hash->objects, E_XML_HASH_TYPE_OBJECT_UID, "xmlhash");
+ doc = e_xml_from_hash (
+ hash->objects, E_XML_HASH_TYPE_OBJECT_UID, "xmlhash");
e_xml_save_file (hash->filename, doc);
diff --git a/libedataserver/e-xml-hash-utils.h b/libedataserver/e-xml-hash-utils.h
index 39ba3d6..0150f06 100644
--- a/libedataserver/e-xml-hash-utils.h
+++ b/libedataserver/e-xml-hash-utils.h
@@ -17,8 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef __E_XML_HASH_UTILS_H__
-#define __E_XML_HASH_UTILS_H__
+#ifndef E_XML_HASH_UTILS_H
+#define E_XML_HASH_UTILS_H
#include <glib.h>
#include <libxml/parser.h>
@@ -35,13 +35,12 @@ typedef enum {
E_XML_HASH_TYPE_PROPERTY
} EXmlHashType;
-GHashTable *e_xml_to_hash (xmlDoc *doc,
- EXmlHashType type);
-xmlDoc *e_xml_from_hash (GHashTable *hash,
- EXmlHashType type,
- const gchar *root_node);
-
-void e_xml_destroy_hash (GHashTable *hash);
+GHashTable * e_xml_to_hash (xmlDoc *doc,
+ EXmlHashType type);
+xmlDoc * e_xml_from_hash (GHashTable *hash,
+ EXmlHashType type,
+ const gchar *root_name);
+void e_xml_destroy_hash (GHashTable *hash);
/**
* EXmlHashStatus:
@@ -55,32 +54,33 @@ typedef enum {
E_XMLHASH_STATUS_NOT_FOUND
} EXmlHashStatus;
-typedef void (* EXmlHashFunc) (const gchar *key, const gchar *value, gpointer user_data);
-typedef gboolean (* EXmlHashRemoveFunc) (const gchar *key, const gchar *value, gpointer user_data);
+typedef void (*EXmlHashFunc) (const gchar *key,
+ const gchar *value,
+ gpointer user_data);
+typedef gboolean (*EXmlHashRemoveFunc) (const gchar *key,
+ const gchar *value,
+ gpointer user_data);
typedef struct EXmlHash EXmlHash;
-EXmlHash *e_xmlhash_new (const gchar *filename);
-
-void e_xmlhash_add (EXmlHash *hash,
- const gchar *key,
- const gchar *data);
-void e_xmlhash_remove (EXmlHash *hash,
- const gchar *key);
-
-EXmlHashStatus e_xmlhash_compare (EXmlHash *hash,
- const gchar *key,
- const gchar *compare_data);
-void e_xmlhash_foreach_key (EXmlHash *hash,
- EXmlHashFunc func,
- gpointer user_data);
-void e_xmlhash_foreach_key_remove (EXmlHash *hash,
- EXmlHashRemoveFunc func,
- gpointer user_data);
-
-void e_xmlhash_write (EXmlHash *hash);
-void e_xmlhash_destroy (EXmlHash *hash);
+EXmlHash * e_xmlhash_new (const gchar *filename);
+void e_xmlhash_add (EXmlHash *hash,
+ const gchar *key,
+ const gchar *data);
+void e_xmlhash_remove (EXmlHash *hash,
+ const gchar *key);
+EXmlHashStatus e_xmlhash_compare (EXmlHash *hash,
+ const gchar *key,
+ const gchar *compare_data);
+void e_xmlhash_foreach_key (EXmlHash *hash,
+ EXmlHashFunc func,
+ gpointer user_data);
+void e_xmlhash_foreach_key_remove (EXmlHash *hash,
+ EXmlHashRemoveFunc func,
+ gpointer user_data);
+void e_xmlhash_write (EXmlHash *hash);
+void e_xmlhash_destroy (EXmlHash *hash);
G_END_DECLS
-#endif
+#endif /* E_XML_HASH_UTILS_H */
diff --git a/libedataserver/e-xml-utils.c b/libedataserver/e-xml-utils.c
index e44f8c9..f3594ea 100644
--- a/libedataserver/e-xml-utils.c
+++ b/libedataserver/e-xml-utils.c
@@ -39,6 +39,16 @@
#define fsync(fd) 0
#endif
+/**
+ * e_xml_parse_file:
+ * @filename: path to an XML file
+ *
+ * Reads a local XML file and parses the contents into an XML document
+ * structure. If the XML file cannot be read or its contents are malformed,
+ * the function returns %NULL.
+ *
+ * Returns: an XML document structure, or %NULL
+ **/
xmlDocPtr
e_xml_parse_file (const gchar *filename)
{
@@ -48,19 +58,28 @@ e_xml_parse_file (const gchar *filename)
mapped_file = g_mapped_file_new (filename, FALSE, NULL);
if (mapped_file) {
- result = xmlParseMemory (g_mapped_file_get_contents (mapped_file),
- g_mapped_file_get_length (mapped_file));
-#if GLIB_CHECK_VERSION(2,21,3)
+ result = xmlParseMemory (
+ g_mapped_file_get_contents (mapped_file),
+ g_mapped_file_get_length (mapped_file));
g_mapped_file_unref (mapped_file);
-#else
- g_mapped_file_free (mapped_file);
-#endif
}
+
return result;
}
+/**
+ * e_xml_save_file:
+ * @filename: path to a file to save to
+ * @doc: an XML document structure
+ *
+ * Writes the given XML document structure to the file given by @filename.
+ * If an error occurs while saving, the function returns -1 and sets errno.
+ *
+ * Returns: 0 on success, -1 on failure
+ **/
gint
-e_xml_save_file (const gchar *filename, xmlDocPtr doc)
+e_xml_save_file (const gchar *filename,
+ xmlDocPtr doc)
{
gchar *filesave;
xmlChar *xmlbuf;
@@ -133,8 +152,19 @@ e_xml_save_file (const gchar *filename, xmlDocPtr doc)
return 0;
}
+/**
+ * e_xml_get_child_by_name:
+ * @parent: an XML node structure
+ * @child_name: element name of a child node
+ *
+ * Attempts to find a child element of @parent named @child_name.
+ * If no such child exists, the function returns %NULL.
+ *
+ * Returns: a child XML node structure, or %NULL
+ **/
xmlNode *
-e_xml_get_child_by_name (const xmlNode *parent, const xmlChar *child_name)
+e_xml_get_child_by_name (const xmlNode *parent,
+ const xmlChar *child_name)
{
xmlNode *child;
diff --git a/libedataserver/e-xml-utils.h b/libedataserver/e-xml-utils.h
index c52e0de..cda2b1c 100644
--- a/libedataserver/e-xml-utils.h
+++ b/libedataserver/e-xml-utils.h
@@ -17,22 +17,21 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef __E_XML_UTILS_H__
-#define __E_XML_UTILS_H__
+#ifndef E_XML_UTILS_H
+#define E_XML_UTILS_H
#include <glib.h>
-
#include <libxml/parser.h>
G_BEGIN_DECLS
-xmlDocPtr e_xml_parse_file (const gchar *filename);
-gint e_xml_save_file (const gchar *filename,
- xmlDocPtr doc);
-xmlNode *e_xml_get_child_by_name (const xmlNode *parent,
- const xmlChar *child_name);
+xmlDocPtr e_xml_parse_file (const gchar *filename);
+gint e_xml_save_file (const gchar *filename,
+ xmlDocPtr doc);
+xmlNode * e_xml_get_child_by_name (const xmlNode *parent,
+ const xmlChar *child_name);
G_END_DECLS
-#endif /* __E_XML_UTILS_H__ */
+#endif /* E_XML_UTILS_H */
diff --git a/libedataserver/libedataserver-private.h b/libedataserver/libedataserver-private.h
index ebbf848..c4c87c8 100644
--- a/libedataserver/libedataserver-private.h
+++ b/libedataserver/libedataserver-private.h
@@ -21,14 +21,15 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef _LIBEDATASERVER_PRIVATE_H_
-#define _LIBEDATASERVER_PRIVATE_H_
+#ifndef LIBEDATASERVER_PRIVATE_H
+#define LIBEDATASERVER_PRIVATE_H
#ifdef G_OS_WIN32
-const gchar *_libedataserver_get_extensiondir (void) G_GNUC_CONST;
-const gchar *_libedataserver_get_imagesdir (void) G_GNUC_CONST;
-const gchar *_libedataserver_get_ui_uidir (void) G_GNUC_CONST;
+const gchar * _libedataserver_get_extensiondir
+ (void) G_GNUC_CONST;
+const gchar * _libedataserver_get_imagesdir (void) G_GNUC_CONST;
+const gchar * _libedataserver_get_ui_uidir (void) G_GNUC_CONST;
#undef E_DATA_SERVER_EXTENSIONDIR
#define E_DATA_SERVER_EXTENSIONDIR _libedataserver_get_extensiondir ()
@@ -41,4 +42,4 @@ const gchar *_libedataserver_get_ui_uidir (void) G_GNUC_CONST;
#endif /* G_OS_WIN32 */
-#endif /* _LIBEDATASERVER_PRIVATE_H_ */
+#endif /* LIBEDATASERVER_PRIVATE_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]