summaryrefslogtreecommitdiff
path: root/gtk/gtkcalendar.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-05-26 19:20:26 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-05-26 19:20:26 -0400
commit695b450e8053c6caa243ec38e70d0d9cbce8aade (patch)
tree9c10ead44eef8cb8d3cc45bf86cf1a9a8513ccf5 /gtk/gtkcalendar.c
parent76f2a8f2dc0ed8c13d209f226434255649f407e2 (diff)
downloadgtk+-695b450e8053c6caa243ec38e70d0d9cbce8aade.tar.gz
calendar: Drop the priv pointer
Diffstat (limited to 'gtk/gtkcalendar.c')
-rw-r--r--gtk/gtkcalendar.c160
1 files changed, 74 insertions, 86 deletions
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index a349318524..31c385f01d 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -190,8 +190,6 @@ typedef struct _GtkCalendarPrivate GtkCalendarPrivate;
struct _GtkCalendar
{
GtkWidget widget;
-
- GtkCalendarPrivate *priv;
};
struct _GtkCalendarClass
@@ -667,7 +665,7 @@ gtk_calendar_init (GtkCalendar *calendar)
char buffer[255];
time_t tmp_time;
#endif
- GtkCalendarPrivate *priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gchar *year_before;
#ifdef HAVE__NL_TIME_FIRST_WEEKDAY
union { unsigned int word; char *string; } langinfo;
@@ -678,8 +676,6 @@ gtk_calendar_init (GtkCalendar *calendar)
gchar *week_start;
#endif
- priv = calendar->priv = gtk_calendar_get_instance_private (calendar);
-
gtk_widget_set_can_focus (widget, TRUE);
gtk_widget_set_has_surface (widget, FALSE);
@@ -879,7 +875,7 @@ gtk_calendar_init (GtkCalendar *calendar)
static void
calendar_queue_refresh (GtkCalendar *calendar)
{
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
if (!(priv->detail_func) ||
!(priv->display_flags & GTK_CALENDAR_SHOW_DETAILS) ||
@@ -892,8 +888,8 @@ calendar_queue_refresh (GtkCalendar *calendar)
static void
calendar_set_month_next (GtkCalendar *calendar)
{
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gint month_len;
- GtkCalendarPrivate *priv = calendar->priv;
if (priv->display_flags & GTK_CALENDAR_NO_MONTH_CHANGE)
return;
@@ -930,7 +926,7 @@ calendar_set_month_next (GtkCalendar *calendar)
static void
calendar_set_year_prev (GtkCalendar *calendar)
{
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gint month_len;
priv->year--;
@@ -958,7 +954,7 @@ calendar_set_year_prev (GtkCalendar *calendar)
static void
calendar_set_year_next (GtkCalendar *calendar)
{
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gint month_len;
priv->year++;
@@ -986,7 +982,7 @@ calendar_set_year_next (GtkCalendar *calendar)
static void
calendar_compute_days (GtkCalendar *calendar)
{
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gint month;
gint year;
gint ndays_in_month;
@@ -1054,7 +1050,7 @@ static void
calendar_select_and_focus_day (GtkCalendar *calendar,
guint day)
{
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gint old_focus_row = priv->focus_row;
gint old_focus_col = priv->focus_col;
gint row;
@@ -1085,7 +1081,7 @@ calendar_select_and_focus_day (GtkCalendar *calendar,
static gint
calendar_row_height (GtkCalendar *calendar)
{
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
return (priv->main_h - CALENDAR_MARGIN
- ((priv->display_flags & GTK_CALENDAR_SHOW_DAY_NAMES)
@@ -1135,7 +1131,7 @@ static gint
calendar_left_x_for_column (GtkCalendar *calendar,
gint column)
{
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gint width;
gint x_left;
gint week_width;
@@ -1152,7 +1148,7 @@ calendar_left_x_for_column (GtkCalendar *calendar,
week_width = 0;
}
- width = calendar->priv->day_width;
+ width = priv->day_width;
if (priv->display_flags & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
x_left = week_width + calendar_xsep + (width + DAY_XSEP) * column;
else
@@ -1167,6 +1163,7 @@ static gint
calendar_column_from_x (GtkCalendar *calendar,
gint event_x)
{
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gint c, column;
gint x_left, x_right;
@@ -1175,7 +1172,7 @@ calendar_column_from_x (GtkCalendar *calendar,
for (c = 0; c < 7; c++)
{
x_left = calendar_left_x_for_column (calendar, c);
- x_right = x_left + calendar->priv->day_width;
+ x_right = x_left + priv->day_width;
if (event_x >= x_left && event_x < x_right)
{
@@ -1193,7 +1190,7 @@ static gint
calendar_top_y_for_row (GtkCalendar *calendar,
gint row)
{
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gint inner_border = calendar_get_inner_border (calendar);
return priv->header_h + priv->day_name_h + inner_border
@@ -1233,8 +1230,8 @@ calendar_arrow_rectangle (GtkCalendar *calendar,
guint arrow,
GdkRectangle *rect)
{
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
GtkWidget *widget = GTK_WIDGET (calendar);
- GtkCalendarPrivate *priv = calendar->priv;
int width;
gboolean year_left;
@@ -1287,7 +1284,7 @@ calendar_day_rectangle (GtkCalendar *calendar,
gint col,
GdkRectangle *rect)
{
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
rect->x = calendar_left_x_for_column (calendar, col);
rect->y = calendar_top_y_for_row (calendar, row);
@@ -1298,7 +1295,7 @@ calendar_day_rectangle (GtkCalendar *calendar,
static void
calendar_set_month_prev (GtkCalendar *calendar)
{
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gint month_len;
if (priv->display_flags & GTK_CALENDAR_NO_MONTH_CHANGE)
@@ -1346,9 +1343,10 @@ calendar_set_month_prev (GtkCalendar *calendar)
static void
gtk_calendar_destroy (GtkWidget *widget)
{
- GtkCalendarPrivate *priv = GTK_CALENDAR (widget)->priv;
+ GtkCalendar *calendar = GTK_CALENDAR (widget);
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
- calendar_stop_spinning (GTK_CALENDAR (widget));
+ calendar_stop_spinning (calendar);
/* Call the destroy function for the extra display callback: */
if (priv->detail_func_destroy && priv->detail_func_user_data)
@@ -1366,7 +1364,7 @@ calendar_set_display_option (GtkCalendar *calendar,
GtkCalendarDisplayOptions flag,
gboolean setting)
{
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
GtkCalendarDisplayOptions flags;
gboolean old_setting;
@@ -1388,7 +1386,7 @@ static gboolean
calendar_get_display_option (GtkCalendar *calendar,
GtkCalendarDisplayOptions flag)
{
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
return (priv->display_flags & flag) != 0;
}
@@ -1400,7 +1398,7 @@ gtk_calendar_set_property (GObject *object,
GParamSpec *pspec)
{
GtkCalendar *calendar = GTK_CALENDAR (object);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
switch (prop_id)
{
@@ -1469,7 +1467,7 @@ gtk_calendar_get_property (GObject *object,
GParamSpec *pspec)
{
GtkCalendar *calendar = GTK_CALENDAR (object);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
switch (prop_id)
{
@@ -1538,7 +1536,7 @@ gtk_calendar_get_detail (GtkCalendar *calendar,
gint row,
gint column)
{
- GtkCalendarPrivate *priv = GTK_CALENDAR (calendar)->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gint year, month;
if (priv->detail_func == NULL)
@@ -1572,7 +1570,7 @@ gtk_calendar_query_tooltip (GtkWidget *widget,
GtkTooltip *tooltip)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gchar *detail = NULL;
GdkRectangle day_rect;
gint row, col;
@@ -1613,7 +1611,7 @@ gtk_calendar_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
GtkBorder day_padding, day_name_padding, week_padding;
PangoLayout *layout;
PangoRectangle logical_rect;
@@ -1876,7 +1874,7 @@ gtk_calendar_size_allocate (GtkWidget *widget,
int baseline)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gint inner_border = calendar_get_inner_border (calendar);
gint calendar_xsep = calendar_get_xsep (calendar);
@@ -1910,7 +1908,7 @@ calendar_snapshot_header (GtkCalendar *calendar,
GtkSnapshot *snapshot)
{
GtkWidget *widget = GTK_WIDGET (calendar);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
GtkStyleContext *context;
GtkStateFlags state;
char buffer[255];
@@ -2018,7 +2016,7 @@ calendar_snapshot_day_names (GtkCalendar *calendar,
GtkSnapshot *snapshot)
{
GtkWidget *widget = GTK_WIDGET (calendar);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
GtkStyleContext *context;
GtkStateFlags state;
GtkBorder day_name_padding;
@@ -2106,7 +2104,7 @@ calendar_snapshot_week_numbers (GtkCalendar *calendar,
GtkSnapshot *snapshot)
{
GtkWidget *widget = GTK_WIDGET (calendar);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
GtkStyleContext *context;
GtkStateFlags state;
GtkBorder week_padding;
@@ -2235,7 +2233,7 @@ calendar_snapshot_day (GtkCalendar *calendar,
gint col)
{
GtkWidget *widget = GTK_WIDGET (calendar);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
GtkStyleContext *context;
GtkStateFlags state = 0;
gchar *detail;
@@ -2397,7 +2395,7 @@ calendar_snapshot_arrow (GtkCalendar *calendar,
guint arrow)
{
GtkWidget *widget = GTK_WIDGET (calendar);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
GtkCssImageBuiltinType image_type;
GtkStyleContext *context;
GtkStateFlags state;
@@ -2444,7 +2442,7 @@ gtk_calendar_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
int i;
calendar_snapshot_main (calendar, snapshot);
@@ -2495,7 +2493,7 @@ static gboolean
calendar_timer (gpointer data)
{
GtkCalendar *calendar = data;
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gboolean retval = FALSE;
if (priv->timer)
@@ -2522,7 +2520,7 @@ static void
calendar_start_spinning (GtkCalendar *calendar,
gint click_child)
{
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
priv->click_child = click_child;
@@ -2540,7 +2538,7 @@ calendar_start_spinning (GtkCalendar *calendar,
static void
calendar_stop_spinning (GtkCalendar *calendar)
{
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
if (priv->timer)
{
@@ -2558,7 +2556,7 @@ calendar_main_button_press (GtkCalendar *calendar,
int button)
{
GtkWidget *widget = GTK_WIDGET (calendar);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gint row, col;
gint day_month;
gint day;
@@ -2613,7 +2611,7 @@ gtk_calendar_button_press (GtkGestureMultiPress *gesture,
{
GtkCalendar *calendar = user_data;
GtkWidget *widget = GTK_WIDGET (calendar);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
int button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
gint arrow = -1;
@@ -2649,7 +2647,7 @@ gtk_calendar_button_release (GtkGestureMultiPress *gesture,
gpointer user_data)
{
GtkCalendar *calendar = user_data;
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
int button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
if (button == GDK_BUTTON_PRIMARY)
@@ -2667,8 +2665,8 @@ gtk_calendar_drag_begin (GtkGestureDrag *gesture,
double y,
gpointer data)
{
- GtkWidget *widget = data;
- GtkCalendarPrivate *priv = GTK_CALENDAR (widget)->priv;
+ GtkCalendar *calendar = data;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
priv->in_drag = TRUE;
}
@@ -2680,7 +2678,8 @@ gtk_calendar_drag_update (GtkGestureDrag *gesture,
gpointer data)
{
GtkWidget *widget = data;
- GtkCalendarPrivate *priv = GTK_CALENDAR (widget)->priv;
+ GtkCalendar *calendar = GTK_CALENDAR (widget);
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gdouble start_x, start_y;
GdkDrag *drag;
GdkContentFormats *targets;
@@ -2736,7 +2735,7 @@ static void
move_focus (GtkCalendar *calendar,
gint direction)
{
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
GtkTextDirection text_dir = gtk_widget_get_direction (GTK_WIDGET (calendar));
if ((text_dir == GTK_TEXT_DIR_LTR && direction == -1) ||
@@ -2780,7 +2779,7 @@ gtk_calendar_key_controller_key_pressed (GtkEventControllerKey *controller,
GtkWidget *widget)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gint return_val;
gint old_focus_row;
gint old_focus_col;
@@ -2884,10 +2883,11 @@ gtk_calendar_key_controller_focus (GtkEventControllerKey *key,
GtkWidget *widget)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
calendar_queue_refresh (calendar);
calendar_stop_spinning (calendar);
- calendar->priv->in_drag = 0;
+ priv->in_drag = 0;
}
@@ -2900,7 +2900,7 @@ gtk_calendar_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
if (!gtk_widget_is_sensitive (widget))
{
@@ -2930,7 +2930,7 @@ gtk_calendar_drag_data_get (GtkWidget *widget,
GtkSelectionData *selection_data)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
GDate *date;
gchar str[128];
gsize len;
@@ -2966,7 +2966,8 @@ static void
gtk_calendar_drag_leave (GtkWidget *widget,
GdkDrop *drop)
{
- GtkCalendarPrivate *priv = GTK_CALENDAR (widget)->priv;
+ GtkCalendar *calendar = GTK_CALENDAR (widget);
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
priv->drag_highlight = 0;
gtk_drag_unhighlight (widget);
@@ -2978,7 +2979,8 @@ gtk_calendar_drag_motion (GtkWidget *widget,
gint x,
gint y)
{
- GtkCalendarPrivate *priv = GTK_CALENDAR (widget)->priv;
+ GtkCalendar *calendar = GTK_CALENDAR (widget);
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
GdkAtom target;
if (!priv->drag_highlight)
@@ -3023,7 +3025,7 @@ gtk_calendar_drag_data_received (GtkWidget *widget,
GtkSelectionData *selection_data)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
guint day, month, year;
gchar *str;
GDate *date;
@@ -3120,9 +3122,11 @@ gtk_calendar_new (void)
GtkCalendarDisplayOptions
gtk_calendar_get_display_options (GtkCalendar *calendar)
{
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
+
g_return_val_if_fail (GTK_IS_CALENDAR (calendar), 0);
- return calendar->priv->display_flags;
+ return priv->display_flags;
}
/**
@@ -3138,7 +3142,7 @@ gtk_calendar_set_display_options (GtkCalendar *calendar,
GtkCalendarDisplayOptions flags)
{
GtkWidget *widget = GTK_WIDGET (calendar);
- GtkCalendarPrivate *priv = calendar->priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
gint resize = 0;
GtkCalendarDisplayOptions old_flags;
@@ -3219,13 +3223,11 @@ gtk_calendar_select_month (GtkCalendar *calendar,
guint month,
guint year)
{
- GtkCalendarPrivate *priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
g_return_if_fail (GTK_IS_CALENDAR (calendar));
g_return_if_fail (month <= 11);
- priv = calendar->priv;
-
g_object_freeze_notify (G_OBJECT (calendar));
if (priv->month != month)
@@ -3259,13 +3261,11 @@ void
gtk_calendar_select_day (GtkCalendar *calendar,
guint day)
{
- GtkCalendarPrivate *priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
g_return_if_fail (GTK_IS_CALENDAR (calendar));
g_return_if_fail (day <= 31);
- priv = calendar->priv;
-
if (priv->selected_day != day)
{
/* Deselect the old day */
@@ -3300,13 +3300,11 @@ gtk_calendar_select_day (GtkCalendar *calendar,
void
gtk_calendar_clear_marks (GtkCalendar *calendar)
{
- GtkCalendarPrivate *priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
guint day;
g_return_if_fail (GTK_IS_CALENDAR (calendar));
- priv = calendar->priv;
-
for (day = 0; day < 31; day++)
{
priv->marked_date[day] = FALSE;
@@ -3327,12 +3325,10 @@ void
gtk_calendar_mark_day (GtkCalendar *calendar,
guint day)
{
- GtkCalendarPrivate *priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
g_return_if_fail (GTK_IS_CALENDAR (calendar));
- priv = calendar->priv;
-
if (day >= 1 && day <= 31 && !priv->marked_date[day-1])
{
priv->marked_date[day - 1] = TRUE;
@@ -3354,12 +3350,10 @@ gboolean
gtk_calendar_get_day_is_marked (GtkCalendar *calendar,
guint day)
{
- GtkCalendarPrivate *priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
g_return_val_if_fail (GTK_IS_CALENDAR (calendar), FALSE);
- priv = calendar->priv;
-
if (day >= 1 && day <= 31)
return priv->marked_date[day - 1];
@@ -3377,12 +3371,10 @@ void
gtk_calendar_unmark_day (GtkCalendar *calendar,
guint day)
{
- GtkCalendarPrivate *priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
g_return_if_fail (GTK_IS_CALENDAR (calendar));
- priv = calendar->priv;
-
if (day >= 1 && day <= 31 && priv->marked_date[day-1])
{
priv->marked_date[day - 1] = FALSE;
@@ -3409,12 +3401,10 @@ gtk_calendar_get_date (GtkCalendar *calendar,
guint *month,
guint *day)
{
- GtkCalendarPrivate *priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
g_return_if_fail (GTK_IS_CALENDAR (calendar));
- priv = calendar->priv;
-
if (year)
*year = priv->year;
@@ -3449,12 +3439,10 @@ gtk_calendar_set_detail_func (GtkCalendar *calendar,
gpointer data,
GDestroyNotify destroy)
{
- GtkCalendarPrivate *priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
g_return_if_fail (GTK_IS_CALENDAR (calendar));
- priv = calendar->priv;
-
if (priv->detail_func_destroy)
priv->detail_func_destroy (priv->detail_func_user_data);
@@ -3479,12 +3467,10 @@ void
gtk_calendar_set_detail_width_chars (GtkCalendar *calendar,
gint chars)
{
- GtkCalendarPrivate *priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
g_return_if_fail (GTK_IS_CALENDAR (calendar));
- priv = calendar->priv;
-
if (chars != priv->detail_width_chars)
{
priv->detail_width_chars = chars;
@@ -3505,12 +3491,10 @@ void
gtk_calendar_set_detail_height_rows (GtkCalendar *calendar,
gint rows)
{
- GtkCalendarPrivate *priv;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
g_return_if_fail (GTK_IS_CALENDAR (calendar));
- priv = calendar->priv;
-
if (rows != priv->detail_height_rows)
{
priv->detail_height_rows = rows;
@@ -3531,9 +3515,11 @@ gtk_calendar_set_detail_height_rows (GtkCalendar *calendar,
gint
gtk_calendar_get_detail_width_chars (GtkCalendar *calendar)
{
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
+
g_return_val_if_fail (GTK_IS_CALENDAR (calendar), 0);
- return calendar->priv->detail_width_chars;
+ return priv->detail_width_chars;
}
/**
@@ -3548,7 +3534,9 @@ gtk_calendar_get_detail_width_chars (GtkCalendar *calendar)
gint
gtk_calendar_get_detail_height_rows (GtkCalendar *calendar)
{
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
+
g_return_val_if_fail (GTK_IS_CALENDAR (calendar), 0);
- return calendar->priv->detail_height_rows;
+ return priv->detail_height_rows;
}