[gnome-calendar/ui-rewrite] manager: migrate :objects-added signal
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/ui-rewrite] manager: migrate :objects-added signal
- Date: Mon, 6 Oct 2014 16:26:56 +0000 (UTC)
commit 951dfca731f38b226974185028ba228aab6ffccd
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Sun Oct 5 19:01:49 2014 -0400
manager: migrate :objects-added signal
GcalManager:objects-added signal pass a list of struct containing
ECalComponents for the event widgets. This ECalComponent instance will
be owned and released by the event widget. Look at: GcalEventWidget::finalize
src/gcal-manager.c | 27 +++++++++++++--------------
src/gcal-manager.h | 9 +++++++++
2 files changed, 22 insertions(+), 14 deletions(-)
---
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index 82160bc..414d15a 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -22,9 +22,6 @@
#include <glib/gi18n.h>
-#include <libecal/libecal.h>
-#include <libedataserver/libedataserver.h>
-
typedef struct _RetryOpenData
{
ESource *source;
@@ -364,34 +361,36 @@ on_view_objects_added (ECalClientView *view,
gpointer user_data)
{
GcalManagerPrivate *priv;
+
+ ESource *source;
GcalManagerUnit *unit;
- const gchar *source_uid;
GSList *l;
GSList *events_data;
ECalClient *client;
- gchar *event_uuid;
priv = gcal_manager_get_instance_private (GCAL_MANAGER (user_data));
events_data = NULL;
client = e_cal_client_view_ref_client (view);
- source_uid =
- e_source_get_uid (e_client_get_source (E_CLIENT (client)));
+ source = e_client_get_source (E_CLIENT (client));
- unit = (GcalManagerUnit*)
- g_hash_table_lookup (priv->clients,
- e_client_get_source (E_CLIENT (client)));
+ unit = (GcalManagerUnit*) g_hash_table_lookup (priv->clients,
+ source);
for (l = objects; l != NULL; l = l->next)
{
if (l->data != NULL && unit->enabled)
{
- event_uuid = g_strdup_printf ("%s:%s",
- source_uid,
- icalcomponent_get_uid (l->data));
- events_data = g_slist_append (events_data, event_uuid);
+ GcalEventData *data;
+
+ data = g_new0 (GcalEventData, 1);
+ data->source = source;
+ data->event_component =
+ e_cal_component_new_from_icalcomponent (
+ icalcomponent_new_clone (l->data));
+ events_data = g_slist_append (events_data, data);
}
}
diff --git a/src/gcal-manager.h b/src/gcal-manager.h
index bb41e7e..0aa2b92 100644
--- a/src/gcal-manager.h
+++ b/src/gcal-manager.h
@@ -23,6 +23,9 @@
#include <gtk/gtk.h>
#include <glib-object.h>
+#include <libedataserver/libedataserver.h>
+#include <libecal/libecal.h>
+
#include <libical/icaltime.h>
G_BEGIN_DECLS
@@ -54,6 +57,12 @@ struct _GcalManagerClass
};
+typedef struct
+{
+ ESource *source;
+ ECalComponent *event_component;
+} GcalEventData;
+
GType gcal_manager_get_type (void);
GcalManager* gcal_manager_new (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]