[gdk-pixbuf] Support g_autoptr() for all gdk-pixbuf object types



commit 1c2a984c83d73b11b924894a6bfd50859bd2f6c4
Author: Kalev Lember <kalevlember gmail com>
Date:   Sat Jun 6 20:29:20 2015 +0200

    Support g_autoptr() for all gdk-pixbuf object types
    
    This allows using e.g. g_autoptr(GdkPixbuf) in other programs, but does
    not make gdk-pixbuf itself use g_autoptr, or require a new enough glib
    to support it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=750497

 gdk-pixbuf/Makefile.am               |    1 +
 gdk-pixbuf/gdk-pixbuf-autocleanups.h |   37 ++++++++++++++++++++++++++++++++++
 gdk-pixbuf/gdk-pixbuf.h              |    2 +
 3 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/gdk-pixbuf/Makefile.am b/gdk-pixbuf/Makefile.am
index 08031c9..39a94b7 100644
--- a/gdk-pixbuf/Makefile.am
+++ b/gdk-pixbuf/Makefile.am
@@ -580,6 +580,7 @@ libgdk_pixbuf_2_0_la_DEPENDENCIES = pixops/libpixops.la $(builtin_objs) $(gdk_pi
 
 gdk_pixbuf_headers =                   \
        gdk-pixbuf.h                    \
+       gdk-pixbuf-autocleanups.h       \
        gdk-pixbuf-core.h               \
        gdk-pixbuf-transform.h          \
        gdk-pixbuf-io.h                 \
diff --git a/gdk-pixbuf/gdk-pixbuf-autocleanups.h b/gdk-pixbuf/gdk-pixbuf-autocleanups.h
new file mode 100644
index 0000000..9b6f58b
--- /dev/null
+++ b/gdk-pixbuf/gdk-pixbuf-autocleanups.h
@@ -0,0 +1,37 @@
+/* GdkPixbuf library - Autocleanup definitions
+ *
+ * Copyright (C) 2015 Kalev Lember <kalevlember gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GDK_PIXBUF_AUTOCLEANUPS_H
+#define GDK_PIXBUF_AUTOCLEANUPS_H
+
+/* We need all the types, so don't try to include this directly */
+#if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined 
(GDK_PIXBUF_COMPILATION)
+#error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
+#endif
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkPixbuf, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkPixbufAnimation, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkPixbufAnimationIter, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkPixbufLoader, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkPixbufSimpleAnim, g_object_unref)
+
+#endif
+
+#endif /* GDK_PIXBUF_AUTOCLEANUPS_H */
diff --git a/gdk-pixbuf/gdk-pixbuf.h b/gdk-pixbuf/gdk-pixbuf.h
index 29cdf6f..cecd962 100644
--- a/gdk-pixbuf/gdk-pixbuf.h
+++ b/gdk-pixbuf/gdk-pixbuf.h
@@ -38,6 +38,8 @@
 #include <gdk-pixbuf/gdk-pixbuf-loader.h>
 #include <gdk-pixbuf/gdk-pixbuf-enum-types.h>
 
+#include <gdk-pixbuf/gdk-pixbuf-autocleanups.h>
+
 #undef GDK_PIXBUF_H_INSIDE
 
 #endif  /* GDK_PIXBUF_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]