[gnome-calendar] build: moved gobject construction to new sugar
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] build: moved gobject construction to new sugar
- Date: Thu, 4 Dec 2014 22:26:27 +0000 (UTC)
commit 1ada96616b91f6fde3d425d7b8dd22fa285e4060
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Sat Jun 29 22:04:14 2013 -0400
build: moved gobject construction to new sugar
Misc formatting fixes
Misc minor refactoring
src/gcal-all-day-grid.c | 49 +++++++--------
src/gcal-all-day-grid.h | 4 -
src/gcal-application.c | 65 ++++++++++-----------
src/gcal-application.h | 3 -
src/gcal-arrow-bin.c | 30 ++++------
src/gcal-arrow-bin.h | 4 -
src/gcal-day-view.c | 46 +++++++--------
src/gcal-day-view.h | 4 -
src/gcal-days-grid.c | 61 ++++++++++----------
src/gcal-days-grid.h | 4 -
src/gcal-event-widget.c | 34 +++++------
src/gcal-event-widget.h | 3 -
src/gcal-manager.c | 135 +++++++++++++++++++------------------------
src/gcal-manager.h | 4 -
src/gcal-nav-bar.c | 19 ++----
src/gcal-nav-bar.h | 4 -
src/gcal-new-event-widget.c | 15 +----
src/gcal-new-event-widget.h | 3 -
src/gcal-viewport.c | 22 +++-----
src/gcal-viewport.h | 4 -
src/gcal-window.c | 80 ++++++++++----------------
src/gcal-window.h | 3 -
src/gcal-year-view.c | 63 +++++++++-----------
src/gcal-year-view.h | 4 -
24 files changed, 270 insertions(+), 393 deletions(-)
---
diff --git a/src/gcal-all-day-grid.c b/src/gcal-all-day-grid.c
index e6fbd82..d3e4894 100644
--- a/src/gcal-all-day-grid.c
+++ b/src/gcal-all-day-grid.c
@@ -39,7 +39,7 @@ struct _ChildInfo
typedef struct _ChildInfo ChildInfo;
-struct _GcalAllDayGridPrivate
+typedef struct
{
/* property */
guint columns_nr;
@@ -49,7 +49,7 @@ struct _GcalAllDayGridPrivate
GList *children;
GdkWindow *event_window;
-};
+} GcalAllDayGridPrivate;
static void gcal_all_day_grid_finalize (GObject *object);
@@ -102,7 +102,7 @@ static void gcal_all_day_grid_forall (GtkContainer *
GtkCallback callback,
gpointer callback_data);
-G_DEFINE_TYPE (GcalAllDayGrid,gcal_all_day_grid, GTK_TYPE_CONTAINER);
+G_DEFINE_TYPE_WITH_PRIVATE (GcalAllDayGrid,gcal_all_day_grid, GTK_TYPE_CONTAINER);
static void
gcal_all_day_grid_class_init (GcalAllDayGridClass *klass)
@@ -157,8 +157,6 @@ gcal_all_day_grid_class_init (GcalAllDayGridClass *klass)
0,
G_PARAM_CONSTRUCT |
G_PARAM_READWRITE));
-
- g_type_class_add_private ((gpointer)klass, sizeof (GcalAllDayGridPrivate));
}
@@ -170,10 +168,7 @@ gcal_all_day_grid_init (GcalAllDayGrid *self)
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- GCAL_TYPE_ALL_DAY_GRID,
- GcalAllDayGridPrivate);
- priv = self->priv;
+ priv = gcal_all_day_grid_get_instance_private (self);
priv->column_headers = NULL;
priv->children = NULL;
}
@@ -184,7 +179,7 @@ gcal_all_day_grid_finalize (GObject *object)
GcalAllDayGridPrivate *priv;
GList *column;
- priv = GCAL_ALL_DAY_GRID (object)->priv;
+ priv = gcal_all_day_grid_get_instance_private (GCAL_ALL_DAY_GRID (object));
if (priv->children != NULL)
{
@@ -211,7 +206,8 @@ gcal_all_day_grid_set_property (GObject *object,
GParamSpec *pspec)
{
GcalAllDayGridPrivate *priv;
- priv = GCAL_ALL_DAY_GRID (object)->priv;
+
+ priv = gcal_all_day_grid_get_instance_private (GCAL_ALL_DAY_GRID (object));
switch (property_id)
{
@@ -241,7 +237,8 @@ gcal_all_day_grid_get_property (GObject *object,
GParamSpec *pspec)
{
GcalAllDayGridPrivate *priv;
- priv = GCAL_ALL_DAY_GRID (object)->priv;
+
+ priv = gcal_all_day_grid_get_instance_private (GCAL_ALL_DAY_GRID (object));
switch (property_id)
{
@@ -274,7 +271,7 @@ gcal_all_day_grid_get_preferred_width (GtkWidget *widget,
PangoLayout *layout;
PangoRectangle logical_rect;
- priv = GCAL_ALL_DAY_GRID (widget)->priv;
+ priv = gcal_all_day_grid_get_instance_private (GCAL_ALL_DAY_GRID (widget));
length = 0;
longest_header = NULL;
@@ -333,7 +330,7 @@ gcal_all_day_grid_get_preferred_height (GtkWidget *widget,
PangoLayout *layout;
PangoRectangle logical_rect;
- priv = GCAL_ALL_DAY_GRID (widget)->priv;
+ priv = gcal_all_day_grid_get_instance_private (GCAL_ALL_DAY_GRID (widget));
layout = gtk_widget_create_pango_layout (widget, "0");
@@ -394,7 +391,7 @@ gcal_all_day_grid_realize (GtkWidget *widget)
gint attributes_mask;
GtkAllocation allocation;
- priv = GCAL_ALL_DAY_GRID (widget)->priv;
+ priv = gcal_all_day_grid_get_instance_private (GCAL_ALL_DAY_GRID (widget));
gtk_widget_set_realized (widget, TRUE);
parent_window = gtk_widget_get_parent_window (widget);
@@ -430,7 +427,7 @@ gcal_all_day_grid_unrealize (GtkWidget *widget)
{
GcalAllDayGridPrivate *priv;
- priv = GCAL_ALL_DAY_GRID (widget)->priv;
+ priv = gcal_all_day_grid_get_instance_private (GCAL_ALL_DAY_GRID (widget));
if (priv->event_window != NULL)
{
gdk_window_set_user_data (priv->event_window, NULL);
@@ -446,7 +443,7 @@ gcal_all_day_grid_map (GtkWidget *widget)
{
GcalAllDayGridPrivate *priv;
- priv = GCAL_ALL_DAY_GRID (widget)->priv;
+ priv = gcal_all_day_grid_get_instance_private (GCAL_ALL_DAY_GRID (widget));
if (priv->event_window != NULL)
gdk_window_show (priv->event_window);
@@ -458,7 +455,7 @@ gcal_all_day_grid_unmap (GtkWidget *widget)
{
GcalAllDayGridPrivate *priv;
- priv = GCAL_ALL_DAY_GRID (widget)->priv;
+ priv = gcal_all_day_grid_get_instance_private (GCAL_ALL_DAY_GRID (widget));
if (priv->event_window != NULL)
gdk_window_hide (priv->event_window);
@@ -485,7 +482,7 @@ gcal_all_day_grid_size_allocate (GtkWidget *widget,
GArray *last_y;
- priv = GCAL_ALL_DAY_GRID (widget)->priv;
+ priv = gcal_all_day_grid_get_instance_private (GCAL_ALL_DAY_GRID (widget));
gtk_widget_set_allocation (widget, allocation);
gtk_style_context_get_padding (
@@ -584,7 +581,7 @@ gcal_all_day_grid_draw (GtkWidget *widget,
GdkRGBA ligther_color;
- priv = GCAL_ALL_DAY_GRID (widget)->priv;
+ priv = gcal_all_day_grid_get_instance_private (GCAL_ALL_DAY_GRID (widget));
gtk_style_context_get_padding (
gtk_widget_get_style_context (widget),
@@ -690,7 +687,7 @@ gcal_all_day_grid_add (GtkContainer *container,
{
GcalAllDayGridPrivate* priv;
- priv = GCAL_ALL_DAY_GRID (container)->priv;
+ priv = gcal_all_day_grid_get_instance_private (GCAL_ALL_DAY_GRID (container));
g_return_if_fail (priv->columns_nr != 0);
gcal_all_day_grid_place (GCAL_ALL_DAY_GRID (container),
@@ -706,7 +703,7 @@ gcal_all_day_grid_remove (GtkContainer *container,
GList *columns;
- priv = GCAL_ALL_DAY_GRID (container)->priv;
+ priv = gcal_all_day_grid_get_instance_private (GCAL_ALL_DAY_GRID (container));
for (columns = priv->children;
columns != NULL;
@@ -743,7 +740,7 @@ gcal_all_day_grid_forall (GtkContainer *container,
GList* columns;
- priv = GCAL_ALL_DAY_GRID (container)->priv;
+ priv = gcal_all_day_grid_get_instance_private (GCAL_ALL_DAY_GRID (container));
columns = priv->children;
while (columns)
@@ -793,7 +790,7 @@ gcal_all_day_grid_set_column_headers (GcalAllDayGrid *all_day,
va_list args;
gint i;
- priv = all_day->priv;
+ priv = gcal_all_day_grid_get_instance_private (all_day);
if (priv->columns_nr == 0)
return;
@@ -836,7 +833,7 @@ gcal_all_day_grid_place (GcalAllDayGrid *all_day,
GList* column;
ChildInfo *info;
- priv = all_day->priv;
+ priv = gcal_all_day_grid_get_instance_private (all_day);
g_return_if_fail (column_idx < priv->columns_nr);
@@ -859,7 +856,7 @@ gcal_all_day_grid_get_by_uuid (GcalAllDayGrid *all_day,
GList* columns;
- priv = all_day->priv;
+ priv = gcal_all_day_grid_get_instance_private (all_day);
columns = priv->children;
while (columns)
diff --git a/src/gcal-all-day-grid.h b/src/gcal-all-day-grid.h
index 69a586a..e5ae23c 100644
--- a/src/gcal-all-day-grid.h
+++ b/src/gcal-all-day-grid.h
@@ -33,14 +33,10 @@ G_BEGIN_DECLS
typedef struct _GcalAllDayGrid GcalAllDayGrid;
typedef struct _GcalAllDayGridClass GcalAllDayGridClass;
-typedef struct _GcalAllDayGridPrivate GcalAllDayGridPrivate;
struct _GcalAllDayGrid
{
GtkContainer parent;
-
- /* add your public declarations here */
- GcalAllDayGridPrivate *priv;
};
struct _GcalAllDayGridClass
diff --git a/src/gcal-application.c b/src/gcal-application.c
index d2001c4..a388366 100644
--- a/src/gcal-application.c
+++ b/src/gcal-application.c
@@ -28,7 +28,7 @@
#define CSS_FILE UI_DATA_DIR "/gtk-styles.css"
-struct _GcalApplicationPrivate
+typedef struct
{
GtkWidget *window;
@@ -37,7 +37,7 @@ struct _GcalApplicationPrivate
GcalManager *manager;
GtkCssProvider *provider;
-};
+} GcalApplicationPrivate;
static void gcal_application_finalize (GObject *object);
@@ -82,7 +82,7 @@ static gboolean gcal_application_window_configured (GtkWidget *
GdkEvent *event,
gpointer user_data);
-G_DEFINE_TYPE (GcalApplication, gcal_application, GTK_TYPE_APPLICATION);
+G_DEFINE_TYPE_WITH_PRIVATE (GcalApplication, gcal_application, GTK_TYPE_APPLICATION);
static gboolean show_version = FALSE;
@@ -108,16 +108,11 @@ gcal_application_class_init (GcalApplicationClass *klass)
application_class->activate = gcal_application_activate;
application_class->startup = gcal_application_startup;
application_class->command_line = gcal_application_command_line;
-
- g_type_class_add_private ((gpointer) klass, sizeof(GcalApplicationPrivate));
}
static void
gcal_application_init (GcalApplication *self)
{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- GCAL_TYPE_APPLICATION,
- GcalApplicationPrivate);
}
static void
@@ -125,8 +120,7 @@ gcal_application_finalize (GObject *object)
{
GcalApplicationPrivate *priv;
- g_return_if_fail (GCAL_IS_APPLICATION (object));
- priv = GCAL_APPLICATION (object)->priv;
+ priv = gcal_application_get_instance_private (GCAL_APPLICATION (object));
g_clear_object (&(priv->settings));
@@ -138,7 +132,8 @@ static void
gcal_application_activate (GApplication *application)
{
GcalApplicationPrivate *priv;
- priv = GCAL_APPLICATION (application)->priv;
+
+ priv = gcal_application_get_instance_private (GCAL_APPLICATION (application));
if (priv->window != NULL)
{
@@ -203,7 +198,8 @@ gcal_application_startup (GApplication *app)
{
GcalApplicationPrivate *priv;
GError *error;
- priv = GCAL_APPLICATION (app)->priv;
+
+ priv = gcal_application_get_instance_private (GCAL_APPLICATION (app));
G_APPLICATION_CLASS (gcal_application_parent_class)->startup (app);
@@ -282,8 +278,7 @@ gcal_application_set_app_menu (GApplication *app)
GSimpleAction *about;
GSimpleAction *quit;
- g_return_if_fail (GCAL_IS_APPLICATION (app));
- priv = GCAL_APPLICATION (app)->priv;
+ priv = gcal_application_get_instance_private (GCAL_APPLICATION (app));
app_menu = g_menu_new ();
@@ -343,7 +338,7 @@ gcal_application_create_new_event (GSimpleAction *new_event,
{
GcalApplicationPrivate *priv;
- priv = GCAL_APPLICATION (app)->priv;
+ priv = gcal_application_get_instance_private (GCAL_APPLICATION (app));
gcal_window_new_event (GCAL_WINDOW (priv->window));
}
@@ -355,7 +350,7 @@ gcal_application_launch_search (GSimpleAction *search,
{
GcalApplicationPrivate *priv;
- priv = GCAL_APPLICATION (app)->priv;
+ priv = gcal_application_get_instance_private (GCAL_APPLICATION (app));
gcal_window_set_search_mode (GCAL_WINDOW (priv->window), TRUE);
}
@@ -367,8 +362,7 @@ gcal_application_change_view (GSimpleAction *simple,
{
GcalApplicationPrivate *priv;
- g_return_if_fail (GCAL_IS_APPLICATION (user_data));
- priv = GCAL_APPLICATION (user_data)->priv;
+ priv = gcal_application_get_instance_private (GCAL_APPLICATION (user_data));
g_settings_set_value (priv->settings, "active-view", parameter);
}
@@ -378,7 +372,7 @@ gcal_application_show_about (GSimpleAction *simple,
GVariant *parameter,
gpointer user_data)
{
- GcalApplication *app = GCAL_APPLICATION (user_data);
+ GcalApplicationPrivate *priv;
char *copyright;
GDateTime *date;
int created_year = 2012;
@@ -392,6 +386,7 @@ gcal_application_show_about (GSimpleAction *simple,
NULL
};
+ priv = gcal_application_get_instance_private (GCAL_APPLICATION (user_data));
date = g_date_time_new_now_local ();
if (g_date_time_get_year (date) == created_year)
@@ -407,7 +402,7 @@ gcal_application_show_about (GSimpleAction *simple,
created_year, g_date_time_get_year (date));
}
- gtk_show_about_dialog (GTK_WINDOW (app->priv->window),
+ gtk_show_about_dialog (GTK_WINDOW (priv->window),
"program-name", _("Calendar"),
"version", VERSION,
"copyright", copyright,
@@ -426,9 +421,7 @@ gcal_application_quit (GSimpleAction *simple,
GVariant *parameter,
gpointer user_data)
{
- GApplication *app = G_APPLICATION (user_data);
-
- g_application_quit (app);
+ g_application_quit (G_APPLICATION (user_data));
}
static void
@@ -438,8 +431,7 @@ gcal_application_changed_view (GSettings *settings,
{
GcalApplicationPrivate *priv;
- g_return_if_fail (GCAL_IS_APPLICATION (user_data));
- priv = GCAL_APPLICATION (user_data)->priv;
+ priv = gcal_application_get_instance_private (GCAL_APPLICATION (user_data));
g_simple_action_set_state (priv->view,
g_settings_get_value (priv->settings,
"active-view"));
@@ -454,7 +446,7 @@ gcal_application_window_state_changed (GtkWidget *widget,
GdkWindowState state;
gboolean maximized;
- priv = GCAL_APPLICATION (user_data)->priv;
+ priv = gcal_application_get_instance_private (GCAL_APPLICATION (user_data));
state = gdk_window_get_state (gtk_widget_get_window (widget));
maximized = state & GDK_WINDOW_STATE_MAXIMIZED;
@@ -474,7 +466,7 @@ gcal_application_window_configured (GtkWidget *widget,
gint32 size[2];
gint32 position[2];
- priv = GCAL_APPLICATION (user_data)->priv;
+ priv = gcal_application_get_instance_private (GCAL_APPLICATION (user_data));
state = gdk_window_get_state (gtk_widget_get_window (widget));
if (state & GDK_WINDOW_STATE_MAXIMIZED)
return FALSE;
@@ -503,6 +495,7 @@ GcalApplication*
gcal_application_new (void)
{
GcalApplication *app;
+ GcalApplicationPrivate *priv;
g_set_application_name ("Calendar");
@@ -510,8 +503,10 @@ gcal_application_new (void)
"application-id", "org.gnome.Calendar",
"flags", G_APPLICATION_HANDLES_COMMAND_LINE,
NULL);
- app->priv->settings = g_settings_new ("org.gnome.calendar");
- g_signal_connect (app->priv->settings,
+
+ priv = gcal_application_get_instance_private (app);
+ priv->settings = g_settings_new ("org.gnome.calendar");
+ g_signal_connect (priv->settings,
"changed::active-view",
G_CALLBACK (gcal_application_changed_view),
app);
@@ -521,13 +516,17 @@ gcal_application_new (void)
GcalManager*
gcal_application_get_manager (GcalApplication *app)
{
- g_return_val_if_fail (GCAL_IS_APPLICATION (app), NULL);
- return app->priv->manager;
+ GcalApplicationPrivate *priv;
+
+ priv = gcal_application_get_instance_private (app);
+ return priv->manager;
}
GSettings*
gcal_application_get_settings (GcalApplication *app)
{
- g_return_val_if_fail (GCAL_IS_APPLICATION (app), NULL);
- return app->priv->settings;
+ GcalApplicationPrivate *priv;
+
+ priv = gcal_application_get_instance_private (app);
+ return priv->settings;
}
diff --git a/src/gcal-application.h b/src/gcal-application.h
index f5e4f14..c270677 100644
--- a/src/gcal-application.h
+++ b/src/gcal-application.h
@@ -35,7 +35,6 @@ G_BEGIN_DECLS
typedef struct _GcalApplicationClass GcalApplicationClass;
typedef struct _GcalApplication GcalApplication;
-typedef struct _GcalApplicationPrivate GcalApplicationPrivate;
struct _GcalApplicationClass
{
@@ -45,8 +44,6 @@ struct _GcalApplicationClass
struct _GcalApplication
{
GtkApplication parent_instance;
-
- GcalApplicationPrivate *priv;
};
GType gcal_application_get_type (void) G_GNUC_CONST;
diff --git a/src/gcal-arrow-bin.c b/src/gcal-arrow-bin.c
index b200b90..73f8003 100644
--- a/src/gcal-arrow-bin.c
+++ b/src/gcal-arrow-bin.c
@@ -27,11 +27,11 @@ struct _GPoint
typedef struct _GPoint GPoint;
-struct _GcalArrowBinPrivate
+typedef struct
{
GtkPositionType arrow_position;
gdouble arrow_align;
-};
+} GcalArrowBinPrivate;
enum
{
@@ -81,7 +81,7 @@ static void gcal_arrow_bin_size_allocate (GtkWidget *
static gboolean gcal_arrow_bin_draw (GtkWidget *widget,
cairo_t *cr);
-G_DEFINE_TYPE(GcalArrowBin, gcal_arrow_bin, GTK_TYPE_BIN)
+G_DEFINE_TYPE_WITH_PRIVATE (GcalArrowBin, gcal_arrow_bin, GTK_TYPE_BIN)
static void
get_padding_and_border (GtkWidget *widget,
@@ -138,7 +138,7 @@ draw_arrow (GtkWidget *widget,
GPoint p3 = { 0, 0 };
GPoint p4 = { 0, 0 };
- priv = GCAL_ARROW_BIN (widget)->priv;
+ priv = gcal_arrow_bin_get_instance_private (GCAL_ARROW_BIN (widget));
gtk_style_context_get_border (gtk_widget_get_style_context (widget),
gtk_widget_get_state_flags (widget),
@@ -334,18 +334,12 @@ gcal_arrow_bin_class_init (GcalArrowBinClass *klass)
G_MAXUINT32,
0,
G_PARAM_READABLE));
-
- g_type_class_add_private ((gpointer)klass, sizeof(GcalArrowBinPrivate));
}
static void
gcal_arrow_bin_init (GcalArrowBin *self)
{
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
-
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- GCAL_TYPE_ARROW_BIN,
- GcalArrowBinPrivate);
}
static void
@@ -356,7 +350,7 @@ gcal_arrow_bin_set_property (GObject *object,
{
GcalArrowBinPrivate *priv;
- priv = GCAL_ARROW_BIN (object)->priv;
+ priv = gcal_arrow_bin_get_instance_private (GCAL_ARROW_BIN (object));
switch (property_id)
{
@@ -380,7 +374,7 @@ gcal_arrow_bin_get_property (GObject *object,
{
GcalArrowBinPrivate *priv;
- priv = GCAL_ARROW_BIN (object)->priv;
+ priv = gcal_arrow_bin_get_instance_private (GCAL_ARROW_BIN (object));
switch (property_id)
{
@@ -408,7 +402,7 @@ gcal_arrow_bin_get_preferred_width (GtkWidget *widget,
gint minimum, natural;
guint arrow_size;
- priv = GCAL_ARROW_BIN (widget)->priv;
+ priv = gcal_arrow_bin_get_instance_private (GCAL_ARROW_BIN (widget));
get_padding_and_border (widget, &padding, &arrow_size);
minimum = 0;
@@ -455,7 +449,7 @@ gcal_arrow_bin_get_preferred_height_for_width (GtkWidget *widget,
gint minimum;
gint natural;
- priv = GCAL_ARROW_BIN (widget)->priv;
+ priv = gcal_arrow_bin_get_instance_private (GCAL_ARROW_BIN (widget));
get_padding_and_border (widget, &padding, &arrow_size);
@@ -505,7 +499,7 @@ gcal_arrow_bin_get_preferred_height (GtkWidget *widget,
gint minimum;
gint natural;
- priv = GCAL_ARROW_BIN (widget)->priv;
+ priv = gcal_arrow_bin_get_instance_private (GCAL_ARROW_BIN (widget));
get_padding_and_border (widget, &padding, &arrow_size);
@@ -554,7 +548,7 @@ gcal_arrow_bin_get_preferred_width_for_height (GtkWidget *widget,
gint minimum;
gint natural;
- priv = GCAL_ARROW_BIN (widget)->priv;
+ priv = gcal_arrow_bin_get_instance_private (GCAL_ARROW_BIN (widget));
get_padding_and_border (widget, &padding, &arrow_size);
@@ -601,7 +595,7 @@ gcal_arrow_bin_size_allocate (GtkWidget *widget,
GtkWidget *child;
guint arrow_size;
- priv = GCAL_ARROW_BIN (widget)->priv;
+ priv = gcal_arrow_bin_get_instance_private (GCAL_ARROW_BIN (widget));
gtk_widget_set_allocation (widget, allocation);
@@ -653,7 +647,7 @@ gcal_arrow_bin_draw (GtkWidget *widget,
gdouble arrow_start_point;
gdouble x, y;
- priv = GCAL_ARROW_BIN (widget)->priv;
+ priv = gcal_arrow_bin_get_instance_private (GCAL_ARROW_BIN (widget));
gtk_style_context_get_border (gtk_widget_get_style_context (widget),
gtk_widget_get_state_flags (widget),
diff --git a/src/gcal-arrow-bin.h b/src/gcal-arrow-bin.h
index b8f143d..138829d 100644
--- a/src/gcal-arrow-bin.h
+++ b/src/gcal-arrow-bin.h
@@ -34,14 +34,10 @@ G_BEGIN_DECLS
typedef struct _GcalArrowBin GcalArrowBin;
typedef struct _GcalArrowBinClass GcalArrowBinClass;
-typedef struct _GcalArrowBinPrivate GcalArrowBinPrivate;
struct _GcalArrowBin
{
GtkBin parent;
- /* add your public declarations here */
-
- GcalArrowBinPrivate *priv;
};
struct _GcalArrowBinClass
diff --git a/src/gcal-day-view.c b/src/gcal-day-view.c
index d46880c..863d536 100644
--- a/src/gcal-day-view.c
+++ b/src/gcal-day-view.c
@@ -36,7 +36,7 @@ enum
PROP_DATE
};
-struct _GcalDayViewPrivate
+typedef struct
{
/* property */
icaltimetype *date;
@@ -47,7 +47,7 @@ struct _GcalDayViewPrivate
/* events widgets parents */
GtkWidget *all_day_grid;
GtkWidget *day_grid;
-};
+} GcalDayViewPrivate;
static void viewport_shown (GtkWidget *widget,
gpointer user_data);
@@ -94,6 +94,7 @@ static void gcal_day_view_clear (GcalView *view)
G_DEFINE_TYPE_WITH_CODE (GcalDayView,
gcal_day_view,
GTK_TYPE_GRID,
+ G_ADD_PRIVATE (GcalDayView)
G_IMPLEMENT_INTERFACE (GCAL_TYPE_VIEW,
gcal_view_interface_init));
@@ -105,7 +106,7 @@ viewport_shown (GtkWidget *widget,
icaltimetype date;
gdouble value;
- priv = GCAL_DAY_VIEW (user_data)->priv;
+ priv = gcal_day_view_get_instance_private (GCAL_DAY_VIEW (user_data));
if (priv->date == NULL)
return;
@@ -138,8 +139,6 @@ gcal_day_view_class_init (GcalDayViewClass *klass)
/* gtk_container_class_handle_border_width (container_class); */
g_object_class_override_property (object_class, PROP_DATE, "active-date");
-
- g_type_class_add_private ((gpointer)klass, sizeof (GcalDayViewPrivate));
}
@@ -147,9 +146,6 @@ gcal_day_view_class_init (GcalDayViewClass *klass)
static void
gcal_day_view_init (GcalDayView *self)
{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- GCAL_TYPE_DAY_VIEW,
- GcalDayViewPrivate);
}
static void
@@ -173,8 +169,7 @@ gcal_day_view_constructed (GObject *object)
{
GcalDayViewPrivate *priv;
- g_return_if_fail (GCAL_IS_DAY_VIEW (object));
- priv = GCAL_DAY_VIEW (object)->priv;
+ priv = gcal_day_view_get_instance_private (GCAL_DAY_VIEW (object));
if (G_OBJECT_CLASS (gcal_day_view_parent_class)->constructed != NULL)
G_OBJECT_CLASS (gcal_day_view_parent_class)->constructed (object);
@@ -226,7 +221,8 @@ gcal_day_view_constructed (GObject *object)
static void
gcal_day_view_finalize (GObject *object)
{
- GcalDayViewPrivate *priv = GCAL_DAY_VIEW (object)->priv;
+ GcalDayViewPrivate *priv;
+ priv = gcal_day_view_get_instance_private (GCAL_DAY_VIEW (object));
if (priv->date != NULL)
g_free (priv->date);
@@ -243,7 +239,7 @@ gcal_day_view_set_property (GObject *object,
{
GcalDayViewPrivate *priv;
- priv = GCAL_DAY_VIEW (object)->priv;
+ priv = gcal_day_view_get_instance_private (GCAL_DAY_VIEW (object));
switch (property_id)
{
@@ -261,13 +257,13 @@ gcal_day_view_set_property (GObject *object,
static void
gcal_day_view_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
GcalDayViewPrivate *priv;
- priv = GCAL_DAY_VIEW (object)->priv;
+ priv = gcal_day_view_get_instance_private (GCAL_DAY_VIEW (object));
switch (property_id)
{
@@ -293,7 +289,7 @@ gcal_day_view_add (GtkContainer *container,
g_return_if_fail (GCAL_IS_EVENT_WIDGET (widget));
g_return_if_fail (gtk_widget_get_parent (widget) == NULL);
- priv = GCAL_DAY_VIEW (container)->priv;
+ priv = gcal_day_view_get_instance_private (GCAL_DAY_VIEW (container));
summ = gcal_event_widget_get_summary (GCAL_EVENT_WIDGET (widget));
@@ -357,7 +353,7 @@ gcal_day_view_remove (GtkContainer *container,
{
GcalDayViewPrivate *priv;
- priv = GCAL_DAY_VIEW (container)->priv;
+ priv = gcal_day_view_get_instance_private (GCAL_DAY_VIEW (container));
if (gtk_widget_get_parent (widget) == (GtkWidget*) container)
{
@@ -378,7 +374,7 @@ gcal_day_view_get_initial_date (GcalView *view)
GcalDayViewPrivate *priv;
icaltimetype *new_date;
- priv = GCAL_DAY_VIEW (view)->priv;
+ priv = gcal_day_view_get_instance_private (GCAL_DAY_VIEW (view));
new_date = g_new0 (icaltimetype, 1);
*new_date = *(priv->date);
new_date->hour = 0;
@@ -402,7 +398,7 @@ gcal_day_view_get_final_date (GcalView *view)
GcalDayViewPrivate *priv;
icaltimetype *new_date;
- priv = GCAL_DAY_VIEW (view)->priv;
+ priv = gcal_day_view_get_instance_private (GCAL_DAY_VIEW (view));
new_date = g_new0 (icaltimetype, 1);
*new_date = *(priv->date);
@@ -427,7 +423,7 @@ gcal_day_view_draw_event (GcalView *view,
gint left_boundary;
gint right_boundary;
- priv = GCAL_DAY_VIEW (view)->priv;
+ priv = gcal_day_view_get_instance_private (GCAL_DAY_VIEW (view));
first_day = gcal_day_view_get_initial_date (view);
last_day = gcal_day_view_get_final_date (view);
@@ -453,7 +449,7 @@ gcal_day_view_get_left_header (GcalView *view)
struct tm tm_date;
- priv = GCAL_DAY_VIEW (view)->priv;
+ priv = gcal_day_view_get_instance_private (GCAL_DAY_VIEW (view));
tm_date = icaltimetype_to_tm (priv->date);
e_utf8_strftime_fix_am_pm (str_date, 64, "%A %B", &tm_date);
@@ -466,7 +462,7 @@ gcal_day_view_get_right_header (GcalView *view)
{
GcalDayViewPrivate *priv;
- priv = GCAL_DAY_VIEW (view)->priv;
+ priv = gcal_day_view_get_instance_private (GCAL_DAY_VIEW (view));
return g_strdup_printf ("%d", priv->date->year);
}
@@ -478,7 +474,7 @@ gcal_day_view_get_by_uuid (GcalView *view,
GcalDayViewPrivate *priv;
GtkWidget *widget;
- priv = GCAL_DAY_VIEW (view)->priv;
+ priv = gcal_day_view_get_instance_private (GCAL_DAY_VIEW (view));
widget =
gcal_all_day_grid_get_by_uuid (GCAL_ALL_DAY_GRID (priv->all_day_grid),
@@ -500,7 +496,7 @@ gcal_day_view_clear (GcalView *view)
{
GcalDayViewPrivate *priv;
- priv = GCAL_DAY_VIEW (view)->priv;
+ priv = gcal_day_view_get_instance_private (GCAL_DAY_VIEW (view));
gtk_container_foreach (GTK_CONTAINER (priv->all_day_grid),
(GtkCallback) gtk_widget_destroy, NULL);
diff --git a/src/gcal-day-view.h b/src/gcal-day-view.h
index 418a7d2..c564cd3 100644
--- a/src/gcal-day-view.h
+++ b/src/gcal-day-view.h
@@ -33,14 +33,10 @@ G_BEGIN_DECLS
typedef struct _GcalDayView GcalDayView;
typedef struct _GcalDayViewClass GcalDayViewClass;
-typedef struct _GcalDayViewPrivate GcalDayViewPrivate;
struct _GcalDayView
{
GtkGrid parent;
-
- /* add your public declarations here */
- GcalDayViewPrivate *priv;
};
struct _GcalDayViewClass
diff --git a/src/gcal-days-grid.c b/src/gcal-days-grid.c
index c2a7443..a80e4ed 100644
--- a/src/gcal-days-grid.c
+++ b/src/gcal-days-grid.c
@@ -61,7 +61,7 @@ struct _ChildInfo
typedef struct _ChildInfo ChildInfo;
-struct _GcalDaysGridPrivate
+typedef struct
{
/* property */
guint columns_nr;
@@ -74,7 +74,7 @@ struct _GcalDaysGridPrivate
GList *children;
GdkWindow *event_window;
-};
+} GcalDaysGridPrivate;
/* Helpers and private */
static gint compare_child_info (gconstpointer a,
@@ -132,7 +132,7 @@ static void gcal_days_grid_forall (GtkContainer *con
gpointer callback_data);
-G_DEFINE_TYPE (GcalDaysGrid,gcal_days_grid, GTK_TYPE_CONTAINER);
+G_DEFINE_TYPE_WITH_PRIVATE (GcalDaysGrid,gcal_days_grid, GTK_TYPE_CONTAINER);
/* Helpers and private */
static gint
@@ -176,7 +176,7 @@ gcal_days_grid_class_init (GcalDaysGridClass *klass)
widget_class->button_release_event = gcal_days_grid_button_release_event;
container_class = GTK_CONTAINER_CLASS (klass);
- container_class->add = gcal_days_grid_add;
+ container_class->add = gcal_days_grid_add;
container_class->remove = gcal_days_grid_remove;
container_class->forall = gcal_days_grid_forall;
gtk_container_class_handle_border_width (container_class);
@@ -214,8 +214,6 @@ gcal_days_grid_class_init (GcalDaysGridClass *klass)
FALSE,
G_PARAM_CONSTRUCT |
G_PARAM_READWRITE));
-
- g_type_class_add_private ((gpointer)klass, sizeof (GcalDaysGridPrivate));
}
@@ -227,10 +225,7 @@ gcal_days_grid_init (GcalDaysGrid *self)
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- GCAL_TYPE_DAYS_GRID,
- GcalDaysGridPrivate);
- priv = self->priv;
+ priv = gcal_days_grid_get_instance_private (self);
priv->scale_width = 0;
priv->req_cell_height = 0;
@@ -242,7 +237,7 @@ gcal_days_grid_finalize (GObject *object)
{
GcalDaysGridPrivate *priv;
- priv = GCAL_DAYS_GRID (object)->priv;
+ priv = gcal_days_grid_get_instance_private (GCAL_DAYS_GRID (object));
if (priv->children != NULL)
g_list_free_full (priv->children, (GDestroyNotify) g_list_free);
@@ -258,7 +253,8 @@ gcal_days_grid_set_property (GObject *object,
GParamSpec *pspec)
{
GcalDaysGridPrivate *priv;
- priv = GCAL_DAYS_GRID (object)->priv;
+
+ priv = gcal_days_grid_get_instance_private (GCAL_DAYS_GRID (object));
switch (property_id)
{
@@ -291,7 +287,8 @@ gcal_days_grid_get_property (GObject *object,
GParamSpec *pspec)
{
GcalDaysGridPrivate *priv;
- priv = GCAL_DAYS_GRID (object)->priv;
+
+ priv = gcal_days_grid_get_instance_private (GCAL_DAYS_GRID (object));
switch (property_id)
{
@@ -328,7 +325,7 @@ gcal_days_grid_get_preferred_width (GtkWidget *widget,
gint min_keeper;
gint min_width;
- priv = GCAL_DAYS_GRID (widget)->priv;
+ priv = gcal_days_grid_get_instance_private (GCAL_DAYS_GRID (widget));
gtk_style_context_get_padding (gtk_widget_get_style_context (widget),
gtk_widget_get_state_flags (widget),
@@ -383,7 +380,7 @@ gcal_days_grid_get_preferred_height (GtkWidget *widget,
GtkBorder padding;
- priv = GCAL_DAYS_GRID (widget)->priv;
+ priv = gcal_days_grid_get_instance_private (GCAL_DAYS_GRID (widget));
gtk_style_context_get_padding (gtk_widget_get_style_context (widget),
gtk_widget_get_state_flags (widget),
@@ -408,7 +405,7 @@ gcal_days_grid_realize (GtkWidget *widget)
gint attributes_mask;
GtkAllocation allocation;
- priv = GCAL_DAYS_GRID (widget)->priv;
+ priv = gcal_days_grid_get_instance_private (GCAL_DAYS_GRID (widget));
gtk_widget_set_realized (widget, TRUE);
parent_window = gtk_widget_get_parent_window (widget);
@@ -444,7 +441,7 @@ gcal_days_grid_unrealize (GtkWidget *widget)
{
GcalDaysGridPrivate *priv;
- priv = GCAL_DAYS_GRID (widget)->priv;
+ priv = gcal_days_grid_get_instance_private (GCAL_DAYS_GRID (widget));
if (priv->event_window != NULL)
{
gdk_window_set_user_data (priv->event_window, NULL);
@@ -460,7 +457,7 @@ gcal_days_grid_map (GtkWidget *widget)
{
GcalDaysGridPrivate *priv;
- priv = GCAL_DAYS_GRID (widget)->priv;
+ priv = gcal_days_grid_get_instance_private (GCAL_DAYS_GRID (widget));
if (priv->event_window != NULL)
gdk_window_show (priv->event_window);
@@ -472,7 +469,7 @@ gcal_days_grid_unmap (GtkWidget *widget)
{
GcalDaysGridPrivate *priv;
- priv = GCAL_DAYS_GRID (widget)->priv;
+ priv = gcal_days_grid_get_instance_private (GCAL_DAYS_GRID (widget));
if (priv->event_window != NULL)
gdk_window_hide (priv->event_window);
@@ -494,7 +491,7 @@ gcal_days_grid_size_allocate (GtkWidget *widget,
GList *columns;
gint idx;
- priv = GCAL_DAYS_GRID (widget)->priv;
+ priv = gcal_days_grid_get_instance_private (GCAL_DAYS_GRID (widget));
gtk_widget_set_allocation (widget, allocation);
/* Placing the event_window */
@@ -604,7 +601,7 @@ gcal_days_grid_draw (GtkWidget *widget,
gint i;
- priv = GCAL_DAYS_GRID (widget)->priv;
+ priv = gcal_days_grid_get_instance_private (GCAL_DAYS_GRID (widget));
gtk_style_context_get_padding (
gtk_widget_get_style_context (widget),
@@ -741,7 +738,7 @@ gcal_days_grid_add (GtkContainer *container,
{
GcalDaysGridPrivate* priv;
- priv = GCAL_DAYS_GRID (container)->priv;
+ priv = gcal_days_grid_get_instance_private (GCAL_DAYS_GRID (container));
g_return_if_fail (priv->columns_nr != 0);
gcal_days_grid_place (GCAL_DAYS_GRID (container),
@@ -757,7 +754,7 @@ gcal_days_grid_remove (GtkContainer *container,
GList *columns;
- priv = GCAL_DAYS_GRID (container)->priv;
+ priv = gcal_days_grid_get_instance_private (GCAL_DAYS_GRID (container));
for (columns = priv->children;
columns != NULL;
@@ -795,7 +792,7 @@ gcal_days_grid_forall (GtkContainer *container,
GList* columns;
- priv = GCAL_DAYS_GRID (container)->priv;
+ priv = gcal_days_grid_get_instance_private (GCAL_DAYS_GRID (container));
columns = priv->children;
while (columns)
@@ -834,7 +831,8 @@ gcal_days_grid_set_preferred_cell_height (GcalDaysGrid *days_grid,
guint cell_height)
{
GcalDaysGridPrivate *priv;
- priv = days_grid->priv;
+
+ priv = gcal_days_grid_get_instance_private (days_grid);
priv->req_cell_height = cell_height;
}
@@ -843,7 +841,8 @@ guint
gcal_days_grid_get_scale_width (GcalDaysGrid *days_grid)
{
GcalDaysGridPrivate *priv;
- priv = days_grid->priv;
+
+ priv = gcal_days_grid_get_instance_private (days_grid);
if (priv->scale_width == 0)
{
@@ -876,7 +875,7 @@ gcal_days_grid_get_scale_width (GcalDaysGrid *days_grid)
/**
* gcal_days_grid_place:
- * @all_day: a #GcalDaysGrid widget
+ * @days_grid: a #GcalDaysGrid widget
* @widget: the child widget to add
* @column_idx: the index of the column, starting with zero
* @start_cell: the start-cell, refering the hour, starting with zero
@@ -887,7 +886,7 @@ gcal_days_grid_get_scale_width (GcalDaysGrid *days_grid)
* it will do nothing.
**/
void
-gcal_days_grid_place (GcalDaysGrid *all_day,
+gcal_days_grid_place (GcalDaysGrid *days_grid,
GtkWidget *widget,
guint column_idx,
guint start_cell,
@@ -898,7 +897,7 @@ gcal_days_grid_place (GcalDaysGrid *all_day,
GList* column;
ChildInfo *info;
- priv = all_day->priv;
+ priv = gcal_days_grid_get_instance_private (days_grid);
g_return_if_fail (column_idx < priv->columns_nr);
@@ -913,7 +912,7 @@ gcal_days_grid_place (GcalDaysGrid *all_day,
info->sub_column = 0;
children_link->data = g_list_insert_sorted (column, info, compare_child_info);
- gtk_widget_set_parent (widget, GTK_WIDGET (all_day));
+ gtk_widget_set_parent (widget, GTK_WIDGET (days_grid));
}
GtkWidget*
@@ -924,7 +923,7 @@ gcal_days_grid_get_by_uuid (GcalDaysGrid *days_grid,
GList* columns;
- priv = days_grid->priv;
+ priv = gcal_days_grid_get_instance_private (days_grid);
columns = priv->children;
while (columns)
diff --git a/src/gcal-days-grid.h b/src/gcal-days-grid.h
index d7cb89e..712d8ea 100644
--- a/src/gcal-days-grid.h
+++ b/src/gcal-days-grid.h
@@ -33,14 +33,10 @@ G_BEGIN_DECLS
typedef struct _GcalDaysGrid GcalDaysGrid;
typedef struct _GcalDaysGridClass GcalDaysGridClass;
-typedef struct _GcalDaysGridPrivate GcalDaysGridPrivate;
struct _GcalDaysGrid
{
GtkContainer parent;
-
- /* add your public declarations here */
- GcalDaysGridPrivate *priv;
};
struct _GcalDaysGridClass
diff --git a/src/gcal-event-widget.c b/src/gcal-event-widget.c
index e9ad2be..28c76d9 100644
--- a/src/gcal-event-widget.c
+++ b/src/gcal-event-widget.c
@@ -20,7 +20,7 @@
#include "gcal-event-widget.h"
#include "gcal-utils.h"
-struct _GcalEventWidgetPrivate
+typedef struct
{
/* properties */
gchar *uuid;
@@ -32,7 +32,7 @@ struct _GcalEventWidgetPrivate
gboolean has_reminders;
GdkWindow *event_window;
-};
+} GcalEventWidgetPrivate;
enum
{
@@ -91,7 +91,7 @@ static gboolean gcal_event_widget_draw (GtkWidget *widget,
static gboolean gcal_event_widget_button_press_event (GtkWidget *widget,
GdkEventButton *event);
-G_DEFINE_TYPE(GcalEventWidget, gcal_event_widget, GTK_TYPE_WIDGET)
+G_DEFINE_TYPE_WITH_PRIVATE (GcalEventWidget, gcal_event_widget, GTK_TYPE_WIDGET)
static void
gcal_event_widget_class_init(GcalEventWidgetClass *klass)
@@ -187,17 +187,11 @@ gcal_event_widget_class_init(GcalEventWidgetClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
-
- g_type_class_add_private((gpointer)klass, sizeof(GcalEventWidgetPrivate));
}
static void
gcal_event_widget_init(GcalEventWidget *self)
{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self,
- GCAL_TYPE_EVENT_WIDGET,
- GcalEventWidgetPrivate);
-
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
@@ -211,7 +205,7 @@ gcal_event_widget_constructed (GObject *object)
{
GcalEventWidgetPrivate *priv;
- priv = GCAL_EVENT_WIDGET (object)->priv;
+ priv = gcal_event_widget_get_instance_private (GCAL_EVENT_WIDGET (object));
if (G_OBJECT_CLASS (gcal_event_widget_parent_class)->constructed != NULL)
G_OBJECT_CLASS (gcal_event_widget_parent_class)->constructed (object);
@@ -227,7 +221,7 @@ gcal_event_widget_set_property (GObject *object,
{
GcalEventWidgetPrivate *priv;
- priv = GCAL_EVENT_WIDGET (object)->priv;
+ priv = gcal_event_widget_get_instance_private (GCAL_EVENT_WIDGET (object));
switch (property_id)
{
@@ -284,7 +278,7 @@ gcal_event_widget_get_property (GObject *object,
{
GcalEventWidgetPrivate *priv;
- priv = GCAL_EVENT_WIDGET (object)->priv;
+ priv = gcal_event_widget_get_instance_private (GCAL_EVENT_WIDGET (object));
switch (property_id)
{
@@ -379,7 +373,7 @@ gcal_event_widget_realize (GtkWidget *widget)
gint attributes_mask;
GtkAllocation allocation;
- priv = GCAL_EVENT_WIDGET (widget)->priv;
+ priv = gcal_event_widget_get_instance_private (GCAL_EVENT_WIDGET (widget));
gtk_widget_set_realized (widget, TRUE);
parent_window = gtk_widget_get_parent_window (widget);
@@ -416,7 +410,7 @@ gcal_event_widget_unrealize (GtkWidget *widget)
{
GcalEventWidgetPrivate *priv;
- priv = GCAL_EVENT_WIDGET (widget)->priv;
+ priv = gcal_event_widget_get_instance_private (GCAL_EVENT_WIDGET (widget));
if (priv->event_window != NULL)
{
gdk_window_set_user_data (priv->event_window, NULL);
@@ -432,7 +426,7 @@ gcal_event_widget_map (GtkWidget *widget)
{
GcalEventWidgetPrivate *priv;
- priv = GCAL_EVENT_WIDGET (widget)->priv;
+ priv = gcal_event_widget_get_instance_private (GCAL_EVENT_WIDGET (widget));
GTK_WIDGET_CLASS (gcal_event_widget_parent_class)->map (widget);
@@ -445,7 +439,7 @@ gcal_event_widget_unmap (GtkWidget *widget)
{
GcalEventWidgetPrivate *priv;
- priv = GCAL_EVENT_WIDGET (widget)->priv;
+ priv = gcal_event_widget_get_instance_private (GCAL_EVENT_WIDGET (widget));
GTK_WIDGET_CLASS (gcal_event_widget_parent_class)->unmap (widget);
@@ -459,7 +453,7 @@ gcal_event_widget_size_allocate (GtkWidget *widget,
{
GcalEventWidgetPrivate *priv;
- priv = GCAL_EVENT_WIDGET (widget)->priv;
+ priv = gcal_event_widget_get_instance_private (GCAL_EVENT_WIDGET (widget));
gtk_widget_set_allocation (widget, allocation);
if (gtk_widget_get_realized (widget))
@@ -489,7 +483,7 @@ gcal_event_widget_draw (GtkWidget *widget,
PangoFontDescription *font_desc;
GdkRGBA fg_color;
- priv = GCAL_EVENT_WIDGET (widget)->priv;
+ priv = gcal_event_widget_get_instance_private (GCAL_EVENT_WIDGET (widget));
context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
@@ -593,7 +587,7 @@ const gchar*
gcal_event_widget_peek_uuid (GcalEventWidget *event)
{
GcalEventWidgetPrivate *priv;
- priv = event->priv;
+ priv = gcal_event_widget_get_instance_private (event);
return priv->uuid;
}
@@ -674,7 +668,7 @@ gcal_event_widget_get_summary (GcalEventWidget *event)
{
GcalEventWidgetPrivate *priv;
- priv = event->priv;
+ priv = gcal_event_widget_get_instance_private (event);
return g_strdup (priv->summary);
}
diff --git a/src/gcal-event-widget.h b/src/gcal-event-widget.h
index fb39aa7..538eba7 100644
--- a/src/gcal-event-widget.h
+++ b/src/gcal-event-widget.h
@@ -36,7 +36,6 @@ G_BEGIN_DECLS
typedef struct _GcalEventWidget GcalEventWidget;
typedef struct _GcalEventWidgetClass GcalEventWidgetClass;
-typedef struct _GcalEventWidgetPrivate GcalEventWidgetPrivate;
struct _GcalEventWidgetClass
{
@@ -49,8 +48,6 @@ struct _GcalEventWidgetClass
struct _GcalEventWidget
{
GtkWidget parent;
-
- GcalEventWidgetPrivate *priv;
};
GType gcal_event_widget_get_type (void);
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index cd56687..41c2ce9 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -82,7 +82,7 @@ struct _MoveEventData
typedef struct _MoveEventData MoveEventData;
-struct _GcalManagerPrivate
+typedef struct
{
/**
* The list of clients we are managing.
@@ -111,7 +111,7 @@ struct _GcalManagerPrivate
/* uid of pending create event actions */
gchar *pending_event_uid;
gchar *pending_event_source;
-};
+} GcalManagerPrivate;
/* Signal IDs */
enum
@@ -193,7 +193,7 @@ static void gcal_manager_on_event_created (GObject *sour
GAsyncResult *result,
gpointer user_data);
-G_DEFINE_TYPE(GcalManager, gcal_manager, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GcalManager, gcal_manager, G_TYPE_OBJECT)
static void
gcal_manager_class_init (GcalManagerClass *klass)
@@ -244,8 +244,6 @@ gcal_manager_class_init (GcalManagerClass *klass)
2,
G_TYPE_POINTER,
G_TYPE_POINTER);
-
- g_type_class_add_private ((gpointer) klass, sizeof(GcalManagerPrivate));
}
static void
@@ -253,10 +251,7 @@ gcal_manager_init (GcalManager *self)
{
GcalManagerPrivate *priv;
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- GCAL_TYPE_MANAGER,
- GcalManagerPrivate);
- priv = self->priv;
+ priv = gcal_manager_get_instance_private (self);
priv->sources_model = gtk_list_store_new (N_COLUMNS,
G_TYPE_STRING,
G_TYPE_STRING,
@@ -295,7 +290,7 @@ gcal_manager_constructed (GObject *object)
if (G_OBJECT_CLASS (gcal_manager_parent_class)->constructed != NULL)
G_OBJECT_CLASS (gcal_manager_parent_class)->constructed (object);
- priv = GCAL_MANAGER (object)->priv;
+ priv = gcal_manager_get_instance_private (GCAL_MANAGER (object));
error = NULL;
priv->source_registry = e_source_registry_new_sync (NULL, &error);
@@ -324,7 +319,7 @@ gcal_manager_finalize (GObject *object)
{
GcalManagerPrivate *priv;
- priv = GCAL_MANAGER (object)->priv;
+ priv = gcal_manager_get_instance_private (GCAL_MANAGER (object));
g_hash_table_destroy (priv->clients);
g_clear_object (&(priv->sources_model));
@@ -384,7 +379,7 @@ gcal_manager_on_client_opened (GObject *source_object,
GcalManagerUnit *unit;
client = E_CAL_CLIENT (source_object);
- priv = ((GcalManager*) user_data)->priv;
+ priv = gcal_manager_get_instance_private (GCAL_MANAGER (user_data));
error = NULL;
if (e_client_open_finish (E_CLIENT (client), result, &error))
{
@@ -509,7 +504,7 @@ gcal_manager_remove_source (GcalManager *manager,
g_return_if_fail (GCAL_IS_MANAGER (manager));
g_return_if_fail (E_IS_SOURCE (source));
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = (GcalManagerUnit*) g_hash_table_lookup (priv->clients,
e_source_get_uid (source));
@@ -532,7 +527,7 @@ gcal_manager_load_source (GcalManager *manager,
GcalManagerUnit *unit;
GError *error;
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
error = NULL;
new_client = e_cal_client_new (source,
E_CAL_CLIENT_SOURCE_TYPE_EVENTS,
@@ -596,7 +591,7 @@ gcal_manager_reload_events (GcalManager *manager)
gpointer key;
gpointer value;
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
g_hash_table_iter_init (&iter, priv->clients);
while (g_hash_table_iter_next (&iter, &key, &value))
{
@@ -613,7 +608,7 @@ gcal_manager_reload_view (GcalManager *manager,
GcalManagerPrivate *priv;
GError *error;
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
g_return_if_fail (priv->query != NULL);
/* stopping */
@@ -681,7 +676,7 @@ gcal_manager_on_view_objects_added (ECalClientView *view,
const gchar *source_uid;
gchar *event_uuid;
- priv = GCAL_MANAGER (user_data)->priv;
+ priv = gcal_manager_get_instance_private (GCAL_MANAGER (user_data));
events_data = NULL;
client = e_cal_client_view_get_client (view);
@@ -757,8 +752,7 @@ gcal_manager_on_view_objects_removed (ECalClientView *view,
ECalClient *client;
const gchar *source_uid;
- g_return_if_fail (GCAL_IS_MANAGER (user_data));
- priv = GCAL_MANAGER (user_data)->priv;
+ priv = gcal_manager_get_instance_private (GCAL_MANAGER (user_data));
events_data = NULL;
client = e_cal_client_view_get_client (view);
@@ -806,8 +800,6 @@ gcal_manager_on_view_objects_modified (ECalClientView *view,
ECalClient *client;
const gchar *source_uid;
- g_return_if_fail (GCAL_IS_MANAGER (user_data));
-
events_data = NULL;
client = e_cal_client_view_get_client (view);
source_uid = e_source_get_uid (e_client_get_source (E_CLIENT (client)));
@@ -846,7 +838,7 @@ gcal_manager_on_sources_row_changed (GtkTreeModel *store,
gchar *source_uid;
gboolean active;
- priv = GCAL_MANAGER (user_data)->priv;
+ priv = gcal_manager_get_instance_private (GCAL_MANAGER (user_data));
gtk_tree_model_get (store,
iter,
COLUMN_UID,
@@ -911,7 +903,7 @@ gcal_manager_on_event_removed_for_move (GObject *source_object,
client = E_CAL_CLIENT (source_object);
data = (MoveEventData*) user_data;
- priv = ((GcalManager*) data->manager)->priv;
+ priv = gcal_manager_get_instance_private (data->manager);
error = NULL;
if (e_cal_client_remove_object_finish (client, result, &error))
@@ -959,7 +951,7 @@ gcal_manager_send_fake_events_added (GcalManager *manager)
const gchar *event_uid;
gchar *event_uuid;
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
events_data = NULL;
g_hash_table_iter_init (&clients_iter, priv->clients);
@@ -1080,15 +1072,19 @@ gcal_manager_new (void)
GtkListStore*
gcal_manager_get_sources_model (GcalManager *manager)
{
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), NULL);
- return manager->priv->sources_model;
+ GcalManagerPrivate *priv;
+
+ priv = gcal_manager_get_instance_private (manager);
+ return priv->sources_model;
}
icaltimezone*
gcal_manager_get_system_timezone (GcalManager *manager)
{
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), NULL);
- return manager->priv->system_timezone;
+ GcalManagerPrivate *priv;
+
+ priv = gcal_manager_get_instance_private (manager);
+ return priv->system_timezone;
}
/**
@@ -1117,9 +1113,7 @@ gcal_manager_add_source (GcalManager *manager,
ESourceCalendar *extension;
GError *error;
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), NULL);
- priv = manager->priv;
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), FALSE);
+ priv = gcal_manager_get_instance_private (manager);
source = e_source_new (NULL, NULL, NULL);
extension = E_SOURCE_CALENDAR (e_source_get_extension (source,
@@ -1157,8 +1151,7 @@ gcal_manager_get_source_name (GcalManager *manager,
GcalManagerPrivate *priv;
GcalManagerUnit *unit;
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), NULL);
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
return e_source_get_display_name (unit->source);
@@ -1171,8 +1164,7 @@ gcal_manager_get_source_readonly (GcalManager *manager,
GcalManagerPrivate *priv;
GcalManagerUnit *unit;
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), FALSE);
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
return e_client_is_readonly (E_CLIENT (unit->client));
@@ -1207,8 +1199,7 @@ gcal_manager_set_new_range (GcalManager *manager,
GcalManagerPrivate *priv;
gboolean refresh_events;
- g_return_if_fail (GCAL_IS_MANAGER (manager));
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
refresh_events = FALSE;
/* updating query range */
@@ -1251,6 +1242,19 @@ gcal_manager_set_new_range (GcalManager *manager,
}
else
{
+ gchar* since_iso8601 =
+ isodate_from_time_t (icaltime_as_timet (*(priv->initial_date)));
+
+ gchar* until_iso8601 =
+ isodate_from_time_t (icaltime_as_timet (*(priv->final_date)));
+
+ g_debug ("fake-events-added between \"%s\" and \"%s\")",
+ since_iso8601,
+ until_iso8601);
+
+ g_free (since_iso8601);
+ g_free (until_iso8601);
+
gcal_manager_send_fake_events_added (manager);
}
}
@@ -1263,8 +1267,7 @@ gcal_manager_exists_event (GcalManager *manager,
GcalManagerPrivate *priv;
GcalManagerUnit *unit;
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), FALSE);
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
if ((unit = g_hash_table_lookup (priv->clients, source_uid)) != NULL)
return g_hash_table_lookup (unit->events, event_uid) != NULL;
@@ -1282,8 +1285,7 @@ gcal_manager_get_event_start_date (GcalManager *manager,
ECalComponentDateTime dt;
icaltimetype *dtstart;
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), NULL);
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
event = g_hash_table_lookup (unit->events, event_uid);
@@ -1318,8 +1320,7 @@ gcal_manager_get_event_end_date (GcalManager *manager,
ECalComponentDateTime dt;
icaltimetype *dtend;
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), NULL);
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
event = g_hash_table_lookup (unit->events, event_uid);
@@ -1354,8 +1355,7 @@ gcal_manager_get_event_summary (GcalManager *manager,
ECalComponentText e_summary;
gchar *summary;
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), NULL);
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
event = g_hash_table_lookup (unit->events, event_uid);
@@ -1376,8 +1376,7 @@ gcal_manager_get_event_organizer (GcalManager *manager,
ECalComponentOrganizer e_organizer;
gchar** values;
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), NULL);
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
event = g_hash_table_lookup (unit->events, event_uid);
@@ -1404,8 +1403,7 @@ gcal_manager_get_event_location (GcalManager *manager,
ECalComponent *event;
const gchar* location;
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), NULL);
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
event = g_hash_table_lookup (unit->events, event_uid);
@@ -1426,8 +1424,7 @@ gcal_manager_get_event_description (GcalManager *manager,
gchar *desc;
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), NULL);
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
desc = NULL;
unit = g_hash_table_lookup (priv->clients, source_uid);
@@ -1469,8 +1466,7 @@ gcal_manager_get_event_color (GcalManager *manager,
ESourceSelectable *extension;
GdkRGBA *color;
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), NULL);
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
color = g_new0 (GdkRGBA, 1);
unit = g_hash_table_lookup (priv->clients, source_uid);
@@ -1491,8 +1487,7 @@ gcal_manager_get_event_reminders (GcalManager *manager,
ECalComponent *event;
GList *reminders;
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), NULL);
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
reminders = NULL;
unit = g_hash_table_lookup (priv->clients, source_uid);
@@ -1596,8 +1591,7 @@ gcal_manager_has_event_reminders (GcalManager *manager,
GcalManagerUnit *unit;
ECalComponent *event;
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), FALSE);
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
event = g_hash_table_lookup (unit->events, event_uid);
@@ -1619,8 +1613,7 @@ gcal_manager_get_event_all_day (GcalManager *manager,
gboolean all_day;
- g_return_val_if_fail (GCAL_IS_MANAGER (manager), FALSE);
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
event = g_hash_table_lookup (unit->events, event_uid);
@@ -1649,8 +1642,7 @@ gcal_manager_remove_event (GcalManager *manager,
GcalManagerUnit *unit;
ECalComponent *event;
- g_return_if_fail (GCAL_IS_MANAGER (manager));
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
event = g_hash_table_lookup (unit->events, event_uid);
@@ -1689,8 +1681,7 @@ gcal_manager_create_event (GcalManager *manager,
icalcomponent *new_event_icalcomp;
icaltimetype *dt_start;
- g_return_if_fail (GCAL_IS_MANAGER (manager));
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
@@ -1747,8 +1738,7 @@ gcal_manager_set_event_start_date (GcalManager *manager,
ECalComponentDateTime dt;
icaltimetype *dt_start;
- g_return_if_fail (GCAL_IS_MANAGER (manager));
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
event = g_hash_table_lookup (unit->events, event_uid);
@@ -1780,8 +1770,7 @@ gcal_manager_set_event_end_date (GcalManager *manager,
ECalComponentDateTime dt;
icaltimetype *dt_start;
- g_return_if_fail (GCAL_IS_MANAGER (manager));
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
event = g_hash_table_lookup (unit->events, event_uid);
@@ -1812,8 +1801,7 @@ gcal_manager_set_event_summary (GcalManager *manager,
ECalComponent *event;
ECalComponentText e_summary;
- g_return_if_fail (GCAL_IS_MANAGER (manager));
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
event = g_hash_table_lookup (unit->events, event_uid);
@@ -1842,8 +1830,7 @@ gcal_manager_set_event_location (GcalManager *manager,
GcalManagerUnit *unit;
ECalComponent *event;
- g_return_if_fail (GCAL_IS_MANAGER (manager));
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
event = g_hash_table_lookup (unit->events, event_uid);
@@ -1872,8 +1859,7 @@ gcal_manager_set_event_description (GcalManager *manager,
GSList l;
ECalComponentText desc;
- g_return_if_fail (GCAL_IS_MANAGER (manager));
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
event = g_hash_table_lookup (unit->events, event_uid);
@@ -1907,8 +1893,7 @@ gcal_manager_move_event_to_source (GcalManager *manager,
ECalComponent *old_event;
ECalComponent *new_event;
- g_return_if_fail (GCAL_IS_MANAGER (manager));
- priv = manager->priv;
+ priv = gcal_manager_get_instance_private (manager);
unit = g_hash_table_lookup (priv->clients, source_uid);
old_event = g_hash_table_lookup (unit->events, event_uid);
diff --git a/src/gcal-manager.h b/src/gcal-manager.h
index b615f34..501c1ff 100644
--- a/src/gcal-manager.h
+++ b/src/gcal-manager.h
@@ -36,14 +36,10 @@ G_BEGIN_DECLS
typedef struct _GcalManager GcalManager;
typedef struct _GcalManagerClass GcalManagerClass;
-typedef struct _GcalManagerPrivate GcalManagerPrivate;
struct _GcalManager
{
GObject parent;
- /* add your public declarations here */
-
- GcalManagerPrivate *priv;
};
struct _GcalManagerClass
diff --git a/src/gcal-nav-bar.c b/src/gcal-nav-bar.c
index 542b9c2..e257b80 100644
--- a/src/gcal-nav-bar.c
+++ b/src/gcal-nav-bar.c
@@ -23,14 +23,14 @@
#include <glib/gi18n.h>
-struct _GcalNavBarPrivate
+typedef struct
{
GtkWidget *back_button;
GtkWidget *forward_button;
GtkWidget *left_label;
GtkWidget *right_label;
-};
+} GcalNavBarPrivate;
enum
{
@@ -49,7 +49,7 @@ static void gcal_nav_bar_get_property (GObject *object
GValue *value,
GParamSpec *pspec);
-G_DEFINE_TYPE(GcalNavBar, gcal_nav_bar, GTK_TYPE_GRID)
+G_DEFINE_TYPE_WITH_PRIVATE (GcalNavBar, gcal_nav_bar, GTK_TYPE_GRID)
static void
gcal_nav_bar_class_init (GcalNavBarClass *klass)
@@ -91,8 +91,6 @@ gcal_nav_bar_class_init (GcalNavBarClass *klass)
gtk_widget_class_bind_child (widget_class, GcalNavBarPrivate, forward_button);
gtk_widget_class_bind_child (widget_class, GcalNavBarPrivate, left_label);
gtk_widget_class_bind_child (widget_class, GcalNavBarPrivate, right_label);
-
- g_type_class_add_private ((gpointer)klass, sizeof (GcalNavBarPrivate));
}
@@ -100,9 +98,6 @@ gcal_nav_bar_class_init (GcalNavBarClass *klass)
static void
gcal_nav_bar_init (GcalNavBar *self)
{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- GCAL_TYPE_NAV_BAR,
- GcalNavBarPrivate);
gtk_widget_init_template (GTK_WIDGET (self));
}
@@ -113,7 +108,7 @@ gcal_nav_bar_set_property (GObject *object,
GParamSpec *pspec)
{
GcalNavBarPrivate *priv;
- priv = GCAL_NAV_BAR (object)->priv;
+ priv = gcal_nav_bar_get_instance_private (GCAL_NAV_BAR (object));
switch (property_id)
{
@@ -138,7 +133,7 @@ gcal_nav_bar_get_property (GObject *object,
GParamSpec *pspec)
{
GcalNavBarPrivate *priv;
- priv = GCAL_NAV_BAR (object)->priv;
+ priv = gcal_nav_bar_get_instance_private (GCAL_NAV_BAR (object));
switch (property_id)
{
@@ -174,8 +169,8 @@ GtkWidget*
gcal_nav_bar_get_prev_button (GcalNavBar *nav_bar)
{
GcalNavBarPrivate *priv;
- priv = nav_bar->priv;
+ priv = gcal_nav_bar_get_instance_private (nav_bar);
return priv->back_button;
}
@@ -183,7 +178,7 @@ GtkWidget*
gcal_nav_bar_get_next_button (GcalNavBar *nav_bar)
{
GcalNavBarPrivate *priv;
- priv = nav_bar->priv;
+ priv = gcal_nav_bar_get_instance_private (nav_bar);
return priv->forward_button;
}
diff --git a/src/gcal-nav-bar.h b/src/gcal-nav-bar.h
index 3f48d5a..076ef40 100644
--- a/src/gcal-nav-bar.h
+++ b/src/gcal-nav-bar.h
@@ -33,14 +33,10 @@ G_BEGIN_DECLS
typedef struct _GcalNavBar GcalNavBar;
typedef struct _GcalNavBarClass GcalNavBarClass;
-typedef struct _GcalNavBarPrivate GcalNavBarPrivate;
struct _GcalNavBar
{
GtkGrid parent;
-
- /* add your public declarations here */
- GcalNavBarPrivate *priv;
};
struct _GcalNavBarClass
diff --git a/src/gcal-new-event-widget.c b/src/gcal-new-event-widget.c
index 8d561c1..27703db 100644
--- a/src/gcal-new-event-widget.c
+++ b/src/gcal-new-event-widget.c
@@ -20,7 +20,7 @@
#include "gcal-new-event-widget.h"
#include "gcal-arrow-bin.h"
-struct _GcalNewEventWidgetPrivate
+typedef struct
{
GtkWidget *title_label;
GtkWidget *what_entry;
@@ -30,9 +30,9 @@ struct _GcalNewEventWidgetPrivate
GtkWidget *details_button;
GtkWidget *close_button;
-};
+} GcalNewEventWidgetPrivate;
-G_DEFINE_TYPE(GcalNewEventWidget, gcal_new_event_widget, GTK_TYPE_OVERLAY)
+G_DEFINE_TYPE_WITH_PRIVATE (GcalNewEventWidget, gcal_new_event_widget, GTK_TYPE_OVERLAY)
static void
gcal_new_event_widget_class_init (GcalNewEventWidgetClass *klass)
@@ -51,17 +51,11 @@ gcal_new_event_widget_class_init (GcalNewEventWidgetClass *klass)
gtk_widget_class_bind_child (widget_class, GcalNewEventWidgetPrivate, create_button);
gtk_widget_class_bind_child (widget_class, GcalNewEventWidgetPrivate, details_button);
gtk_widget_class_bind_child (widget_class, GcalNewEventWidgetPrivate, close_button);
-
- g_type_class_add_private ((gpointer)klass, sizeof(GcalNewEventWidgetPrivate));
}
static void
gcal_new_event_widget_init (GcalNewEventWidget *self)
{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- GCAL_TYPE_NEW_EVENT_WIDGET,
- GcalNewEventWidgetPrivate);
-
gtk_widget_init_template (GTK_WIDGET (self));
}
@@ -78,7 +72,6 @@ gcal_new_event_widget_set_title (GcalNewEventWidget *widget,
{
GcalNewEventWidgetPrivate *priv;
- priv = widget->priv;
-
+ priv = gcal_new_event_widget_get_instance_private (widget);
gtk_label_set_text (GTK_LABEL (priv->title_label), title);
}
diff --git a/src/gcal-new-event-widget.h b/src/gcal-new-event-widget.h
index b183900..79ff4b4 100644
--- a/src/gcal-new-event-widget.h
+++ b/src/gcal-new-event-widget.h
@@ -44,13 +44,10 @@ struct _GcalNewEventData
typedef struct _GcalNewEventWidget GcalNewEventWidget;
typedef struct _GcalNewEventWidgetClass GcalNewEventWidgetClass;
-typedef struct _GcalNewEventWidgetPrivate GcalNewEventWidgetPrivate;
struct _GcalNewEventWidget
{
GtkOverlay parent;
-
- GcalNewEventWidgetPrivate *priv;
};
struct _GcalNewEventWidgetClass
diff --git a/src/gcal-viewport.c b/src/gcal-viewport.c
index a6f0973..722e431 100644
--- a/src/gcal-viewport.c
+++ b/src/gcal-viewport.c
@@ -24,13 +24,13 @@
#include <math.h>
-struct _GcalViewportPrivate
+typedef struct
{
/* property */
GtkWidget *viewport;
GtkWidget *hscrollbar;
GtkWidget *vscrollbar;
-};
+} GcalViewportPrivate;
static void gcal_viewport_constructed (GObject *object);
@@ -49,7 +49,7 @@ static void gcal_viewport_child_allocated (GtkWidget *widget,
GdkRectangle *allocation,
gpointer user_data);
-G_DEFINE_TYPE (GcalViewport,gcal_viewport, GTK_TYPE_OVERLAY);
+G_DEFINE_TYPE_WITH_PRIVATE (GcalViewport,gcal_viewport, GTK_TYPE_OVERLAY);
static void
gcal_viewport_class_init (GcalViewportClass *klass)
@@ -72,8 +72,6 @@ gcal_viewport_class_init (GcalViewportClass *klass)
gtk_widget_class_bind_child (widget_class, GcalViewportPrivate, hscrollbar);
gtk_widget_class_bind_child (widget_class, GcalViewportPrivate, vscrollbar);
gtk_widget_class_bind_child (widget_class, GcalViewportPrivate, viewport);
-
- g_type_class_add_private ((gpointer)klass, sizeof (GcalViewportPrivate));
}
@@ -81,10 +79,6 @@ gcal_viewport_class_init (GcalViewportClass *klass)
static void
gcal_viewport_init (GcalViewport *self)
{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- GCAL_TYPE_VIEWPORT,
- GcalViewportPrivate);
-
gtk_widget_init_template (GTK_WIDGET (self));
}
@@ -95,7 +89,7 @@ gcal_viewport_constructed (GObject *object)
GtkAdjustment *adj;
- priv = GCAL_VIEWPORT (object)->priv;
+ priv = gcal_viewport_get_instance_private (GCAL_VIEWPORT (object));
adj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (priv->viewport));
gtk_range_set_adjustment (GTK_RANGE (priv->hscrollbar), adj);
@@ -137,7 +131,7 @@ gcal_viewport_scroll_event (GtkWidget *widget,
g_return_val_if_fail (event != NULL, FALSE);
- priv = GCAL_VIEWPORT (widget)->priv;
+ priv = gcal_viewport_get_instance_private (GCAL_VIEWPORT (widget));
if (gdk_event_get_scroll_deltas ((GdkEvent *) event, NULL, &delta_y))
{
@@ -203,7 +197,7 @@ gcal_viewport_child_allocated (GtkWidget *widget,
GcalViewportPrivate *priv;
gint width, height;
- priv = GCAL_VIEWPORT (user_data)->priv;
+ priv = gcal_viewport_get_instance_private (GCAL_VIEWPORT (user_data));
width = gtk_widget_get_allocated_width (GTK_WIDGET (user_data));
height = gtk_widget_get_allocated_height (GTK_WIDGET (user_data));
@@ -246,7 +240,7 @@ gcal_viewport_add (GcalViewport *viewport,
{
GcalViewportPrivate *priv;
- priv = viewport->priv;
+ priv = gcal_viewport_get_instance_private (viewport);
gtk_container_add (GTK_CONTAINER (priv->viewport), widget);
/* signals handlers */
@@ -269,7 +263,7 @@ gcal_viewport_scroll_to (GcalViewport *viewport,
GtkAdjustment *adj;
gdouble lower, upper, page_size;
- priv = viewport->priv;
+ priv = gcal_viewport_get_instance_private (viewport);
value = CLAMP (value, 0.0, 1.0);
diff --git a/src/gcal-viewport.h b/src/gcal-viewport.h
index e237fca..d8d3aaf 100644
--- a/src/gcal-viewport.h
+++ b/src/gcal-viewport.h
@@ -33,14 +33,10 @@ G_BEGIN_DECLS
typedef struct _GcalViewport GcalViewport;
typedef struct _GcalViewportClass GcalViewportClass;
-typedef struct _GcalViewportPrivate GcalViewportPrivate;
struct _GcalViewport
{
GtkOverlay parent;
-
- /* add your public declarations here */
- GcalViewportPrivate *priv;
};
struct _GcalViewportClass
diff --git a/src/gcal-window.c b/src/gcal-window.c
index 051555a..89d6b21 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -48,7 +48,7 @@ struct _NewEventData
typedef struct _NewEventData NewEventData;
-struct _GcalWindowPrivate
+typedef struct
{
/* upper level widgets */
GtkWidget *main_box;
@@ -84,7 +84,7 @@ struct _GcalWindowPrivate
/* temp to keep event_creation */
gboolean waiting_for_creation;
gboolean queue_open_edit_dialog;
-};
+} GcalWindowPrivate;
enum
{
@@ -184,7 +184,7 @@ static void gcal_window_update_event_widget (GcalManager *m
const gchar *event_uid,
GcalEventWidget *widget);
-G_DEFINE_TYPE(GcalWindow, gcal_window, GTK_TYPE_APPLICATION_WINDOW)
+G_DEFINE_TYPE_WITH_PRIVATE (GcalWindow, gcal_window, GTK_TYPE_APPLICATION_WINDOW)
static void
set_new_event_mode (GcalWindow *window,
@@ -192,7 +192,7 @@ set_new_event_mode (GcalWindow *window,
{
GcalWindowPrivate *priv;
- priv = window->priv;
+ priv = gcal_window_get_instance_private (window);
priv->new_event_mode = enabled;
g_object_notify (G_OBJECT (window), "new-event-mode");
@@ -216,7 +216,7 @@ date_updated (GtkButton *button,
gboolean move_back;
- priv = GCAL_WINDOW (user_data)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
move_back = gcal_nav_bar_get_prev_button (GCAL_NAV_BAR (priv->nav_bar)) == (GtkWidget*) button;
@@ -260,7 +260,7 @@ update_view (GcalWindow *window)
icaltimetype *last_day;
gchar* header;
- priv = window->priv;
+ priv = gcal_window_get_instance_private (window);
widget = priv->views[priv->active_view];
@@ -293,15 +293,11 @@ view_changed (GObject *object,
{
GcalWindowPrivate *priv;
- GcalWindow *window;
-
GEnumClass *eklass;
GEnumValue *eval;
GcalWindowViewType view_type;
- priv = GCAL_WINDOW (user_data)->priv;
-
- window = GCAL_WINDOW (user_data);
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
eklass = g_type_class_ref (gcal_window_view_type_get_type ());
eval = g_enum_get_value_by_nick (
@@ -314,7 +310,7 @@ view_changed (GObject *object,
/* Get view_type from widget, or widget-name */
priv->active_view = view_type;
- g_object_notify (G_OBJECT (window), "active-view");
+ g_object_notify (G_OBJECT (user_data), "active-view");
update_view (GCAL_WINDOW (user_data));
}
@@ -332,7 +328,7 @@ show_new_event_widget (GcalView *view,
GcalManager *manager;
g_return_if_fail (user_data);
- priv = GCAL_WINDOW (user_data)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
/* 1st and 2nd steps */
set_new_event_mode (GCAL_WINDOW (user_data), TRUE);
@@ -377,7 +373,7 @@ place_new_event_widget (GtkOverlay *overlay,
gint nat_width;
gint nat_height;
- priv = GCAL_WINDOW (user_data)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
if (! priv->new_event_mode)
return FALSE;
@@ -451,8 +447,6 @@ gcal_window_class_init(GcalWindowClass *klass)
FALSE,
G_PARAM_CONSTRUCT |
G_PARAM_READWRITE));
-
- g_type_class_add_private((gpointer)klass, sizeof (GcalWindowPrivate));
}
static void
@@ -460,10 +454,7 @@ gcal_window_init(GcalWindow *self)
{
GcalWindowPrivate *priv;
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self,
- GCAL_TYPE_WINDOW,
- GcalWindowPrivate);
- priv = self->priv;
+ priv = gcal_window_get_instance_private (self);
/* states */
priv->search_mode = FALSE;
@@ -490,7 +481,7 @@ gcal_window_constructed (GObject *object)
if (G_OBJECT_CLASS (gcal_window_parent_class)->constructed != NULL)
G_OBJECT_CLASS (gcal_window_parent_class)->constructed (object);
- priv = GCAL_WINDOW (object)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (object));
/* ui construction */
priv->main_box = gtk_grid_new ();
@@ -656,8 +647,7 @@ gcal_window_finalize (GObject *object)
{
GcalWindowPrivate *priv;
- g_return_if_fail (GCAL_IS_WINDOW (object));
- priv = GCAL_WINDOW (object)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (object));
if (priv->active_date != NULL)
g_free (priv->active_date);
@@ -673,8 +663,7 @@ gcal_window_set_property (GObject *object,
{
GcalWindowPrivate *priv;
- g_return_if_fail (GCAL_IS_WINDOW (object));
- priv = GCAL_WINDOW (object)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (object));
switch (property_id)
{
@@ -704,7 +693,7 @@ gcal_window_get_property (GObject *object,
{
GcalWindowPrivate *priv;
- priv = GCAL_WINDOW (object)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (object));
switch (property_id)
{
@@ -729,7 +718,7 @@ gcal_window_search_toggled (GObject *object,
{
GcalWindowPrivate *priv;
- priv = GCAL_WINDOW (user_data)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
if (gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (priv->search_bar)))
{
@@ -760,7 +749,7 @@ gcal_window_search_changed (GtkEditable *editable,
{
GcalWindowPrivate *priv;
- priv = GCAL_WINDOW (user_data)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
if (gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (priv->search_bar)))
{
@@ -795,8 +784,7 @@ gcal_window_init_edit_dialog (GcalWindow *window)
{
GcalWindowPrivate *priv;
- g_return_if_fail (GCAL_IS_WINDOW (window));
- priv = window->priv;
+ priv = gcal_window_get_instance_private (window);
priv->edit_dialog = gcal_edit_dialog_new ();
gtk_window_set_transient_for (GTK_WINDOW (priv->edit_dialog),
@@ -829,7 +817,7 @@ gcal_window_events_added (GcalManager *manager,
icaltimetype *start_date;
icaltimetype *end_date;
- priv = GCAL_WINDOW (user_data)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
view = GCAL_VIEW (priv->views[priv->active_view]);
for (l = events_list; l != NULL; l = l->next)
@@ -881,8 +869,7 @@ gcal_window_events_removed (GcalManager *manager,
GcalWindowPrivate *priv;
GSList *l;
- g_return_if_fail (GCAL_IS_WINDOW (user_data));
- priv = GCAL_WINDOW (user_data)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
for (l = events_list; l != NULL; l = l->next)
{
@@ -915,7 +902,7 @@ gcal_window_events_modified (GcalManager *manager,
icaltimetype *start_date;
icaltimetype *end_date;
- priv = GCAL_WINDOW (user_data)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
for (l = events_list; l != NULL; l = l->next)
{
@@ -982,7 +969,7 @@ gcal_window_event_created (GcalManager *manager,
{
GcalWindowPrivate *priv;
- priv = GCAL_WINDOW (user_data)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
if (! priv->waiting_for_creation)
return;
@@ -1012,8 +999,7 @@ gcal_window_event_activated (GcalEventWidget *event_widget,
GcalWindowPrivate *priv;
gchar **tokens;
- g_return_if_fail (GCAL_IS_WINDOW (user_data));
- priv = GCAL_WINDOW (user_data)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
if (priv->edit_dialog == NULL)
gcal_window_init_edit_dialog (GCAL_WINDOW (user_data));
@@ -1035,8 +1021,7 @@ gcal_window_remove_event (GdNotification *notification,
GcalManager *manager;
gchar **tokens;
- g_return_if_fail (GCAL_IS_WINDOW (user_data));
- priv = GCAL_WINDOW (user_data)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
if (priv->event_to_delete != NULL)
{
@@ -1061,8 +1046,7 @@ gcal_window_undo_remove_event (GtkButton *button,
GcalWindowPrivate *priv;
GtkWidget *event_widget;
- g_return_if_fail (GCAL_IS_WINDOW (user_data));
- priv = GCAL_WINDOW (user_data)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
if (priv->event_to_delete != NULL)
{
@@ -1088,7 +1072,7 @@ gcal_window_create_event (GcalNewEventWidget *widget,
GcalWindowPrivate *priv;
GcalManager *manager;
- priv = GCAL_WINDOW (user_data)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
if (open_details)
{
@@ -1122,7 +1106,7 @@ gcal_window_edit_dialog_responded (GtkDialog *dialog,
GtkWidget *grid;
GtkWidget *undo_button;
- priv = GCAL_WINDOW (user_data)->priv;
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
gtk_widget_hide (priv->edit_dialog);
@@ -1365,7 +1349,7 @@ gcal_window_set_search_mode (GcalWindow *window,
{
GcalWindowPrivate *priv;
- priv = window->priv;
+ priv = gcal_window_get_instance_private (window);
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (priv->search_bar), enabled);
}
@@ -1374,9 +1358,7 @@ gcal_window_show_notification (GcalWindow *window)
{
GcalWindowPrivate *priv;
- g_return_if_fail (GCAL_IS_WINDOW (window));
- priv = window->priv;
-
+ priv = gcal_window_get_instance_private (window);
gtk_overlay_add_overlay (GTK_OVERLAY (priv->views_overlay),
priv->noty);
gtk_widget_show_all (priv->noty);
@@ -1387,8 +1369,6 @@ gcal_window_hide_notification (GcalWindow *window)
{
GcalWindowPrivate *priv;
- g_return_if_fail (GCAL_IS_WINDOW (window));
- priv = window->priv;
-
+ priv = gcal_window_get_instance_private (window);
gd_notification_dismiss (GD_NOTIFICATION (priv->noty));
}
diff --git a/src/gcal-window.h b/src/gcal-window.h
index c71ac96..c95b2d6 100644
--- a/src/gcal-window.h
+++ b/src/gcal-window.h
@@ -37,13 +37,10 @@ G_BEGIN_DECLS
typedef struct _GcalWindow GcalWindow;
typedef struct _GcalWindowClass GcalWindowClass;
-typedef struct _GcalWindowPrivate GcalWindowPrivate;
struct _GcalWindow
{
GtkApplicationWindow parent;
-
- GcalWindowPrivate *priv;
};
struct _GcalWindowClass
diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c
index 6e88abf..f018b5b 100644
--- a/src/gcal-year-view.c
+++ b/src/gcal-year-view.c
@@ -27,7 +27,7 @@
#include <libecal/libecal.h>
-struct _GcalYearViewPrivate
+typedef struct
{
/**
* This is where we keep the refs of the child widgets.
@@ -47,7 +47,7 @@ struct _GcalYearViewPrivate
gint start_mark_cell;
gint end_mark_cell;
-};
+} GcalYearViewPrivate;
enum
{
@@ -133,6 +133,7 @@ static void gcal_year_view_create_event_on_current_unit (GcalView
G_DEFINE_TYPE_WITH_CODE (GcalYearView,
gcal_year_view,
GTK_TYPE_CONTAINER,
+ G_ADD_PRIVATE (GcalYearView)
G_IMPLEMENT_INTERFACE (GCAL_TYPE_VIEW,
gcal_view_interface_init));
@@ -166,8 +167,6 @@ gcal_year_view_class_init (GcalYearViewClass *klass)
object_class->finalize = gcal_year_view_finalize;
g_object_class_override_property (object_class, PROP_DATE, "active-date");
-
- g_type_class_add_private ((gpointer)klass, sizeof (GcalYearViewPrivate));
}
@@ -180,10 +179,7 @@ gcal_year_view_init (GcalYearView *self)
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- GCAL_TYPE_YEAR_VIEW,
- GcalYearViewPrivate);
- priv = self->priv;
+ priv = gcal_year_view_get_instance_private (self);
priv->clicked_cell = -1;
@@ -226,7 +222,7 @@ gcal_year_view_set_property (GObject *object,
{
GcalYearViewPrivate *priv;
- priv = GCAL_YEAR_VIEW (object)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (object));
switch (property_id)
{
@@ -250,8 +246,7 @@ gcal_year_view_get_property (GObject *object,
{
GcalYearViewPrivate *priv;
- g_return_if_fail (GCAL_IS_YEAR_VIEW (object));
- priv = GCAL_YEAR_VIEW (object)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (object));
switch (property_id)
{
@@ -267,7 +262,8 @@ gcal_year_view_get_property (GObject *object,
static void
gcal_year_view_finalize (GObject *object)
{
- GcalYearViewPrivate *priv = GCAL_YEAR_VIEW (object)->priv;
+ GcalYearViewPrivate *priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (object));
if (priv->date != NULL)
g_free (priv->date);
@@ -285,7 +281,7 @@ gcal_year_view_realize (GtkWidget *widget)
gint attributes_mask;
GtkAllocation allocation;
- priv = GCAL_YEAR_VIEW (widget)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (widget));
gtk_widget_set_realized (widget, TRUE);
parent_window = gtk_widget_get_parent_window (widget);
@@ -321,7 +317,7 @@ gcal_year_view_unrealize (GtkWidget *widget)
{
GcalYearViewPrivate *priv;
- priv = GCAL_YEAR_VIEW (widget)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (widget));
if (priv->event_window != NULL)
{
gdk_window_set_user_data (priv->event_window, NULL);
@@ -337,7 +333,7 @@ gcal_year_view_map (GtkWidget *widget)
{
GcalYearViewPrivate *priv;
- priv = GCAL_YEAR_VIEW (widget)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (widget));
if (priv->event_window)
gdk_window_show (priv->event_window);
@@ -349,7 +345,7 @@ gcal_year_view_unmap (GtkWidget *widget)
{
GcalYearViewPrivate *priv;
- priv = GCAL_YEAR_VIEW (widget)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (widget));
if (priv->event_window)
gdk_window_hide (priv->event_window);
@@ -375,7 +371,7 @@ gcal_year_view_size_allocate (GtkWidget *widget,
gdouble vertical_block;
gdouble vertical_cell_margin;
- priv = GCAL_YEAR_VIEW (widget)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (widget));
gtk_widget_set_allocation (widget, allocation);
if (gtk_widget_get_realized (widget))
@@ -493,7 +489,7 @@ gcal_year_view_button_press (GtkWidget *widget,
gdouble x, y;
gint width, height;
- priv = GCAL_YEAR_VIEW (widget)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (widget));
x = event->x;
y = event->y;
@@ -545,7 +541,7 @@ gcal_year_view_motion_notify_event (GtkWidget *widget,
gint width, height;
gint y;
- priv = GCAL_YEAR_VIEW (widget)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (widget));
if (priv->clicked_cell == -1)
return FALSE;
@@ -581,7 +577,7 @@ gcal_year_view_button_release (GtkWidget *widget,
gint released;
- priv = GCAL_YEAR_VIEW (widget)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (widget));
x = event->x;
y = event->y;
@@ -640,10 +636,9 @@ gcal_year_view_add (GtkContainer *container,
GcalViewChild *new_child;
- g_return_if_fail (GCAL_IS_YEAR_VIEW (container));
g_return_if_fail (GCAL_IS_EVENT_WIDGET (widget));
g_return_if_fail (gtk_widget_get_parent (widget) == NULL);
- priv = GCAL_YEAR_VIEW (container)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (container));
/* Check if it's already added for date */
date = gcal_event_widget_get_date (GCAL_EVENT_WIDGET (widget));
@@ -686,9 +681,8 @@ gcal_year_view_remove (GtkContainer *container,
gint i;
GList *l;
- g_return_if_fail (GCAL_IS_YEAR_VIEW (container));
g_return_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (container));
- priv = GCAL_YEAR_VIEW (container)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (container));
for (i = 0; i < 12; i++)
{
@@ -726,7 +720,7 @@ gcal_year_view_forall (GtkContainer *container,
gint i;
GList *l;
- priv = GCAL_YEAR_VIEW (container)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (container));
for (i = 0; i < 12; i++)
{
@@ -768,7 +762,7 @@ gcal_year_view_draw_grid (GcalYearView *view,
PangoLayout *layout;
const PangoFontDescription *font;
- priv = view->priv;
+ priv = gcal_year_view_get_instance_private (view);
widget = GTK_WIDGET (view);
context = gtk_widget_get_style_context (widget);
@@ -945,7 +939,8 @@ gcal_year_view_get_initial_date (GcalView *view)
icaltimetype *new_date;
g_return_val_if_fail (GCAL_IS_YEAR_VIEW (view), NULL);
- priv = GCAL_YEAR_VIEW (view)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (view));
+
new_date = gcal_dup_icaltime (priv->date);
new_date->day = 1;
new_date->month = 1;
@@ -968,7 +963,8 @@ gcal_year_view_get_final_date (GcalView *view)
icaltimetype *new_date;
g_return_val_if_fail (GCAL_IS_YEAR_VIEW (view), NULL);
- priv = GCAL_YEAR_VIEW (view)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (view));
+
new_date = gcal_dup_icaltime (priv->date);
new_date->day = 31;
new_date->month = 12;
@@ -984,7 +980,7 @@ gcal_year_view_draw_event (GcalView *view,
GcalYearViewPrivate *priv;
g_return_val_if_fail (GCAL_IS_YEAR_VIEW (view), FALSE);
- priv = GCAL_YEAR_VIEW (view)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (view));
if (priv->date == NULL)
return FALSE;
@@ -1001,7 +997,7 @@ gcal_year_view_get_by_uuid (GcalView *view,
GList *l;
g_return_val_if_fail (GCAL_IS_YEAR_VIEW (view), NULL);
- priv = GCAL_YEAR_VIEW (view)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (view));
for (i = 0; i < 12; i++)
{
@@ -1031,7 +1027,7 @@ gcal_year_view_clear_selection (GcalView *view)
{
GcalYearViewPrivate *priv;
- priv = GCAL_YEAR_VIEW (view)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (view));
priv->start_mark_cell = -1;
priv->end_mark_cell = -1;
@@ -1050,8 +1046,7 @@ gcal_year_view_create_event_on_current_unit (GcalView *view)
icaltimetype *end_span;
/* FIXME: This need to include marking the current unit */
- g_return_if_fail (GCAL_IS_YEAR_VIEW (view));
- priv = GCAL_YEAR_VIEW (view)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (view));
width = gtk_widget_get_allocated_width (GTK_WIDGET (view));
height = gtk_widget_get_allocated_height (GTK_WIDGET (view));
@@ -1085,7 +1080,7 @@ gcal_year_view_get_left_header (GcalView *view)
{
GcalYearViewPrivate *priv;
- priv = GCAL_YEAR_VIEW (view)->priv;
+ priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (view));
return g_strdup_printf ("%d", priv->date->year);
}
diff --git a/src/gcal-year-view.h b/src/gcal-year-view.h
index 44840ae..3b9b7d4 100644
--- a/src/gcal-year-view.h
+++ b/src/gcal-year-view.h
@@ -35,14 +35,10 @@ G_BEGIN_DECLS
typedef struct _GcalYearView GcalYearView;
typedef struct _GcalYearViewClass GcalYearViewClass;
-typedef struct _GcalYearViewPrivate GcalYearViewPrivate;
struct _GcalYearView
{
GtkContainer parent;
-
- /* add your public declarations here */
- GcalYearViewPrivate *priv;
};
struct _GcalYearViewClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]