Wrapped icaltimetype as G_TYPE_BOXED
Fixed GcalMonthView to use this. Added date-start for GcalEventWidget.
This commit is contained in:
+27
-4
@@ -18,20 +18,25 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gcal-event-widget.h"
|
#include "gcal-event-widget.h"
|
||||||
|
#include "gcal-utils.h"
|
||||||
|
|
||||||
|
#include <libical/icaltime.h>
|
||||||
|
|
||||||
struct _GcalEventWidgetPrivate
|
struct _GcalEventWidgetPrivate
|
||||||
{
|
{
|
||||||
GdkWindow *event_window;
|
GdkWindow *event_window;
|
||||||
|
|
||||||
gchar *summary;
|
gchar *summary;
|
||||||
GdkRGBA *color;
|
GdkRGBA *color;
|
||||||
|
icaltimetype *dt_start;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_SUMMARY,
|
PROP_SUMMARY,
|
||||||
PROP_COLOR
|
PROP_COLOR,
|
||||||
|
PROP_DTSTART
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gcal_event_widget_constructed (GObject *object);
|
static void gcal_event_widget_constructed (GObject *object);
|
||||||
@@ -113,6 +118,15 @@ gcal_event_widget_class_init(GcalEventWidgetClass *klass)
|
|||||||
G_PARAM_CONSTRUCT |
|
G_PARAM_CONSTRUCT |
|
||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_DTSTART,
|
||||||
|
g_param_spec_boxed ("date-start",
|
||||||
|
"Date Start",
|
||||||
|
"The starting date of the event",
|
||||||
|
ICAL_TIME_TYPE,
|
||||||
|
G_PARAM_CONSTRUCT |
|
||||||
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
g_type_class_add_private((gpointer)klass, sizeof(GcalEventWidgetPrivate));
|
g_type_class_add_private((gpointer)klass, sizeof(GcalEventWidgetPrivate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,6 +176,12 @@ gcal_event_widget_set_property (GObject *object,
|
|||||||
|
|
||||||
priv->color = g_value_dup_boxed (value);
|
priv->color = g_value_dup_boxed (value);
|
||||||
return;
|
return;
|
||||||
|
case PROP_DTSTART:
|
||||||
|
if (priv->dt_start != NULL)
|
||||||
|
g_free (priv->dt_start);
|
||||||
|
|
||||||
|
priv->dt_start = g_value_dup_boxed (value);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
@@ -185,6 +205,9 @@ gcal_event_widget_get_property (GObject *object,
|
|||||||
case PROP_COLOR:
|
case PROP_COLOR:
|
||||||
g_value_set_boxed (value, priv->color);
|
g_value_set_boxed (value, priv->color);
|
||||||
return;
|
return;
|
||||||
|
case PROP_DTSTART:
|
||||||
|
g_value_set_boxed (value, priv->dt_start);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
|||||||
+10
-11
@@ -117,15 +117,14 @@ static void gcal_month_view_class_init (GcalMonthViewClass *klass)
|
|||||||
object_class->get_property = gcal_month_view_get_property;
|
object_class->get_property = gcal_month_view_get_property;
|
||||||
object_class->finalize = gcal_month_view_finalize;
|
object_class->finalize = gcal_month_view_finalize;
|
||||||
|
|
||||||
g_object_class_install_property (object_class, PROP_DATE,
|
g_object_class_install_property (object_class,
|
||||||
g_param_spec_pointer ("date",
|
PROP_DATE,
|
||||||
"date",
|
g_param_spec_boxed ("date",
|
||||||
_("Date"),
|
"Date",
|
||||||
G_PARAM_CONSTRUCT |
|
_("Date"),
|
||||||
G_PARAM_READWRITE |
|
ICAL_TIME_TYPE,
|
||||||
G_PARAM_STATIC_NAME |
|
G_PARAM_CONSTRUCT |
|
||||||
G_PARAM_STATIC_BLURB |
|
G_PARAM_READWRITE));
|
||||||
G_PARAM_STATIC_NICK));
|
|
||||||
|
|
||||||
g_type_class_add_private ((gpointer)klass, sizeof (GcalMonthViewPrivate));
|
g_type_class_add_private ((gpointer)klass, sizeof (GcalMonthViewPrivate));
|
||||||
}
|
}
|
||||||
@@ -170,7 +169,7 @@ gcal_month_view_set_property (GObject *object,
|
|||||||
if (priv->date != NULL)
|
if (priv->date != NULL)
|
||||||
g_free (priv->date);
|
g_free (priv->date);
|
||||||
|
|
||||||
priv->date = g_value_get_pointer (value);
|
priv->date = g_value_dup_boxed (value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
@@ -189,7 +188,7 @@ gcal_month_view_get_property (GObject *object,
|
|||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
case PROP_DATE:
|
case PROP_DATE:
|
||||||
g_value_set_pointer (value, priv->date);
|
g_value_set_boxed (value, priv->date);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
|||||||
+3
-1
@@ -18,11 +18,13 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "gcal-utils.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <libedataserverui/e-cell-renderer-color.h>
|
#include <libedataserverui/e-cell-renderer-color.h>
|
||||||
|
|
||||||
#include "gcal-utils.h"
|
G_DEFINE_BOXED_TYPE (icaltimetype, icaltime, gcal_dup_icaltime, g_free)
|
||||||
|
|
||||||
/* taken from eel/eel-gtk-extensions.c */
|
/* taken from eel/eel-gtk-extensions.c */
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ typedef enum
|
|||||||
GCAL_VIEW_TYPE_LIST,
|
GCAL_VIEW_TYPE_LIST,
|
||||||
} GcalViewTypeEnum;
|
} GcalViewTypeEnum;
|
||||||
|
|
||||||
|
#define ICAL_TIME_TYPE (icaltime_get_type ())
|
||||||
|
|
||||||
|
GType icaltime_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
void gcal_gtk_tree_view_set_activate_on_single_click (GtkTreeView *tree_view,
|
void gcal_gtk_tree_view_set_activate_on_single_click (GtkTreeView *tree_view,
|
||||||
gboolean should_activate);
|
gboolean should_activate);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user