Added initial implementation of GcalView interface.
Added files to Makefile.am
This commit is contained in:
@@ -25,8 +25,12 @@ gnome_calendar_SOURCES = \
|
||||
gcal-main-toolbar.c \
|
||||
gcal-window.h \
|
||||
gcal-window.c \
|
||||
gcal-view.c \
|
||||
gcal-view.h \
|
||||
gcal-month-view.c \
|
||||
gcal-month-view.h \
|
||||
gcal-event-widget.c \
|
||||
gcal-event-widget.h \
|
||||
gcal-manager.c \
|
||||
gcal-manager.h \
|
||||
gcal-utils.c \
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* gcal-view.c
|
||||
*
|
||||
* Copyright (C) 2012 - Erick Pérez Castellanos
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "gcal-view.h"
|
||||
|
||||
static void
|
||||
gcal_view_base_init (gpointer g_iface)
|
||||
{
|
||||
static gboolean initialized = FALSE;
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
/* create interface signals here. */
|
||||
initialized = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
GType
|
||||
gcal_view_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
if (type == 0)
|
||||
{
|
||||
const GTypeInfo info =
|
||||
{
|
||||
sizeof (GcalViewInterface),
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
NULL, /* class_init */
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL /* instance_init */
|
||||
};
|
||||
const GInterfaceInfo view_info =
|
||||
{
|
||||
(GInterfaceInitFunc) gcal_view_base_init,
|
||||
NULL, /* interface_finalize */
|
||||
NULL /* interface_data */
|
||||
};
|
||||
type = g_type_register_static (G_TYPE_OBJECT,
|
||||
"GcalViewType",
|
||||
&info,
|
||||
0);
|
||||
g_type_add_interface_static (type,
|
||||
GCAL_TYPE_VIEW,
|
||||
&view_info);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gcal_view_is_in_range (GcalView *view,
|
||||
icaltimetype *date)
|
||||
{
|
||||
return GCAL_VIEW_GET_INTERFACE (view)->is_in_range (view, date);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* gcal-view.h
|
||||
*
|
||||
* Copyright (C) 2012 - Erick Pérez Castellanos
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GCAL_VIEW_H__
|
||||
#define __GCAL_VIEW_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <libical/icaltime.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GCAL_TYPE_VIEW (gcal_view_get_type ())
|
||||
#define GCAL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCAL_TYPE_VIEW, GcalView))
|
||||
#define GCAL_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCAL_TYPE_VIEW))
|
||||
#define GCAL_VIEW_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GCAL_TYPE_VIEW, GcalViewInterface))
|
||||
|
||||
|
||||
typedef struct _GcalView GcalView;
|
||||
typedef struct _GcalViewInterface GcalViewInterface;
|
||||
|
||||
struct _GcalViewInterface
|
||||
{
|
||||
GTypeInterface parent_iface;
|
||||
|
||||
gboolean (*is_in_range) (GcalView *view, icaltimetype* date);
|
||||
};
|
||||
|
||||
GType gcal_view_get_type (void);
|
||||
|
||||
gboolean gcal_view_is_in_range (GcalView *view, icaltimetype* date);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GCAL_MONTH_VIEW_H__ */
|
||||
Reference in New Issue
Block a user