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 471397 - Gdk::Cairo::set_source_color() should take a const reference to RefPtr
Gdk::Cairo::set_source_color() should take a const reference to RefPtr
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2007-08-29 02:18 UTC by Jonathon Jongsma
Modified: 2007-08-30 21:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add overloaded functions, deprecate old functions (8.12 KB, patch)
2007-08-29 16:05 UTC, Jonathon Jongsma
none Details | Review
Add overloaded functions, deprecate old functions (8.12 KB, patch)
2007-08-29 16:05 UTC, Jonathon Jongsma
none Details | Review

Description Jonathon Jongsma 2007-08-29 02:18:33 UTC
The signature for Gdk::Cairo::set_source_color() is as follows:
void set_source_color (Cairo::RefPtr<Cairo::Context>& context, const Gdk::Color& color)

This makes it impossible to use this function from within a function such as this:
void render_foo (const Cairo::RefPtr<Cairo::Context>& cr)
{
  Gdk::Cairo::set_source_color (cr, foo); // won't compile
}

this is rather annoying since it should work just fine.  It would be nice if the set_source_color() function took a const reference to RefPtr, as in:

void set_source_color (const Cairo::RefPtr<::Cairo::Context>& context, const Gdk::Color& color)
Comment 1 Murray Cumming 2007-08-29 14:51:09 UTC
Oops. And I think some more functions have this problem in this general.[h|cc] file. I guess we should add a const version of these methods and deprecate the non-const ones.

Could you prepare a patch and then ask for a freeze-break approval from the release-team?
http://live.gnome.org/ReleasePlanning/RequestingFreezeBreaks
I doubt that they will have any objection.
Comment 2 Jonathon Jongsma 2007-08-29 16:05:39 UTC
Created attachment 94552 [details] [review]
Add overloaded functions, deprecate old functions

This patch adds overloaded functions that take a const reference for the first parameter instead of a non-const reference and deprecates the old versions of these functions.

It also fixes a TODO in the code by introducing new names for two deprecated functions:
Gdk::Cairo::rectangle() is deprecated, use Gdk::Cairo::add_rectangle_to_path() instead
Gdk::Cairo::region() is deprecated, use Gdk::Cairo::add_regioN_to_path() instead

Murray, when you've looked at the patch and are happy with it, let me know so I can propose the change to the release team -- or feel free to do it yourself.
Comment 3 Jonathon Jongsma 2007-08-29 16:05:39 UTC
Created attachment 94553 [details] [review]
Add overloaded functions, deprecate old functions

This patch adds overloaded functions that take a const reference for the first parameter instead of a non-const reference and deprecates the old versions of these functions.

It also fixes a TODO in the code by introducing new names for two deprecated functions:
Gdk::Cairo::rectangle() is deprecated, use Gdk::Cairo::add_rectangle_to_path() instead
Gdk::Cairo::region() is deprecated, use Gdk::Cairo::add_regioN_to_path() instead

Murray, when you've looked at the patch and are happy with it, let me know so I can propose the change to the release team -- or feel free to do it yourself.
Comment 4 Jonathon Jongsma 2007-08-29 16:07:17 UTC
sorry about the duplicate attachments, bugzilla was misbehaving.  there's no difference between the two.
Comment 5 Murray Cumming 2007-08-29 16:12:31 UTC
It looks good, though I'd prefer "Use the other overloaded function instead" to read specifically "Use the overloaded function that takes a const RefPtr reference."

Please ask for the freeze break now.
Comment 6 Jonathon Jongsma 2007-08-30 15:46:01 UTC
I got 2 approvals from the release team (elijah newren and frederic crozat).  OK to commit (with the doc changes)?
Comment 7 Murray Cumming 2007-08-30 18:03:46 UTC
Yes. Thanks for getting this done.
Comment 8 Jonathon Jongsma 2007-08-30 18:50:33 UTC
Committed to trunk with updated documentation (rev 895)
Comment 9 Jonathon Jongsma 2007-08-30 21:30:21 UTC
hmm, sorry.  I guess I actually committed this to branch gtkmm-2-12.  I suppose I should add it to trunk as well.