[gnome-calendar] Added GcalManager::event-created signal.



commit 49afd07fc72756c8aacffb7c207df795d8e35dea
Author: Erick PÃrez Castellanos <erick red gmail com>
Date:   Thu Aug 23 14:58:08 2012 -0400

    Added GcalManager::event-created signal.
    
    The signal is emitted when an event is created through GcalManager.

 src/gcal-manager.c |   27 +++++++++++++++++++++++++--
 src/gcal-manager.h |    1 +
 2 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index 99d100a..74be18e 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -19,6 +19,7 @@
 
 #include "gcal-manager.h"
 #include "gcal-utils.h"
+#include "gcal-marshalers.h"
 
 #include <glib/gi18n.h>
 
@@ -104,6 +105,7 @@ enum
   EVENTS_ADDED,
   EVENTS_MODIFIED,
   EVENTS_REMOVED,
+  EVENT_CREATED,
   LAST_SIGNAL
 };
 
@@ -201,6 +203,7 @@ gcal_manager_class_init (GcalManagerClass *klass)
                                            G_TYPE_NONE,
                                            1,
                                            G_TYPE_POINTER);
+
   signals[EVENTS_REMOVED] = g_signal_new ("events-removed",
                                           GCAL_TYPE_MANAGER,
                                           G_SIGNAL_RUN_FIRST,
@@ -212,6 +215,18 @@ gcal_manager_class_init (GcalManagerClass *klass)
                                           1,
                                           G_TYPE_POINTER);
 
+  signals[EVENT_CREATED] = g_signal_new ("event-created",
+                                         GCAL_TYPE_MANAGER,
+                                         G_SIGNAL_RUN_FIRST,
+                                         G_STRUCT_OFFSET (GcalManagerClass,
+                                                          event_created),
+                                         NULL, NULL,
+                                         _gcal_marshal_VOID__POINTER_POINTER,
+                                         G_TYPE_NONE,
+                                         2,
+                                         G_TYPE_POINTER,
+                                         G_TYPE_POINTER);
+
   g_type_class_add_private ((gpointer) klass, sizeof(GcalManagerPrivate));
 }
 
@@ -916,7 +931,16 @@ gcal_manager_on_event_created (GObject      *source_object,
   error = NULL;
   if (e_cal_client_create_object_finish (client, result, &new_uid, &error))
     {
-      g_debug ("Telling event: %s was created", new_uid);
+      ESource *source;
+      const gchar *uid;
+
+      source = e_client_get_source (E_CLIENT (client));
+      uid = e_source_get_uid (source);
+
+      g_signal_emit (GCAL_MANAGER (user_data),
+                     signals[EVENT_CREATED],
+                     0,
+                     uid, new_uid);
 
       g_free (new_uid);
     }
@@ -1543,7 +1567,6 @@ gcal_manager_create_event (GcalManager        *manager,
   dt.value = dt_start;
   dt.tzid = NULL;
   e_cal_component_set_dtstart (event, &dt);
-  g_debug ("dt_start :%s", icaltime_as_ical_string (*dt_start));
 
   if (final_date != NULL)
     {
diff --git a/src/gcal-manager.h b/src/gcal-manager.h
index 2015fe6..880ed2a 100644
--- a/src/gcal-manager.h
+++ b/src/gcal-manager.h
@@ -54,6 +54,7 @@ struct _GcalManagerClass
   void (* events_added)    (GcalManager *manager, const GList *events);
   void (* events_modified) (GcalManager *manager, const GList *events);
   void (* events_removed)  (GcalManager *manager, const GList *uids);
+  void (* event_created)   (GcalManager *manager, const gchar *source_uid, const gchar event_uid);
 
 };
 



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