[gnome-calendar] Improved GcalView API.
- From: Erick PÃrez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] Improved GcalView API.
- Date: Wed, 11 Jul 2012 14:51:23 +0000 (UTC)
commit 444298ae2601803d4a9f843e1e7340e53fa7e4b7
Author: Erick PÃrez Castellanos <erick red gmail com>
Date: Sat Jul 7 22:38:25 2012 -0400
Improved GcalView API.
Added ::active-date property
Added set_date/get_date pair of methods for handling the property
Added get_initial_date/get_final_date pure virtual methods.
src/gcal-view.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++---
src/gcal-view.h | 33 +++++++++++++++++++++++----------
2 files changed, 70 insertions(+), 13 deletions(-)
---
diff --git a/src/gcal-view.c b/src/gcal-view.c
index 44728a9..7e9ffcd 100644
--- a/src/gcal-view.c
+++ b/src/gcal-view.c
@@ -19,6 +19,7 @@
*/
#include "gcal-view.h"
+#include "gcal-utils.h"
#include <glib.h>
@@ -29,7 +30,14 @@ gcal_view_base_init (gpointer g_iface)
if (!initialized)
{
- /* create interface signals here. */
+ /* create interface signals && properties here. */
+ g_object_interface_install_property (
+ g_iface,
+ g_param_spec_boxed ("active-date",
+ "The active date",
+ "The active/selecetd date in the view",
+ ICAL_TIME_TYPE,
+ G_PARAM_READWRITE));
initialized = TRUE;
}
}
@@ -62,13 +70,49 @@ gcal_view_get_type (void)
return type;
}
+void
+gcal_view_set_date (GcalView *view,
+ icaltimetype *date)
+{
+ g_return_if_fail (GCAL_IS_VIEW (view));
+
+ g_object_set (view, "active-date", date, NULL);
+}
+
+icaltimetype*
+gcal_view_get_date (GcalView *view)
+{
+ icaltimetype *date;
+
+ g_return_val_if_fail (GCAL_IS_VIEW (view), NULL);
+
+ g_object_get (view, "active-date", &date, NULL);
+ return date;
+}
+
+icaltimetype*
+gcal_view_get_initial_date (GcalView *view)
+{
+ g_return_val_if_fail (GCAL_IS_VIEW (view), NULL);
+
+ return GCAL_VIEW_GET_INTERFACE (view)->get_initial_date (view);
+}
+
+icaltimetype*
+gcal_view_get_final_date (GcalView *view)
+{
+ g_return_val_if_fail (GCAL_IS_VIEW (view), NULL);
+
+ return GCAL_VIEW_GET_INTERFACE (view)->get_final_date (view);
+}
+
gboolean
-gcal_view_is_in_range (GcalView *view,
+gcal_view_contains (GcalView *view,
icaltimetype *date)
{
g_return_val_if_fail (GCAL_IS_VIEW (view), FALSE);
- return GCAL_VIEW_GET_INTERFACE (view)->is_in_range (view, date);
+ return GCAL_VIEW_GET_INTERFACE (view)->contains (view, date);
}
void
diff --git a/src/gcal-view.h b/src/gcal-view.h
index de2d3ef..c936fd2 100644
--- a/src/gcal-view.h
+++ b/src/gcal-view.h
@@ -40,21 +40,34 @@ struct _GcalViewIface
{
GTypeInterface parent_iface;
- gboolean (*is_in_range) (GcalView *view, icaltimetype *date);
- void (*remove_by_uuid) (GcalView *view, const gchar *uuid);
- GtkWidget* (*get_by_uuid) (GcalView *view, const gchar *uuid);
+ /* pure virtual methods */
+ icaltimetype* (*get_initial_date) (GcalView *view);
+ icaltimetype* (*get_final_date) (GcalView *view);
+
+ gboolean (*contains) (GcalView *view, icaltimetype *date);
+ void (*remove_by_uuid) (GcalView *view, const gchar *uuid);
+ GtkWidget* (*get_by_uuid) (GcalView *view, const gchar *uuid);
};
-GType gcal_view_get_type (void);
+GType gcal_view_get_type (void);
+
+void gcal_view_set_date (GcalView *view,
+ icaltimetype *date);
+
+icaltimetype* gcal_view_get_date (GcalView *view);
+
+icaltimetype* gcal_view_get_initial_date (GcalView *view);
+
+icaltimetype* gcal_view_get_final_date (GcalView *view);
-gboolean gcal_view_is_in_range (GcalView *view,
- icaltimetype *date);
+gboolean gcal_view_contains (GcalView *view,
+ icaltimetype *date);
-void gcal_view_remove_by_uuid (GcalView *view,
- const gchar *uuid);
+void gcal_view_remove_by_uuid (GcalView *view,
+ const gchar *uuid);
-GtkWidget* gcal_view_get_by_uuid (GcalView *view,
- const gchar *uuid);
+GtkWidget* gcal_view_get_by_uuid (GcalView *view,
+ const gchar *uuid);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]