[gdk-pixbuf] lib: Add gdk_pixbuf_get_options() helper
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] lib: Add gdk_pixbuf_get_options() helper
- Date: Tue, 21 Oct 2014 17:02:42 +0000 (UTC)
commit 273e88b77a67b4d2f715d391e4f4c54462dbc888
Author: Bastien Nocera <hadess hadess net>
Date: Thu Apr 26 10:37:20 2012 +0100
lib: Add gdk_pixbuf_get_options() helper
So people don't have to guess the possible values of "key" in
gdk_pixbuf_get_option() calls
https://bugzilla.gnome.org/show_bug.cgi?id=674858
docs/reference/gdk-pixbuf/gdk-pixbuf-sections.txt | 1 +
gdk-pixbuf/gdk-pixbuf-core.h | 1 +
gdk-pixbuf/gdk-pixbuf.c | 36 +++++++++++++++++++++
gdk-pixbuf/gdk-pixbuf.symbols | 1 +
4 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gdk-pixbuf/gdk-pixbuf-sections.txt
b/docs/reference/gdk-pixbuf/gdk-pixbuf-sections.txt
index 17da421..823a5c8 100644
--- a/docs/reference/gdk-pixbuf/gdk-pixbuf-sections.txt
+++ b/docs/reference/gdk-pixbuf/gdk-pixbuf-sections.txt
@@ -36,6 +36,7 @@ gdk_pixbuf_get_height
gdk_pixbuf_get_rowstride
gdk_pixbuf_get_byte_length
gdk_pixbuf_get_option
+gdk_pixbuf_get_options
gdk_pixbuf_read_pixels
<SUBSECTION Standard>
diff --git a/gdk-pixbuf/gdk-pixbuf-core.h b/gdk-pixbuf/gdk-pixbuf-core.h
index b152aa9..b131255 100644
--- a/gdk-pixbuf/gdk-pixbuf-core.h
+++ b/gdk-pixbuf/gdk-pixbuf-core.h
@@ -465,6 +465,7 @@ GdkPixbuf *gdk_pixbuf_apply_embedded_orientation (GdkPixbuf *src);
const gchar * gdk_pixbuf_get_option (GdkPixbuf *pixbuf,
const gchar *key);
+GHashTable * gdk_pixbuf_get_options (GdkPixbuf *pixbuf);
G_END_DECLS
diff --git a/gdk-pixbuf/gdk-pixbuf.c b/gdk-pixbuf/gdk-pixbuf.c
index 6ea8a1b..b17190b 100644
--- a/gdk-pixbuf/gdk-pixbuf.c
+++ b/gdk-pixbuf/gdk-pixbuf.c
@@ -926,6 +926,42 @@ gdk_pixbuf_get_option (GdkPixbuf *pixbuf,
}
/**
+ * gdk_pixbuf_get_options:
+ * @pixbuf: a #GdkPixbuf
+ *
+ * Returns a #GHashTable with a list of all the options that may have been
+ * attached to the @pixbuf when it was loaded, or that may have been
+ * attached by another function using gdk_pixbuf_set_option().
+ *
+ * See gdk_pixbuf_get_option() for more details.
+ *
+ * Return value: (transfer container): a #GHashTable of key/values
+ *
+ * Since: 2.32
+ **/
+GHashTable *
+gdk_pixbuf_get_options (GdkPixbuf *pixbuf)
+{
+ GHashTable *ht;
+ gchar **options;
+
+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
+
+ ht = g_hash_table_new (g_str_hash, g_str_equal);
+
+ options = g_object_get_qdata (G_OBJECT (pixbuf),
+ g_quark_from_static_string ("gdk_pixbuf_options"));
+ if (options) {
+ gint i;
+
+ for (i = 0; options[2*i]; i++)
+ g_hash_table_insert (ht, options[2*i], options[2*i+1]);
+ }
+
+ return ht;
+}
+
+/**
* gdk_pixbuf_set_option:
* @pixbuf: a #GdkPixbuf
* @key: a nul-terminated string.
diff --git a/gdk-pixbuf/gdk-pixbuf.symbols b/gdk-pixbuf/gdk-pixbuf.symbols
index 4117f02..1532535 100644
--- a/gdk-pixbuf/gdk-pixbuf.symbols
+++ b/gdk-pixbuf/gdk-pixbuf.symbols
@@ -31,6 +31,7 @@ gdk_pixbuf_get_byte_length
gdk_pixbuf_get_rowstride
gdk_pixbuf_get_width
gdk_pixbuf_get_option
+gdk_pixbuf_get_options
gdk_pixbuf_copy
gdk_pixbuf_new_subpixbuf
gdk_pixbuf_fill
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]