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.
This commit is contained in:
Erick Pérez Castellanos
2012-08-19 02:47:36 -04:00
parent 34d458d8a9
commit 0820d49e4e
2 changed files with 44 additions and 1 deletions
+35
View File
@@ -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);
}
+9 -1
View File
@@ -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__ */