Added function to get last calendar date and time

pull/18/head
parent 9a024a66c5
commit 6ff3b47bd5

@ -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_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){ void yon_calendar_set_date_orientation(int orientation){
yon_calendar_set_orientation = 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); int comparison = g_date_time_compare(current_datetime,datetime);
if ((comparison <0&&yon_calendar_set_orientation>0)||(comparison>0&&yon_calendar_set_orientation<0)){ 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")); 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 { } else {
char *date_string = yon_char_unite(yr,"-",mn,"-",dy,NULL); char *date_string = yon_char_unite(yr,"-",mn,"-",dy,NULL);
gtk_entry_set_text(GTK_ENTRY(target), date_string); gtk_entry_set_text(GTK_ENTRY(target), date_string);
yon_calendar_last_date = g_date_time_to_unix(current_datetime);
} }
free(dy); free(dy);
free(mn); free(mn);

@ -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_set_date_orientation(int orientation);
void yon_calendar_popover_open(GtkEntry *TargetEntry,GtkWidget *PopupTarget); void yon_calendar_popover_open(GtkEntry *TargetEntry,GtkWidget *PopupTarget);
int yon_calendar_get_last_date();
Loading…
Cancel
Save