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 110605 - Gtk::Widget::modify_fg/bg can't take a 0
Gtk::Widget::modify_fg/bg can't take a 0
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
2.4
Other All
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2003-04-12 01:23 UTC by Ole Laursen
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch that adds unset_* and custom documentation to modify_* (5.56 KB, patch)
2003-04-15 21:09 UTC, Ole Laursen
none Details | Review

Description Ole Laursen 2003-04-12 01:23:51 UTC
According to the GTK+ (and the gtkmm) documentation, one should pass a 0 to
modify_fg/bg for the Gdk::Color parameter to undo the effects of previous
calls to the methods. However, the Gdk::Color parameter is wrapped as a
reference, not a pointer, rendering passing of zero impossible.

I guess there is some common pattern in gtkmm for solving this problem.
Comment 1 Murray Cumming 2003-04-13 13:01:31 UTC
Well spotted. We would usually wrap this as hand-coded unset_fg() and
unset_bg() methods. A patch against gtkmm 2.4 would be very helpful.

In the meantime, you can use the GTK+ C function as a workaround.
Comment 2 Ole Laursen 2003-04-14 21:35:37 UTC
I've got one cooked now. I just need to add documentation. Can I grab
the current documentation for modify_fg in Doxygen format from
somewhere? I need to modify it to strip out the "or [pass] 0 to undo
the effect of previous calls to modify_fg()" and mention unset instead.

Also, I've added unset_* methods for fg, bg, text, base and font, but
not for modify_bg_pixmap since I'm a little unsure of where that
method comes from. It is hand coded, not wrapped, and I can't find
anything like it in GTK+. Any ideas?

> In the meantime, you can use the GTK+ C function as a workaround.

I'm glad C++ is so compatible with C. Stroustrup knew what he was doing.
Comment 3 Murray Cumming 2003-04-15 07:39:27 UTC
> Can I grab the current documentation for modify_fg in Doxygen 
format.

Yes, using similar doxygen comments would be fine.

> Also, I've added unset_* methods for fg, bg, text, base and font

OK, as long as you are sure they can take 0 too.

> but not for modify_bg_pixmap since I'm a little unsure of where that
method comes from.

Google gave me this:

http://mail.gnome.org/archives/cvs-commits-list/2002-
December/msg04868.html

But it doesn't really mean much to me. Putting that in a doxygen 
comment would be nice.
Comment 4 Ole Laursen 2003-04-15 21:07:51 UTC
Attaching a patch that adds the unset_blabla methods and changes the
documentation for modify_blabla to mention this (and updates the
ChangeLog).

I haven't touched modify_bg_pixmap since I still don't quite
understand how it is supposed to work (after having grep-researched it
for a while; GtkStyle is still black magic as far as I am concerned).
Perhaps we could persuade Daniel to look at it?
Comment 5 Ole Laursen 2003-04-15 21:09:16 UTC
Created attachment 15752 [details] [review]
Patch that adds unset_* and custom documentation to modify_*
Comment 6 Murray Cumming 2003-04-16 06:52:14 UTC
That looks great. Please apply to gtkmm 2.4. Please do add a "//TODO: 
Document this" comment next to modify_bg_pixmap().
Comment 7 Ole Laursen 2003-04-16 20:11:23 UTC
OK, done.
Comment 8 Murray Cumming 2003-04-17 05:54:27 UTC
Thanks again, Ole.