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 65818 - rename gtk_window_set_default() and add getter for it
rename gtk_window_set_default() and add getter for it
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
1.3.x
Other All
: Normal normal
: Small API
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2001-11-30 14:44 UTC by Vitaly Tishkov
Modified: 2008-08-02 04:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
20080315_bgo_65818_getter.diff: Implements the getter (1.41 KB, patch)
2008-03-15 20:47 UTC, Diego Escalante Urrelo (not reading bugmail)
needs-work Details | Review
Update with behdad's comments (2.08 KB, patch)
2008-06-08 01:59 UTC, Diego Escalante Urrelo (not reading bugmail)
none Details | Review
Update with behdad's comments (2.08 KB, patch)
2008-06-08 01:59 UTC, Diego Escalante Urrelo (not reading bugmail)
none Details | Review
Implemented gtk_window_{get,set}_default and property (6.11 KB, patch)
2008-06-09 16:47 UTC, Christian Dywan
none Details | Review
Implemented gtk_window_{get,set}_default, take 2 (6.25 KB, patch)
2008-06-16 22:15 UTC, Christian Dywan
none Details | Review
Fix docs and remove wrong getter (7.25 KB, patch)
2008-07-24 18:58 UTC, Christian Dywan
none Details | Review
Rename gtk_window_get_s/default/default_widget (1.80 KB, patch)
2008-08-01 00:25 UTC, Christian Dywan
committed Details | Review

Description Vitaly Tishkov 2001-11-30 14:44:06 UTC
I think that function gtk_window_set_default() should be renamed to
gtk_window_set_default_widget() because there are other GtkWindow functions
setting default values (_set_default_icon_list(), _set_default_size())
which names show what they set.

A getter is also needed.
Comment 1 Owen Taylor 2001-11-30 15:08:18 UTC
set_default_widget() would be _better_, but I don't think
is worth a rename at the point.

The getter is a future milestone issue.
Comment 2 Xan Lopez 2007-04-25 20:54:24 UTC
Copying from the GtkLove wiki:
"This and the latter should have been addressed in http://bugzilla.gnome.org/show_bug.cgi?id=55767 where using a script to find missing getters was suggested and functions not implemented were shown in http://mail.gnome.org/archives/gtk-devel-list/2001-June/msg00420.html"
Comment 3 Diego Escalante Urrelo (not reading bugmail) 2008-03-15 20:47:32 UTC
Created attachment 107357 [details] [review]
20080315_bgo_65818_getter.diff: Implements the getter

Enough?
Comment 4 Behdad Esfahbod 2008-06-05 18:08:47 UTC
> + * Return value: the default_widget for the @window, or %NULL if there's none.

That should be "default widget", not "default_widget".

Also, may be better to call the getter get_default_widget() at least, and reference set_default() in the docs.
Comment 5 Behdad Esfahbod 2008-06-05 18:10:36 UTC
Patch also should hook it into docs.  Edit docs/reference/gtk/gtk-sections.txt.

I *think* you also need to edit gtk/gtk.symbols.

I know, it's a pain to add new API...
Comment 6 Diego Escalante Urrelo (not reading bugmail) 2008-06-07 03:16:20 UTC
I called it get_default to be consistent with set_default. But I agree that _widget() would be much more obvious. How do we name it then?
I'll add a line about set_default in the docs. The "Since:" must be 2.13 or 2.14?
Comment 7 Behdad Esfahbod 2008-06-07 18:37:10 UTC
2.14
Comment 8 Diego Escalante Urrelo (not reading bugmail) 2008-06-08 01:59:21 UTC
Created attachment 112347 [details] [review]
Update with behdad's comments
Comment 9 Diego Escalante Urrelo (not reading bugmail) 2008-06-08 01:59:23 UTC
Created attachment 112348 [details] [review]
Update with behdad's comments
Comment 10 Christian Dywan 2008-06-08 02:11:29 UTC
I don't think it's a good idea to add gtk_window_get_default. It looks like gdk_screen_get_default and gtk_settings_get_default but is something totally different.

Instead gtk_window_get_default_widget should be introduced along with a GtkWindow:default-widget property which is still missing.

I also suggest that gtk_window_set_default should be superseded by gtk_window_set_default_window, but that's sort of optional.
Comment 11 Christian Dywan 2008-06-09 16:47:41 UTC
Created attachment 112424 [details] [review]
Implemented gtk_window_{get,set}_default and property

I took the liberty to implement my suggestions.

Note that I am not sure what the proper way is to deprecate a function, this may need to be adjusted.
Comment 12 Christian Dywan 2008-06-16 22:15:34 UTC
Created attachment 112872 [details] [review]
Implemented gtk_window_{get,set}_default, take 2

Updated patch, with proper deprecation hint.
Comment 13 Björn Lindqvist 2008-06-16 23:39:04 UTC
Looks good. But it is probably a good idea to try and get buy-in on the mailing list about the deprecation.
Comment 14 Emmanuele Bassi (:ebassi) 2008-07-22 22:10:19 UTC
small nitpick in gtk_window_set_default() documentation:

+ * Deprecated: gtk_window_set_default() is deprecated and
+ *   should not be used in newly-written code. Use
+ *   gtk_window_set_default_widget() instead.

the blurb is not needed - gtk-doc will do it for you. the deprecation should look like:

+ * Deprecated: 2.14: Use gtk_window_set_default_widget() instead
Comment 15 Christian Dywan 2008-07-24 18:58:21 UTC
Created attachment 115193 [details] [review]
Fix docs and remove wrong getter

I updated the doc comment.

Apparently during sealing gtk_window_get_default was added, so I updated the patch to also remove that again. Plus in two places where the old function is used in the same file, I replaced it with the new one.
Comment 16 Christian Dywan 2008-07-28 23:20:33 UTC
Could this please be reviewed before 2.14 is frozen? The gtk_window_get_default from GSEAL is badly missnamed and we should not keep it only to deprecate it again in 2.16.
Comment 17 Matthias Clasen 2008-07-29 14:15:42 UTC
I'm kinda torn on the deprecation. It would be easier if deprecations would just spew warnings, instead of breaking the build. As Owen said 7 years ago:

set_default_widget() would be _better_, but I don't think
is worth a rename at the point.


Renaming the getter to gtk_window_get_default_widget() seems like the right thing to do, though. set_default_widget() would be _better_, but I don't think
is worth a rename at the point.
Comment 18 Christian Dywan 2008-07-29 16:08:15 UTC
I can't quite follow the argumentation here. The fact that DISABLE_DEPRECATED style macros break builds is nothing particularly special in this case. Whoever turns them on knows what to expect. If you dislike the way this mechanism works, please address that, raise it in a meeting, but please don't reject api development only because of this.

Incidentally I have seen a patch to use gcc deprecation syntax to make deprecated functions warn without actually breaking the build. I'm not sure if they were in bugzilla, or just proposed somewhere else, I might try to find out if you are interested in this.

When you write "I don't think is worth a rename at the point" I read it as "I don't think it's currently a good idea". So when is a good point in time to fix badly named api? What is worthy of improvement?



That said...
for all that matters to me, we can defer the question of whether or not to deprecate gtk_window_set_default and only go for gtk_window_get_default_widget for this release. If you are okay with this, I'll make a separate patch just for this.
Comment 19 Matthias Clasen 2008-07-29 16:35:52 UTC
> If you dislike the way this mechanism
> works, please address that, raise it in a meeting, but please don't reject api
> development only because of this.

Blargh. Bugzilla is a valid communication channel for this kind of feedback, don't you think ? 

My concern is that this is exactly the kind of 'a new deprecation every week' style of 'api development' that application developers are complaining about. 
Comment 20 Christian Dywan 2008-07-29 21:08:39 UTC
(In reply to comment #19)
> My concern is that this is exactly the kind of 'a new deprecation every week'
> style of 'api development' that application developers are complaining about. 

This bug is 7 years old, so it's not exactly every week. There are surely enough missnamers, but I don't plan to address all of them all of a sudden.

Anyways, your call, if you consider it a bad idea, I'm okay with fixing only the getter, which disturbs me considerably more than the setter.
Comment 21 Christian Dywan 2008-08-01 00:25:57 UTC
Created attachment 115648 [details] [review]
Rename gtk_window_get_s/default/default_widget

This patch *only* renames the getter, nothing else.
Comment 22 Matthias Clasen 2008-08-01 18:59:03 UTC
Lets get the rename in before the release on Monday.
Comment 23 Matthias Clasen 2008-08-02 04:30:16 UTC
2008-08-02  Matthias Clasen  <mclasen@redhat.com>

        Bug 65818 – rename gtk_window_set_default() and add getter for it

        * gtk/gtk.symbols:
        * gtk/gtkwindow.[hc]: Rename gtk_window_get_default to
        gtk_window_get_default_widget. Patch by Christian Dywan