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 586635 - gtk_info_bar_add_button() should return GtkButton*
gtk_info_bar_add_button() should return GtkButton*
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Documentation
2.90.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2009-06-22 12:41 UTC by Murray Cumming
Modified: 2011-01-26 09:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
State that _add_button functions return a "#GtkButton widget" (919 bytes, patch)
2010-03-28 01:03 UTC, Christian Dywan
reviewed Details | Review
State that _add_button functions return a "#GtkButton widget" #2 (1.37 KB, patch)
2010-09-24 16:05 UTC, Christian Dywan
none Details | Review

Description Murray Cumming 2009-06-22 12:41:34 UTC
It would be nice if gtk_info_bar_add_button()'s return type was GtkButton*, if that's really what it always returns, instead of a GtkWidget*.
http://library.gnome.org/devel/gtk/unstable/GtkInfoBar.html#gtk-info-bar-add-button
Comment 1 Claudio Saavedra 2009-06-22 12:54:25 UTC
That would be inconsistent with gtk_dialog_add_button().

[which leads me to wonder whether there should be a common interface for these widgets]
Comment 2 Murray Cumming 2009-06-22 13:03:18 UTC
We(In reply to comment #1)
> That would be inconsistent with gtk_dialog_add_button().

Well, that's wrong too, but I saw if when it was too late to change the API.



Comment 3 Christian Dywan 2009-06-23 07:03:29 UTC
There is nothing wrong here. Widgets are typed as GtkWidget* and the API user has to cast to specific types, that is almost everywhere in GTK+ the case except for few exceptions.
Comment 4 Murray Cumming 2009-06-23 07:42:25 UTC
That's unfortunate. Then the documentation should at least make clear that it's a GtkButton rather than just some generic "button" widget.
Comment 5 Matthias Clasen 2009-06-23 14:38:43 UTC
I agree with Christian here that internal consistency is more important here. 
We are also not going to start changing all our constructors to return something other than GtkWidget*...

I don't know how the docs can be much clearer about what is returned (after all, they are just a straight copy of the dialog_add_button docs).

Murray, any concrete proposal for the docs ?
Comment 6 Javier Jardón (IRC: jjardon) 2009-11-12 21:02:58 UTC
Moved to doc component
Comment 7 Javier Jardón (IRC: jjardon) 2010-03-24 03:23:05 UTC
Murray: ping
Comment 8 Murray Cumming 2010-03-24 07:43:27 UTC
(In reply to comment #5)
> I don't know how the docs can be much clearer about what is returned (after
> all, they are just a straight copy of the dialog_add_button docs).
> 
> Murray, any concrete proposal for the docs ?

The documentation for these kinds of functions should name the type more exactly. For instance, it should say "GtkButton" instead of just "button". The ambiguity is unnecessary, and there's no reason to make the reader guess if that's what you really mean.

I guess that there should be some introspection annotation for this too, so that real OO languages can return the most specific type, but I don't see anything here:
http://live.gnome.org/GObjectIntrospection/Annotations
Comment 9 Christian Dywan 2010-03-28 01:03:21 UTC
Created attachment 157295 [details] [review]
State that _add_button functions return a "#GtkButton widget"

Changed gtk_dialog_add_button and gtk_info_bar_add_button to state that they return a "#GtkButton widget".
Comment 10 Javier Jardón (IRC: jjardon) 2010-05-20 19:25:49 UTC
Comment on attachment 157295 [details] [review]
State that _add_button functions return a "#GtkButton widget"

looks good for me
Comment 11 Claudio Saavedra 2010-05-21 11:44:50 UTC
It's a bit more confusing for me this way, because it's not a GtkButton what's returned. But maybe it's just me.
Comment 12 Murray Cumming 2010-05-21 11:49:29 UTC
(In reply to comment #11)
> It's a bit more confusing for me this way, because it's not a GtkButton what's
> returned. But maybe it's just me.

Do you just mean that GtkButton* is not the type in the C function's signature, or do you mean that the instance is not a GtkButton?
Comment 13 Claudio Saavedra 2010-05-21 11:54:29 UTC
I meant the former. But now I had a quick look to some _new() methods and I see that it's stated in a similar way to this, so I guess it's fine.
Comment 14 Murray Cumming 2010-09-08 10:37:12 UTC
So, I guess this patch is OK to commit, right?
Comment 15 Christian Dywan 2010-09-24 16:05:09 UTC
Created attachment 171040 [details] [review]
State that _add_button functions return a "#GtkButton widget" #2

Updated to git master.
Comment 16 Murray Cumming 2011-01-25 14:50:11 UTC
Thanks. Is there any reason that I shouldn't push that?
Comment 17 Matthias Clasen 2011-01-25 17:10:44 UTC
Not sure how significant the clarification is between 'button' and '#GtkButton', but sure, feel free to commit it.