From 6ff3b47bd50fec2e9e372472af252fdae4a79a5b Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 29 May 2024 18:08:10 +0600 Subject: [PATCH] Added function to get last calendar date and time --- source/libublsettings-gtk3.c | 8 ++++++++ source/libublsettings-gtk3.h | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/libublsettings-gtk3.c b/source/libublsettings-gtk3.c index 4712085..1a1a431 100644 --- a/source/libublsettings-gtk3.c +++ b/source/libublsettings-gtk3.c @@ -1176,6 +1176,12 @@ gboolean yon_gtk_tree_iter_get_from_combo_box_id(GtkComboBox *combo, GtkTreeMode int yon_calendar_set_orientation = 0; +int yon_calendar_last_date = 0; + +int yon_calendar_get_last_date(){ + return yon_calendar_last_date; +} + void yon_calendar_set_date_orientation(int orientation){ yon_calendar_set_orientation = orientation; } @@ -1196,9 +1202,11 @@ void yon_on_date_selected(GtkWidget *self,GtkWidget *target){ int comparison = g_date_time_compare(current_datetime,datetime); if ((comparison <0&&yon_calendar_set_orientation>0)||(comparison>0&&yon_calendar_set_orientation<0)){ gtk_entry_set_text(GTK_ENTRY(target),g_date_time_format(datetime,"%Y-%m-%d")); + yon_calendar_last_date = g_date_time_to_unix(datetime); } else { char *date_string = yon_char_unite(yr,"-",mn,"-",dy,NULL); gtk_entry_set_text(GTK_ENTRY(target), date_string); + yon_calendar_last_date = g_date_time_to_unix(current_datetime); } free(dy); free(mn); diff --git a/source/libublsettings-gtk3.h b/source/libublsettings-gtk3.h index ea45a40..8c965d7 100644 --- a/source/libublsettings-gtk3.h +++ b/source/libublsettings-gtk3.h @@ -473,4 +473,6 @@ gboolean yon_gtk_tree_iter_get_from_combo_box_id(GtkComboBox *combo, GtkTreeMode void yon_calendar_set_date_orientation(int orientation); -void yon_calendar_popover_open(GtkEntry *TargetEntry,GtkWidget *PopupTarget); \ No newline at end of file +void yon_calendar_popover_open(GtkEntry *TargetEntry,GtkWidget *PopupTarget); + +int yon_calendar_get_last_date(); \ No newline at end of file