Mathias Hasselmann

GtkCalendar Details

Hmm... Too much whining on this blog recently. So let's demonstrate some small, but exiting code I've wrote for Openismus, and which will show up in GTK+ 2.16:

/**
 * gtk_calendar_set_detail_func:
 * @calendar: a #GtkCalendar.
 * @func: a function providing details for each day.
 * @data: data to pass to @func invokations.
 * @destroy: a function for releasing @data.
 *
 * Installs a function which provides Pango markup with detail information
 * for each day. Examples for such details are holidays or appointments.
 * That information is shown below each day when #GtkCalendar:show-details
 * is set. A tooltip containing with full detail information is provided,
 * if the entire text should not fit into the details area, or if
 * #GtkCalendar:show-details is not set.
 *
 * The size of the details area can be restricted by setting the
 * #GtkCalendar:detail-width-chars and #GtkCalendar:detail-height-rows
 * properties. 
 *
 * Since: 2.16
 */

Comments

Eskild Hustvedt commented on January 7, 2008 at 7:21 p.m.

Excellent, this will definitely be a useful addition to Gtk2

mila commented on January 7, 2008 at 9:43 p.m.

Cool, but also very big (width * height i mean ;))

Wouldn't mouse-over pop-ups do?

Mathias Hasselmann commented on January 7, 2008 at 10:22 p.m.

Eskild: :-) - Murray deserves credits for having that idea.

Mila: Situations vary. During date selection in Glom you'll have the space for using the verbose variant demonstrated in the screencast, for other uses, like for instance GNOME Panel's clock, a tooltip variant is preferable. Well, and good news are: This variant exists. When the "show-details" property is set to FALSE, days with details will only be highlighted, and you have to hover them, to get a tooltip with the detail information.

Guess I didn't demonstrate that feature in the video, as I implemented it after recording the screencast. The Bugzilla entry should reveal history of that patch. ;-)

Mila commented on January 7, 2008 at 11:56 p.m.

Very cool :)

Really great!

ksdfjk commented on January 8, 2008 at 10:15 a.m.

Hmmm... isn't this API a little short sighted? I'd rather see model/view that leaves room for more than simple string passing. That would clear the way so that GtkCalendar may evolve into a more powerful, editable calendar widget.

Mathias Hasselmann commented on January 8, 2008 at 10:50 a.m.

ksdfjk (hope you read this): I also proposed to support a model/view model by implementing the GtkCellLayout interface, but Matthias Clasen considered that too much effort for an old and rusty widget like GtkCalendar.

Well, but feel free to comment on bug 339540 - or open a new one.

[1] http://bugzilla.gnome.org/show_bug.cg...

Murray Cumming commented on January 11, 2008 at 10:53 p.m.

ksdfjk, nothing is stopping someone from implementing a great calendar widget (by improving or replacing the existing one). But the fact that nobody is doing that now shouldn't stop us from having something we need now.