From b00ce69d4b42b057d83130e9614eb8b05a98ab4c Mon Sep 17 00:00:00 2001 From: Florent D'halluin Date: Tue, 13 Oct 2009 19:38:43 +0200 Subject: [PATCH] When creating a new appointment from the month view, Pick selected date as default date for the new event --- src/mainbox.c | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/mainbox.c b/src/mainbox.c index 412a28d..3ec123b 100644 --- a/src/mainbox.c +++ b/src/mainbox.c @@ -80,9 +80,21 @@ static void mFile_newApp_activate_cb(GtkMenuItem *menuitem, gpointer user_data) #ifdef ORAGE_DEBUG orage_message(-100, P_N); #endif - t = orage_localtime(); - g_snprintf(cur_date, 9, "%04d%02d%02d", t->tm_year+1900 - , t->tm_mon+1, t->tm_mday); + + /* getting selected date on the calendar */ + CalWin *cal = (CalWin *)g_par.xfcal; + char *s_time; + struct tm tt= {0,0,0,0,0,0,0,0,0}; + + gtk_calendar_get_date(GTK_CALENDAR(cal->mCalendar) + , (unsigned int *)&tt.tm_year + , (unsigned int *)&tt.tm_mon + , (unsigned int *)&tt.tm_mday); + tt.tm_year -= 1900; + s_time = orage_tm_time_to_icaltime(&tt); + strncpy(cur_date, s_time, 8); + cur_date[8] = '\0'; + create_appt_win("NEW", cur_date); } -- 1.6.3.3