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