After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 350584 - Patch: Calendar::get_date() method using Glib::Date
Patch: Calendar::get_date() method using Glib::Date
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
2.8.x
Other All
: Normal minor
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2006-08-09 12:45 UTC by sosuiming
Modified: 2007-05-01 17:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Adds get_date(Glib::Date& date) (2.90 KB, patch)
2006-08-30 14:18 UTC, Johannes Schmid
none Details | Review

Description sosuiming 2006-08-09 12:45:10 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));
Comment 1 Murray Cumming 2006-08-10 06:17:54 UTC
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.
Comment 2 Johannes Schmid 2006-08-30 14:18:28 UTC
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!
Comment 3 Murray Cumming 2006-09-11 17:34:05 UTC
Great. This should be applied when we branch. When someone does that, please remember to also initialize those guints to 0.
Comment 4 Murray Cumming 2007-05-01 17:03:03 UTC
Committed to svn trunk, after branching for gtkmm-2-10.