[f21/master] Remove anaconda_make_pixbuf

David Shea dshea at redhat.com
Tue Aug 26 20:55:26 UTC 2014


This function is not needed as of gdk-pixbuf-2.31.0. Use
gdk_pixbuf_new_from_bytes instead.

There hasn't been a fedora release since the function was added, so
leaving the widgets version number alone.
---
 pyanaconda/ui/gui/__init__.py |  5 +++--
 widgets/src/widgets-common.c  | 47 -------------------------------------------
 widgets/src/widgets-common.h  |  2 --
 3 files changed, 3 insertions(+), 51 deletions(-)

diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
index 117879b..e235b74 100644
--- a/pyanaconda/ui/gui/__init__.py
+++ b/pyanaconda/ui/gui/__init__.py
@@ -23,7 +23,7 @@ import meh.ui.gui
 
 from contextlib import contextmanager
 
-from gi.repository import Gdk, Gtk, AnacondaWidgets, Keybinder, GdkPixbuf
+from gi.repository import Gdk, Gtk, AnacondaWidgets, Keybinder, GdkPixbuf, GLib
 
 from pyanaconda.i18n import _
 from pyanaconda.constants import IPMI_ABORTED
@@ -261,7 +261,8 @@ class MainWindow(Gtk.Window):
         self.connect("delete-event", self._on_delete_event)
 
         # Create a black, 50% opacity pixel that will be scaled to fit the lightbox overlay
-        self._transparent_base  = AnacondaWidgets.make_pixbuf([0, 0, 0, 127], True, 1, 1, 1)
+        self._transparent_base = GdkPixbuf.Pixbuf.new_from_bytes(GLib.Bytes.new([0, 0, 0, 127]),
+                GdkPixbuf.Colorspace.RGB, True, 8, 1, 1, 1)
 
         # Contain everything in an overlay so the window can be overlayed with the transparency
         # for the lightbox effect
diff --git a/widgets/src/widgets-common.c b/widgets/src/widgets-common.c
index 52ef240..d965d79 100644
--- a/widgets/src/widgets-common.c
+++ b/widgets/src/widgets-common.c
@@ -48,50 +48,3 @@ const gchar *anaconda_get_widgets_datadir(void) {
     else
         return env_value;
 }
-
-static void free_pixbuf(guchar *pixels, gpointer data) {
-    g_free(pixels);
-}
-
-/**
- * anaconda_make_pixbuf:
- * @data: (array): The data that would be passed to gdk_pixbuf_new_from_data() were
- * that actually possible
- * @has_alpha: Whether the data has an opacity channel
- * @width: Width of the image in pixels, must be > 0
- * @height: Height of the image in pixels, must be > 0
- * @rowstride: Distance in bytes between row starts
- *
- * Create a GdkPixbuf in a way that actually works in gobject-introspection bindings.
- *
- * See also: https://bugzilla.gnome.org/show_bug.cgi?id=732297
- *
- * colorspace and bits_per_sample are not provided as parameters because it would break
- * something if they were ever not GDK_COLORSPACE_RGB and 8, respectively.
- *
- * Returns: (transfer full): A new GdkPixbuf
- *
- * Since: 3.0
- */
-GdkPixbuf * anaconda_make_pixbuf(const guint8 *data, gboolean has_alpha,
-        int width, int height, int rowstride) {
-    guchar *data_copy;
-
-    /* Length of the data is max_y * rowstride + max_x * n_channels */
-    size_t data_len = (width * rowstride) + (height * (has_alpha ? 4 : 3));
-
-    /* Create a copy of the data because whoever wrote gdk-pixbuf doesn't understand
-     * reference ownership. */
-    data_copy = g_malloc(data_len);
-    memcpy(data_copy, data, data_len);
-    return gdk_pixbuf_new_from_data(data_copy,
-            GDK_COLORSPACE_RGB,
-            has_alpha,
-            8,
-            width,
-            height,
-            rowstride,
-            free_pixbuf,
-            NULL
-            );
-}
diff --git a/widgets/src/widgets-common.h b/widgets/src/widgets-common.h
index d3aa488..5dd7c1b 100644
--- a/widgets/src/widgets-common.h
+++ b/widgets/src/widgets-common.h
@@ -26,8 +26,6 @@
 G_BEGIN_DECLS
 
 const gchar *anaconda_get_widgets_datadir(void);
-GdkPixbuf * anaconda_make_pixbuf(const guint8 *data, gboolean has_alpha,
-        int width, int height, int rowstride);
 
 G_END_DECLS
 
-- 
2.0.0



More information about the anaconda-patches mailing list