[gimp] libgimpwidgets: add gimp_prop_icon_image_new()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpwidgets: add gimp_prop_icon_image_new()
- Date: Fri, 9 May 2014 00:06:44 +0000 (UTC)
commit ed7cdba5b697922f1082a1f0fe4206789b59478a
Author: Michael Natterer <mitch gimp org>
Date: Fri May 9 00:55:02 2014 +0200
libgimpwidgets: add gimp_prop_icon_image_new()
and deprecate gimp_prop_stock_image_new().
libgimpwidgets/gimppropwidgets.c | 66 ++++++++++++++++++++++++++------------
libgimpwidgets/gimppropwidgets.h | 6 +++-
libgimpwidgets/gimpwidgets.def | 1 +
3 files changed, 51 insertions(+), 22 deletions(-)
---
diff --git a/libgimpwidgets/gimppropwidgets.c b/libgimpwidgets/gimppropwidgets.c
index 7b93bdf..b58e6a2 100644
--- a/libgimpwidgets/gimppropwidgets.c
+++ b/libgimpwidgets/gimppropwidgets.c
@@ -3687,13 +3687,13 @@ gimp_prop_unit_menu_notify (GObject *config,
}
-/*****************/
-/* stock image */
-/*****************/
+/***************/
+/* icon name */
+/***************/
-static void gimp_prop_stock_image_notify (GObject *config,
- GParamSpec *param_spec,
- GtkWidget *image);
+static void gimp_prop_icon_image_notify (GObject *config,
+ GParamSpec *param_spec,
+ GtkWidget *image);
/**
* gimp_prop_stock_image_new:
@@ -3708,15 +3708,39 @@ static void gimp_prop_stock_image_notify (GObject *config,
* Return value: A new #GtkImage widget.
*
* Since GIMP 2.4
+ *
+ * Deprecated: GIMP 2.10
*/
GtkWidget *
gimp_prop_stock_image_new (GObject *config,
const gchar *property_name,
GtkIconSize icon_size)
{
+ return gimp_prop_icon_image_new (config, property_name, icon_size);
+}
+
+/**
+ * gimp_prop_icom_image_new:
+ * @config: Object to which property is attached.
+ * @property_name: Name of string property.
+ * @icon_size: Size of desired icon image.
+ *
+ * Creates a widget to display a icon image representing the value of the
+ * specified string property, which should encode an icon name.
+ * See gtk_image_new_from_icon_name() for more information.
+ *
+ * Return value: A new #GtkImage widget.
+ *
+ * Since GIMP 2.10
+ */
+GtkWidget *
+gimp_prop_icon_image_new (GObject *config,
+ const gchar *property_name,
+ GtkIconSize icon_size)
+{
GParamSpec *param_spec;
GtkWidget *image;
- gchar *stock_id;
+ gchar *icon_name;
param_spec = check_param_spec (config, property_name,
G_TYPE_PARAM_STRING, G_STRFUNC);
@@ -3724,40 +3748,40 @@ gimp_prop_stock_image_new (GObject *config,
return NULL;
g_object_get (config,
- property_name, &stock_id,
+ property_name, &icon_name,
NULL);
- image = gtk_image_new_from_stock (stock_id, icon_size);
+ image = gtk_image_new_from_icon_name (icon_name, icon_size);
- if (stock_id)
- g_free (stock_id);
+ if (icon_name)
+ g_free (icon_name);
set_param_spec (G_OBJECT (image), image, param_spec);
connect_notify (config, property_name,
- G_CALLBACK (gimp_prop_stock_image_notify),
+ G_CALLBACK (gimp_prop_icon_image_notify),
image);
return image;
}
static void
-gimp_prop_stock_image_notify (GObject *config,
- GParamSpec *param_spec,
- GtkWidget *image)
+gimp_prop_icon_image_notify (GObject *config,
+ GParamSpec *param_spec,
+ GtkWidget *image)
{
- gchar *stock_id;
+ gchar *icon_name;
GtkIconSize icon_size;
g_object_get (config,
- param_spec->name, &stock_id,
+ param_spec->name, &icon_name,
NULL);
- gtk_image_get_stock (GTK_IMAGE (image), NULL, &icon_size);
- gtk_image_set_from_stock (GTK_IMAGE (image), stock_id, icon_size);
+ gtk_image_get_icon_name (GTK_IMAGE (image), NULL, &icon_size);
+ gtk_image_set_from_icon_name (GTK_IMAGE (image), icon_name, icon_size);
- if (stock_id)
- g_free (stock_id);
+ if (icon_name)
+ g_free (icon_name);
}
diff --git a/libgimpwidgets/gimppropwidgets.h b/libgimpwidgets/gimppropwidgets.h
index 66a6ee2..469e667 100644
--- a/libgimpwidgets/gimppropwidgets.h
+++ b/libgimpwidgets/gimppropwidgets.h
@@ -222,11 +222,15 @@ GtkWidget * gimp_prop_unit_menu_new (GObject *config,
const gchar *unit_format);
-/* GParamString (stock_id) */
+/* GParamString (icon name) */
+GIMP_DEPRECATED_FOR(gimp_prop_stock_image_new)
GtkWidget * gimp_prop_stock_image_new (GObject *config,
const gchar *property_name,
GtkIconSize icon_size);
+GtkWidget * gimp_prop_icon_image_new (GObject *config,
+ const gchar *property_name,
+ GtkIconSize icon_size);
G_END_DECLS
diff --git a/libgimpwidgets/gimpwidgets.def b/libgimpwidgets/gimpwidgets.def
index b8f005e..1d91bad 100644
--- a/libgimpwidgets/gimpwidgets.def
+++ b/libgimpwidgets/gimpwidgets.def
@@ -298,6 +298,7 @@ EXPORTS
gimp_prop_file_chooser_button_new
gimp_prop_file_chooser_button_new_with_dialog
gimp_prop_hscale_new
+ gimp_prop_icon_image_new
gimp_prop_int_combo_box_new
gimp_prop_label_new
gimp_prop_memsize_entry_new
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]