build: added ECalDataModel related files
Implements an ECalDataModel object from evolution courtesy of Milan Crha ECalDataModel hides the details of events retrieving from calendars. Provides a time range and a subscriber system allowing objects implements the necessary callbacks to be notified of events happening on the selected time range.
This commit is contained in:
+12
-9
@@ -67,14 +67,15 @@ AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
|
||||
|
||||
GNOME_COMPILE_WARNINGS(maximum)
|
||||
|
||||
MAINTAINER_COMPILER_FLAGS="$MAINTAINER_COMPILER_FLAGS \
|
||||
-Wall -Wcast-align -Wuninitialized \
|
||||
-Wno-strict-aliasing -Wempty-body -Wformat \
|
||||
-Wformat-security -Wformat-nonliteral -Winit-self \
|
||||
-Wdeclaration-after-statement -Wvla \
|
||||
-Wpointer-arith -Wmissing-declarations \
|
||||
-Wcast-align \
|
||||
-Wredundant-decls"
|
||||
MAINTAINER_COMPILER_FLAGS="\
|
||||
$MAINTAINER_COMPILER_FLAGS\
|
||||
-Wall -Wcast-align -Wuninitialized\
|
||||
-Wno-strict-aliasing -Wempty-body -Wformat\
|
||||
-Wformat-security -Wformat-nonliteral -Winit-self\
|
||||
-Wdeclaration-after-statement -Wvla\
|
||||
-Wpointer-arith -Wmissing-declarations\
|
||||
-Wcast-align -Wmissing-prototypes\
|
||||
-Wredundant-decls"
|
||||
|
||||
# strip leading spaces
|
||||
MAINTAINER_COMPILER_FLAGS=${MAINTAINER_COMPILER_FLAGS#* }
|
||||
@@ -114,7 +115,9 @@ echo "
|
||||
|
||||
prefix: ${prefix}
|
||||
compiler: ${CC}
|
||||
flags: ${CFLAGS} ${CPPFLAGS} ${CALENDAR_CFLAGS} ${LDFLAGS} ${CALENDAR_LIBS} ${LIBS}
|
||||
flags: ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||
flags: ${MAINTAINER_COMPILER_FLAGS}
|
||||
flags: ${CALENDAR_CFLAGS} ${CALENDAR_LIBS} ${LIBS}
|
||||
|
||||
Now type 'make' to build $PACKAGE
|
||||
"
|
||||
|
||||
@@ -20,6 +20,10 @@ gnome_calendar_SOURCES = \
|
||||
$(BUILT_SOURCES) \
|
||||
e-cell-renderer-color.c \
|
||||
e-cell-renderer-color.h \
|
||||
e-cal-data-model-subscriber.h \
|
||||
e-cal-data-model-subscriber.c \
|
||||
e-cal-data-model.h \
|
||||
e-cal-data-model.c \
|
||||
main.c \
|
||||
gcal-application.h \
|
||||
gcal-application.c \
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Red Hat, Inc. (www.redhat.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Milan Crha <mcrha@redhat.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "e-cal-data-model-subscriber.h"
|
||||
|
||||
G_DEFINE_INTERFACE (ECalDataModelSubscriber, e_cal_data_model_subscriber, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
e_cal_data_model_subscriber_default_init (ECalDataModelSubscriberInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* e_cal_data_model_subscriber_component_added:
|
||||
* @subscriber: an #ECalDataModelSubscriber
|
||||
* @client: an #ECalClient, which notifies about the component addition
|
||||
* @icalcomp: an #ECalComponent which was added
|
||||
*
|
||||
* Notifies the @subscriber about an added component which belongs
|
||||
* to the time range used by the @subscriber.
|
||||
*
|
||||
* Note: The @subscriber can be frozen during these calls, to be able
|
||||
* to cumulate multiple changes and propagate them at once.
|
||||
**/
|
||||
void
|
||||
e_cal_data_model_subscriber_component_added (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
ECalComponent *comp)
|
||||
{
|
||||
ECalDataModelSubscriberInterface *iface;
|
||||
|
||||
g_return_if_fail (E_IS_CAL_DATA_MODEL_SUBSCRIBER (subscriber));
|
||||
g_return_if_fail (E_IS_CAL_COMPONENT (comp));
|
||||
|
||||
iface = E_CAL_DATA_MODEL_SUBSCRIBER_GET_INTERFACE (subscriber);
|
||||
g_return_if_fail (iface->component_added != NULL);
|
||||
|
||||
iface->component_added (subscriber, client, comp);
|
||||
}
|
||||
|
||||
/**
|
||||
* e_cal_data_model_subscriber_component_modified:
|
||||
* @subscriber: an #ECalDataModelSubscriber
|
||||
* @client: an #ECalClient, which notifies about the component modification
|
||||
* @comp: an #ECalComponent which was modified
|
||||
*
|
||||
* Notifies the @subscriber about a modified component which belongs
|
||||
* to the time range used by the @subscriber.
|
||||
*
|
||||
* Note: The @subscriber can be frozen during these calls, to be able
|
||||
* to cumulate multiple changes and propagate them at once.
|
||||
**/
|
||||
void
|
||||
e_cal_data_model_subscriber_component_modified (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
ECalComponent *comp)
|
||||
{
|
||||
ECalDataModelSubscriberInterface *iface;
|
||||
|
||||
g_return_if_fail (E_IS_CAL_DATA_MODEL_SUBSCRIBER (subscriber));
|
||||
g_return_if_fail (E_IS_CAL_COMPONENT (comp));
|
||||
|
||||
iface = E_CAL_DATA_MODEL_SUBSCRIBER_GET_INTERFACE (subscriber);
|
||||
g_return_if_fail (iface->component_modified != NULL);
|
||||
|
||||
iface->component_modified (subscriber, client, comp);
|
||||
}
|
||||
|
||||
/**
|
||||
* e_cal_data_model_subscriber_component_removed:
|
||||
* @subscriber: an #ECalDataModelSubscriber
|
||||
* @client: an #ECalClient, which notifies about the component removal
|
||||
* @uid: UID of a removed component
|
||||
* @rid: RID of a removed component
|
||||
*
|
||||
* Notifies the @subscriber about a removed component identified
|
||||
* by @uid and @rid. This component may or may not be within
|
||||
* the time range specified by the @subscriber.
|
||||
*
|
||||
* Note: The @subscriber can be frozen during these calls, to be able
|
||||
* to cumulate multiple changes and propagate them at once.
|
||||
**/
|
||||
void
|
||||
e_cal_data_model_subscriber_component_removed (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
const gchar *uid,
|
||||
const gchar *rid)
|
||||
{
|
||||
ECalDataModelSubscriberInterface *iface;
|
||||
|
||||
g_return_if_fail (E_IS_CAL_DATA_MODEL_SUBSCRIBER (subscriber));
|
||||
|
||||
iface = E_CAL_DATA_MODEL_SUBSCRIBER_GET_INTERFACE (subscriber);
|
||||
g_return_if_fail (iface->component_removed != NULL);
|
||||
|
||||
iface->component_removed (subscriber, client, uid, rid);
|
||||
}
|
||||
|
||||
/**
|
||||
* e_cal_data_model_subscriber_freeze:
|
||||
* @subscriber: an #ECalDataModelSubscriber
|
||||
*
|
||||
* Tells the @subscriber that it'll be notified about multiple
|
||||
* changes. Once all the notifications are done,
|
||||
* a e_cal_data_model_subscriber_thaw() is called.
|
||||
*
|
||||
* Note: This function can be called multiple times/recursively, with
|
||||
* the same count of the e_cal_data_model_subscriber_thaw(), thus
|
||||
* count with it.
|
||||
**/
|
||||
void
|
||||
e_cal_data_model_subscriber_freeze (ECalDataModelSubscriber *subscriber)
|
||||
{
|
||||
ECalDataModelSubscriberInterface *iface;
|
||||
|
||||
g_return_if_fail (E_IS_CAL_DATA_MODEL_SUBSCRIBER (subscriber));
|
||||
|
||||
iface = E_CAL_DATA_MODEL_SUBSCRIBER_GET_INTERFACE (subscriber);
|
||||
g_return_if_fail (iface->freeze != NULL);
|
||||
|
||||
iface->freeze (subscriber);
|
||||
}
|
||||
|
||||
/**
|
||||
* e_cal_data_model_subscriber_thaw:
|
||||
* @subscriber: an #ECalDataModelSubscriber
|
||||
*
|
||||
* A pair function for e_cal_data_model_subscriber_freeze(), which notifies
|
||||
* about the end of a content update.
|
||||
**/
|
||||
void
|
||||
e_cal_data_model_subscriber_thaw (ECalDataModelSubscriber *subscriber)
|
||||
{
|
||||
ECalDataModelSubscriberInterface *iface;
|
||||
|
||||
g_return_if_fail (E_IS_CAL_DATA_MODEL_SUBSCRIBER (subscriber));
|
||||
|
||||
iface = E_CAL_DATA_MODEL_SUBSCRIBER_GET_INTERFACE (subscriber);
|
||||
g_return_if_fail (iface->thaw != NULL);
|
||||
|
||||
iface->thaw (subscriber);
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Red Hat, Inc. (www.redhat.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Milan Crha <mcrha@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef E_CAL_DATA_MODEL_SUBSCRIBER_H
|
||||
#define E_CAL_DATA_MODEL_SUBSCRIBER_H
|
||||
|
||||
#include <libecal/libecal.h>
|
||||
|
||||
/* Standard GObject macros */
|
||||
#define E_TYPE_CAL_DATA_MODEL_SUBSCRIBER \
|
||||
(e_cal_data_model_subscriber_get_type ())
|
||||
#define E_CAL_DATA_MODEL_SUBSCRIBER(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST \
|
||||
((obj), E_TYPE_CAL_DATA_MODEL_SUBSCRIBER, ECalDataModelSubscriber))
|
||||
#define E_CAL_DATA_MODEL_SUBSCRIBER_INTERFACE(cls) \
|
||||
(G_TYPE_CHECK_CLASS_CAST \
|
||||
((cls), E_TYPE_CAL_DATA_MODEL_SUBSCRIBER, ECalDataModelSubscriberInterface))
|
||||
#define E_IS_CAL_DATA_MODEL_SUBSCRIBER(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE \
|
||||
((obj), E_TYPE_CAL_DATA_MODEL_SUBSCRIBER))
|
||||
#define E_IS_CAL_DATA_MODEL_SUBSCRIBER_INTERFACE(cls) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE \
|
||||
((cls), E_TYPE_CAL_DATA_MODEL_SUBSCRIBER))
|
||||
#define E_CAL_DATA_MODEL_SUBSCRIBER_GET_INTERFACE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_INTERFACE \
|
||||
((obj), E_TYPE_CAL_DATA_MODEL_SUBSCRIBER, ECalDataModelSubscriberInterface))
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _ECalDataModelSubscriber ECalDataModelSubscriber;
|
||||
typedef struct _ECalDataModelSubscriberInterface ECalDataModelSubscriberInterface;
|
||||
|
||||
struct _ECalDataModelSubscriberInterface {
|
||||
GTypeInterface parent_interface;
|
||||
|
||||
void (*component_added) (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
ECalComponent *comp);
|
||||
void (*component_modified) (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
ECalComponent *comp);
|
||||
void (*component_removed) (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
const gchar *uid,
|
||||
const gchar *rid);
|
||||
void (*freeze) (ECalDataModelSubscriber *subscriber);
|
||||
void (*thaw) (ECalDataModelSubscriber *subscriber);
|
||||
};
|
||||
|
||||
GType e_cal_data_model_subscriber_get_type (void) G_GNUC_CONST;
|
||||
void e_cal_data_model_subscriber_component_added (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
ECalComponent *comp);
|
||||
void e_cal_data_model_subscriber_component_modified (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
ECalComponent *comp);
|
||||
void e_cal_data_model_subscriber_component_removed (ECalDataModelSubscriber *subscriber,
|
||||
ECalClient *client,
|
||||
const gchar *uid,
|
||||
const gchar *rid);
|
||||
void e_cal_data_model_subscriber_freeze (ECalDataModelSubscriber *subscriber);
|
||||
void e_cal_data_model_subscriber_thaw (ECalDataModelSubscriber *subscriber);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* E_CAL_DATA_MODEL_SUBSCRIBER_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Red Hat, Inc. (www.redhat.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Milan Crha <mcrha@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef E_CAL_DATA_MODEL_H
|
||||
#define E_CAL_DATA_MODEL_H
|
||||
|
||||
#include <libecal/libecal.h>
|
||||
|
||||
#include "e-cal-data-model-subscriber.h"
|
||||
|
||||
/* Standard GObject macros */
|
||||
#define E_TYPE_CAL_DATA_MODEL \
|
||||
(e_cal_data_model_get_type ())
|
||||
#define E_CAL_DATA_MODEL(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST \
|
||||
((obj), E_TYPE_CAL_DATA_MODEL, ECalDataModel))
|
||||
#define E_CAL_DATA_MODEL_CLASS(cls) \
|
||||
(G_TYPE_CHECK_CLASS_CAST \
|
||||
((cls), E_TYPE_CAL_DATA_MODEL, ECalDataModelClass))
|
||||
#define E_IS_CAL_DATA_MODEL(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE \
|
||||
((obj), E_TYPE_CAL_DATA_MODEL))
|
||||
#define E_IS_CAL_DATA_MODEL_CLASS(cls) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE \
|
||||
((cls), E_TYPE_CAL_DATA_MODEL))
|
||||
#define E_CAL_DATA_MODEL_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS \
|
||||
((obj), E_TYPE_CAL_DATA_MODEL, ECalDataModelClass))
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum {
|
||||
E_CAL_DATA_MODEL_VIEW_STATE_START,
|
||||
E_CAL_DATA_MODEL_VIEW_STATE_PROGRESS,
|
||||
E_CAL_DATA_MODEL_VIEW_STATE_COMPLETE,
|
||||
E_CAL_DATA_MODEL_VIEW_STATE_STOP
|
||||
} ECalDataModelViewState;
|
||||
|
||||
typedef struct _ECalDataModel ECalDataModel;
|
||||
typedef struct _ECalDataModelClass ECalDataModelClass;
|
||||
typedef struct _ECalDataModelPrivate ECalDataModelPrivate;
|
||||
|
||||
struct _ECalDataModel {
|
||||
GObject parent;
|
||||
ECalDataModelPrivate *priv;
|
||||
};
|
||||
|
||||
struct _ECalDataModelClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* Signals */
|
||||
void (* view_state_changed) (ECalDataModel *data_model,
|
||||
ECalClientView *view,
|
||||
ECalDataModelViewState state,
|
||||
guint percent,
|
||||
const gchar *message,
|
||||
const GError *error);
|
||||
};
|
||||
|
||||
typedef void (* EThreadJobFunc) (gpointer user_data,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
typedef GCancellable * (* ECalDataModelSubmitThreadJobFunc)
|
||||
(EThreadJobFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify free_user_data);
|
||||
|
||||
GType e_cal_data_model_get_type (void);
|
||||
ECalDataModel * e_cal_data_model_new (ECalDataModelSubmitThreadJobFunc func);
|
||||
ECalDataModel * e_cal_data_model_new_clone (ECalDataModel *src_data_model);
|
||||
GCancellable * e_cal_data_model_submit_thread_job
|
||||
(ECalDataModel *data_model,
|
||||
EThreadJobFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify free_user_data);
|
||||
gboolean e_cal_data_model_get_disposing (ECalDataModel *data_model);
|
||||
void e_cal_data_model_set_disposing (ECalDataModel *data_model,
|
||||
gboolean disposing);
|
||||
gboolean e_cal_data_model_get_expand_recurrences
|
||||
(ECalDataModel *data_model);
|
||||
void e_cal_data_model_set_expand_recurrences
|
||||
(ECalDataModel *data_model,
|
||||
gboolean expand_recurrences);
|
||||
icaltimezone * e_cal_data_model_get_timezone (ECalDataModel *data_model);
|
||||
void e_cal_data_model_set_timezone (ECalDataModel *data_model,
|
||||
icaltimezone *zone);
|
||||
void e_cal_data_model_set_filter (ECalDataModel *data_model,
|
||||
const gchar *sexp);
|
||||
gchar * e_cal_data_model_dup_filter (ECalDataModel *data_model);
|
||||
void e_cal_data_model_add_client (ECalDataModel *data_model,
|
||||
ECalClient *client);
|
||||
void e_cal_data_model_remove_client (ECalDataModel *data_model,
|
||||
const gchar *uid);
|
||||
ECalClient * e_cal_data_model_ref_client (ECalDataModel *data_model,
|
||||
const gchar *uid);
|
||||
GList * e_cal_data_model_get_clients (ECalDataModel *data_model);
|
||||
GSList * e_cal_data_model_get_components (ECalDataModel *data_model,
|
||||
time_t in_range_start,
|
||||
time_t in_range_end);
|
||||
|
||||
typedef gboolean (* ECalDataModelForeachFunc) (ECalDataModel *data_model,
|
||||
ECalClient *client,
|
||||
const ECalComponentId *id,
|
||||
ECalComponent *comp,
|
||||
time_t instance_start,
|
||||
time_t instance_end,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean e_cal_data_model_foreach_component
|
||||
(ECalDataModel *data_model,
|
||||
time_t in_range_start,
|
||||
time_t in_range_end,
|
||||
ECalDataModelForeachFunc func,
|
||||
gpointer user_data);
|
||||
|
||||
void e_cal_data_model_subscribe (ECalDataModel *data_model,
|
||||
ECalDataModelSubscriber *subscriber,
|
||||
time_t range_start,
|
||||
time_t range_end);
|
||||
void e_cal_data_model_unsubscribe (ECalDataModel *data_model,
|
||||
ECalDataModelSubscriber *subscriber);
|
||||
gboolean e_cal_data_model_get_subscriber_range
|
||||
(ECalDataModel *data_model,
|
||||
ECalDataModelSubscriber *subscriber,
|
||||
time_t *range_start,
|
||||
time_t *range_end);
|
||||
void e_cal_data_model_freeze_views_update
|
||||
(ECalDataModel *data_model);
|
||||
void e_cal_data_model_thaw_views_update
|
||||
(ECalDataModel *data_model);
|
||||
gboolean e_cal_data_model_is_views_update_frozen
|
||||
(ECalDataModel *data_model);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* E_CAL_DATA_MODEL_H */
|
||||
Reference in New Issue
Block a user