GNOME Bugzilla – Bug 350584
Patch: Calendar::get_date() method using Glib::Date
Last modified: 2007-05-01 17:03:03 UTC
Patching the function: "Gtk::Calendar::get_date()" in class Gtk::Calendar. Other information: Month returned by "Gtk::Calendar::get_date()" is between 0 and 11. However, good value of "enum Glib::Date::Month" is between 1 and 12. Hack in code is necessary, e.g. calendar->get_date(year, month, day); Glib::Date date = Glib::Date::Date (Glib::Date::Day(day), Glib::Date::Month(month + 1), Glib::Date::Year(year));
This is a GTK+ issue, and one that I doubt they'd bother fixing, though it would theoretically be possible by deprecated gtk_calendar_get_date() and adding a new function that returned the enum instead of an int. I think it is how it is because GtkCalendare existed before GDate. It is at least documented: http://developer.gimp.org/api/2.0/gtk/GtkCalendar.html#gtk-calendar-get-date But for gtkmm it would be nice to add a void get_date(Glib::Date& date) const method overload. A patch would be welcome. Normally we would use a return type instead of an output parameter but I think that would be strange next to the existing get_date() method.
Created attachment 71906 [details] [review] Adds get_date(Glib::Date& date) This patch adds the proposed function and updates the calendar example. Anyway, with and without the patch the month_changed signal seems not to work correctly in the example but throws some (lt-calendar:30138): GLib-CRITICAL **: g_date_get_year: assertion `g_date_valid (d)' failed sometimes. Patch was made during the work for Openimus Gmbh!
Great. This should be applied when we branch. When someone does that, please remember to also initialize those guints to 0.
Committed to svn trunk, after branching for gtkmm-2-10.