Really fix #162297, and preload the current dates if they aren't already
2005-01-07 Glynn Foster <glynn.foster@sun.com> * src/option.c, src/calendar.c: Really fix #162297, and preload the current dates if they aren't already set.
This commit is contained in:
parent
20277e4962
commit
516f994409
@ -1,3 +1,8 @@
|
|||||||
|
2005-01-07 Glynn Foster <glynn.foster@sun.com>
|
||||||
|
|
||||||
|
* src/option.c, src/calendar.c: Really fix #162297, and
|
||||||
|
preload the current dates if they aren't already set.
|
||||||
|
|
||||||
2005-01-07 Glynn Foster <glynn.foster@sun.com>
|
2005-01-07 Glynn Foster <glynn.foster@sun.com>
|
||||||
|
|
||||||
* src/option.c: Pre-load the year, because gtk_calendar* is
|
* src/option.c: Pre-load the year, because gtk_calendar* is
|
||||||
|
@ -73,7 +73,7 @@ zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data)
|
|||||||
if (glade_dialog)
|
if (glade_dialog)
|
||||||
g_object_unref (glade_dialog);
|
g_object_unref (glade_dialog);
|
||||||
|
|
||||||
if (cal_data->month > 0 && cal_data->year > 0)
|
if (cal_data->month > 0 || cal_data->year > 0)
|
||||||
gtk_calendar_select_month (GTK_CALENDAR (calendar), cal_data->month - 1, cal_data->year);
|
gtk_calendar_select_month (GTK_CALENDAR (calendar), cal_data->month - 1, cal_data->year);
|
||||||
if (cal_data->day > 0)
|
if (cal_data->day > 0)
|
||||||
gtk_calendar_select_day (GTK_CALENDAR (calendar), cal_data->day);
|
gtk_calendar_select_day (GTK_CALENDAR (calendar), cal_data->day);
|
||||||
|
32
src/option.c
32
src/option.c
@ -714,17 +714,11 @@ zenity_calendar_pre_callback (GOptionContext *context,
|
|||||||
gpointer data,
|
gpointer data,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
struct tm *t;
|
|
||||||
time_t current_time;
|
|
||||||
|
|
||||||
time (¤t_time);
|
|
||||||
t = localtime (¤t_time);
|
|
||||||
|
|
||||||
zenity_calendar_active = FALSE;
|
zenity_calendar_active = FALSE;
|
||||||
zenity_calendar_date_format = NULL;
|
zenity_calendar_date_format = NULL;
|
||||||
zenity_calendar_day = 0;
|
zenity_calendar_day = -1;
|
||||||
zenity_calendar_month = 0;
|
zenity_calendar_month = -1;
|
||||||
zenity_calendar_year = t->tm_year + 1900;
|
zenity_calendar_year = -1;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -892,6 +886,19 @@ zenity_calendar_post_callback (GOptionContext *context,
|
|||||||
zenity_option_set_dialog_mode (zenity_calendar_active, MODE_CALENDAR);
|
zenity_option_set_dialog_mode (zenity_calendar_active, MODE_CALENDAR);
|
||||||
|
|
||||||
if (results->mode == MODE_CALENDAR) {
|
if (results->mode == MODE_CALENDAR) {
|
||||||
|
struct tm *t;
|
||||||
|
time_t current_time;
|
||||||
|
|
||||||
|
time (¤t_time);
|
||||||
|
t = localtime (¤t_time);
|
||||||
|
|
||||||
|
if (zenity_calendar_day < 0)
|
||||||
|
zenity_calendar_day = t->tm_mday;
|
||||||
|
if (zenity_calendar_month < 0)
|
||||||
|
zenity_calendar_month = t->tm_mon + 1;
|
||||||
|
if (zenity_calendar_year < 0)
|
||||||
|
zenity_calendar_year = t->tm_year + 1900;
|
||||||
|
|
||||||
results->calendar_data->dialog_text = zenity_general_dialog_text;
|
results->calendar_data->dialog_text = zenity_general_dialog_text;
|
||||||
results->calendar_data->day = zenity_calendar_day;
|
results->calendar_data->day = zenity_calendar_day;
|
||||||
results->calendar_data->month = zenity_calendar_month;
|
results->calendar_data->month = zenity_calendar_month;
|
||||||
@ -900,16 +907,17 @@ zenity_calendar_post_callback (GOptionContext *context,
|
|||||||
results->calendar_data->date_format = zenity_calendar_date_format;
|
results->calendar_data->date_format = zenity_calendar_date_format;
|
||||||
else
|
else
|
||||||
results->calendar_data->date_format = g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL);
|
results->calendar_data->date_format = g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (zenity_calendar_day)
|
if (zenity_calendar_day > -1)
|
||||||
zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_day),
|
zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_day),
|
||||||
ERROR_SUPPORT);
|
ERROR_SUPPORT);
|
||||||
|
|
||||||
if (zenity_calendar_month)
|
if (zenity_calendar_month > -1)
|
||||||
zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_month),
|
zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_month),
|
||||||
ERROR_SUPPORT);
|
ERROR_SUPPORT);
|
||||||
|
|
||||||
if (zenity_calendar_year)
|
if (zenity_calendar_year > -1)
|
||||||
zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_year),
|
zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_year),
|
||||||
ERROR_SUPPORT);
|
ERROR_SUPPORT);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user