jana r745 - in trunk: . libjana



Author: rbradford
Date: Thu Mar 19 17:30:21 2009
New Revision: 745
URL: http://svn.gnome.org/viewvc/jana?rev=745&view=rev

Log:
2009-03-19  Rob Bradford  <rob linux intel com>

	* libjana/jana-utils.c (jana_utils_task_copy):
	* libjana/jana-utils.h:
	Add the jana_utils_task_copy function.

Modified:
   trunk/ChangeLog
   trunk/libjana/jana-utils.c
   trunk/libjana/jana-utils.h

Modified: trunk/libjana/jana-utils.c
==============================================================================
--- trunk/libjana/jana-utils.c	(original)
+++ trunk/libjana/jana-utils.c	Thu Mar 19 17:30:21 2009
@@ -720,6 +720,47 @@
 	return dest;
 }
 
+/**
+ * jana_utils_task_copy:
+ * @source: A #JanaTask to copy from
+ * @dest: A #JanaTask to copy to
+ *
+ * Copies the contents of @source into @dest. This function copies all fields
+ * of @source over those of @dest.
+ *
+ * Returns: @dest.
+ */
+JanaTask *
+jana_utils_task_copy (JanaTask *source, JanaTask *dest)
+{
+	gchar *string;
+	JanaTime *time;
+	gint priority;
+	gboolean completed;
+
+	string = jana_task_get_summary (source);
+	jana_task_set_summary (dest, string);
+	g_free (string);
+	
+	string = jana_task_get_description (source);
+	jana_task_set_description (dest, string);
+	g_free (string);
+	
+	completed = jana_task_get_completed (source);
+	jana_task_set_completed (dest, completed);
+	
+	priority = jana_task_get_priority (source);
+	jana_task_set_priority (dest, priority);
+
+	time = jana_task_get_due_date (source);
+	jana_task_set_due_date (dest, time);
+	g_object_unref (time);
+	
+	copy_component_fields ((JanaComponent *)source, (JanaComponent *)dest);
+
+	return dest;
+}
+
 static GList *
 jana_utils_event_get_instances_cb (JanaTime *start, JanaTime *end,
 				   JanaTime *range_start, JanaTime *range_end,

Modified: trunk/libjana/jana-utils.h
==============================================================================
--- trunk/libjana/jana-utils.h	(original)
+++ trunk/libjana/jana-utils.h	Thu Mar 19 17:30:21 2009
@@ -25,6 +25,7 @@
 #include <glib.h>
 #include <libjana/jana-event.h>
 #include <libjana/jana-note.h>
+#include <libjana/jana-task.h>
 #include <libjana/jana-time.h>
 
 gboolean jana_utils_time_is_leap_year (guint16 year);
@@ -66,6 +67,8 @@
 
 JanaNote * jana_utils_note_copy (JanaNote *source, JanaNote *dest);
 
+JanaTask * jana_utils_task_copy (JanaTask *source, JanaTask *dest);
+
 GList * jana_utils_event_get_instances (JanaEvent *event, JanaTime *range_start,
 					JanaTime *range_end, glong offset);
 



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