[gnome-calendar] views: use new comparison function



commit c777d4c8527a56c9983cbb97ed4a8c7c1d371dc6
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Thu Oct 16 15:21:16 2014 -0400

    views: use new comparison function

 src/gcal-week-view.c |   11 +++++------
 src/gcal-year-view.c |   11 +++++------
 2 files changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/src/gcal-week-view.c b/src/gcal-week-view.c
index b131b07..a6f2ace 100644
--- a/src/gcal-week-view.c
+++ b/src/gcal-week-view.c
@@ -801,16 +801,15 @@ gcal_week_view_add (GtkContainer *container,
 
   for (l = priv->days[day - 1]; l != NULL; l = l->next)
     {
-      GcalWeekViewChild *child;
-
-      child = (GcalWeekViewChild*) l->data;
+      GtkWidget *event;
 
-      if (g_strcmp0 (
-            gcal_event_widget_peek_uuid (GCAL_EVENT_WIDGET (widget)),
-            gcal_event_widget_peek_uuid (GCAL_EVENT_WIDGET (child->widget))) == 0)
+      event = GTK_WIDGET (((GcalWeekViewChild*) l->data)->widget);
+      if (gcal_event_widget_equal (GCAL_EVENT_WIDGET (widget),
+                                   GCAL_EVENT_WIDGET (event)))
         {
           //TODO: remove once the main-dev phase its over
           g_warning ("Trying to add an event with the same uuid to the view");
+          g_object_unref (widget); /* FIXME: check if this destroy it */
           return;
         }
     }
diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c
index 0522dc0..880b5a0 100644
--- a/src/gcal-year-view.c
+++ b/src/gcal-year-view.c
@@ -622,16 +622,15 @@ gcal_year_view_add (GtkContainer *container,
 
   for (l = priv->months[date->month - 1]; l != NULL; l = l->next)
     {
-      GcalViewChild *child;
+      GtkWidget *event;
 
-      child = (GcalViewChild*) l->data;
-      if (g_strcmp0 (
-            gcal_event_widget_peek_uuid (GCAL_EVENT_WIDGET (widget)),
-            gcal_event_widget_peek_uuid (GCAL_EVENT_WIDGET (child->widget)))
-          == 0)
+      event = GTK_WIDGET (((GcalViewChild*) l->data)->widget);
+      if (gcal_event_widget_equal (GCAL_EVENT_WIDGET (widget),
+                                   GCAL_EVENT_WIDGET (event)))
         {
           //TODO: remove once the main-dev phase its over
           g_warning ("Trying to add an event with the same uuid to the view");
+          g_object_unref (widget); /* FIXME: check if this destroy it */
           return;
         }
     }


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