diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 8 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 8 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 8 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 8 | ||||
-rw-r--r-- | docs/reference/ChangeLog | 6 | ||||
-rw-r--r-- | docs/reference/gtk/gtk-sections.txt | 2 | ||||
-rw-r--r-- | docs/reference/gtk/tmpl/gtkcalendar.sgml | 3 | ||||
-rw-r--r-- | gtk/gtkcalendar.c | 279 | ||||
-rw-r--r-- | gtk/gtkcalendar.h | 6 |
10 files changed, 322 insertions, 14 deletions
@@ -1,3 +1,11 @@ +2003-05-08 Matthias Clasen <maclas@gmx.de> + + * gtk/gtkcalendar.[ch] (gtk_calendar_set_display_options): + (gtk_calendar_get_display_options): New functions. + (gtk_calendar_display_options): Depreate. (#64567) + (gtk_calendar_class_init): Add boolean properties for the display + options. (#50949) + Tue May 6 16:50:52 2003 Owen Taylor <otaylor@redhat.com> Patch from James Henstridge to update to automake-1.7 diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 0e73b9e271..50335d78f2 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +2003-05-08 Matthias Clasen <maclas@gmx.de> + + * gtk/gtkcalendar.[ch] (gtk_calendar_set_display_options): + (gtk_calendar_get_display_options): New functions. + (gtk_calendar_display_options): Depreate. (#64567) + (gtk_calendar_class_init): Add boolean properties for the display + options. (#50949) + Tue May 6 16:50:52 2003 Owen Taylor <otaylor@redhat.com> Patch from James Henstridge to update to automake-1.7 diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 0e73b9e271..50335d78f2 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +2003-05-08 Matthias Clasen <maclas@gmx.de> + + * gtk/gtkcalendar.[ch] (gtk_calendar_set_display_options): + (gtk_calendar_get_display_options): New functions. + (gtk_calendar_display_options): Depreate. (#64567) + (gtk_calendar_class_init): Add boolean properties for the display + options. (#50949) + Tue May 6 16:50:52 2003 Owen Taylor <otaylor@redhat.com> Patch from James Henstridge to update to automake-1.7 diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 0e73b9e271..50335d78f2 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +2003-05-08 Matthias Clasen <maclas@gmx.de> + + * gtk/gtkcalendar.[ch] (gtk_calendar_set_display_options): + (gtk_calendar_get_display_options): New functions. + (gtk_calendar_display_options): Depreate. (#64567) + (gtk_calendar_class_init): Add boolean properties for the display + options. (#50949) + Tue May 6 16:50:52 2003 Owen Taylor <otaylor@redhat.com> Patch from James Henstridge to update to automake-1.7 diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 0e73b9e271..50335d78f2 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +2003-05-08 Matthias Clasen <maclas@gmx.de> + + * gtk/gtkcalendar.[ch] (gtk_calendar_set_display_options): + (gtk_calendar_get_display_options): New functions. + (gtk_calendar_display_options): Depreate. (#64567) + (gtk_calendar_class_init): Add boolean properties for the display + options. (#50949) + Tue May 6 16:50:52 2003 Owen Taylor <otaylor@redhat.com> Patch from James Henstridge to update to automake-1.7 diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index ceb1bf6b7d..52f7cd1106 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,9 @@ +2003-05-08 Matthias Clasen <maclas@gmx.de> + + * gtk/tmpl/gtkcalendar.sgml: Deprecate gtk_calendar_display_options(). + + * gtk/gtk-sections.txt: Add gtk_calendar_[sg]et_display_options(). + 2003-05-05 Matthias Clasen <maclas@gmx.de> * gtk/gtk-docs.sgml: diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt index c58e148d7d..fca986ac12 100644 --- a/docs/reference/gtk/gtk-sections.txt +++ b/docs/reference/gtk/gtk-sections.txt @@ -284,6 +284,8 @@ gtk_calendar_select_day gtk_calendar_mark_day gtk_calendar_unmark_day gtk_calendar_clear_marks +gtk_calendar_get_display_options +gtk_calendar_set_display_options gtk_calendar_display_options gtk_calendar_get_date gtk_calendar_freeze diff --git a/docs/reference/gtk/tmpl/gtkcalendar.sgml b/docs/reference/gtk/tmpl/gtkcalendar.sgml index 439a428331..911f3f8077 100644 --- a/docs/reference/gtk/tmpl/gtkcalendar.sgml +++ b/docs/reference/gtk/tmpl/gtkcalendar.sgml @@ -21,7 +21,7 @@ Alternative, all marks can be cleared with gtk_calendar_clear_marks(). </para> <para> The way in which the calendar itself is displayed can be altered using -gtk_calendar_display_options(). +gtk_calendar_set_display_options(). </para> <para> The selected date can be retrieved from a #GtkCalendar using @@ -166,6 +166,7 @@ Sets display options (whether to display the heading and the month headings). @calendar: a #GtkCalendar. @flags: the display options to set. +@Deprecated: Use gtk_calendar_set_display_options() instead <!-- ##### FUNCTION gtk_calendar_get_date ##### --> diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index cccdc35c5a..ee740d569b 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -41,6 +41,7 @@ #include "gtkcalendar.h" #include "gtkmarshalers.h" +#include "gtkintl.h" #include "gdk/gdkkeysyms.h" /***************************************************************************/ @@ -212,6 +213,20 @@ enum { LAST_SIGNAL }; +enum +{ + PROP_0, + PROP_YEAR, + PROP_MONTH, + PROP_DAY, + PROP_SHOW_HEADING, + PROP_SHOW_DAY_NAMES, + PROP_NO_MONTH_CHANGE, + PROP_SHOW_WEEK_NUMBERS, + PROP_WEEK_START_MONDAY, + PROP_LAST +}; + static gint gtk_calendar_signals[LAST_SIGNAL] = { 0 }; static GtkWidgetClass *parent_class = NULL; @@ -261,6 +276,14 @@ typedef void (*GtkCalendarSignalDate) (GtkObject *object, guint arg1, guint arg2 static void gtk_calendar_class_init (GtkCalendarClass *class); static void gtk_calendar_init (GtkCalendar *calendar); static void gtk_calendar_finalize (GObject *calendar); +static void gtk_calendar_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void gtk_calendar_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); static void gtk_calendar_realize (GtkWidget *widget); static void gtk_calendar_unrealize (GtkWidget *widget); static void gtk_calendar_size_request (GtkWidget *widget, @@ -347,6 +370,8 @@ gtk_calendar_class_init (GtkCalendarClass *class) parent_class = g_type_class_peek_parent (class); + gobject_class->set_property = gtk_calendar_set_property; + gobject_class->get_property = gtk_calendar_get_property; gobject_class->finalize = gtk_calendar_finalize; widget_class->realize = gtk_calendar_realize; @@ -370,6 +395,64 @@ gtk_calendar_class_init (GtkCalendarClass *class) class->prev_year = NULL; class->next_year = NULL; + g_object_class_install_property (gobject_class, + PROP_YEAR, + g_param_spec_int ("year", + _("Year"), + _("The selected year"), + 0, G_MAXINT, 0, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROP_MONTH, + g_param_spec_int ("month", + _("Month"), + _("The selected month (as a number between 0 and 11)"), + 0, 11, 0, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROP_DAY, + g_param_spec_int ("day", + _("Day"), + _("The selected day (as a number between 1 and 31, or 0 to unselect the currently selected day)"), + 0, 31, 0, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROP_SHOW_HEADING, + g_param_spec_boolean ("show_heading", + _("Show Heading"), + _("If TRUE, a heading is displayed"), + TRUE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROP_SHOW_DAY_NAMES, + g_param_spec_boolean ("show_day_names", + _("Show Day Names"), + _("If TRUE, day names are displayed"), + TRUE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROP_NO_MONTH_CHANGE, + g_param_spec_boolean ("no_month_change", + _("No Month Change"), + _("If TRUE, the selected month can not be changed"), + FALSE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROP_SHOW_WEEK_NUMBERS, + g_param_spec_boolean ("show_week_numbers", + _("Show Week Numbers"), + _("If TRUE, week numbers are displayed"), + FALSE, + G_PARAM_READWRITE)); + 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), @@ -1990,32 +2073,56 @@ gtk_calendar_compute_days (GtkCalendar *calendar) } } -/* ---------------------------------------------------------------------- - NAME: gtk_calendar_display_options - DESCRIPTION: Set display options (whether to display the - heading and the month headings) - - flags is can be an XOR of: - GTK_CALENDAR_SHOW_HEADING - GTK_CALENDAR_SHOW_DAY_NAMES - GTK_CALENDAR_NO_MONTH_CHANGE - GTK_CALENDAR_SHOW_WEEK_NUMBERS - GTK_CALENDAR_WEEK_START_MONDAY - ---------------------------------------------------------------------- */ - void gtk_calendar_display_options (GtkCalendar *calendar, GtkCalendarDisplayOptions flags) { + gtk_calendar_set_display_options (calendar, flags); +} + +/** + * gtk_calendar_get_display_options: + * @calendar: a #GtkCalendar + * + * Returns the current display options of @calendar. + * + * Return value: the display options. + * + * Since: 2.4 + **/ +GtkCalendarDisplayOptions +gtk_calendar_get_display_options (GtkCalendar *calendar) +{ + g_return_val_if_fail (GTK_IS_CALENDAR (calendar), 0); + + return calendar->display_flags; +} + +/** + * gtk_calendar_set_display_options: + * @calendar: a #GtkCalendar + * @flags: the display options to set + * + * Sets display options (whether to display the heading and the month + * headings). + * + * Since: 2.4 + **/ +void +gtk_calendar_set_display_options (GtkCalendar *calendar, + GtkCalendarDisplayOptions flags) +{ GtkCalendarPrivateData *private_data; gint resize = 0; GtkWidget *widget; gint i; + GtkCalendarDisplayOptions old_flags; g_return_if_fail (GTK_IS_CALENDAR (calendar)); widget = GTK_WIDGET (calendar); private_data = GTK_CALENDAR_PRIVATE_DATA (calendar); + old_flags = calendar->display_flags; if (GTK_WIDGET_REALIZED (widget)) { @@ -2126,6 +2233,18 @@ gtk_calendar_display_options (GtkCalendar *calendar, else calendar->display_flags = flags; + g_object_freeze_notify (G_OBJECT (calendar)); + if ((old_flags ^ calendar->display_flags) & GTK_CALENDAR_SHOW_HEADING) + g_object_notify (G_OBJECT (calendar), "show_heading"); + if ((old_flags ^ calendar->display_flags) & GTK_CALENDAR_SHOW_DAY_NAMES) + g_object_notify (G_OBJECT (calendar), "show_day_names"); + if ((old_flags ^ calendar->display_flags) & GTK_CALENDAR_NO_MONTH_CHANGE) + 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)); } gboolean @@ -2142,6 +2261,12 @@ gtk_calendar_select_month (GtkCalendar *calendar, gtk_calendar_compute_days (calendar); gtk_widget_queue_draw (GTK_WIDGET (calendar)); + + g_object_freeze_notify (G_OBJECT (calendar)); + g_object_notify (G_OBJECT (calendar), "month"); + g_object_notify (G_OBJECT (calendar), "year"); + g_object_thaw_notify (G_OBJECT (calendar)); + g_signal_emit (calendar, gtk_calendar_signals[MONTH_CHANGED_SIGNAL], 0); @@ -2177,6 +2302,8 @@ gtk_calendar_select_day (GtkCalendar *calendar, gtk_calendar_paint_day_num (GTK_WIDGET (calendar), day); } + g_object_notify (G_OBJECT (calendar), "day"); + g_signal_emit (calendar, gtk_calendar_signals[DAY_SELECTED_SIGNAL], 0); @@ -2720,3 +2847,129 @@ gtk_calendar_key_press (GtkWidget *widget, return return_val; } + +static void +gtk_calendar_set_display_option (GtkCalendar *calendar, + GtkCalendarDisplayOptions flag, + gboolean setting) +{ + GtkCalendarDisplayOptions flags; + if (setting) + flags = calendar->display_flags | flag; + else + flags = calendar->display_flags & ~flag; + gtk_calendar_display_options (calendar, flags); +} + +static gboolean +gtk_calendar_get_display_option (GtkCalendar *calendar, + GtkCalendarDisplayOptions flag) +{ + return (calendar->display_flags & flag) != 0; +} + + +static void +gtk_calendar_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GtkCalendar *calendar; + + calendar = GTK_CALENDAR (object); + + switch (prop_id) + { + case PROP_YEAR: + gtk_calendar_select_month (calendar, + calendar->month, + g_value_get_int (value)); + break; + case PROP_MONTH: + gtk_calendar_select_month (calendar, + g_value_get_int (value), + calendar->year); + break; + case PROP_DAY: + gtk_calendar_select_day (calendar, + g_value_get_int (value)); + break; + case PROP_SHOW_HEADING: + gtk_calendar_set_display_option (calendar, + GTK_CALENDAR_SHOW_HEADING, + g_value_get_boolean (value)); + break; + case PROP_SHOW_DAY_NAMES: + gtk_calendar_set_display_option (calendar, + GTK_CALENDAR_SHOW_DAY_NAMES, + g_value_get_boolean (value)); + break; + case PROP_NO_MONTH_CHANGE: + gtk_calendar_set_display_option (calendar, + GTK_CALENDAR_NO_MONTH_CHANGE, + g_value_get_boolean (value)); + break; + case PROP_SHOW_WEEK_NUMBERS: + gtk_calendar_set_display_option (calendar, + 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; + } +} + +static void +gtk_calendar_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GtkCalendar *calendar; + + calendar = GTK_CALENDAR (object); + + switch (prop_id) + { + case PROP_YEAR: + g_value_set_int (value, calendar->year); + break; + case PROP_MONTH: + g_value_set_int (value, calendar->month); + break; + case PROP_DAY: + g_value_set_int (value, calendar->selected_day); + break; + case PROP_SHOW_HEADING: + g_value_set_boolean (value, gtk_calendar_get_display_option (calendar, + GTK_CALENDAR_SHOW_HEADING)); + break; + case PROP_SHOW_DAY_NAMES: + g_value_set_boolean (value, gtk_calendar_get_display_option (calendar, + GTK_CALENDAR_SHOW_DAY_NAMES)); + break; + case PROP_NO_MONTH_CHANGE: + g_value_set_boolean (value, gtk_calendar_get_display_option (calendar, + GTK_CALENDAR_NO_MONTH_CHANGE)); + break; + case PROP_SHOW_WEEK_NUMBERS: + 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; + } + +} diff --git a/gtk/gtkcalendar.h b/gtk/gtkcalendar.h index 7ecff247dd..ef7143588e 100644 --- a/gtk/gtkcalendar.h +++ b/gtk/gtkcalendar.h @@ -131,8 +131,14 @@ gboolean gtk_calendar_unmark_day (GtkCalendar *calendar, void gtk_calendar_clear_marks (GtkCalendar *calendar); +void gtk_calendar_set_display_options (GtkCalendar *calendar, + GtkCalendarDisplayOptions flags); +GtkCalendarDisplayOptions + gtk_calendar_get_display_options (GtkCalendar *calendar); +#ifndef GTK_DISABLE_DEPRECATED void gtk_calendar_display_options (GtkCalendar *calendar, GtkCalendarDisplayOptions flags); +#endif void gtk_calendar_get_date (GtkCalendar *calendar, guint *year, |