jana r731 - in trunk: . libjana libjana-ecal
- From: rbradford svn gnome org
- To: svn-commits-list gnome org
- Subject: jana r731 - in trunk: . libjana libjana-ecal
- Date: Mon, 12 Jan 2009 17:06:52 +0000 (UTC)
Author: rbradford
Date: Mon Jan 12 17:06:51 2009
New Revision: 731
URL: http://svn.gnome.org/viewvc/jana?rev=731&view=rev
Log:
2008-12-31 Rob Bradford <rob linux intel com>
* libjana-ecal/jana-ecal-component.c (component_interface_init),
(component_peek_uid):
* libjana/jana-component.c (jana_component_peek_uid):
* libjana/jana-component.h:
Add jana_component_peek_uid which returns a constant string over
jana_component_get_uid which returns a newly allocated one.
Modified:
trunk/ChangeLog
trunk/libjana-ecal/jana-ecal-component.c
trunk/libjana/jana-component.c
trunk/libjana/jana-component.h
Modified: trunk/libjana-ecal/jana-ecal-component.c
==============================================================================
--- trunk/libjana-ecal/jana-ecal-component.c (original)
+++ trunk/libjana-ecal/jana-ecal-component.c Mon Jan 12 17:06:51 2009
@@ -37,6 +37,7 @@
static gboolean component_is_fully_represented
(JanaComponent *self);
static gchar * component_get_uid (JanaComponent *self);
+static const gchar * component_peek_uid (JanaComponent *self);
static gchar ** component_get_categories(JanaComponent *self);
static void component_set_categories(JanaComponent *self,
const gchar **categories);
@@ -128,6 +129,7 @@
iface->get_component_type = component_get_component_type;
iface->is_fully_represented = component_is_fully_represented;
iface->get_uid = component_get_uid;
+ iface->peek_uid = component_peek_uid;
iface->get_categories = component_get_categories;
iface->set_categories = component_set_categories;
@@ -491,6 +493,17 @@
return uid ? g_strdup (uid) : NULL;
}
+static const gchar *
+component_peek_uid (JanaComponent *self)
+{
+ const char *uid = NULL;
+ JanaEcalComponentPrivate *priv = COMPONENT_PRIVATE (self);
+
+ e_cal_component_get_uid (priv->comp, &uid);
+
+ return uid;
+}
+
static gchar **
component_get_categories (JanaComponent *self)
{
Modified: trunk/libjana/jana-component.c
==============================================================================
--- trunk/libjana/jana-component.c (original)
+++ trunk/libjana/jana-component.c Mon Jan 12 17:06:51 2009
@@ -96,6 +96,9 @@
* key in a hash table and does not change when modifying the component. A
* #JanaComponent that is not a part of a #JanaStore may not have a uid.
*
+ * This function returns a newly allocated string. To avoid this allocation
+ * please use jana_component_peek_uid().
+ *
* Returns: The unique identifier of @self.
*/
gchar *
@@ -105,6 +108,26 @@
}
/**
+ * jana_component_peek_uid:
+ * @self: A #JanaComponent
+ *
+ * Get a unique identifying string for @self. This can be used as the
+ * key in a hash table and does not change when modifying the component. A
+ * #JanaComponent that is not a part of a #JanaStore may not have a uid.
+ *
+ * Unlike jana_component_get_uid() this function does not return a newly
+ * allocated string. It is owned internally and must not be freed or
+ * modified.
+ *
+ * Returns: The unique identifier of @self.
+ */
+const gchar *
+jana_component_peek_uid (JanaComponent *self)
+{
+ return JANA_COMPONENT_GET_INTERFACE (self)->peek_uid (self);
+}
+
+/**
* jana_component_get_categories:
* @self: A #JanaComponent
*
Modified: trunk/libjana/jana-component.h
==============================================================================
--- trunk/libjana/jana-component.h (original)
+++ trunk/libjana/jana-component.h Mon Jan 12 17:06:51 2009
@@ -62,6 +62,7 @@
gboolean (*is_fully_represented) (JanaComponent *self);
gchar * (*get_uid) (JanaComponent *self);
+ const gchar * (*peek_uid) (JanaComponent *self);
gchar ** (*get_categories) (JanaComponent *self);
void (*set_categories) (JanaComponent *self,
const gchar **categories);
@@ -83,6 +84,7 @@
(JanaComponent *self);
gchar * jana_component_get_uid (JanaComponent *self);
+const gchar * jana_component_peek_uid (JanaComponent *self);
gchar ** jana_component_get_categories (JanaComponent *self);
void jana_component_set_categories (JanaComponent *self,
const gchar **categories);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]