Stock: Emphasise deprecation; explain alternatives

A user in #gtk+ was confused what to do instead of creating a Button via
gtk_button_new_from_stock(). Our docs could stand to be clearer on this
point; it only costs a few lines. So, link from that constructor* to the
GtkStock doc, and add a banner there telling folk they shouldn’t use it.

* not that most [of these][links] even work right now…
This commit is contained in:
Daniel Boles 2018-04-21 01:02:59 +01:00
parent c2672b4f05
commit 2c2ea83333
2 changed files with 10 additions and 4 deletions

View File

@ -36,10 +36,14 @@
/**
* SECTION:gtkstock
* @Short_description:
Prebuilt common menu/toolbar items and corresponding icons
* @Short_description: Prebuilt common menu/toolbar items and corresponding
* icons
* @Title: Stock Items
*
* > Since GTK+ 3.10, stock items are deprecated. You should instead set
* > up whatever labels and/or icons you need using normal widget API,
* > rather than relying on GTK+ providing ready-made combinations of these.
*
* Stock items represent commonly-used menu or toolbar items such as
* Open or Exit. Each stock item is identified by a stock ID;
* stock IDs are just strings, but macros such as #GTK_STOCK_OPEN are

View File

@ -1452,7 +1452,8 @@ gtk_button_new_from_icon_name (const gchar *icon_name,
* gtk_button_new_from_stock:
* @stock_id: the name of the stock item
*
* Creates a new #GtkButton containing the image and text from a stock item.
* Creates a new #GtkButton containing the image and text from a
* [stock item][gtkstock].
* Some stock ids have preprocessor macros like #GTK_STOCK_OK and
* #GTK_STOCK_APPLY.
*
@ -1461,7 +1462,8 @@ gtk_button_new_from_icon_name (const gchar *icon_name,
*
* Returns: a new #GtkButton
*
* Deprecated: 3.10: Use gtk_button_new_with_label() instead.
* Deprecated: 3.10: Stock items are deprecated. Use gtk_button_new_with_label()
* instead.
*/
GtkWidget*
gtk_button_new_from_stock (const gchar *stock_id)