Remove GtkStock API from GtkImage

This commit is contained in:
Timm Bäder 2016-10-03 10:33:17 +02:00 committed by Benjamin Otte
parent f37cb8f9d0
commit ad155fb26c
29 changed files with 28 additions and 951 deletions

View File

@ -171,8 +171,6 @@ gtk_image_accessible_get_name (AtkObject *accessible)
GtkWidget* widget;
GtkImage *image;
GtkImageAccessible *image_accessible;
GtkStockItem stock_item;
gchar *stock_id;
const gchar *name;
GtkImageType storage_type;
@ -190,23 +188,9 @@ gtk_image_accessible_get_name (AtkObject *accessible)
g_free (image_accessible->priv->stock_name);
image_accessible->priv->stock_name = NULL;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
storage_type = gtk_image_get_storage_type (image);
if (storage_type == GTK_IMAGE_STOCK)
{
gtk_image_get_stock (image, &stock_id, NULL);
if (stock_id == NULL)
return NULL;
if (!gtk_stock_lookup (stock_id, &stock_item))
return NULL;
G_GNUC_END_IGNORE_DEPRECATIONS;
image_accessible->priv->stock_name = _gtk_toolbar_elide_underscores (stock_item.label);
}
else if (storage_type == GTK_IMAGE_ICON_NAME)
if (storage_type == GTK_IMAGE_ICON_NAME)
{
const gchar *icon_name;
@ -295,7 +279,6 @@ gtk_image_accessible_get_image_size (AtkImage *image,
*width = gdk_pixbuf_get_width (pixbuf);
break;
}
case GTK_IMAGE_STOCK:
case GTK_IMAGE_ICON_SET:
case GTK_IMAGE_ICON_NAME:
case GTK_IMAGE_GICON:

View File

@ -1007,18 +1007,11 @@ gtk_action_create_icon (GtkAction *action, GtkIconSize icon_size)
g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (action->private_data->stock_id &&
gtk_icon_factory_lookup_default (action->private_data->stock_id))
widget = gtk_image_new_from_stock (action->private_data->stock_id, icon_size);
else if (action->private_data->gicon)
if (action->private_data->gicon)
widget = gtk_image_new_from_gicon (action->private_data->gicon, icon_size);
else if (action->private_data->icon_name)
widget = gtk_image_new_from_icon_name (action->private_data->icon_name, icon_size);
G_GNUC_END_IGNORE_DEPRECATIONS;
return widget;
}

View File

@ -442,7 +442,7 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
g_object_set_data (G_OBJECT (button), I_("COLORSEL"), colorsel);
g_signal_connect (button, "clicked",
G_CALLBACK (get_screen_color), NULL);
picker_image = gtk_image_new_from_stock (GTK_STOCK_COLOR_PICKER, GTK_ICON_SIZE_BUTTON);
picker_image = gtk_image_new_from_icon_name ("gtk-color-picker", GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (button), picker_image);
gtk_widget_show (GTK_WIDGET (picker_image));
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE);

View File

@ -227,23 +227,6 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
P_("Child widget to appear next to the menu text"),
GTK_TYPE_WIDGET,
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
/**
* GtkImageMenuItem:use-stock:
*
* If %TRUE, the label set in the menuitem is used as a
* stock id to select the stock item for the item.
*
* Since: 2.16
*
* Deprecated: 3.10: Use a named icon from the #GtkIconTheme instead
*/
g_object_class_install_property (gobject_class,
PROP_USE_STOCK,
g_param_spec_boolean ("use-stock",
P_("Use stock"),
P_("Whether to use the label text to create a stock menu item"),
FALSE,
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_DEPRECATED));
/**
* GtkImageMenuItem:always-show-image:
@ -322,11 +305,6 @@ gtk_image_menu_item_set_property (GObject *object,
case PROP_IMAGE:
gtk_image_menu_item_set_image (image_menu_item, (GtkWidget *) g_value_get_object (value));
break;
case PROP_USE_STOCK:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gtk_image_menu_item_set_use_stock (image_menu_item, g_value_get_boolean (value));
G_GNUC_END_IGNORE_DEPRECATIONS;
break;
case PROP_ALWAYS_SHOW_IMAGE:
gtk_image_menu_item_set_always_show_image (image_menu_item, g_value_get_boolean (value));
break;
@ -354,11 +332,6 @@ gtk_image_menu_item_get_property (GObject *object,
case PROP_IMAGE:
g_value_set_object (value, gtk_image_menu_item_get_image (image_menu_item));
break;
case PROP_USE_STOCK:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
g_value_set_boolean (value, gtk_image_menu_item_get_use_stock (image_menu_item));
G_GNUC_END_IGNORE_DEPRECATIONS;
break;
case PROP_ALWAYS_SHOW_IMAGE:
g_value_set_boolean (value, gtk_image_menu_item_get_always_show_image (image_menu_item));
break;
@ -457,29 +430,8 @@ static void
gtk_image_menu_item_recalculate (GtkImageMenuItem *image_menu_item)
{
GtkImageMenuItemPrivate *priv = image_menu_item->priv;
GtkStockItem stock_item;
GtkWidget *image;
const gchar *resolved_label = priv->label;
if (priv->use_stock && priv->label)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (!priv->image)
{
image = gtk_image_new_from_stock (priv->label, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (image_menu_item, image);
}
if (gtk_stock_lookup (priv->label, &stock_item))
resolved_label = stock_item.label;
gtk_menu_item_set_use_underline (GTK_MENU_ITEM (image_menu_item), TRUE);
G_GNUC_END_IGNORE_DEPRECATIONS;
}
GTK_MENU_ITEM_CLASS
(gtk_image_menu_item_parent_class)->set_label (GTK_MENU_ITEM (image_menu_item), resolved_label);
@ -746,39 +698,14 @@ gtk_image_menu_item_ensure_image (GtkImageMenuItem *item)
return image;
}
static gboolean
activatable_update_stock_id (GtkImageMenuItem *image_menu_item, GtkAction *action)
{
const gchar *stock_id = gtk_action_get_stock_id (action);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (stock_id && gtk_icon_factory_lookup_default (stock_id))
{
GtkWidget *image;
image = gtk_image_menu_item_ensure_image (image_menu_item);
gtk_image_set_from_stock (GTK_IMAGE (image), stock_id, GTK_ICON_SIZE_MENU);
return TRUE;
}
G_GNUC_END_IGNORE_DEPRECATIONS;
return FALSE;
}
static gboolean
activatable_update_gicon (GtkImageMenuItem *image_menu_item, GtkAction *action)
{
GIcon *icon = gtk_action_get_gicon (action);
const gchar *stock_id;
gboolean ret = FALSE;
stock_id = gtk_action_get_stock_id (action);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (icon && !(stock_id && gtk_icon_factory_lookup_default (stock_id)))
if (icon)
{
GtkWidget *image;
@ -787,8 +714,6 @@ activatable_update_gicon (GtkImageMenuItem *image_menu_item, GtkAction *action)
ret = TRUE;
}
G_GNUC_END_IGNORE_DEPRECATIONS;
return ret;
}
@ -825,9 +750,7 @@ gtk_image_menu_item_update (GtkActivatable *activatable,
if (!use_appearance)
return;
if (strcmp (property_name, "stock-id") == 0)
activatable_update_stock_id (image_menu_item, action);
else if (strcmp (property_name, "gicon") == 0)
if (strcmp (property_name, "gicon") == 0)
activatable_update_gicon (image_menu_item, action);
else if (strcmp (property_name, "icon-name") == 0)
activatable_update_icon_name (image_menu_item, action);
@ -851,8 +774,7 @@ gtk_image_menu_item_sync_action_properties (GtkActivatable *activatable,
if (!use_appearance)
return;
if (!activatable_update_stock_id (image_menu_item, action) &&
!activatable_update_gicon (image_menu_item, action))
if (!activatable_update_gicon (image_menu_item, action))
activatable_update_icon_name (image_menu_item, action);
gtk_image_menu_item_set_always_show_image (image_menu_item,
@ -915,91 +837,6 @@ gtk_image_menu_item_new_with_mnemonic (const gchar *label)
NULL);
}
/**
* gtk_image_menu_item_new_from_stock:
* @stock_id: the name of the stock item.
* @accel_group: (allow-none): the #GtkAccelGroup to add the menu items
* accelerator to, or %NULL.
*
* Creates a new #GtkImageMenuItem containing the image and text from a
* stock item. Some stock ids have preprocessor macros like #GTK_STOCK_OK
* and #GTK_STOCK_APPLY.
*
* If you want this menu item to have changeable accelerators, then pass in
* %NULL for accel_group. Next call gtk_menu_item_set_accel_path() with an
* appropriate path for the menu item, use gtk_stock_lookup() to look up the
* standard accelerator for the stock item, and if one is found, call
* gtk_accel_map_add_entry() to register it.
*
* Returns: a new #GtkImageMenuItem.
*
* Deprecated: 3.10: Use gtk_menu_item_new_with_mnemonic() instead.
*/
GtkWidget*
gtk_image_menu_item_new_from_stock (const gchar *stock_id,
GtkAccelGroup *accel_group)
{
return g_object_new (GTK_TYPE_IMAGE_MENU_ITEM,
"label", stock_id,
"use-stock", TRUE,
"accel-group", accel_group,
NULL);
}
/**
* gtk_image_menu_item_set_use_stock:
* @image_menu_item: a #GtkImageMenuItem
* @use_stock: %TRUE if the menuitem should use a stock item
*
* If %TRUE, the label set in the menuitem is used as a
* stock id to select the stock item for the item.
*
* Since: 2.16
*
* Deprecated: 3.10
*/
void
gtk_image_menu_item_set_use_stock (GtkImageMenuItem *image_menu_item,
gboolean use_stock)
{
GtkImageMenuItemPrivate *priv;
g_return_if_fail (GTK_IS_IMAGE_MENU_ITEM (image_menu_item));
priv = image_menu_item->priv;
if (priv->use_stock != use_stock)
{
priv->use_stock = use_stock;
gtk_image_menu_item_recalculate (image_menu_item);
g_object_notify (G_OBJECT (image_menu_item), "use-stock");
}
}
/**
* gtk_image_menu_item_get_use_stock:
* @image_menu_item: a #GtkImageMenuItem
*
* Checks whether the label set in the menuitem is used as a
* stock id to select the stock item for the item.
*
* Returns: %TRUE if the label set in the menuitem is used as a
* stock id to select the stock item for the item
*
* Since: 2.16
*
* Deprecated: 3.10
*/
gboolean
gtk_image_menu_item_get_use_stock (GtkImageMenuItem *image_menu_item)
{
g_return_val_if_fail (GTK_IS_IMAGE_MENU_ITEM (image_menu_item), FALSE);
return image_menu_item->priv->use_stock;
}
/**
* gtk_image_menu_item_set_always_show_image:
* @image_menu_item: a #GtkImageMenuItem

View File

@ -80,9 +80,6 @@ GDK_DEPRECATED_IN_3_10_FOR(gtk_menu_item_new_with_label)
GtkWidget* gtk_image_menu_item_new_with_label (const gchar *label);
GDK_DEPRECATED_IN_3_10_FOR(gtk_menu_item_new_with_mnemonic)
GtkWidget* gtk_image_menu_item_new_with_mnemonic (const gchar *label);
GDK_DEPRECATED_IN_3_10_FOR(gtk_menu_item_new)
GtkWidget* gtk_image_menu_item_new_from_stock (const gchar *stock_id,
GtkAccelGroup *accel_group);
GDK_DEPRECATED_IN_3_10
void gtk_image_menu_item_set_always_show_image (GtkImageMenuItem *image_menu_item,
gboolean always_show);
@ -94,12 +91,7 @@ void gtk_image_menu_item_set_image (GtkImageMenuItem *image_menu_i
GDK_DEPRECATED_IN_3_10
GtkWidget* gtk_image_menu_item_get_image (GtkImageMenuItem *image_menu_item);
GDK_DEPRECATED_IN_3_10
void gtk_image_menu_item_set_use_stock (GtkImageMenuItem *image_menu_item,
gboolean use_stock);
GDK_DEPRECATED_IN_3_10
gboolean gtk_image_menu_item_get_use_stock (GtkImageMenuItem *image_menu_item);
GDK_DEPRECATED_IN_3_10
void gtk_image_menu_item_set_accel_group (GtkImageMenuItem *image_menu_item,
void gtk_image_menu_item_set_accel_group (GtkImageMenuItem *image_menu_item,
GtkAccelGroup *accel_group);
G_END_DECLS

View File

@ -77,7 +77,6 @@ enum {
PROP_PIXBUF_EXPANDER_OPEN,
PROP_PIXBUF_EXPANDER_CLOSED,
PROP_SURFACE,
PROP_STOCK_ID,
PROP_STOCK_SIZE,
PROP_STOCK_DETAIL,
PROP_FOLLOW_STATE,
@ -182,19 +181,6 @@ gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class)
CAIRO_GOBJECT_TYPE_SURFACE,
GTK_PARAM_READWRITE));
/**
* GtkCellRendererPixbuf:stock-id:
*
* Deprecated: 3.10: Use #GtkCellRendererPixbuf:icon-name instead.
*/
g_object_class_install_property (object_class,
PROP_STOCK_ID,
g_param_spec_string ("stock-id",
P_("Stock ID"),
P_("The stock ID of the stock icon to render"),
NULL,
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
g_object_class_install_property (object_class,
PROP_STOCK_SIZE,
g_param_spec_uint ("stock-size",
@ -295,9 +281,6 @@ gtk_cell_renderer_pixbuf_get_property (GObject *object,
case PROP_SURFACE:
g_value_set_boxed (value, gtk_image_definition_get_surface (priv->image_def));
break;
case PROP_STOCK_ID:
g_value_set_string (value, gtk_image_definition_get_stock (priv->image_def));
break;
case PROP_STOCK_SIZE:
g_value_set_uint (value, priv->icon_size);
break;
@ -331,9 +314,6 @@ notify_storage_type (GtkCellRendererPixbuf *cellpixbuf,
case GTK_IMAGE_PIXBUF:
g_object_notify (G_OBJECT (cellpixbuf), "pixbuf");
break;
case GTK_IMAGE_STOCK:
g_object_notify (G_OBJECT (cellpixbuf), "stock-id");
break;
case GTK_IMAGE_ICON_NAME:
g_object_notify (G_OBJECT (cellpixbuf), "icon-name");
break;
@ -396,9 +376,6 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
case PROP_SURFACE:
take_image_definition (cellpixbuf, gtk_image_definition_new_surface (g_value_get_boxed (value)));
break;
case PROP_STOCK_ID:
take_image_definition (cellpixbuf, gtk_image_definition_new_stock (g_value_get_string (value)));
break;
case PROP_STOCK_SIZE:
priv->icon_size = g_value_get_uint (value);
break;

View File

@ -1981,35 +1981,6 @@ gtk_drag_set_icon_pixbuf (GdkDragContext *context,
gtk_image_definition_unref (def);
}
/**
* gtk_drag_set_icon_stock: (method)
* @context: the context for a drag (This must be called
* with a context for the source side of a drag)
* @stock_id: the ID of the stock icon to use for the drag
* @hot_x: the X offset within the icon of the hotspot
* @hot_y: the Y offset within the icon of the hotspot
*
* Sets the icon for a given drag from a stock ID.
*
* Deprecated: 3.10: Use gtk_drag_set_icon_name() instead.
*/
void
gtk_drag_set_icon_stock (GdkDragContext *context,
const gchar *stock_id,
gint hot_x,
gint hot_y)
{
GtkImageDefinition *def;
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
g_return_if_fail (stock_id != NULL);
def = gtk_image_definition_new_stock (stock_id);
set_icon_helper (context, def, hot_x, hot_y);
gtk_image_definition_unref (def);
}
/* XXX: This function is in gdk, too. Should it be in Cairo? */
static gboolean
_gtk_cairo_surface_extents (cairo_surface_t *surface,

View File

@ -89,11 +89,6 @@ void gtk_drag_set_icon_pixbuf (GdkDragContext *context,
GdkPixbuf *pixbuf,
gint hot_x,
gint hot_y);
GDK_DEPRECATED_IN_3_10_FOR(gtk_drag_set_icon_name)
void gtk_drag_set_icon_stock (GdkDragContext *context,
const gchar *stock_id,
gint hot_x,
gint hot_y);
GDK_AVAILABLE_IN_ALL
void gtk_drag_set_icon_surface(GdkDragContext *context,
cairo_surface_t *surface);

View File

@ -377,43 +377,17 @@ gtk_drag_source_set_icon_pixbuf (GtkWidget *widget,
site->image_def = gtk_image_definition_new_pixbuf (pixbuf, 1);
}
/**
* gtk_drag_source_set_icon_stock: (method)
* @widget: a #GtkWidget
* @stock_id: the ID of the stock icon to use
*
* Sets the icon that will be used for drags from a particular source
* to a stock icon.
*
* Deprecated: 3.10: Use gtk_drag_source_set_icon_name() instead.
*/
void
gtk_drag_source_set_icon_stock (GtkWidget *widget,
const gchar *stock_id)
{
GtkDragSourceSite *site;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (stock_id != NULL);
site = g_object_get_data (G_OBJECT (widget), "gtk-site-data");
g_return_if_fail (site != NULL);
gtk_image_definition_unref (site->image_def);
site->image_def = gtk_image_definition_new_stock (stock_id);
}
/**
* gtk_drag_source_set_icon_name: (method)
* @widget: a #GtkWidget
* @icon_name: name of icon to use
*
*
* Sets the icon that will be used for drags from a particular source
* to a themed icon. See the docs for #GtkIconTheme for more details.
*
* Since: 2.8
*/
void
void
gtk_drag_source_set_icon_name (GtkWidget *widget,
const gchar *icon_name)
{

View File

@ -62,9 +62,6 @@ void gtk_drag_source_add_uri_targets (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_drag_source_set_icon_pixbuf (GtkWidget *widget,
GdkPixbuf *pixbuf);
GDK_DEPRECATED_IN_3_10_FOR(gtk_drag_source_set_icon_name)
void gtk_drag_source_set_icon_stock (GtkWidget *widget,
const gchar *stock_id);
GDK_AVAILABLE_IN_ALL
void gtk_drag_source_set_icon_name (GtkWidget *widget,
const gchar *icon_name);

View File

@ -351,8 +351,6 @@ enum {
PROP_PROGRESS_PULSE_STEP,
PROP_PIXBUF_PRIMARY,
PROP_PIXBUF_SECONDARY,
PROP_STOCK_PRIMARY,
PROP_STOCK_SECONDARY,
PROP_ICON_NAME_PRIMARY,
PROP_ICON_NAME_SECONDARY,
PROP_GICON_PRIMARY,
@ -1129,38 +1127,6 @@ gtk_entry_class_init (GtkEntryClass *class)
GDK_TYPE_PIXBUF,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:primary-icon-stock:
*
* The stock id to use for the primary icon for the entry.
*
* Since: 2.16
*
* Deprecated: 3.10: Use #GtkEntry:primary-icon-name instead.
*/
entry_props[PROP_STOCK_PRIMARY] =
g_param_spec_string ("primary-icon-stock",
P_("Primary stock ID"),
P_("Stock ID for primary icon"),
NULL,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_DEPRECATED);
/**
* GtkEntry:secondary-icon-stock:
*
* The stock id to use for the secondary icon for the entry.
*
* Since: 2.16
*
* Deprecated: 3.10: Use #GtkEntry:secondary-icon-name instead.
*/
entry_props[PROP_STOCK_SECONDARY] =
g_param_spec_string ("secondary-icon-stock",
P_("Secondary stock ID"),
P_("Stock ID for secondary icon"),
NULL,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_DEPRECATED);
/**
* GtkEntry:primary-icon-name:
*
@ -2259,22 +2225,6 @@ gtk_entry_set_property (GObject *object,
g_value_get_object (value));
break;
case PROP_STOCK_PRIMARY:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gtk_entry_set_icon_from_stock (entry,
GTK_ENTRY_ICON_PRIMARY,
g_value_get_string (value));
G_GNUC_END_IGNORE_DEPRECATIONS;
break;
case PROP_STOCK_SECONDARY:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gtk_entry_set_icon_from_stock (entry,
GTK_ENTRY_ICON_SECONDARY,
g_value_get_string (value));
G_GNUC_END_IGNORE_DEPRECATIONS;
break;
case PROP_ICON_NAME_PRIMARY:
gtk_entry_set_icon_from_icon_name (entry,
GTK_ENTRY_ICON_PRIMARY,
@ -2522,22 +2472,6 @@ gtk_entry_get_property (GObject *object,
GTK_ENTRY_ICON_SECONDARY));
break;
case PROP_STOCK_PRIMARY:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
g_value_set_string (value,
gtk_entry_get_icon_stock (entry,
GTK_ENTRY_ICON_PRIMARY));
G_GNUC_END_IGNORE_DEPRECATIONS;
break;
case PROP_STOCK_SECONDARY:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
g_value_set_string (value,
gtk_entry_get_icon_stock (entry,
GTK_ENTRY_ICON_SECONDARY));
G_GNUC_END_IGNORE_DEPRECATIONS;
break;
case PROP_ICON_NAME_PRIMARY:
g_value_set_string (value,
gtk_entry_get_icon_name (entry,
@ -7365,13 +7299,6 @@ gtk_entry_clear (GtkEntry *entry,
: PROP_PIXBUF_SECONDARY]);
break;
case GTK_IMAGE_STOCK:
g_object_notify_by_pspec (G_OBJECT (entry),
entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY
? PROP_STOCK_PRIMARY
: PROP_STOCK_SECONDARY]);
break;
case GTK_IMAGE_ICON_NAME:
g_object_notify_by_pspec (G_OBJECT (entry),
entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY
@ -8421,66 +8348,6 @@ gtk_entry_set_icon_from_pixbuf (GtkEntry *entry,
g_object_thaw_notify (G_OBJECT (entry));
}
/**
* gtk_entry_set_icon_from_stock:
* @entry: A #GtkEntry
* @icon_pos: Icon position
* @stock_id: (allow-none): The name of the stock item, or %NULL
*
* Sets the icon shown in the entry at the specified position from
* a stock image.
*
* If @stock_id is %NULL, no icon will be shown in the specified position.
*
* Since: 2.16
*
* Deprecated: 3.10: Use gtk_entry_set_icon_from_icon_name() instead.
*/
void
gtk_entry_set_icon_from_stock (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
const gchar *stock_id)
{
GtkEntryPrivate *priv;
EntryIconInfo *icon_info;
g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
priv = entry->priv;
if ((icon_info = priv->icons[icon_pos]) == NULL)
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
g_object_freeze_notify (G_OBJECT (entry));
if (stock_id != NULL)
{
_gtk_icon_helper_set_stock_id (GTK_ICON_HELPER (icon_info->gadget), stock_id, GTK_ICON_SIZE_MENU);
if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
{
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STOCK_PRIMARY]);
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STORAGE_TYPE_PRIMARY]);
}
else
{
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STOCK_SECONDARY]);
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STORAGE_TYPE_SECONDARY]);
}
if (gtk_widget_get_mapped (GTK_WIDGET (entry)))
gdk_window_show_unraised (icon_info->window);
}
else
gtk_entry_clear (entry, icon_pos);
if (gtk_widget_get_visible (GTK_WIDGET (entry)))
gtk_widget_queue_resize (GTK_WIDGET (entry));
g_object_thaw_notify (G_OBJECT (entry));
}
/**
* gtk_entry_set_icon_from_icon_name:
* @entry: A #GtkEntry
@ -8681,7 +8548,7 @@ gtk_entry_get_icon_activatable (GtkEntry *entry,
*
* Unlike the other methods of setting and getting icon data, this
* method will work regardless of whether the icon was set using a
* #GdkPixbuf, a #GIcon, a stock item, or an icon name.
* #GdkPixbuf, a #GIcon or an icon name.
*
* Returns: (transfer none) (nullable): A #GdkPixbuf, or %NULL if no icon is
* set for this position.
@ -8762,41 +8629,6 @@ gtk_entry_get_icon_gicon (GtkEntry *entry,
return _gtk_icon_helper_peek_gicon (GTK_ICON_HELPER (icon_info->gadget));
}
/**
* gtk_entry_get_icon_stock:
* @entry: A #GtkEntry
* @icon_pos: Icon position
*
* Retrieves the stock id used for the icon, or %NULL if there is
* no icon or if the icon was set by some other method (e.g., by
* pixbuf, icon name or gicon).
*
* Returns: A stock id, or %NULL if no icon is set or if the icon
* wasnt set from a stock id
*
* Since: 2.16
*
* Deprecated: 3.10: Use gtk_entry_get_icon_name() instead.
*/
const gchar *
gtk_entry_get_icon_stock (GtkEntry *entry,
GtkEntryIconPosition icon_pos)
{
GtkEntryPrivate *priv;
EntryIconInfo *icon_info;
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), NULL);
priv = entry->priv;
icon_info = priv->icons[icon_pos];
if (!icon_info)
return NULL;
return _gtk_icon_helper_get_stock_id (GTK_ICON_HELPER (icon_info->gadget));
}
/**
* gtk_entry_get_icon_name:
* @entry: A #GtkEntry

View File

@ -316,10 +316,6 @@ GDK_AVAILABLE_IN_ALL
void gtk_entry_set_icon_from_pixbuf (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
GdkPixbuf *pixbuf);
GDK_DEPRECATED_IN_3_10_FOR(gtk_entry_set_icon_from_icon_name)
void gtk_entry_set_icon_from_stock (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
const gchar *stock_id);
GDK_AVAILABLE_IN_ALL
void gtk_entry_set_icon_from_icon_name (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
@ -334,9 +330,6 @@ GtkImageType gtk_entry_get_icon_storage_type (GtkEntry *
GDK_AVAILABLE_IN_ALL
GdkPixbuf* gtk_entry_get_icon_pixbuf (GtkEntry *entry,
GtkEntryIconPosition icon_pos);
GDK_DEPRECATED_IN_3_10_FOR(gtk_entry_get_icon_name)
const gchar* gtk_entry_get_icon_stock (GtkEntry *entry,
GtkEntryIconPosition icon_pos);
GDK_AVAILABLE_IN_ALL
const gchar* gtk_entry_get_icon_name (GtkEntry *entry,
GtkEntryIconPosition icon_pos);

View File

@ -32,7 +32,6 @@
#include "gtkiconthemeprivate.h"
#include "gtkrendericonprivate.h"
#include "deprecated/gtkiconfactoryprivate.h"
#include "deprecated/gtkstock.h"
struct _GtkIconHelperPrivate {
GtkImageDefinition *def;
@ -535,19 +534,6 @@ gtk_icon_helper_load_surface (GtkIconHelper *self,
gtk_image_definition_get_scale (self->priv->def));
break;
case GTK_IMAGE_STOCK:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
icon_set = gtk_icon_factory_lookup_default (gtk_image_definition_get_stock (self->priv->def));
G_GNUC_END_IGNORE_DEPRECATIONS;
if (icon_set != NULL)
surface = ensure_surface_for_icon_set (self,
gtk_css_node_get_style (gtk_css_gadget_get_node (GTK_CSS_GADGET (self))),
gtk_widget_get_direction (gtk_css_gadget_get_owner (GTK_CSS_GADGET (self))),
scale, icon_set);
else
surface = NULL;
break;
case GTK_IMAGE_ICON_SET:
icon_set = gtk_image_definition_get_icon_set (self->priv->def);
surface = ensure_surface_for_icon_set (self,
@ -647,7 +633,6 @@ _gtk_icon_helper_get_size (GtkIconHelper *self,
break;
case GTK_IMAGE_STOCK:
case GTK_IMAGE_ICON_SET:
case GTK_IMAGE_EMPTY:
default:
@ -712,36 +697,27 @@ _gtk_icon_helper_set_icon_set (GtkIconHelper *self,
_gtk_icon_helper_set_icon_size (self, icon_size);
}
void
void
_gtk_icon_helper_set_pixbuf (GtkIconHelper *self,
GdkPixbuf *pixbuf)
{
gtk_icon_helper_take_definition (self, gtk_image_definition_new_pixbuf (pixbuf, 1));
}
void
void
_gtk_icon_helper_set_animation (GtkIconHelper *self,
GdkPixbufAnimation *animation)
{
gtk_icon_helper_take_definition (self, gtk_image_definition_new_animation (animation, 1));
}
void
void
_gtk_icon_helper_set_surface (GtkIconHelper *self,
cairo_surface_t *surface)
{
gtk_icon_helper_take_definition (self, gtk_image_definition_new_surface (surface));
}
void
_gtk_icon_helper_set_stock_id (GtkIconHelper *self,
const gchar *stock_id,
GtkIconSize icon_size)
{
gtk_icon_helper_take_definition (self, gtk_image_definition_new_stock (stock_id));
_gtk_icon_helper_set_icon_size (self, icon_size);
}
gboolean
_gtk_icon_helper_set_icon_size (GtkIconHelper *self,
GtkIconSize icon_size)
@ -841,12 +817,6 @@ _gtk_icon_helper_peek_surface (GtkIconHelper *self)
return gtk_image_definition_get_surface (self->priv->def);
}
const gchar *
_gtk_icon_helper_get_stock_id (GtkIconHelper *self)
{
return gtk_image_definition_get_stock (self->priv->def);
}
const gchar *
_gtk_icon_helper_get_icon_name (GtkIconHelper *self)
{

View File

@ -95,9 +95,6 @@ void _gtk_icon_helper_set_icon_set (GtkIconHelper *self,
void _gtk_icon_helper_set_icon_name (GtkIconHelper *self,
const gchar *icon_name,
GtkIconSize icon_size);
void _gtk_icon_helper_set_stock_id (GtkIconHelper *self,
const gchar *stock_id,
GtkIconSize icon_size);
void _gtk_icon_helper_set_surface (GtkIconHelper *self,
cairo_surface_t *surface);
@ -120,7 +117,6 @@ GdkPixbufAnimation *_gtk_icon_helper_peek_animation (GtkIconHelper *self);
cairo_surface_t *_gtk_icon_helper_peek_surface (GtkIconHelper *self);
GtkImageDefinition *gtk_icon_helper_get_definition (GtkIconHelper *self);
const gchar *_gtk_icon_helper_get_stock_id (GtkIconHelper *self);
const gchar *_gtk_icon_helper_get_icon_name (GtkIconHelper *self);
cairo_surface_t *gtk_icon_helper_load_surface (GtkIconHelper *self,

View File

@ -33,7 +33,6 @@
#include "gtkiconhelperprivate.h"
#include "gtkimageprivate.h"
#include "deprecated/gtkiconfactory.h"
#include "deprecated/gtkstock.h"
#include "gtkicontheme.h"
#include "gtksizerequest.h"
#include "gtkintl.h"
@ -198,7 +197,6 @@ enum
PROP_PIXBUF,
PROP_SURFACE,
PROP_FILE,
PROP_STOCK,
PROP_ICON_SET,
PROP_ICON_SIZE,
PROP_PIXEL_SIZE,
@ -258,18 +256,6 @@ gtk_image_class_init (GtkImageClass *class)
NULL,
GTK_PARAM_READWRITE);
/**
* GtkImage:stock:
*
* Deprecated: 3.10: Use #GtkImage:icon-name instead.
*/
image_props[PROP_STOCK] =
g_param_spec_string ("stock",
P_("Stock ID"),
P_("Stock ID for a stock image to display"),
NULL,
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED);
/**
* GtkImage:icon-set:
*
@ -287,7 +273,7 @@ gtk_image_class_init (GtkImageClass *class)
image_props[PROP_ICON_SIZE] =
g_param_spec_int ("icon-size",
P_("Icon size"),
P_("Symbolic size to use for stock icon, icon set or named icon"),
P_("Symbolic size to use for icon set or named icon"),
0, G_MAXINT,
DEFAULT_ICON_SIZE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
@ -454,11 +440,6 @@ gtk_image_set_property (GObject *object,
case PROP_FILE:
gtk_image_set_from_file (image, g_value_get_string (value));
break;
case PROP_STOCK:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gtk_image_set_from_stock (image, g_value_get_string (value), icon_size);
G_GNUC_END_IGNORE_DEPRECATIONS;
break;
case PROP_ICON_SET:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gtk_image_set_from_icon_set (image, g_value_get_boxed (value), icon_size);
@ -518,9 +499,6 @@ gtk_image_get_property (GObject *object,
case PROP_FILE:
g_value_set_string (value, priv->filename);
break;
case PROP_STOCK:
g_value_set_string (value, _gtk_icon_helper_get_stock_id (priv->icon_helper));
break;
case PROP_ICON_SET:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
g_value_set_boxed (value, _gtk_icon_helper_peek_icon_set (priv->icon_helper));
@ -678,37 +656,6 @@ gtk_image_new_from_surface (cairo_surface_t *surface)
gtk_image_set_from_surface (image, surface);
return GTK_WIDGET (image);
}
/**
* gtk_image_new_from_stock:
* @stock_id: a stock icon name
* @size: (type int): a stock icon size (#GtkIconSize)
*
* Creates a #GtkImage displaying a stock icon. Sample stock icon
* names are #GTK_STOCK_OPEN, #GTK_STOCK_QUIT. Sample stock sizes
* are #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_SMALL_TOOLBAR. If the stock
* icon name isnt known, the image will be empty.
* You can register your own stock icon names, see
* gtk_icon_factory_add_default() and gtk_icon_factory_add().
*
* Returns: a new #GtkImage displaying the stock icon
*
* Deprecated: 3.10: Use gtk_image_new_from_icon_name() instead.
**/
GtkWidget*
gtk_image_new_from_stock (const gchar *stock_id,
GtkIconSize size)
{
GtkImage *image;
image = g_object_new (GTK_TYPE_IMAGE, NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gtk_image_set_from_stock (image, stock_id, size);
G_GNUC_END_IGNORE_DEPRECATIONS;
return GTK_WIDGET (image);
}
@ -1062,52 +1009,13 @@ gtk_image_set_from_pixbuf (GtkImage *image,
priv = image->priv;
g_object_freeze_notify (G_OBJECT (image));
gtk_image_clear (image);
if (pixbuf != NULL)
_gtk_icon_helper_set_pixbuf (priv->icon_helper, pixbuf);
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_PIXBUF]);
g_object_thaw_notify (G_OBJECT (image));
}
/**
* gtk_image_set_from_stock:
* @image: a #GtkImage
* @stock_id: a stock icon name
* @size: (type int): a stock icon size (#GtkIconSize)
*
* See gtk_image_new_from_stock() for details.
*
* Deprecated: 3.10: Use gtk_image_set_from_icon_name() instead.
**/
void
gtk_image_set_from_stock (GtkImage *image,
const gchar *stock_id,
GtkIconSize size)
{
GtkImagePrivate *priv;
gchar *new_id;
g_return_if_fail (GTK_IS_IMAGE (image));
priv = image->priv;
g_object_freeze_notify (G_OBJECT (image));
new_id = g_strdup (stock_id);
gtk_image_clear (image);
if (new_id)
{
_gtk_icon_helper_set_stock_id (priv->icon_helper, new_id, size);
g_free (new_id);
}
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_STOCK]);
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_SIZE]);
g_object_thaw_notify (G_OBJECT (image));
}
@ -1344,40 +1252,6 @@ gtk_image_get_pixbuf (GtkImage *image)
return _gtk_icon_helper_peek_pixbuf (image->priv->icon_helper);
}
/**
* gtk_image_get_stock:
* @image: a #GtkImage
* @stock_id: (out) (transfer none) (allow-none): place to store a
* stock icon name, or %NULL
* @size: (out) (allow-none) (type int): place to store a stock icon
* size (#GtkIconSize), or %NULL
*
* Gets the stock icon name and size being displayed by the #GtkImage.
* The storage type of the image must be %GTK_IMAGE_EMPTY or
* %GTK_IMAGE_STOCK (see gtk_image_get_storage_type()).
* The returned string is owned by the #GtkImage and should not
* be freed.
*
* Deprecated: 3.10: Use gtk_image_get_icon_name() instead.
**/
void
gtk_image_get_stock (GtkImage *image,
gchar **stock_id,
GtkIconSize *size)
{
GtkImagePrivate *priv;
g_return_if_fail (GTK_IS_IMAGE (image));
priv = image->priv;
if (stock_id)
*stock_id = (gchar *) _gtk_icon_helper_get_stock_id (priv->icon_helper);
if (size)
*size = _gtk_icon_helper_get_icon_size (priv->icon_helper);
}
/**
* gtk_image_get_icon_set:
* @image: a #GtkImage
@ -1748,9 +1622,6 @@ gtk_image_notify_for_storage_type (GtkImage *image,
case GTK_IMAGE_PIXBUF:
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_PIXBUF]);
break;
case GTK_IMAGE_STOCK:
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_STOCK]);
break;
case GTK_IMAGE_ICON_SET:
g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_ICON_SET]);
break;

View File

@ -52,7 +52,6 @@ typedef struct _GtkImageClass GtkImageClass;
* GtkImageType:
* @GTK_IMAGE_EMPTY: there is no image displayed by the widget
* @GTK_IMAGE_PIXBUF: the widget contains a #GdkPixbuf
* @GTK_IMAGE_STOCK: the widget contains a [stock item name][gtkstock]
* @GTK_IMAGE_ICON_SET: the widget contains a #GtkIconSet
* @GTK_IMAGE_ANIMATION: the widget contains a #GdkPixbufAnimation
* @GTK_IMAGE_ICON_NAME: the widget contains a named icon.
@ -74,7 +73,6 @@ typedef enum
{
GTK_IMAGE_EMPTY,
GTK_IMAGE_PIXBUF,
GTK_IMAGE_STOCK,
GTK_IMAGE_ICON_SET,
GTK_IMAGE_ANIMATION,
GTK_IMAGE_ICON_NAME,
@ -119,9 +117,6 @@ GtkWidget* gtk_image_new_from_resource (const gchar *resource_path);
GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf);
GDK_DEPRECATED_IN_3_10_FOR(gtk_image_new_from_icon_name)
GtkWidget* gtk_image_new_from_stock (const gchar *stock_id,
GtkIconSize size);
GDK_DEPRECATED_IN_3_10_FOR(gtk_image_new_from_icon_name)
GtkWidget* gtk_image_new_from_icon_set (GtkIconSet *icon_set,
GtkIconSize size);
GDK_AVAILABLE_IN_ALL
@ -147,10 +142,6 @@ GDK_AVAILABLE_IN_ALL
void gtk_image_set_from_pixbuf (GtkImage *image,
GdkPixbuf *pixbuf);
GDK_DEPRECATED_IN_3_10_FOR(gtk_image_set_from_icon_name)
void gtk_image_set_from_stock (GtkImage *image,
const gchar *stock_id,
GtkIconSize size);
GDK_DEPRECATED_IN_3_10_FOR(gtk_image_set_from_icon_name)
void gtk_image_set_from_icon_set (GtkImage *image,
GtkIconSet *icon_set,
GtkIconSize size);
@ -178,10 +169,6 @@ GtkImageType gtk_image_get_storage_type (GtkImage *image);
GDK_AVAILABLE_IN_ALL
GdkPixbuf* gtk_image_get_pixbuf (GtkImage *image);
GDK_DEPRECATED_IN_3_10_FOR(gtk_image_get_icon_name)
void gtk_image_get_stock (GtkImage *image,
gchar **stock_id,
GtkIconSize *size);
GDK_DEPRECATED_IN_3_10_FOR(gtk_image_get_icon_name)
void gtk_image_get_icon_set (GtkImage *image,
GtkIconSet **icon_set,
GtkIconSize *size);

View File

@ -147,20 +147,6 @@ gtk_image_definition_new_pixbuf (GdkPixbuf *pixbuf,
return def;
}
GtkImageDefinition *
gtk_image_definition_new_stock (const char *stock_id)
{
GtkImageDefinition *def;
if (stock_id == NULL || stock_id[0] == '\0')
return NULL;
def = gtk_image_definition_alloc (GTK_IMAGE_STOCK);
def->stock.id = g_strdup (stock_id);
return def;
}
GtkImageDefinition *
gtk_image_definition_new_icon_set (GtkIconSet *icon_set)
{
@ -266,9 +252,6 @@ gtk_image_definition_unref (GtkImageDefinition *def)
case GTK_IMAGE_SURFACE:
cairo_surface_destroy (def->surface.surface);
break;
case GTK_IMAGE_STOCK:
g_free (def->stock.id);
break;
case GTK_IMAGE_ICON_SET:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gtk_icon_set_unref (def->icon_set.icon_set);
@ -300,7 +283,6 @@ gtk_image_definition_get_scale (const GtkImageDefinition *def)
g_assert_not_reached ();
case GTK_IMAGE_EMPTY:
case GTK_IMAGE_SURFACE:
case GTK_IMAGE_STOCK:
case GTK_IMAGE_ICON_SET:
case GTK_IMAGE_ICON_NAME:
case GTK_IMAGE_GICON:
@ -321,15 +303,6 @@ gtk_image_definition_get_pixbuf (const GtkImageDefinition *def)
return def->pixbuf.pixbuf;
}
const gchar *
gtk_image_definition_get_stock (const GtkImageDefinition *def)
{
if (def->type != GTK_IMAGE_STOCK)
return NULL;
return def->stock.id;
}
GtkIconSet *
gtk_image_definition_get_icon_set (const GtkImageDefinition *def)
{

View File

@ -28,7 +28,6 @@ typedef union _GtkImageDefinition GtkImageDefinition;
GtkImageDefinition * gtk_image_definition_new_empty (void);
GtkImageDefinition * gtk_image_definition_new_pixbuf (GdkPixbuf *pixbuf,
int scale);
GtkImageDefinition * gtk_image_definition_new_stock (const char *stock_id);
GtkImageDefinition * gtk_image_definition_new_icon_set (GtkIconSet *icon_set);
GtkImageDefinition * gtk_image_definition_new_animation (GdkPixbufAnimation *animation,
int scale);
@ -42,7 +41,6 @@ void gtk_image_definition_unref (GtkImageDefinit
GtkImageType gtk_image_definition_get_storage_type (const GtkImageDefinition *def);
gint gtk_image_definition_get_scale (const GtkImageDefinition *def);
GdkPixbuf * gtk_image_definition_get_pixbuf (const GtkImageDefinition *def);
const gchar * gtk_image_definition_get_stock (const GtkImageDefinition *def);
GtkIconSet * gtk_image_definition_get_icon_set (const GtkImageDefinition *def);
GdkPixbufAnimation * gtk_image_definition_get_animation (const GtkImageDefinition *def);
const gchar * gtk_image_definition_get_icon_name (const GtkImageDefinition *def);

View File

@ -22,7 +22,6 @@
#include "gtkcheckmenuitem.h"
#include "gtklabel.h"
#include "gtktogglebutton.h"
#include "deprecated/gtkstock.h"
#include "gtkintl.h"
#include "gtkradiotoolbutton.h"
#include "deprecated/gtktoggleaction.h"
@ -212,12 +211,10 @@ gtk_toggle_tool_button_create_menu_proxy (GtkToolItem *item)
GtkToolButton *tool_button = GTK_TOOL_BUTTON (item);
GtkToggleToolButton *toggle_tool_button = GTK_TOGGLE_TOOL_BUTTON (item);
GtkWidget *menu_item = NULL;
GtkStockItem stock_item;
gboolean use_mnemonic = TRUE;
const char *label;
GtkWidget *label_widget;
const gchar *label_text;
const gchar *stock_id;
if (_gtk_tool_item_create_menu_proxy (item))
return TRUE;
@ -225,7 +222,6 @@ gtk_toggle_tool_button_create_menu_proxy (GtkToolItem *item)
label_widget = gtk_tool_button_get_label_widget (tool_button);
label_text = gtk_tool_button_get_label (tool_button);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
stock_id = gtk_tool_button_get_stock_id (tool_button);
if (GTK_IS_LABEL (label_widget))
{
@ -237,10 +233,6 @@ gtk_toggle_tool_button_create_menu_proxy (GtkToolItem *item)
label = label_text;
use_mnemonic = gtk_tool_button_get_use_underline (tool_button);
}
else if (stock_id && gtk_stock_lookup (stock_id, &stock_item))
{
label = stock_item.label;
}
else
{
label = "";
@ -401,37 +393,7 @@ gtk_toggle_tool_button_new (void)
button = g_object_new (GTK_TYPE_TOGGLE_TOOL_BUTTON,
NULL);
return GTK_TOOL_ITEM (button);
}
/**
* gtk_toggle_tool_button_new_from_stock:
* @stock_id: the name of the stock item
*
* Creates a new #GtkToggleToolButton containing the image and text from a
* stock item. Some stock ids have preprocessor macros like #GTK_STOCK_OK
* and #GTK_STOCK_APPLY.
*
* It is an error if @stock_id is not a name of a stock item.
*
* Returns: A new #GtkToggleToolButton
*
* Since: 2.4
*
* Deprecated: 3.10: Use gtk_toggle_tool_button_new() instead.
**/
GtkToolItem *
gtk_toggle_tool_button_new_from_stock (const gchar *stock_id)
{
GtkToolButton *button;
g_return_val_if_fail (stock_id != NULL, NULL);
button = g_object_new (GTK_TYPE_TOGGLE_TOOL_BUTTON,
"stock-id", stock_id,
NULL);
return GTK_TOOL_ITEM (button);
}

View File

@ -75,8 +75,6 @@ GDK_AVAILABLE_IN_ALL
GType gtk_toggle_tool_button_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkToolItem *gtk_toggle_tool_button_new (void);
GDK_DEPRECATED_IN_3_10_FOR(gtk_toggle_tool_button_new)
GtkToolItem *gtk_toggle_tool_button_new_from_stock (const gchar *stock_id);
GDK_AVAILABLE_IN_ALL
void gtk_toggle_tool_button_set_active (GtkToggleToolButton *button,

View File

@ -79,7 +79,6 @@ enum {
PROP_LABEL,
PROP_USE_UNDERLINE,
PROP_LABEL_WIDGET,
PROP_STOCK_ID,
PROP_ICON_NAME,
PROP_ICON_WIDGET,
PROP_ACTION_NAME,
@ -122,7 +121,6 @@ struct _GtkToolButtonPrivate
{
GtkWidget *button;
gchar *stock_id;
gchar *icon_name;
gchar *label_text;
GtkWidget *label_widget;
@ -258,28 +256,14 @@ gtk_tool_button_class_init (GtkToolButtonClass *klass)
P_("Widget to use as the item label"),
GTK_TYPE_WIDGET,
GTK_PARAM_READWRITE));
/**
* GtkToolButton:stock-id:
*
* Deprecated: 3.10: Use #GtkToolButton:icon-name instead.
*/
g_object_class_install_property (object_class,
PROP_STOCK_ID,
g_param_spec_string ("stock-id",
P_("Stock Id"),
P_("The stock icon displayed on the item"),
NULL,
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
/**
* GtkToolButton:icon-name:
*
*
* The name of the themed icon displayed on the item.
* This property only has an effect if not overridden by
* #GtkToolButton:label-widget, #GtkToolButton:icon-widget or
* #GtkToolButton:stock-id properties.
* #GtkToolButton:label-widget or #GtkToolButton:icon-widget
*
* Since: 2.8
* Since: 2.8
*/
g_object_class_install_property (object_class,
PROP_ICON_NAME,
@ -427,9 +411,9 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
{
need_label = TRUE;
}
if (style != GTK_TOOLBAR_TEXT && button->priv->icon_widget == NULL &&
button->priv->stock_id == NULL && button->priv->icon_name == NULL)
button->priv->icon_name == NULL)
{
need_label = TRUE;
need_icon = FALSE;
@ -437,7 +421,7 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
}
if (style == GTK_TOOLBAR_TEXT && button->priv->label_widget == NULL &&
button->priv->stock_id == NULL && button->priv->label_text == NULL)
button->priv->label_text == NULL)
{
need_label = FALSE;
need_icon = TRUE;
@ -452,30 +436,20 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
}
else
{
GtkStockItem stock_item;
gboolean elide;
gchar *label_text;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (button->priv->label_text)
{
label_text = button->priv->label_text;
elide = button->priv->use_underline;
}
else if (button->priv->stock_id && gtk_stock_lookup (button->priv->stock_id, &stock_item))
{
label_text = stock_item.label;
elide = TRUE;
}
else
{
label_text = "";
elide = FALSE;
}
G_GNUC_END_IGNORE_DEPRECATIONS;
if (elide)
label_text = _gtk_toolbar_elide_underscores (label_text);
else
@ -529,19 +503,10 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button));
if (need_icon)
{
GtkIconSet *icon_set = NULL;
if (button->priv->stock_id)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
icon_set = gtk_icon_factory_lookup_default (button->priv->stock_id);
G_GNUC_END_IGNORE_DEPRECATIONS;
}
if (button->priv->icon_widget)
{
icon = button->priv->icon_widget;
if (GTK_IS_IMAGE (icon))
{
g_object_set (button->priv->icon_widget,
@ -549,13 +514,6 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
NULL);
}
}
else if (icon_set != NULL)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
icon = gtk_image_new_from_stock (button->priv->stock_id, icon_size);
G_GNUC_END_IGNORE_DEPRECATIONS;
gtk_widget_show (icon);
}
else if (button->priv->icon_name)
{
icon = gtk_image_new_from_icon_name (button->priv->icon_name, icon_size);
@ -676,11 +634,6 @@ gtk_tool_button_set_property (GObject *object,
case PROP_LABEL_WIDGET:
gtk_tool_button_set_label_widget (button, g_value_get_object (value));
break;
case PROP_STOCK_ID:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gtk_tool_button_set_stock_id (button, g_value_get_string (value));
G_GNUC_END_IGNORE_DEPRECATIONS;
break;
case PROP_ICON_NAME:
gtk_tool_button_set_icon_name (button, g_value_get_string (value));
break;
@ -732,9 +685,6 @@ gtk_tool_button_get_property (GObject *object,
case PROP_USE_UNDERLINE:
g_value_set_boolean (value, gtk_tool_button_get_use_underline (button));
break;
case PROP_STOCK_ID:
g_value_set_string (value, button->priv->stock_id);
break;
case PROP_ICON_NAME:
g_value_set_string (value, button->priv->icon_name);
break;
@ -801,7 +751,6 @@ gtk_tool_button_finalize (GObject *object)
{
GtkToolButton *button = GTK_TOOL_BUTTON (object);
g_free (button->priv->stock_id);
g_free (button->priv->icon_name);
g_free (button->priv->label_text);
@ -819,17 +768,7 @@ clone_image_menu_size (GtkImage *image)
{
GtkImageType storage_type = gtk_image_get_storage_type (image);
if (storage_type == GTK_IMAGE_STOCK)
{
gchar *stock_id;
GtkWidget *widget;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gtk_image_get_stock (image, &stock_id, NULL);
widget = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU);
G_GNUC_END_IGNORE_DEPRECATIONS;
return widget;
}
else if (storage_type == GTK_IMAGE_ICON_NAME)
if (storage_type == GTK_IMAGE_ICON_NAME)
{
const gchar *icon_name;
gtk_image_get_icon_name (image, &icon_name, NULL);
@ -1008,13 +947,11 @@ gtk_tool_button_update (GtkActivatable *activatable,
return;
button = GTK_TOOL_BUTTON (activatable);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (strcmp (property_name, "short-label") == 0)
gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
else if (strcmp (property_name, "stock-id") == 0)
gtk_tool_button_set_stock_id (button, gtk_action_get_stock_id (action));
else if (strcmp (property_name, "gicon") == 0)
{
const gchar *stock_id = gtk_action_get_stock_id (action);
@ -1075,9 +1012,6 @@ gtk_tool_button_sync_action_properties (GtkActivatable *activatable,
gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
gtk_tool_button_set_use_underline (button, TRUE);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gtk_tool_button_set_stock_id (button, stock_id);
G_GNUC_END_IGNORE_DEPRECATIONS;
gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action));
if (stock_id)
@ -1109,36 +1043,6 @@ gtk_tool_button_sync_action_properties (GtkActivatable *activatable,
gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
}
/**
* gtk_tool_button_new_from_stock:
* @stock_id: the name of the stock item
*
* Creates a new #GtkToolButton containing the image and text from a
* stock item. Some stock ids have preprocessor macros like #GTK_STOCK_OK
* and #GTK_STOCK_APPLY.
*
* It is an error if @stock_id is not a name of a stock item.
*
* Returns: A new #GtkToolButton
*
* Since: 2.4
*
* Deprecated: 3.10: Use gtk_tool_button_new() together with
* gtk_image_new_from_icon_name() instead.
**/
GtkToolItem *
gtk_tool_button_new_from_stock (const gchar *stock_id)
{
GtkToolButton *button;
g_return_val_if_fail (stock_id != NULL, NULL);
button = g_object_new (GTK_TYPE_TOOL_BUTTON,
"stock-id", stock_id,
NULL);
return GTK_TOOL_ITEM (button);
}
/**
* gtk_tool_button_new:
@ -1283,58 +1187,6 @@ gtk_tool_button_get_use_underline (GtkToolButton *button)
return button->priv->use_underline;
}
/**
* gtk_tool_button_set_stock_id:
* @button: a #GtkToolButton
* @stock_id: (allow-none): a name of a stock item, or %NULL
*
* Sets the name of the stock item. See gtk_tool_button_new_from_stock().
* The stock_id property only has an effect if not overridden by non-%NULL
* #GtkToolButton:label-widget and #GtkToolButton:icon-widget properties.
*
* Since: 2.4
*
* Deprecated: 3.10: Use gtk_tool_button_set_icon_name() instead.
**/
void
gtk_tool_button_set_stock_id (GtkToolButton *button,
const gchar *stock_id)
{
gchar *old_stock_id;
g_return_if_fail (GTK_IS_TOOL_BUTTON (button));
old_stock_id = button->priv->stock_id;
button->priv->stock_id = g_strdup (stock_id);
button->priv->contents_invalid = TRUE;
g_free (old_stock_id);
g_object_notify (G_OBJECT (button), "stock-id");
}
/**
* gtk_tool_button_get_stock_id:
* @button: a #GtkToolButton
*
* Returns the name of the stock item. See gtk_tool_button_set_stock_id().
* The returned string is owned by GTK+ and must not be freed or modifed.
*
* Returns: the name of the stock item for @button.
*
* Since: 2.4
*
* Deprecated: 3.10: Use gtk_tool_button_get_icon_name() instead.
**/
const gchar *
gtk_tool_button_get_stock_id (GtkToolButton *button)
{
g_return_val_if_fail (GTK_IS_TOOL_BUTTON (button), NULL);
return button->priv->stock_id;
}
/**
* gtk_tool_button_set_icon_name:
* @button: a #GtkToolButton

View File

@ -80,8 +80,6 @@ GType gtk_tool_button_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkToolItem *gtk_tool_button_new (GtkWidget *icon_widget,
const gchar *label);
GDK_DEPRECATED_IN_3_10_FOR(gtk_tool_button_new)
GtkToolItem *gtk_tool_button_new_from_stock (const gchar *stock_id);
GDK_AVAILABLE_IN_ALL
void gtk_tool_button_set_label (GtkToolButton *button,
@ -93,11 +91,6 @@ void gtk_tool_button_set_use_underline (GtkToolButton *button,
gboolean use_underline);
GDK_AVAILABLE_IN_ALL
gboolean gtk_tool_button_get_use_underline (GtkToolButton *button);
GDK_DEPRECATED_IN_3_10_FOR(gtk_tool_button_set_icon_name)
void gtk_tool_button_set_stock_id (GtkToolButton *button,
const gchar *stock_id);
GDK_DEPRECATED_IN_3_10_FOR(gtk_tool_button_get_icon_name)
const gchar * gtk_tool_button_get_stock_id (GtkToolButton *button);
GDK_AVAILABLE_IN_ALL
void gtk_tool_button_set_icon_name (GtkToolButton *button,
const gchar *icon_name);

View File

@ -292,32 +292,6 @@ gtk_tooltip_set_icon (GtkTooltip *tooltip,
gtk_tooltip_window_set_image_icon (GTK_TOOLTIP_WINDOW (tooltip->window), pixbuf);
}
/**
* gtk_tooltip_set_icon_from_stock:
* @tooltip: a #GtkTooltip
* @stock_id: (allow-none): a stock id, or %NULL
* @size: (type int): a stock icon size (#GtkIconSize)
*
* Sets the icon of the tooltip (which is in front of the text) to be
* the stock item indicated by @stock_id with the size indicated
* by @size. If @stock_id is %NULL, the image will be hidden.
*
* Since: 2.12
*
* Deprecated: 3.10: Use gtk_tooltip_set_icon_from_icon_name() instead.
*/
void
gtk_tooltip_set_icon_from_stock (GtkTooltip *tooltip,
const gchar *stock_id,
GtkIconSize size)
{
g_return_if_fail (GTK_IS_TOOLTIP (tooltip));
gtk_tooltip_window_set_image_icon_from_stock (GTK_TOOLTIP_WINDOW (tooltip->window),
stock_id,
size);
}
/**
* gtk_tooltip_set_icon_from_icon_name:
* @tooltip: a #GtkTooltip

View File

@ -44,10 +44,6 @@ void gtk_tooltip_set_text (GtkTooltip *tooltip,
GDK_AVAILABLE_IN_ALL
void gtk_tooltip_set_icon (GtkTooltip *tooltip,
GdkPixbuf *pixbuf);
GDK_DEPRECATED_IN_3_10_FOR(gtk_tooltip_set_icon_from_icon_name)
void gtk_tooltip_set_icon_from_stock (GtkTooltip *tooltip,
const gchar *stock_id,
GtkIconSize size);
GDK_AVAILABLE_IN_ALL
void gtk_tooltip_set_icon_from_icon_name (GtkTooltip *tooltip,
const gchar *icon_name,

View File

@ -137,25 +137,6 @@ gtk_tooltip_window_set_image_icon (GtkTooltipWindow *window,
}
}
void
gtk_tooltip_window_set_image_icon_from_stock (GtkTooltipWindow *window,
const char *stock_id,
GtkIconSize icon_size)
{
if (stock_id != NULL)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gtk_image_set_from_stock (GTK_IMAGE (window->image), stock_id, icon_size);
G_GNUC_END_IGNORE_DEPRECATIONS;
gtk_widget_show (window->image);
}
else
{
gtk_widget_hide (window->image);
}
}
void
gtk_tooltip_window_set_image_icon_from_name (GtkTooltipWindow *window,
const char *icon_name,

View File

@ -43,9 +43,6 @@ void gtk_tooltip_window_set_label_text (GtkTooltipWindo
const char *text);
void gtk_tooltip_window_set_image_icon (GtkTooltipWindow *window,
GdkPixbuf *pixbuf);
void gtk_tooltip_window_set_image_icon_from_stock (GtkTooltipWindow *window,
const char *stock_id,
GtkIconSize icon_size);
void gtk_tooltip_window_set_image_icon_from_name (GtkTooltipWindow *window,
const char *icon_name,
GtkIconSize icon_size);

View File

@ -953,12 +953,6 @@ create_toolbar (GtkWidget *widget)
entry = gtk_entry_new ();
gtk_container_add (GTK_CONTAINER (toolitem), entry);
}
else if (create_toolbar_items[i].stock_id)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
toolitem = gtk_tool_button_new_from_stock (create_toolbar_items[i].stock_id);
G_GNUC_END_IGNORE_DEPRECATIONS;
}
else
{
GtkWidget *icon;

View File

@ -146,15 +146,10 @@ main (int argc, char **argv)
GTK_DEST_DEFAULT_DROP,
NULL, 0, GDK_ACTION_COPY);
gtk_drag_dest_add_image_targets (box);
g_signal_connect (box, "drag_data_received",
g_signal_connect (box, "drag_data_received",
G_CALLBACK (drag_data_received), image);
label = gtk_label_new ("GTK_IMAGE_STOCK");
gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
image = gtk_image_new_from_stock (GTK_STOCK_REDO, GTK_ICON_SIZE_DIALOG);
gtk_grid_attach (GTK_GRID (grid), image, 1, 2, 1, 1);
label = gtk_label_new ("GTK_IMAGE_ICON_SET");
gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1);

View File

@ -1897,9 +1897,7 @@ test_icon_factory (void)
icon_set = gtk_icon_factory_lookup (GTK_ICON_FACTORY (factory), "apple-red");
g_assert (icon_set != NULL);
gtk_icon_factory_add_default (GTK_ICON_FACTORY (factory));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
image = gtk_image_new_from_stock ("apple-red", GTK_ICON_SIZE_BUTTON);
G_GNUC_END_IGNORE_DEPRECATIONS;
image = gtk_image_new_from_icon_name ("audio-volume-high", GTK_ICON_SIZE_BUTTON);
g_assert (image != NULL);
g_object_ref_sink (image);
g_object_unref (image);
@ -2270,7 +2268,6 @@ test_menus (void)
" <object class=\"GtkImageMenuItem\" id=\"imagemenuitem1\">"
" <property name=\"label\">gtk-new</property>"
" <property name=\"visible\">True</property>"
" <property name=\"use_stock\">True</property>"
" <property name=\"accel_group\">accelgroup1</property>"
" </object>"
" </child>"
@ -2333,7 +2330,8 @@ test_menus (void)
gtk_widget_show_all (window);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
sample_menu_item = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, accel_group);
sample_menu_item = gtk_image_menu_item_new ();//_with_label ("Some Label");
gtk_image_menu_item_set_accel_group (GTK_IMAGE_MENU_ITEM (sample_menu_item), accel_group);
G_GNUC_END_IGNORE_DEPRECATIONS;
child = gtk_bin_get_child (GTK_BIN (sample_menu_item));
@ -2444,7 +2442,6 @@ test_message_area (void)
" <child>"
" <object class=\"GtkButton\" id=\"button_ok\">"
" <property name=\"label\">gtk-ok</property>"
" <property name=\"use-stock\">yes</property>"
" </object>"
" </child>"
" </object>"
@ -2687,7 +2684,6 @@ test_no_ids (void)
" <child>"
" <object class=\"GtkButton\" id=\"button_ok\">"
" <property name=\"label\">gtk-ok</property>"
" <property name=\"use-stock\">yes</property>"
" </object>"
" </child>"
" </object>"