[gnome-calendar] Improving GcalView API.



commit 0820d49e4eaedee38829e55b00e4b605885e9595
Author: Erick PÃrez Castellanos <erick red gmail com>
Date:   Sun Aug 19 02:47:36 2012 -0400

    Improving GcalView API.
    
    Added GcalView::update signal for when the view will change it's date range
    Added GcalView::create-event signal for when the view wants to create a new
    event
    
    Added GcalView::clear_selection method for clearing new-event mark.
    
    Note: The views can choose to mark before send a ::create-event signal the range
    over which they will create the new event. This will be called new-event mark.

 src/gcal-view.c |   35 +++++++++++++++++++++++++++++++++++
 src/gcal-view.h |   10 +++++++++-
 2 files changed, 44 insertions(+), 1 deletions(-)
---
diff --git a/src/gcal-view.c b/src/gcal-view.c
index 7e9ffcd..c65b485 100644
--- a/src/gcal-view.c
+++ b/src/gcal-view.c
@@ -20,6 +20,7 @@
 
 #include "gcal-view.h"
 #include "gcal-utils.h"
+#include "gcal-marshalers.h"
 
 #include <glib.h>
 
@@ -38,6 +39,32 @@ gcal_view_base_init (gpointer g_iface)
                               "The active/selecetd date in the view",
                               ICAL_TIME_TYPE,
                               G_PARAM_READWRITE));
+
+      g_signal_new ("create-event",
+                    GCAL_TYPE_VIEW,
+                    G_SIGNAL_RUN_LAST,
+                    G_STRUCT_OFFSET (GcalViewIface,
+                                     create_event),
+                    NULL, NULL,
+                    _gcal_marshal_VOID__POINTER_POINTER_DOUBLE_DOUBLE,
+                    G_TYPE_NONE,
+                    4,
+                    G_TYPE_POINTER,
+                    G_TYPE_POINTER,
+                    G_TYPE_DOUBLE,
+                    G_TYPE_DOUBLE);
+
+      g_signal_new ("updated",
+                    GCAL_TYPE_VIEW,
+                    G_SIGNAL_RUN_LAST,
+                    G_STRUCT_OFFSET (GcalViewIface,
+                                     updated),
+                    NULL, NULL,
+                    g_cclosure_marshal_VOID__POINTER,
+                    G_TYPE_NONE,
+                    1,
+                    G_TYPE_POINTER);
+
       initialized = TRUE;
     }
 }
@@ -132,3 +159,11 @@ gcal_view_get_by_uuid (GcalView    *view,
 
   return GCAL_VIEW_GET_INTERFACE (view)->get_by_uuid (view, uuid);
 }
+
+void
+gcal_view_clear_selection (GcalView *view)
+{
+  g_return_if_fail (GCAL_IS_VIEW (view));
+
+  GCAL_VIEW_GET_INTERFACE (view)->clear_selection (view);
+}
diff --git a/src/gcal-view.h b/src/gcal-view.h
index b1822ad..d0e8739 100644
--- a/src/gcal-view.h
+++ b/src/gcal-view.h
@@ -40,6 +40,10 @@ struct _GcalViewIface
 {
   GTypeInterface parent_iface;
 
+  /* signals */
+  void            (*create_event)         (GcalView *view, icaltimetype *start_span, icaltimetype *end_span, gdouble x, gdouble y);
+  void            (*updated)              (GcalView *view, icaltimetype *date);
+
   /* pure virtual methods */
   icaltimetype*   (*get_initial_date)     (GcalView *view);
   icaltimetype*   (*get_final_date)       (GcalView *view);
@@ -47,6 +51,8 @@ struct _GcalViewIface
   gboolean        (*contains)             (GcalView *view, icaltimetype *date);
   void            (*remove_by_uuid)       (GcalView *view, const gchar *uuid);
   GtkWidget*      (*get_by_uuid)          (GcalView *view, const gchar *uuid);
+
+  void            (*clear_selection)      (GcalView *view);
 };
 
 GType         gcal_view_get_type          (void);
@@ -60,7 +66,7 @@ icaltimetype* gcal_view_get_initial_date  (GcalView     *view);
 
 icaltimetype* gcal_view_get_final_date    (GcalView     *view);
 
-gboolean      gcal_view_contains       (GcalView     *view,
+gboolean      gcal_view_contains          (GcalView     *view,
                                            icaltimetype *date);
 
 void          gcal_view_remove_by_uuid    (GcalView     *view,
@@ -69,6 +75,8 @@ void          gcal_view_remove_by_uuid    (GcalView     *view,
 GtkWidget*    gcal_view_get_by_uuid       (GcalView     *view,
                                            const gchar  *uuid);
 
+void          gcal_view_clear_selection   (GcalView     *view);
+
 G_END_DECLS
 
 #endif /* __GCAL_MONTH_VIEW_H__ */



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