[Xfce4-commits] <midori:master> Move katze_pixbuf_new_from_buffer into Midori.View < WebKit 1.3.13

Christian Dywan noreply at xfce.org
Thu Mar 7 19:48:01 CET 2013


Updating branch refs/heads/master
         to 7bdebfcc54ee83a74b70acd7dbffdf7d0d6bec39 (commit)
       from b3c2a50593d13a23f966fda962431fbca3639ffc (commit)

commit 7bdebfcc54ee83a74b70acd7dbffdf7d0d6bec39
Author: Christian Dywan <christian at twotoasts.de>
Date:   Thu Mar 7 19:45:14 2013 +0100

    Move katze_pixbuf_new_from_buffer into Midori.View < WebKit 1.3.13

 katze/katze-utils.c  |   53 --------------------------------------------------
 katze/katze-utils.h  |    6 -----
 midori/midori-view.c |   39 ++++++++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 59 deletions(-)

diff --git a/katze/katze-utils.c b/katze/katze-utils.c
index 00cc408..f1a1b7e 100644
--- a/katze/katze-utils.c
+++ b/katze/katze-utils.c
@@ -955,59 +955,6 @@ katze_image_menu_item_new_ellipsized (const gchar* label)
 }
 
 /**
- * katze_pixbuf_new_from_buffer:
- * @buffer: Buffer with image data
- * @length: Length of the buffer
- * @mime_type: a MIME type, or %NULL
- * @error: return location for a #GError, or %NULL
- *
- * Creates a new #GdkPixbuf out of the specified buffer.
- *
- * You can specify a MIME type if looking at the buffer
- * is not enough to determine the right type.
- *
- * Return value: A newly-allocated #GdkPixbuf
- **/
-GdkPixbuf*
-katze_pixbuf_new_from_buffer (const guchar* buffer,
-                              gsize         length,
-                              const gchar*  mime_type,
-                              GError**      error)
-{
-    /* Proposed for inclusion in GdkPixbuf
-       See http://bugzilla.gnome.org/show_bug.cgi?id=74291 */
-    GdkPixbufLoader* loader;
-    GdkPixbuf* pixbuf;
-
-    g_return_val_if_fail (buffer != NULL, NULL);
-    g_return_val_if_fail (length > 0, NULL);
-
-    if (mime_type)
-    {
-        loader = gdk_pixbuf_loader_new_with_mime_type (mime_type, error);
-        if (!loader)
-            return NULL;
-    }
-    else
-        loader = gdk_pixbuf_loader_new ();
-    if (!gdk_pixbuf_loader_write (loader, buffer, length, error))
-    {
-        g_object_unref (loader);
-        return NULL;
-    }
-    if (!gdk_pixbuf_loader_close (loader, error))
-    {
-        g_object_unref (loader);
-        return NULL;
-    }
-
-    pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
-    g_object_ref (pixbuf);
-    g_object_unref (loader);
-    return pixbuf;
-}
-
-/**
  * katze_tree_view_get_selected_iter:
  * @treeview: a #GtkTreeView
  * @model: a pointer to store the model, or %NULL
diff --git a/katze/katze-utils.h b/katze/katze-utils.h
index 14f1d2a..3bdc59c 100644
--- a/katze/katze-utils.h
+++ b/katze/katze-utils.h
@@ -96,12 +96,6 @@ katze_widget_popup                   (GtkWidget*      widget,
 GtkWidget*
 katze_image_menu_item_new_ellipsized (const gchar*   label);
 
-GdkPixbuf*
-katze_pixbuf_new_from_buffer         (const guchar* buffer,
-                                      gsize         length,
-                                      const gchar*  mime_type,
-                                      GError**      error);
-
 gboolean
 katze_tree_view_get_selected_iter    (GtkTreeView*   treeview,
                                       GtkTreeModel** model,
diff --git a/midori/midori-view.c b/midori/midori-view.c
index b37ed6c..ea35454 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -476,6 +476,45 @@ midori_view_unset_icon (MidoriView* view)
 }
 
 #if !WEBKIT_CHECK_VERSION (1, 3, 13)
+static GdkPixbuf*
+katze_pixbuf_new_from_buffer (const guchar* buffer,
+                              gsize         length,
+                              const gchar*  mime_type,
+                              GError**      error)
+{
+    /* Proposed for inclusion in GdkPixbuf
+       See http://bugzilla.gnome.org/show_bug.cgi?id=74291 */
+    GdkPixbufLoader* loader;
+    GdkPixbuf* pixbuf;
+
+    g_return_val_if_fail (buffer != NULL, NULL);
+    g_return_val_if_fail (length > 0, NULL);
+
+    if (mime_type)
+    {
+        loader = gdk_pixbuf_loader_new_with_mime_type (mime_type, error);
+        if (!loader)
+            return NULL;
+    }
+    else
+        loader = gdk_pixbuf_loader_new ();
+    if (!gdk_pixbuf_loader_write (loader, buffer, length, error))
+    {
+        g_object_unref (loader);
+        return NULL;
+    }
+    if (!gdk_pixbuf_loader_close (loader, error))
+    {
+        g_object_unref (loader);
+        return NULL;
+    }
+
+    pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+    g_object_ref (pixbuf);
+    g_object_unref (loader);
+    return pixbuf;
+}
+
 static void
 katze_net_object_maybe_unref (gpointer object)
 {


More information about the Xfce4-commits mailing list