summaryrefslogtreecommitdiff
path: root/gtk/gtkcalendar.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2020-02-04 15:20:39 +0100
committerMatthias Clasen <mclasen@redhat.com>2020-02-07 13:16:32 -0500
commit93c6f2256fdd81d581bec68a6f7be8a1aacf161d (patch)
tree3d673cdb319bbd11bfde9d71be097df551a219d3 /gtk/gtkcalendar.c
parent1151da5cf36430cb927000670845469e917b0c1e (diff)
downloadgtk+-93c6f2256fdd81d581bec68a6f7be8a1aacf161d.tar.gz
calendar: Return a GDateTime from get_date()
Diffstat (limited to 'gtk/gtkcalendar.c')
-rw-r--r--gtk/gtkcalendar.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 8468999922..c3580b262e 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -1999,33 +1999,19 @@ gtk_calendar_unmark_day (GtkCalendar *calendar,
/**
* gtk_calendar_get_date:
* @calendar: a #GtkCalendar
- * @year: (out) (allow-none): location to store the year as a decimal
- * number (e.g. 2011), or %NULL
- * @month: (out) (allow-none): location to store the month number
- * (between 0 and 11), or %NULL
- * @day: (out) (allow-none): location to store the day number (between
- * 1 and 31), or %NULL
*
- * Obtains the selected date from a #GtkCalendar.
+ * Returns: (transfer full): A #GDateTime representing the shown
+ * year, month and the selected day, in the local time zone.
*/
-void
-gtk_calendar_get_date (GtkCalendar *calendar,
- guint *year,
- guint *month,
- guint *day)
+GDateTime *
+gtk_calendar_get_date (GtkCalendar *self)
{
- GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
-
- g_return_if_fail (GTK_IS_CALENDAR (calendar));
-
- if (year)
- *year = priv->year;
+ GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (self);
- if (month)
- *month = priv->month;
+ g_return_val_if_fail (GTK_IS_CALENDAR (self), NULL);
- if (day)
- *day = priv->selected_day;
+ return g_date_time_new_local (priv->year, priv->month + 1, priv->selected_day,
+ 0, 0, 0);
}
/**