Commit 79bd9c60 authored by Michael Natterer's avatar Michael Natterer 😴

libgimpwidgets: mostly port from stock IDs to icon names

Add some new API and deprecate old one.
parent 233b86b3
......@@ -124,8 +124,8 @@ gimp_browser_init (GimpBrowser *browser)
G_CALLBACK (gimp_browser_entry_changed),
browser);
gtk_entry_set_icon_from_stock (GTK_ENTRY (browser->search_entry),
GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (browser->search_entry),
GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
gtk_entry_set_icon_activatable (GTK_ENTRY (browser->search_entry),
GTK_ENTRY_ICON_SECONDARY, TRUE);
gtk_entry_set_icon_sensitive (GTK_ENTRY (browser->search_entry),
......
......@@ -87,7 +87,7 @@ G_DEFINE_TYPE (GimpChainButton, gimp_chain_button, GTK_TYPE_TABLE)
static guint gimp_chain_button_signals[LAST_SIGNAL] = { 0 };
static const gchar * const gimp_chain_stock_items[] =
static const gchar * const gimp_chain_icon_names[] =
{
GIMP_STOCK_HCHAIN,
GIMP_STOCK_HCHAIN_BROKEN,
......@@ -308,9 +308,9 @@ gimp_chain_button_update_image (GimpChainButton *button)
i = ((button->position & GIMP_CHAIN_LEFT) << 1) + (button->active ? 0 : 1);
gtk_image_set_from_stock (GTK_IMAGE (button->image),
gimp_chain_stock_items[i],
GTK_ICON_SIZE_BUTTON);
gtk_image_set_from_icon_name (GTK_IMAGE (button->image),
gimp_chain_icon_names[i],
GTK_ICON_SIZE_BUTTON);
}
......
......@@ -331,10 +331,10 @@ gimp_color_button_init (GimpColorButton *button,
GtkAction *action;
action = g_object_new (klass->get_action_type (button),
"name", actions[i].name,
"label", label,
"tooltip", tooltip,
"stock-id", actions[i].stock_id,
"name", actions[i].name,
"label", label,
"tooltip", tooltip,
"icon-name", actions[i].stock_id,
NULL);
if (actions[i].callback)
......
......@@ -203,7 +203,7 @@ gimp_color_notebook_style_set (GtkWidget *widget,
selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (list->data);
image = gtk_image_new_from_stock (selector_class->stock_id, icon_size);
image = gtk_image_new_from_icon_name (selector_class->stock_id, icon_size);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook->notebook),
GTK_WIDGET (list->data),
......@@ -392,8 +392,8 @@ gimp_color_notebook_add_page (GimpColorNotebook *notebook,
menu_widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
image = gtk_image_new_from_stock (selector_class->stock_id,
GTK_ICON_SIZE_MENU);
image = gtk_image_new_from_icon_name (selector_class->stock_id,
GTK_ICON_SIZE_MENU);
gtk_box_pack_start (GTK_BOX (menu_widget), image, FALSE, FALSE, 0);
gtk_widget_show (image);
......@@ -401,8 +401,8 @@ gimp_color_notebook_add_page (GimpColorNotebook *notebook,
gtk_box_pack_start (GTK_BOX (menu_widget), label, FALSE, FALSE, 0);
gtk_widget_show (label);
image = gtk_image_new_from_stock (selector_class->stock_id,
DEFAULT_TAB_ICON_SIZE);
image = gtk_image_new_from_icon_name (selector_class->stock_id,
DEFAULT_TAB_ICON_SIZE);
gtk_notebook_append_page_menu (GTK_NOTEBOOK (notebook->notebook),
page, image, menu_widget);
......
......@@ -192,10 +192,32 @@ gimp_enum_combo_box_new_with_model (GimpEnumStore *enum_store)
* @stock_prefix.
*
* Since: GIMP 2.4
*
* Deprecated: GIMP 2.10
**/
void
gimp_enum_combo_box_set_stock_prefix (GimpEnumComboBox *combo_box,
const gchar *stock_prefix)
{
gimp_enum_combo_box_set_icon_prefix (combo_box, stock_prefix);
}
/**
* gimp_enum_combo_box_set_icon_prefix:
* @combo_box: a #GimpEnumComboBox
* @icon_prefix: a prefix to create icon names from enum values
*
* Attempts to create icons for all items in the @combo_box. See
* gimp_enum_store_set_icon_prefix() to find out what to use as
* @icon_prefix.
*
* Since: GIMP 2.4
*
* Deprecated: GIMP 2.10
**/
void
gimp_enum_combo_box_set_icon_prefix (GimpEnumComboBox *combo_box,
const gchar *icon_prefix)
{
GtkTreeModel *model;
......@@ -203,5 +225,5 @@ gimp_enum_combo_box_set_stock_prefix (GimpEnumComboBox *combo_box,
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
gimp_enum_store_set_stock_prefix (GIMP_ENUM_STORE (model), stock_prefix);
gimp_enum_store_set_icon_prefix (GIMP_ENUM_STORE (model), icon_prefix);
}
......@@ -62,9 +62,13 @@ GType gimp_enum_combo_box_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_enum_combo_box_new (GType enum_type);
GtkWidget * gimp_enum_combo_box_new_with_model (GimpEnumStore *enum_store);
GIMP_DEPRECATED_FOR(gimp_enum_combo_box_set_icon_prefix)
void gimp_enum_combo_box_set_stock_prefix (GimpEnumComboBox *combo_box,
const gchar *stock_prefix);
void gimp_enum_combo_box_set_icon_prefix (GimpEnumComboBox *combo_box,
const gchar *icon_prefix);
G_END_DECLS
#endif /* __GIMP_ENUM_COMBO_BOX_H__ */
......@@ -318,10 +318,31 @@ gimp_enum_store_new_with_values_valist (GType enum_type,
* See also: gimp_enum_combo_box_set_stock_prefix().
*
* Since: GIMP 2.4
*
* Deprecated: GIMP 2.10
**/
void
gimp_enum_store_set_stock_prefix (GimpEnumStore *store,
const gchar *stock_prefix)
{
gimp_enum_store_set_icon_prefix (store, stock_prefix);
}
/**
* gimp_enum_store_set_icon_prefix:
* @store: a #GimpEnumStore
* @icon_prefix: a prefix to create icon names from enum values
*
* Creates an icon name for each enum value in the @store by appending
* the value's nick to the given @icon_prefix, separated by a hyphen.
*
* See also: gimp_enum_combo_box_set_icon_prefix().
*
* Since: GIMP 2.10
**/
void
gimp_enum_store_set_icon_prefix (GimpEnumStore *store,
const gchar *icon_prefix)
{
GtkTreeModel *model;
GtkTreeIter iter;
......@@ -335,9 +356,9 @@ gimp_enum_store_set_stock_prefix (GimpEnumStore *store,
iter_valid;
iter_valid = gtk_tree_model_iter_next (model, &iter))
{
gchar *stock_id = NULL;
gchar *icon_name = NULL;
if (stock_prefix)
if (icon_prefix)
{
GEnumValue *enum_value;
gint value;
......@@ -348,16 +369,16 @@ gimp_enum_store_set_stock_prefix (GimpEnumStore *store,
enum_value = g_enum_get_value (store->enum_class, value);
stock_id = g_strconcat (stock_prefix, "-",
enum_value->value_nick,
NULL);
icon_name = g_strconcat (icon_prefix, "-",
enum_value->value_nick,
NULL);
}
gtk_list_store_set (GTK_LIST_STORE (store), &iter,
GIMP_INT_STORE_STOCK_ID, stock_id,
GIMP_INT_STORE_ICON_NAME, icon_name,
-1);
if (stock_id)
g_free (stock_id);
if (icon_name)
g_free (icon_name);
}
}
......@@ -72,9 +72,13 @@ GtkListStore * gimp_enum_store_new_with_values_valist (GType enum_type,
gint n_values,
va_list args);
GIMP_DEPRECATED_FOR(gimp_enum_store_set_icon_prefix)
void gimp_enum_store_set_stock_prefix (GimpEnumStore *store,
const gchar *stock_prefix);
void gimp_enum_store_set_icon_prefix (GimpEnumStore *store,
const gchar *icon_prefix);
G_END_DECLS
......
......@@ -276,6 +276,8 @@ gimp_enum_radio_frame_new_with_range (GType enum_type,
* Return value: a new #GtkHBox holding a group of #GtkRadioButtons.
*
* Since: GIMP 2.4
*
* Deprecated: GIMP 2.10
**/
GtkWidget *
gimp_enum_stock_box_new (GType enum_type,
......@@ -285,23 +287,9 @@ gimp_enum_stock_box_new (GType enum_type,
gpointer callback_data,
GtkWidget **first_button)
{
GEnumClass *enum_class;
GtkWidget *box;
g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), NULL);
enum_class = g_type_class_ref (enum_type);
box = gimp_enum_stock_box_new_with_range (enum_type,
enum_class->minimum,
enum_class->maximum,
stock_prefix, icon_size,
callback, callback_data,
first_button);
g_type_class_unref (enum_class);
return box;
return gimp_enum_icon_box_new (enum_type, stock_prefix, icon_size,
callback, callback_data,
first_button);
}
/**
......@@ -323,6 +311,8 @@ gimp_enum_stock_box_new (GType enum_type,
* Return value: a new #GtkHBox holding a group of #GtkRadioButtons.
*
* Since: GIMP 2.4
*
* Deprecated: GIMP 2.10
**/
GtkWidget *
gimp_enum_stock_box_new_with_range (GType enum_type,
......@@ -333,17 +323,119 @@ gimp_enum_stock_box_new_with_range (GType enum_type,
GCallback callback,
gpointer callback_data,
GtkWidget **first_button)
{
return gimp_enum_icon_box_new_with_range (enum_type, minimum, maximum,
stock_prefix, icon_size,
callback, callback_data,
first_button);
}
/**
* gimp_enum_stock_box_set_child_padding:
* @stock_box: a stock box widget
* @xpad: horizontal padding
* @ypad: vertical padding
*
* Sets the padding of all buttons in a box created by
* gimp_enum_stock_box_new().
*
* Since: GIMP 2.4
*
* Deprecated: GIMP 2.10
**/
void
gimp_enum_stock_box_set_child_padding (GtkWidget *stock_box,
gint xpad,
gint ypad)
{
gimp_enum_icon_box_set_child_padding (stock_box, xpad, ypad);
}
/**
* gimp_enum_icon_box_new:
* @enum_type: the #GType of an enum.
* @icon_prefix: the prefix of the group of icon names to use.
* @icon_size: the icon size for the icons
* @callback: a callback to connect to the "toggled" signal of each
* #GtkRadioButton that is created.
* @callback_data: data to pass to the @callback.
* @first_button: returns the first button in the created group.
*
* Creates a horizontal box of radio buttons with named icons. The
* icon name for each icon is created by appending the enum_value's
* nick to the given @icon_prefix.
*
* Return value: a new #GtkHBox holding a group of #GtkRadioButtons.
*
* Since: GIMP 2.10
**/
GtkWidget *
gimp_enum_icon_box_new (GType enum_type,
const gchar *icon_prefix,
GtkIconSize icon_size,
GCallback callback,
gpointer callback_data,
GtkWidget **first_button)
{
GEnumClass *enum_class;
GtkWidget *box;
g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), NULL);
enum_class = g_type_class_ref (enum_type);
box = gimp_enum_icon_box_new_with_range (enum_type,
enum_class->minimum,
enum_class->maximum,
icon_prefix, icon_size,
callback, callback_data,
first_button);
g_type_class_unref (enum_class);
return box;
}
/**
* gimp_enum_icon_box_new_with_range:
* @enum_type: the #GType of an enum.
* @minimum: the minumim enum value
* @maximum: the maximum enum value
* @icon_prefix: the prefix of the group of icon names to use.
* @icon_size: the icon size for the icons
* @callback: a callback to connect to the "toggled" signal of each
* #GtkRadioButton that is created.
* @callback_data: data to pass to the @callback.
* @first_button: returns the first button in the created group.
*
* Just like gimp_enum_icon_box_new(), this function creates a group
* of radio buttons, but additionally it supports limiting the range
* of available enum values.
*
* Return value: a new #GtkHBox holding a group of #GtkRadioButtons.
*
* Since: GIMP 2.10
**/
GtkWidget *
gimp_enum_icon_box_new_with_range (GType enum_type,
gint minimum,
gint maximum,
const gchar *icon_prefix,
GtkIconSize icon_size,
GCallback callback,
gpointer callback_data,
GtkWidget **first_button)
{
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *image;
GEnumClass *enum_class;
GEnumValue *value;
gchar *stock_id;
gchar *icon_name;
GSList *group = NULL;
g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), NULL);
g_return_val_if_fail (stock_prefix != NULL, NULL);
g_return_val_if_fail (icon_prefix != NULL, NULL);
enum_class = g_type_class_ref (enum_type);
......@@ -367,14 +459,11 @@ gimp_enum_stock_box_new_with_range (GType enum_type,
if (first_button && *first_button == NULL)
*first_button = button;
stock_id = g_strconcat (stock_prefix, "-", value->value_nick, NULL);
icon_name = g_strconcat (icon_prefix, "-", value->value_nick, NULL);
if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), stock_id))
image = gtk_image_new_from_icon_name (stock_id, icon_size);
else
image = gtk_image_new_from_stock (stock_id, icon_size);
image = gtk_image_new_from_icon_name (icon_name, icon_size);
g_free (stock_id);
g_free (icon_name);
if (image)
{
......@@ -403,27 +492,27 @@ gimp_enum_stock_box_new_with_range (GType enum_type,
}
/**
* gimp_enum_stock_box_set_child_padding:
* @stock_box: a stock box widget
* @xpad: horizontal padding
* @ypad: vertical padding
* gimp_enum_icon_box_set_child_padding:
* @icon_box: an icon box widget
* @xpad: horizontal padding
* @ypad: vertical padding
*
* Sets the padding of all buttons in a box created by
* gimp_enum_stock_box_new().
* gimp_enum_icon_box_new().
*
* Since: GIMP 2.4
* Since: GIMP 2.10
**/
void
gimp_enum_stock_box_set_child_padding (GtkWidget *stock_box,
gint xpad,
gint ypad)
gimp_enum_icon_box_set_child_padding (GtkWidget *icon_box,
gint xpad,
gint ypad)
{
GList *children;
GList *list;
g_return_if_fail (GTK_IS_CONTAINER (stock_box));
g_return_if_fail (GTK_IS_CONTAINER (icon_box));
children = gtk_container_get_children (GTK_CONTAINER (stock_box));
children = gtk_container_get_children (GTK_CONTAINER (icon_box));
for (list = children; list; list = g_list_next (list))
{
......
......@@ -53,12 +53,14 @@ GtkWidget * gimp_enum_radio_frame_new_with_range (GType enum_type,
gpointer callback_data,
GtkWidget **first_button);
GIMP_DEPRECATED_FOR(gimp_enum_icon_box_new)
GtkWidget * gimp_enum_stock_box_new (GType enum_type,
const gchar *stock_prefix,
GtkIconSize icon_size,
GCallback callback,
gpointer callback_data,
GtkWidget **first_button);
GIMP_DEPRECATED_FOR(gimp_enum_icon_box_new_with_range)
GtkWidget * gimp_enum_stock_box_new_with_range (GType enum_type,
gint minimum,
gint maximum,
......@@ -67,11 +69,28 @@ GtkWidget * gimp_enum_stock_box_new_with_range (GType enum_type,
GCallback callback,
gpointer callback_data,
GtkWidget **first_button);
GIMP_DEPRECATED_FOR(gimp_enum_icon_box_set_child_padding)
void gimp_enum_stock_box_set_child_padding (GtkWidget *stock_box,
gint xpad,
gint ypad);
GtkWidget * gimp_enum_icon_box_new (GType enum_type,
const gchar *icon_prefix,
GtkIconSize icon_size,
GCallback callback,
gpointer callback_data,
GtkWidget **first_button);
GtkWidget * gimp_enum_icon_box_new_with_range (GType enum_type,
gint minimum,
gint maximum,
const gchar *icon_prefix,
GtkIconSize icon_size,
GCallback callback,
gpointer callback_data,
GtkWidget **first_button);
void gimp_enum_icon_box_set_child_padding (GtkWidget *icon_box,
gint xpad,
gint ypad);
G_END_DECLS
......
......@@ -129,7 +129,7 @@ gimp_file_entry_init (GimpFileEntry *entry)
gtk_box_pack_end (GTK_BOX (entry), entry->browse_button, FALSE, FALSE, 0);
gtk_widget_show (entry->browse_button);
image = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
image = gtk_image_new_from_icon_name (GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (entry->browse_button), image);
gtk_widget_show (image);
......@@ -203,8 +203,8 @@ gimp_file_entry_new (const gchar *title,
if (check_valid)
{
entry->file_exists = gtk_image_new_from_stock (GTK_STOCK_NO,
GTK_ICON_SIZE_BUTTON);
entry->file_exists = gtk_image_new_from_icon_name (GTK_STOCK_NO,
GTK_ICON_SIZE_BUTTON);
gtk_box_pack_start (GTK_BOX (entry), entry->file_exists, FALSE, FALSE, 0);
gtk_widget_show (entry->file_exists);
}
......@@ -430,7 +430,7 @@ gimp_file_entry_check_filename (GimpFileEntry *entry)
g_free (filename);
gtk_image_set_from_stock (GTK_IMAGE (entry->file_exists),
exists ? GTK_STOCK_YES : GTK_STOCK_NO,
GTK_ICON_SIZE_BUTTON);
gtk_image_set_from_icon_name (GTK_IMAGE (entry->file_exists),
exists ? GTK_STOCK_YES : GTK_STOCK_NO,
GTK_ICON_SIZE_BUTTON);
}
......@@ -42,6 +42,7 @@ typedef struct
{
GtkBox parent_instance;
gchar *icon_name;
gchar *stock_id;
gchar *hint;
} GimpHintBox;
......@@ -52,6 +53,7 @@ typedef struct
enum
{
PROP_0,
PROP_ICON_NAME,
PROP_STOCK_ID,
PROP_HINT
};
......@@ -84,6 +86,11 @@ gimp_hint_box_class_init (GimpHintBoxClass *klass)
object_class->set_property = gimp_hint_box_set_property;
object_class->get_property = gimp_hint_box_get_property;
g_object_class_install_property (object_class, PROP_ICON_NAME,
g_param_spec_string ("icon-name", NULL, NULL,
GIMP_STOCK_INFO,
G_PARAM_CONSTRUCT_ONLY |
GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_STOCK_ID,
g_param_spec_string ("stock-id", NULL, NULL,
GIMP_STOCK_INFO,
......@@ -101,26 +108,32 @@ gimp_hint_box_init (GimpHintBox *box)
{
gtk_orientable_set_orientation (GTK_ORIENTABLE (box),
GTK_ORIENTATION_HORIZONTAL);
box->stock_id = NULL;
box->hint = NULL;
}
static void
gimp_hint_box_constructed (GObject *object)
{
GimpHintBox *box = GIMP_HINT_BOX (object);
GimpHintBox *box = GIMP_HINT_BOX (object);
GtkImage *image = NULL;
GtkWidget *label;
G_OBJECT_CLASS (parent_class)->constructed (object);
gtk_box_set_spacing (GTK_BOX (box), 12);
if (box->stock_id)
if (box->icon_name)
{
image = gtk_image_new_from_icon_name (box->icon_name,
GTK_ICON_SIZE_DIALOG);
}
else if (box->stock_id)
{
GtkWidget *image = gtk_image_new_from_stock (box->stock_id,
GTK_ICON_SIZE_DIALOG);
image = gtk_image_new_from_stock (box->stock_id,
GTK_ICON_SIZE_DIALOG);
}
if (image)
{
gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
gtk_widget_show (image);
}
......@@ -145,6 +158,12 @@ gimp_hint_box_finalize (GObject *object)
{
GimpHintBox *box = GIMP_HINT_BOX (object);
if (box->icon_name)
{
g_free (box->icon_name);
box->icon_name = NULL;
}
if (box->stock_id)
{
g_free (box->stock_id);
......@@ -170,6 +189,10 @@ gimp_hint_box_set_property (GObject *object,
switch (property_id)
{
case PROP_ICON_NAME:
box->icon_name = g_value_dup_string (value);
break;
case PROP_STOCK_ID:
box->stock_id = g_value_dup_string (value);
break;
......@@ -194,6 +217,10 @@ gimp_hint_box_get_property (GObject *object,
switch (property_id)
{
case PROP_ICON_NAME:
g_value_set_string (value, box->icon_name);
break;
case PROP_STOCK_ID:
g_value_set_string (value, box->stock_id);
break;
......
......@@ -145,7 +145,7 @@ gimp_int_store_constructed (GObject *object)
types[GIMP_INT_STORE_VALUE] = G_TYPE_INT;
types[GIMP_INT_STORE_LABEL] = G_TYPE_STRING;
types[GIMP_INT_STORE_STOCK_ID] = G_TYPE_STRING;
types[GIMP_INT_STORE_ICON_NAME] = G_TYPE_STRING;
types[GIMP_INT_STORE_PIXBUF] = GDK_TYPE_PIXBUF;
types[GIMP_INT_STORE_USER_DATA] = (priv->user_data_type != G_TYPE_NONE ?
priv->user_data_type : G_TYPE_POINTER);
......
......@@ -33,10 +33,11 @@ G_BEGIN_DECLS
* GimpIntStoreColumns:
* @GIMP_INT_STORE_VALUE: the integer value
* @GIMP_INT_STORE_LABEL: a human-readable label
* @GIMP_INT_STORE_STOCK_ID: a stock ID
* @GIMP_INT_STORE_ICON_NAME: an icon name
* @GIMP_INT_STORE_PIXBUF: a #GdkPixbuf
* @GIMP_INT_STORE_USER_DATA: arbitrary user data
* @GIMP_INT_STORE_NUM_COLUMNS: the number of columns
* @GIMP_INT_STORE_STOCK_ID: compat alias for @GIMP_INT_STORE_ICON_NAME
*
* The column types of #GimpIntStore.
**/
......@@ -44,10 +45,13 @@ typedef enum
{
GIMP_INT_STORE_VALUE,
GIMP_INT_STORE_LABEL,
GIMP_INT_STORE_STOCK_ID,
GIMP_INT_STORE_ICON_NAME,
GIMP_INT_STORE_PIXBUF,
GIMP_INT_STORE_USER_DATA,
GIMP_INT_STORE_NUM_COLUMNS
GIMP_INT_STORE_NUM_COLUMNS,
/* deprecated */
GIMP_INT_STORE_STOCK_ID = GIMP_INT_STORE_ICON_NAME
} GimpIntStoreColumns;
......
......@@ -122,8 +122,8 @@ gimp_pick_button_init (GimpPickButton *button)
{
GtkWidget *image;
image = gtk_image_new_from_stock (GIMP_STOCK_COLOR_PICK_FROM_SCREEN,
GTK_ICON_SIZE_BUTTON);
image = gtk_image_new_from_icon_name (GIMP_STOCK_COLOR_PICK_FROM_SCREEN,
GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_show (image);
......
......@@ -915,6 +915,8 @@ gimp_prop_boolean_radio_frame_new (GObject *config,
* Return value: A #libgimpwidgets-gimpenumstockbox containing the radio buttons.
*
* Since GIMP 2.4
*
* Deprecated: GIMP 2.10
*/
GtkWidget *
gimp_prop_enum_stock_box_new (GObject *config,
......@@ -922,6 +924,35 @@ gimp_prop_enum_stock_box_new (GObject *config,
const gchar *stock_prefix,
gint minimum,
gint maximum)
{
return gimp_prop_enum_icon_box_new (config, property_name,
stock_prefix, minimum, maximum);
}
/**
* gimp_prop_enum_icon_box_new:
* @config: Object to which property is attached.
* @property_name: Name of enum property controlled by the radio buttons.
* @icon_prefix: The prefix of the group of icon names to use.
* @minimum: Smallest value of enum to be included.
* @maximum: Largest value of enum to be included.
*
* Creates a horizontal box of radio buttons with named icons, which
* function to set and display the value of the specified Enum
* property. The icon name for each icon is created by appending the
* enum_value's nick to the given @icon_prefix. See
* gimp_enum_icon_box_new() for more information.
*
* Return value: A #libgimpwidgets-gimpenumiconbox containing the radio buttons.
*
* Since GIMP 2.10
*/
GtkWidget *
gimp_prop_enum_icon_box_new (GObject *config,
const gchar *property_name,
const gchar *icon_prefix,
gint minimum,
gint maximum)
{
GParamSpec *param_spec;
GtkWidget *box;
......@@ -942,22 +973,22 @@ gimp_prop_enum_stock_box_new (GObject *config,
if (minimum != maximum)
{
box = gimp_enum_stock_box_new_with_range (param_spec->value_type,
minimum, maximum,
stock_prefix,
GTK_ICON_SIZE_MENU,
G_CALLBACK (gimp_prop_radio_button_callback),
config,
&button);
box = gimp_enum_icon_box_new_with_range (param_spec->value_type,
minimum, maximum,
icon_prefix,
GTK_ICON_SIZE_MENU,
G_CALLBACK (gimp_prop_radio_button_callback),
config,
&button);
}
else
{
box = gimp_enum_stock_box_new (param_spec->value_type,
stock_prefix,
GTK_ICON_SIZE_MENU,
G_CALLBACK (gimp_prop_radio_button_callback),
config,
&button);
box = gimp_enum_icon_box_new (param_spec