Commit 6e1e7d30 authored by Matthias Clasen's avatar Matthias Clasen

Get the information about the first day of the week from the locale using

	* gtk/gtkcalendar.c: Get the information about the first day of the week from
	the locale using another instance of the "magic translated string" technique.
	Ignore the display option GTK_CALENDAR_WEEK_START_MONDAY with a warning.  (#87977)
parent 40f0f447
......@@ -6,7 +6,11 @@
* gtk/gtkcalendar.c: Complete the RTL flipping support for GtkCalendar, make it
possible to flip the headings using the "magic translated string" technique.
Translators, note the comment in gtk_calendar_init() explaining this.
Translators, note the comment in gtk_calendar_init() explaining this. (#102416)
* gtk/gtkcalendar.c: Get the information about the first day of the week from
the locale using another instance of the "magic translated string" technique.
Ignore the display option GTK_CALENDAR_WEEK_START_MONDAY with a warning. (#87977)
2003-08-08 Matthias Clasen <maclas@gmx.de>
......
......@@ -6,7 +6,11 @@
* gtk/gtkcalendar.c: Complete the RTL flipping support for GtkCalendar, make it
possible to flip the headings using the "magic translated string" technique.
Translators, note the comment in gtk_calendar_init() explaining this.
Translators, note the comment in gtk_calendar_init() explaining this. (#102416)
* gtk/gtkcalendar.c: Get the information about the first day of the week from
the locale using another instance of the "magic translated string" technique.
Ignore the display option GTK_CALENDAR_WEEK_START_MONDAY with a warning. (#87977)
2003-08-08 Matthias Clasen <maclas@gmx.de>
......
......@@ -6,7 +6,11 @@
* gtk/gtkcalendar.c: Complete the RTL flipping support for GtkCalendar, make it
possible to flip the headings using the "magic translated string" technique.
Translators, note the comment in gtk_calendar_init() explaining this.
Translators, note the comment in gtk_calendar_init() explaining this. (#102416)
* gtk/gtkcalendar.c: Get the information about the first day of the week from
the locale using another instance of the "magic translated string" technique.
Ignore the display option GTK_CALENDAR_WEEK_START_MONDAY with a warning. (#87977)
2003-08-08 Matthias Clasen <maclas@gmx.de>
......
......@@ -6,7 +6,11 @@
* gtk/gtkcalendar.c: Complete the RTL flipping support for GtkCalendar, make it
possible to flip the headings using the "magic translated string" technique.
Translators, note the comment in gtk_calendar_init() explaining this.
Translators, note the comment in gtk_calendar_init() explaining this. (#102416)
* gtk/gtkcalendar.c: Get the information about the first day of the week from
the locale using another instance of the "magic translated string" technique.
Ignore the display option GTK_CALENDAR_WEEK_START_MONDAY with a warning. (#87977)
2003-08-08 Matthias Clasen <maclas@gmx.de>
......
......@@ -6,7 +6,11 @@
* gtk/gtkcalendar.c: Complete the RTL flipping support for GtkCalendar, make it
possible to flip the headings using the "magic translated string" technique.
Translators, note the comment in gtk_calendar_init() explaining this.
Translators, note the comment in gtk_calendar_init() explaining this. (#102416)
* gtk/gtkcalendar.c: Get the information about the first day of the week from
the locale using another instance of the "magic translated string" technique.
Ignore the display option GTK_CALENDAR_WEEK_START_MONDAY with a warning. (#87977)
2003-08-08 Matthias Clasen <maclas@gmx.de>
......
2003-08-09 Matthias Clasen <maclas@gmx.de>
* gtk/tmpl/gtkcalendar.sgml: Deprecate GTK_CALENDAR_WEEK_START_MONDAY. (#87977)
2003-08-03 Matthias Clasen <maclas@gmx.de>
* gdk-pixbuf/tmpl/gdk-pixbuf.sgml: Clarify misleading explanation of rowstride. (#119000)
......
......@@ -67,40 +67,16 @@ are 0-11) while <structfield>selected_day</structfield> is one-based
<!-- ##### ENUM GtkCalendarDisplayOptions ##### -->
<para>
<informaltable pgwide="1" frame="none" role="enum">
<tgroup cols="2"><colspec colwidth="*"/><colspec colwidth="8*"/>
<tbody>
<row>
<entry>GTK_CALENDAR_SHOW_HEADING</entry>
<entry>Specifies that the month and year should be displayed.</entry>
</row>
<row>
<entry>GTK_CALENDAR_SHOW_DAY_NAMES</entry>
<entry>Specifies that three letter day descriptions should be present.</entry>
</row>
<row>
<entry>GTK_CALENDAR_NO_MONTH_CHANGE</entry>
<entry>Prevents the user from switching months with the calendar.</entry>
</row>
<row>
<entry>GTK_CALENDAR_SHOW_WEEK_NUMBERS</entry>
<entry>Displays each week numbers of the current year, down the left side of
the calendar.</entry>
</row>
<row>
<entry>GTK_CALENDAR_WEEK_START_MONDAY</entry>
<entry>Starts the calendar week on Monday, instead of the default Sunday.</entry>
</row>
</tbody></tgroup></informaltable>
</para>
@GTK_CALENDAR_SHOW_HEADING:
@GTK_CALENDAR_SHOW_DAY_NAMES:
@GTK_CALENDAR_NO_MONTH_CHANGE:
@GTK_CALENDAR_SHOW_WEEK_NUMBERS:
@GTK_CALENDAR_WEEK_START_MONDAY:
These options can be used to influence the display and behaviour of a #GtkCalendar.
</para>
@GTK_CALENDAR_SHOW_HEADING: Specifies that the month and year should be displayed.
@GTK_CALENDAR_SHOW_DAY_NAMES: Specifies that three letter day descriptions should be present.
@GTK_CALENDAR_NO_MONTH_CHANGE: Prevents the user from switching months with the calendar.
@GTK_CALENDAR_SHOW_WEEK_NUMBERS: Displays each week numbers of the current year, down the left side
of the calendar.
@GTK_CALENDAR_WEEK_START_MONDAY: Since GTK+ 2.4, this option is deprecated and ignored by GTK+.
The information on which day the calendar week starts is derived from the locale.
<!-- ##### FUNCTION gtk_calendar_new ##### -->
<para>
......@@ -295,11 +271,6 @@ calendar.
</para>
<!-- ##### ARG GtkCalendar:week-start-monday ##### -->
<para>
</para>
<!-- ##### ARG GtkCalendar:year ##### -->
<para>
......
......@@ -225,7 +225,6 @@ enum
PROP_SHOW_DAY_NAMES,
PROP_NO_MONTH_CHANGE,
PROP_SHOW_WEEK_NUMBERS,
PROP_WEEK_START_MONDAY,
PROP_LAST
};
......@@ -276,6 +275,8 @@ struct _GtkCalendarPrivateData
guint32 timer;
gint click_child;
gint week_start;
};
#define GTK_CALENDAR_PRIVATE_DATA(widget) (((GtkCalendarPrivateData*)(GTK_CALENDAR (widget)->private_data)))
......@@ -499,22 +500,6 @@ gtk_calendar_class_init (GtkCalendarClass *class)
FALSE,
G_PARAM_READWRITE));
/**
* GtkCalendar:week-start-monday:
*
* If this is %TRUE, Monday is displayed as the first day of the week.
*
* Since: 2.4
*/
g_object_class_install_property (gobject_class,
PROP_WEEK_START_MONDAY,
g_param_spec_boolean ("week_start_monday",
_("Week Start Monday"),
_("If TRUE, Monday is displayed as the first day of the week"),
FALSE,
G_PARAM_READWRITE));
gtk_calendar_signals[MONTH_CHANGED_SIGNAL] =
g_signal_new ("month_changed",
G_OBJECT_CLASS_TYPE (gobject_class),
......@@ -584,6 +569,7 @@ gtk_calendar_init (GtkCalendar *calendar)
GtkWidget *widget;
GtkCalendarPrivateData *private_data;
gchar *year_before;
gchar *week_start;
widget = GTK_WIDGET (calendar);
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
......@@ -667,6 +653,19 @@ gtk_calendar_init (GtkCalendar *calendar)
private_data->year_before = 1;
else if (strcmp (year_before, "calendar:MY") != 0)
g_warning ("Whoever translated calendar:MY did so wrongly.\n");
/* Translate to calendar:week_start:1 if you want Monday to be the
* first day of the week; otherwise translate to calendar:week_start:0.
* Do *not* translate it to anything else, if it isn't calendar:week_start:1
* or calendar:week_start:0 it will not work.
*/
week_start = _("calendar:week_start:0");
if (strcmp (week_start, "calendar:week_start:1") == 0)
private_data->week_start = 1;
else if (strcmp (week_start, "calendar:week_start:0") == 0)
private_data->week_start = 0;
else
g_warning ("Whoever translated calendar:week_start:0 did so wrongly.\n");
}
GtkWidget*
......@@ -1891,7 +1890,7 @@ gtk_calendar_paint_day_names (GtkWidget *widget)
day = 6 - i;
else
day = i;
if (calendar->display_flags & GTK_CALENDAR_WEEK_START_MONDAY)
if (private_data->week_start == 1)
day= (day+1)%7;
g_snprintf (buffer, sizeof (buffer), "%s", default_abbreviated_dayname[day]);
......@@ -2196,6 +2195,7 @@ gtk_calendar_paint_main (GtkWidget *widget)
static void
gtk_calendar_compute_days (GtkCalendar *calendar)
{
GtkCalendarPrivateData *private_data;
gint month;
gint year;
gint ndays_in_month;
......@@ -2207,6 +2207,8 @@ gtk_calendar_compute_days (GtkCalendar *calendar)
g_return_if_fail (GTK_IS_CALENDAR (calendar));
private_data = GTK_CALENDAR_PRIVATE_DATA (GTK_WIDGET (calendar));
year = calendar->year;
month = calendar->month + 1;
......@@ -2214,7 +2216,7 @@ gtk_calendar_compute_days (GtkCalendar *calendar)
first_day = day_of_week (year, month, 1);
if (calendar->display_flags & GTK_CALENDAR_WEEK_START_MONDAY)
if (private_data->week_start == 1)
first_day--;
else
first_day %= 7;
......@@ -2407,17 +2409,7 @@ gtk_calendar_set_display_options (GtkCalendar *calendar,
}
if ((flags ^ calendar->display_flags) & GTK_CALENDAR_WEEK_START_MONDAY)
{
if (calendar->display_flags & GTK_CALENDAR_WEEK_START_MONDAY)
calendar->display_flags &= ~GTK_CALENDAR_WEEK_START_MONDAY;
else
calendar->display_flags |= GTK_CALENDAR_WEEK_START_MONDAY;
gtk_calendar_compute_days (calendar);
gtk_calendar_paint_main (GTK_WIDGET (calendar));
if (private_data->day_name_win)
gtk_calendar_paint_day_names (GTK_WIDGET (calendar));
}
g_warning ("GTK_CALENDAR_WEEK_START_MONDAY is ignored; the first day of the week is determined from the locale");
calendar->display_flags = flags;
if (resize)
......@@ -2436,8 +2428,6 @@ gtk_calendar_set_display_options (GtkCalendar *calendar,
g_object_notify (G_OBJECT (calendar), "no_month_change");
if ((old_flags ^ calendar->display_flags) & GTK_CALENDAR_SHOW_WEEK_NUMBERS)
g_object_notify (G_OBJECT (calendar), "show_week_numbers");
if ((old_flags ^ calendar->display_flags) & GTK_CALENDAR_WEEK_START_MONDAY)
g_object_notify (G_OBJECT (calendar), "week_start_monday");
g_object_thaw_notify (G_OBJECT (calendar));
}
......@@ -3248,11 +3238,6 @@ gtk_calendar_set_property (GObject *object,
GTK_CALENDAR_SHOW_WEEK_NUMBERS,
g_value_get_boolean (value));
break;
case PROP_WEEK_START_MONDAY:
gtk_calendar_set_display_option (calendar,
GTK_CALENDAR_WEEK_START_MONDAY,
g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -3296,10 +3281,6 @@ gtk_calendar_get_property (GObject *object,
g_value_set_boolean (value, gtk_calendar_get_display_option (calendar,
GTK_CALENDAR_SHOW_WEEK_NUMBERS));
break;
case PROP_WEEK_START_MONDAY:
g_value_set_boolean (value, gtk_calendar_get_display_option (calendar,
GTK_CALENDAR_WEEK_START_MONDAY));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment