Deprecate from-pixbuf apis for widgets
authorMatthias Clasen <mclasen@redhat.com>
Tue, 16 May 2023 01:40:54 +0000 (21:40 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 16 May 2023 03:05:52 +0000 (23:05 -0400)
We want to drop GdkPixbuf from our apis.
These have easy replacements already, so
lets deprecate them.

gtk/gtkimage.c
gtk/gtkimage.h
gtk/gtkpicture.c
gtk/gtkpicture.h
gtk/inspector/gtkdataviewer.c

index 44690975a27ddd865f1b78825cb93086f5d5e5eb..33c2841ef48456b90be7eaef6b54fb75442ebea1 100644 (file)
@@ -475,6 +475,9 @@ gtk_image_new_from_resource (const char *resource_path)
  * want that, you should use [ctor@Gtk.Image.new_from_icon_name].
  *
  * Returns: a new `GtkImage`
+ *
+ * Deprecated: 4.12: Use [ctor@Gtk.Image.new_from_paintable] and
+ *   [ctor@Gdk.Texture.new_for_pixbuf] instead
  */
 GtkWidget*
 gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf)
@@ -483,7 +486,9 @@ gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf)
 
   image = g_object_new (GTK_TYPE_IMAGE, NULL);
 
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   gtk_image_set_from_pixbuf (image, pixbuf);
+G_GNUC_END_IGNORE_DEPRECATIONS
 
   return GTK_WIDGET (image);
 }
@@ -711,6 +716,8 @@ gtk_image_set_from_resource (GtkImage   *image,
  * Note: This is a helper for [method@Gtk.Image.set_from_paintable],
  * and you can't get back the exact pixbuf once this is called,
  * only a paintable.
+ *
+ * Deprecated: 4.12: Use [method@Gtk.Image.set_from_paintable] instead
  */
 void
 gtk_image_set_from_pixbuf (GtkImage  *image,
index 59083e1b9b93f4ac1b644dd008d6bd354b5feb44..8c293c92c37d9dde6f849c3ea0bf6cab8c8fc2a2 100644 (file)
@@ -74,7 +74,7 @@ GDK_AVAILABLE_IN_ALL
 GtkWidget* gtk_image_new_from_file      (const char      *filename);
 GDK_AVAILABLE_IN_ALL
 GtkWidget* gtk_image_new_from_resource  (const char      *resource_path);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_12_FOR(gtk_image_new_from_paintable)
 GtkWidget* gtk_image_new_from_pixbuf    (GdkPixbuf       *pixbuf);
 GDK_AVAILABLE_IN_ALL
 GtkWidget* gtk_image_new_from_paintable (GdkPaintable    *paintable);
@@ -91,7 +91,7 @@ void gtk_image_set_from_file      (GtkImage        *image,
 GDK_AVAILABLE_IN_ALL
 void gtk_image_set_from_resource  (GtkImage        *image,
                                    const char      *resource_path);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_12_FOR(gtk_image_set_from_paintable)
 void gtk_image_set_from_pixbuf    (GtkImage        *image,
                                    GdkPixbuf       *pixbuf);
 GDK_AVAILABLE_IN_ALL
index 72ee47b195b32632d233c5c48626af9b1ad37c23..dadd2b4b6e8149b3d0292aa864ba42de57d1246c 100644 (file)
@@ -525,6 +525,9 @@ gtk_picture_new_for_paintable (GdkPaintable *paintable)
  * The pixbuf must not be modified after passing it to this function.
  *
  * Returns: a new `GtkPicture`
+ *
+ * Deprecated: 4.12: Use [ctor@Gtk.Picture.new_for_paintable] and
+ *   [ctor@Gdk.Texture.new_for_pixbuf] instead
  */
 GtkWidget*
 gtk_picture_new_for_pixbuf (GdkPixbuf *pixbuf)
@@ -779,6 +782,8 @@ gtk_picture_set_resource (GtkPicture *self,
  * See [ctor@Gtk.Picture.new_for_pixbuf] for details.
  *
  * This is a utility function that calls [method@Gtk.Picture.set_paintable].
+ *
+ * Deprecated: 4.12: Use [method@Gtk.Picture.set_paintable] instead
  */
 void
 gtk_picture_set_pixbuf (GtkPicture *self,
index 919369e43d4e76562aa0dd6c2712e47aeba1c473..58f2a1c836259e8c9e54ee9e750e7eb8e7c92edf 100644 (file)
@@ -39,7 +39,7 @@ GDK_AVAILABLE_IN_ALL
 GtkWidget*      gtk_picture_new                         (void);
 GDK_AVAILABLE_IN_ALL
 GtkWidget*      gtk_picture_new_for_paintable           (GdkPaintable           *paintable);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_12_FOR(gtk_pixbuf_new_for_paintable)
 GtkWidget*      gtk_picture_new_for_pixbuf              (GdkPixbuf              *pixbuf);
 GDK_AVAILABLE_IN_ALL
 GtkWidget*      gtk_picture_new_for_file                (GFile                  *file);
@@ -64,7 +64,7 @@ void            gtk_picture_set_filename                (GtkPicture
 GDK_AVAILABLE_IN_ALL
 void            gtk_picture_set_resource                (GtkPicture             *self,
                                                          const char             *resource_path);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_4_12_FOR(gtk_picture_set_paintable)
 void            gtk_picture_set_pixbuf                  (GtkPicture             *self,
                                                          GdkPixbuf              *pixbuf);
 
index bea24dd6d991034e584366e918ef52173277a11c..12808c3ac149ee5096f901e61b7a221f5bdedfd8 100644 (file)
@@ -261,7 +261,9 @@ gtk_data_viewer_load_value (GtkDataViewer *self,
     }
   else if (g_type_is_a (G_VALUE_TYPE (value), GDK_TYPE_PIXBUF))
     {
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
       self->contents = gtk_picture_new_for_pixbuf (g_value_get_object (value));
+G_GNUC_END_IGNORE_DEPRECATIONS
       gtk_widget_set_size_request (self->contents, 256, 256);
       gtk_widget_set_parent (self->contents, GTK_WIDGET (self));
     }