Commit d741b7b8 authored by William Jon McCann's avatar William Jon McCann

Deprecate the gtk stock functions

parent a02f2c42
......@@ -1274,9 +1274,13 @@ gtk_action_set_label (GtkAction *action,
if (!action->private_data->label_set && action->private_data->stock_id)
{
GtkStockItem stock_item;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (gtk_stock_lookup (action->private_data->stock_id, &stock_item))
action->private_data->label = g_strdup (stock_item.label);
G_GNUC_END_IGNORE_DEPRECATIONS;
}
g_object_notify (G_OBJECT (action), "label");
......@@ -1514,13 +1518,17 @@ gtk_action_set_stock_id (GtkAction *action,
if (!action->private_data->label_set)
{
GtkStockItem stock_item;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (action->private_data->stock_id &&
gtk_stock_lookup (action->private_data->stock_id, &stock_item))
gtk_action_set_label (action, stock_item.label);
else
else
gtk_action_set_label (action, NULL);
G_GNUC_END_IGNORE_DEPRECATIONS;
action->private_data->label_set = FALSE;
}
}
......
......@@ -999,12 +999,16 @@ gtk_action_group_add_action_with_accel (GtkActionGroup *action_group,
g_object_get (action, "stock-id", &stock_id, NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (stock_id && gtk_stock_lookup (stock_id, &stock_item))
{
accel_key = stock_item.keyval;
accel_mods = stock_item.modifier;
}
G_GNUC_END_IGNORE_DEPRECATIONS;
g_free (stock_id);
}
......
......@@ -744,6 +744,8 @@ gtk_dialog_add_button (GtkDialog *dialog,
button = gtk_button_new_with_label (button_text);
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (button_text)
{
GtkStockItem item;
......@@ -751,6 +753,8 @@ gtk_dialog_add_button (GtkDialog *dialog,
g_object_set (button, "use-stock", TRUE, NULL);
}
G_GNUC_END_IGNORE_DEPRECATIONS;
gtk_widget_set_can_default (button, TRUE);
gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
......
......@@ -1002,6 +1002,8 @@ gtk_image_menu_item_set_accel_group (GtkImageMenuItem *image_menu_item,
priv = image_menu_item->priv;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (priv->use_stock && priv->label && gtk_stock_lookup (priv->label, &stock_item))
if (stock_item.keyval)
{
......@@ -1014,6 +1016,9 @@ gtk_image_menu_item_set_accel_group (GtkImageMenuItem *image_menu_item,
g_object_notify (G_OBJECT (image_menu_item), "accel-group");
}
G_GNUC_END_IGNORE_DEPRECATIONS;
}
/**
......
......@@ -704,6 +704,8 @@ gtk_info_bar_add_button (GtkInfoBar *info_bar,
button = gtk_button_new_with_label (button_text);
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (button_text)
{
GtkStockItem item;
......@@ -711,6 +713,8 @@ gtk_info_bar_add_button (GtkInfoBar *info_bar,
g_object_set (button, "use-stock", TRUE, NULL);
}
G_GNUC_END_IGNORE_DEPRECATIONS;
gtk_widget_set_can_default (button, TRUE);
gtk_widget_show (button);
......
......@@ -24,6 +24,8 @@
#include "config.h"
#define GDK_DISABLE_DEPRECATION_WARNINGS
#include <string.h>
#include "gtkprivate.h"
......@@ -142,7 +144,8 @@ real_add (const GtkStockItem *items,
* any pointer into @items and @items can be freed. Use
* gtk_stock_add_static() if @items is persistent and GTK+ need not
* copy the array.
*
*
* Deprecated: 3.10
**/
void
gtk_stock_add (const GtkStockItem *items,
......@@ -160,7 +163,8 @@ gtk_stock_add (const GtkStockItem *items,
*
* Same as gtk_stock_add(), but doesn't copy @items, so
* @items must persist until application exit.
*
*
* Deprecated: 3.10
**/
void
gtk_stock_add_static (const GtkStockItem *items,
......@@ -175,12 +179,13 @@ gtk_stock_add_static (const GtkStockItem *items,
* gtk_stock_lookup:
* @stock_id: a stock item name
* @item: (out): stock item to initialize with values
*
*
* Fills @item with the registered values for @stock_id, returning %TRUE
* if @stock_id was known.
*
*
*
* Return value: %TRUE if @item was initialized
*
* Deprecated: 3.10
**/
gboolean
gtk_stock_lookup (const gchar *stock_id,
......@@ -227,6 +232,8 @@ gtk_stock_lookup (const gchar *stock_id,
* and each string in the list must be freed with g_free().
*
* Return value: (element-type utf8) (transfer full): a list of known stock IDs
*
* Deprecated: 3.10
**/
GSList*
gtk_stock_list_ids (void)
......@@ -277,6 +284,8 @@ gtk_stock_list_ids (void)
* Copies a stock item, mostly useful for language bindings and not in applications.
*
* Return value: a new #GtkStockItem
*
* Deprecated: 3.10
**/
GtkStockItem *
gtk_stock_item_copy (const GtkStockItem *item)
......@@ -303,7 +312,8 @@ gtk_stock_item_copy (const GtkStockItem *item)
* Frees a stock item allocated on the heap, such as one returned by
* gtk_stock_item_copy(). Also frees the fields inside the stock item,
* if they are not %NULL.
*
*
* Deprecated: 3.10
**/
void
gtk_stock_item_free (GtkStockItem *item)
......@@ -496,6 +506,8 @@ static const GtkStockItem builtin_items [] =
* ]|
*
* Since: 2.8
*
* Deprecated: 3.10
*/
void
gtk_stock_set_translate_func (const gchar *domain,
......
......@@ -44,6 +44,8 @@ G_BEGIN_DECLS
* and #GtkActionGroup.
*
* Returns: the translated message
*
* Deprecated: 3.10
*/
typedef gchar * (*GtkTranslateFunc) (const gchar *path,
gpointer func_data);
......@@ -59,28 +61,28 @@ struct _GtkStockItem
gchar *translation_domain;
};
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_10
void gtk_stock_add (const GtkStockItem *items,
guint n_items);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_10
void gtk_stock_add_static (const GtkStockItem *items,
guint n_items);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_10
gboolean gtk_stock_lookup (const gchar *stock_id,
GtkStockItem *item);
/* Should free the list (and free each string in it also).
* This function is only useful for GUI builders and such.
*/
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_10
GSList* gtk_stock_list_ids (void);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_10
GtkStockItem *gtk_stock_item_copy (const GtkStockItem *item);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_10
void gtk_stock_item_free (GtkStockItem *item);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_10
void gtk_stock_set_translate_func (const gchar *domain,
GtkTranslateFunc func,
gpointer data,
......
......@@ -224,7 +224,6 @@ gtk_toggle_tool_button_create_menu_proxy (GtkToolItem *item)
label_text = gtk_tool_button_get_label (tool_button);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
stock_id = gtk_tool_button_get_stock_id (tool_button);
G_GNUC_END_IGNORE_DEPRECATIONS;
if (GTK_IS_LABEL (label_widget))
{
......@@ -244,7 +243,9 @@ gtk_toggle_tool_button_create_menu_proxy (GtkToolItem *item)
{
label = "";
}
G_GNUC_END_IGNORE_DEPRECATIONS;
if (use_mnemonic)
menu_item = gtk_check_menu_item_new_with_mnemonic (label);
else
......
......@@ -447,6 +447,8 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
gboolean elide;
gchar *label_text;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (button->priv->label_text)
{
label_text = button->priv->label_text;
......@@ -463,6 +465,8 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
elide = FALSE;
}
G_GNUC_END_IGNORE_DEPRECATIONS;
if (elide)
label_text = _gtk_toolbar_elide_underscores (label_text);
else
......@@ -837,7 +841,9 @@ gtk_tool_button_create_menu_proxy (GtkToolItem *item)
if (_gtk_tool_item_create_menu_proxy (item))
return TRUE;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (GTK_IS_LABEL (button->priv->label_widget))
{
label = gtk_label_get_label (GTK_LABEL (button->priv->label_widget));
......@@ -856,7 +862,9 @@ gtk_tool_button_create_menu_proxy (GtkToolItem *item)
{
label = "";
}
G_GNUC_END_IGNORE_DEPRECATIONS;
if (use_mnemonic)
menu_item = gtk_image_menu_item_new_with_mnemonic (label);
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment