[perl-Gtk2] Gtk2::Gdk::PixbufFormat: add is_writable field



commit a1cd1aa185f5b409c5528af24f687b29247795a3
Author: Kevin Ryde <user42 zip com au>
Date:   Thu Nov 25 09:14:32 2010 +1100

    Gtk2::Gdk::PixbufFormat: add is_writable field
    
    Add "is_writable" field of gdk_pixbuf_format_is_writable(). Done as newSVuv()
    style 0 or 1 the same as is_disabled and is_scalable.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=622324

 t/GdkPixbuf.t   |    7 +++++--
 xs/GdkPixbuf.xs |   23 ++++++++++++++++++++++-
 2 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/t/GdkPixbuf.t b/t/GdkPixbuf.t
index fb5b790..f35efb5 100644
--- a/t/GdkPixbuf.t
+++ b/t/GdkPixbuf.t
@@ -1,6 +1,6 @@
 use strict;
 use warnings;
-use Gtk2::TestHelper tests => 106, noinit => 1;
+use Gtk2::TestHelper tests => 108, noinit => 1;
 
 my $show = 0;
 
@@ -319,7 +319,7 @@ isa_ok ($pixbuf, 'Gtk2::Gdk::Pixbuf', 'composite_color_simple');
 
 
 SKIP: {
-  skip "GdkPixbufFormat stuff is new in 2.2.0", 12
+  skip "GdkPixbufFormat stuff is new in 2.2.0", 14
     unless Gtk2->CHECK_VERSION (2,2,0);
 
   my @formats = Gtk2::Gdk::Pixbuf->get_formats;
@@ -331,6 +331,9 @@ SKIP: {
   is (ref $formats[0]{mime_types}, 'ARRAY', "'mime_types' is a list");
   ok (exists $formats[0]{extensions}, "contains key 'extensions'");
   is (ref $formats[0]{extensions}, 'ARRAY', "'extensions' is a list");
+  ok (exists $formats[0]{is_writable}, "contains key 'is_writable'");
+  ok ($formats[0]{is_writable} == 0 || $formats[0]{is_writable} == 1,
+      "'is_writable' is 0 or 1");
 
   SKIP: {
     skip "new format stuff", 4
diff --git a/xs/GdkPixbuf.xs b/xs/GdkPixbuf.xs
index 43116d4..f03e8fa 100644
--- a/xs/GdkPixbuf.xs
+++ b/xs/GdkPixbuf.xs
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2008 by the gtk2-perl team (see the file AUTHORS)
+ * Copyright (c) 2003-2008, 2010 by the gtk2-perl team (see the file AUTHORS)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -64,6 +64,9 @@ newSVGdkPixbufFormat (GdkPixbufFormat * format)
 	gperl_hv_take_sv_s (hv, "extensions", newRV_noinc ((SV*) av));
 	g_strfreev (strv);
 
+	gperl_hv_take_sv_s (hv, "is_writable",
+			    newSVuv (gdk_pixbuf_format_is_writable (format)));
+
 #if GTK_CHECK_VERSION (2,6,0)
 {
 	gboolean b;
@@ -1019,6 +1022,24 @@ void gdk_pixbuf_get_file_info (class, filename)
 
 MODULE = Gtk2::Gdk::Pixbuf	PACKAGE = Gtk2::Gdk::PixbufFormat	PREFIX = gdk_pixbuf_format_
 
+=for position DESCRIPTION
+
+=head1 DESCRIPTION
+
+A C<Gtk2::Gdk::PixbufFormat> has the following format information fields,
+eg. C<< $format->{'name'} >>,
+
+    name            string
+    description     string
+    mime_types      arrayref of strings
+    extensions      arrayref of strings, eg. ['jpg','jpeg']
+    is_writable     0 or 1
+    is_scalable     0 or 1    # in Gtk 2.6 up
+    is_disabled     0 or 1    # in Gtk 2.6 up
+    license         string    # in Gtk 2.6 up
+
+=cut
+
 #if GTK_CHECK_VERSION(2, 2, 0)
 
 void



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