views: implemented :manager property
As explained before, this is only intended to keep a reference to the GcalManager instance of the application. Misc: fixed some documentation and whitespace issues
This commit is contained in:
+14
-8
@@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
#include <libecal/libecal.h>
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -52,12 +50,14 @@ typedef struct
|
|||||||
|
|
||||||
/* property */
|
/* property */
|
||||||
icaltimetype *date;
|
icaltimetype *date;
|
||||||
|
GcalManager *manager; /* weak reference */
|
||||||
} GcalMonthViewPrivate;
|
} GcalMonthViewPrivate;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_DATE /* active-date inherited property */
|
PROP_DATE, /* active-date inherited property */
|
||||||
|
PROP_MANAGER /* manager inherited property */
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gcal_view_interface_init (GcalViewIface *iface);
|
static void gcal_view_interface_init (GcalViewIface *iface);
|
||||||
@@ -173,10 +173,9 @@ gcal_month_view_class_init (GcalMonthViewClass *klass)
|
|||||||
container_class->forall = gcal_month_view_forall;
|
container_class->forall = gcal_month_view_forall;
|
||||||
|
|
||||||
g_object_class_override_property (object_class, PROP_DATE, "active-date");
|
g_object_class_override_property (object_class, PROP_DATE, "active-date");
|
||||||
|
g_object_class_override_property (object_class, PROP_MANAGER, "manager");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gcal_month_view_init (GcalMonthView *self)
|
gcal_month_view_init (GcalMonthView *self)
|
||||||
{
|
{
|
||||||
@@ -247,6 +246,11 @@ gcal_month_view_set_property (GObject *object,
|
|||||||
priv->days_delay = icaltime_day_of_week (*first_of_month) - 1;
|
priv->days_delay = icaltime_day_of_week (*first_of_month) - 1;
|
||||||
g_free (first_of_month);
|
g_free (first_of_month);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PROP_MANAGER:
|
||||||
|
{
|
||||||
|
priv->manager = g_value_get_pointer (value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -1332,13 +1336,15 @@ gcal_month_view_will_add_event (GcalView *view,
|
|||||||
/* Public API */
|
/* Public API */
|
||||||
/**
|
/**
|
||||||
* gcal_month_view_new:
|
* gcal_month_view_new:
|
||||||
|
* @manager: App singleton #GcalManager instance
|
||||||
*
|
*
|
||||||
* Since: 0.1
|
* Since: 0.1
|
||||||
* Return value: the new month view widget
|
* Create a new month view widget
|
||||||
|
*
|
||||||
* Returns: (transfer full):
|
* Returns: (transfer full):
|
||||||
**/
|
**/
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
gcal_month_view_new (void)
|
gcal_month_view_new (GcalManager *manager)
|
||||||
{
|
{
|
||||||
return g_object_new (GCAL_TYPE_MONTH_VIEW, NULL);
|
return g_object_new (GCAL_TYPE_MONTH_VIEW, "manager", manager, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
#ifndef __GCAL_MONTH_VIEW_H__
|
#ifndef __GCAL_MONTH_VIEW_H__
|
||||||
#define __GCAL_MONTH_VIEW_H__
|
#define __GCAL_MONTH_VIEW_H__
|
||||||
|
|
||||||
|
#include "gcal-manager.h"
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
@@ -49,7 +51,7 @@ struct _GcalMonthViewClass
|
|||||||
|
|
||||||
GType gcal_month_view_get_type (void);
|
GType gcal_month_view_get_type (void);
|
||||||
|
|
||||||
GtkWidget* gcal_month_view_new (void);
|
GtkWidget* gcal_month_view_new (GcalManager *manager);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
+15
-11
@@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
#include <libecal/libecal.h>
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#define ALL_DAY_CELLS_HEIGHT 40
|
#define ALL_DAY_CELLS_HEIGHT 40
|
||||||
@@ -40,7 +38,8 @@ static const double dashed [] =
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_DATE
|
PROP_DATE,
|
||||||
|
PROP_MANAGER
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GcalWeekViewChild
|
struct _GcalWeekViewChild
|
||||||
@@ -71,6 +70,7 @@ typedef struct
|
|||||||
|
|
||||||
/* property */
|
/* property */
|
||||||
icaltimetype *date;
|
icaltimetype *date;
|
||||||
|
GcalManager *manager; /* weak referenced */
|
||||||
|
|
||||||
GdkWindow *event_window;
|
GdkWindow *event_window;
|
||||||
|
|
||||||
@@ -195,10 +195,9 @@ gcal_week_view_class_init (GcalWeekViewClass *klass)
|
|||||||
object_class->get_property = gcal_week_view_get_property;
|
object_class->get_property = gcal_week_view_get_property;
|
||||||
|
|
||||||
g_object_class_override_property (object_class, PROP_DATE, "active-date");
|
g_object_class_override_property (object_class, PROP_DATE, "active-date");
|
||||||
|
g_object_class_override_property (object_class, PROP_MANAGER, "manager");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gcal_week_view_init (GcalWeekView *self)
|
gcal_week_view_init (GcalWeekView *self)
|
||||||
{
|
{
|
||||||
@@ -291,7 +290,9 @@ gcal_week_view_set_property (GObject *object,
|
|||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GCAL_IS_WEEK_VIEW (object));
|
GcalWeekViewPrivate *priv;
|
||||||
|
|
||||||
|
priv = gcal_week_view_get_instance_private (GCAL_WEEK_VIEW (object));
|
||||||
|
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
@@ -300,6 +301,9 @@ gcal_week_view_set_property (GObject *object,
|
|||||||
GCAL_WEEK_VIEW (object),
|
GCAL_WEEK_VIEW (object),
|
||||||
g_value_dup_boxed (value));
|
g_value_dup_boxed (value));
|
||||||
break;
|
break;
|
||||||
|
case PROP_MANAGER:
|
||||||
|
priv->manager = g_value_get_pointer (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -1425,14 +1429,14 @@ gcal_week_view_will_add_event (GcalView *view,
|
|||||||
/* Public API */
|
/* Public API */
|
||||||
/**
|
/**
|
||||||
* gcal_week_view_new:
|
* gcal_week_view_new:
|
||||||
* @date:
|
* @manager: App singleton #GcalManager instance
|
||||||
|
*
|
||||||
|
* Create a week-view widget
|
||||||
*
|
*
|
||||||
* Since: 0.1
|
|
||||||
* Return value: the new month view widget
|
|
||||||
* Returns: (transfer full):
|
* Returns: (transfer full):
|
||||||
**/
|
**/
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
gcal_week_view_new (void)
|
gcal_week_view_new (GcalManager *manager)
|
||||||
{
|
{
|
||||||
return g_object_new (GCAL_TYPE_WEEK_VIEW, NULL);
|
return g_object_new (GCAL_TYPE_WEEK_VIEW, "manager", manager, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
#ifndef __GCAL_WEEK_VIEW_H__
|
#ifndef __GCAL_WEEK_VIEW_H__
|
||||||
#define __GCAL_WEEK_VIEW_H__
|
#define __GCAL_WEEK_VIEW_H__
|
||||||
|
|
||||||
|
#include "gcal-manager.h"
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
@@ -46,7 +48,7 @@ struct _GcalWeekViewClass
|
|||||||
|
|
||||||
GType gcal_week_view_get_type (void);
|
GType gcal_week_view_get_type (void);
|
||||||
|
|
||||||
GtkWidget* gcal_week_view_new (void);
|
GtkWidget* gcal_week_view_new (GcalManager *manager);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
+14
-8
@@ -42,6 +42,7 @@ typedef struct
|
|||||||
|
|
||||||
/* property */
|
/* property */
|
||||||
icaltimetype *date;
|
icaltimetype *date;
|
||||||
|
GcalManager *manager; /* weak reference */
|
||||||
|
|
||||||
gint clicked_cell;
|
gint clicked_cell;
|
||||||
|
|
||||||
@@ -52,7 +53,8 @@ typedef struct
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_DATE //active-date inherited property
|
PROP_DATE, //active-date inherited property
|
||||||
|
PROP_MANAGER //manager inherited property
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gcal_view_interface_init (GcalViewIface *iface);
|
static void gcal_view_interface_init (GcalViewIface *iface);
|
||||||
@@ -171,10 +173,9 @@ gcal_year_view_class_init (GcalYearViewClass *klass)
|
|||||||
object_class->finalize = gcal_year_view_finalize;
|
object_class->finalize = gcal_year_view_finalize;
|
||||||
|
|
||||||
g_object_class_override_property (object_class, PROP_DATE, "active-date");
|
g_object_class_override_property (object_class, PROP_DATE, "active-date");
|
||||||
|
g_object_class_override_property (object_class, PROP_MANAGER, "manager");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gcal_year_view_init (GcalYearView *self)
|
gcal_year_view_init (GcalYearView *self)
|
||||||
{
|
{
|
||||||
@@ -238,6 +239,9 @@ gcal_year_view_set_property (GObject *object,
|
|||||||
|
|
||||||
priv->date = g_value_dup_boxed (value);
|
priv->date = g_value_dup_boxed (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_MANAGER:
|
||||||
|
priv->manager = g_value_get_pointer (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -1035,19 +1039,21 @@ static gboolean
|
|||||||
gcal_year_view_will_add_event (GcalView *view,
|
gcal_year_view_will_add_event (GcalView *view,
|
||||||
GcalEventWidget *event)
|
GcalEventWidget *event)
|
||||||
{
|
{
|
||||||
;
|
/* FIXME: implement me !!! */
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Public API */
|
/* Public API */
|
||||||
/**
|
/**
|
||||||
* gcal_year_view_new:
|
* gcal_year_view_new:
|
||||||
|
* @manager: App singleton #GcalManager instance
|
||||||
|
*
|
||||||
|
* Create the year view
|
||||||
*
|
*
|
||||||
* Since: 0.1
|
|
||||||
* Return value: the new month view widget
|
|
||||||
* Returns: (transfer full):
|
* Returns: (transfer full):
|
||||||
**/
|
**/
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
gcal_year_view_new (void)
|
gcal_year_view_new (GcalManager *manager)
|
||||||
{
|
{
|
||||||
return g_object_new (GCAL_TYPE_YEAR_VIEW, NULL);
|
return g_object_new (GCAL_TYPE_YEAR_VIEW, "manager", manager, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
#ifndef __GCAL_YEAR_VIEW_H__
|
#ifndef __GCAL_YEAR_VIEW_H__
|
||||||
#define __GCAL_YEAR_VIEW_H__
|
#define __GCAL_YEAR_VIEW_H__
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include "gcal-manager.h"
|
||||||
|
|
||||||
#include <libical/icaltime.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ struct _GcalYearViewClass
|
|||||||
|
|
||||||
GType gcal_year_view_get_type (void);
|
GType gcal_year_view_get_type (void);
|
||||||
|
|
||||||
GtkWidget* gcal_year_view_new (void);
|
GtkWidget* gcal_year_view_new (GcalManager *manager);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user