[perl-Gtk2] GtkWidget: a few undef fixes



commit 19c1c453b9114bdb23419f58a42d993b62ea930e
Author: Quentin Sculo <squentin free fr>
Date:   Mon Apr 26 22:19:59 2010 +0200

    GtkWidget: a few undef fixes
    
    allow undef or no arguments for gtk_widget_create_pango_layout
    allow undef for gtk_widget_modify_cursor
    gtk_widget_get_composite_name can return undef
    gtk_widget_get_toplevel can NOT return undef

 t/GtkWidget.t   |    4 +++-
 xs/GtkWidget.xs |   12 +++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/t/GtkWidget.t b/t/GtkWidget.t
index e71ab5e..ccd44d4 100644
--- a/t/GtkWidget.t
+++ b/t/GtkWidget.t
@@ -6,7 +6,7 @@
 
 use warnings;
 use strict;
-use Gtk2::TestHelper tests => 134;
+use Gtk2::TestHelper tests => 135;
 
 # we can't instantiate Gtk2::Widget, it's abstract.  use a button instead.
 
@@ -322,6 +322,7 @@ $widget->modify_font (undef);
 isa_ok ($widget->create_pango_context, "Gtk2::Pango::Context");
 isa_ok ($widget->get_pango_context, "Gtk2::Pango::Context");
 isa_ok ($widget->create_pango_layout ("Bla"), "Gtk2::Pango::Layout");
+isa_ok ($widget->create_pango_layout(), "Gtk2::Pango::Layout");
 isa_ok ($widget->render_icon ("gtk-open", "menu", "detail"), "Gtk2::Gdk::Pixbuf");
 
 Gtk2::Widget->push_composite_child;
@@ -453,6 +454,7 @@ SKIP: {
 
 	$widget->modify_cursor (Gtk2::Gdk::Color->new (0x0000, 0x0000, 0x0000),
 			        Gtk2::Gdk::Color->new (0xffff, 0xffff, 0xffff));
+	$widget->modify_cursor (undef,undef);
 }
 
 SKIP: {
diff --git a/xs/GtkWidget.xs b/xs/GtkWidget.xs
index cc99c1f..8e13de7 100644
--- a/xs/GtkWidget.xs
+++ b/xs/GtkWidget.xs
@@ -812,9 +812,7 @@ GdkExtensionMode
 gtk_widget_get_extension_events (widget)
 	GtkWidget	*widget
 
-## allow NULL for those crazy folks who call get_toplevel before a
-## widget has been added to a container
-GtkWidget_ornull *
+GtkWidget *
 gtk_widget_get_toplevel	(widget)
 	GtkWidget * widget
 
@@ -926,9 +924,9 @@ PangoContext *
 gtk_widget_get_pango_context (GtkWidget *widget)
 
 PangoLayout_noinc *
-gtk_widget_create_pango_layout (widget, text)
+gtk_widget_create_pango_layout (widget, text=NULL)
 	GtkWidget   * widget
-        const gchar *text
+        const gchar_ornull *text
 
  ### may return NULL if stockid isn't known.... but then, it will
  ### croak on converting unknown stock ids, too.
@@ -945,7 +943,7 @@ gtk_widget_render_icon (widget, stock_id, size, detail=NULL)
 
 void gtk_widget_set_composite_name (GtkWidget *widget, const gchar *name)
 
-gchar* gtk_widget_get_composite_name (GtkWidget *widget)
+gchar_ornull* gtk_widget_get_composite_name (GtkWidget *widget)
  
 #/* Descend recursively and set rc-style on all widgets without user styles */
 void gtk_widget_reset_rc_styles (GtkWidget *widget)
@@ -1229,7 +1227,7 @@ void gtk_widget_set_tooltip_markup (GtkWidget *widget, const gchar_ornull *marku
 
 gchar_own * gtk_widget_get_tooltip_markup (GtkWidget *widget);
 
-void gtk_widget_modify_cursor (GtkWidget *widget, const GdkColor *primary, const GdkColor *secondary);
+void gtk_widget_modify_cursor (GtkWidget *widget, const GdkColor_ornull *primary, const GdkColor_ornull *secondary);
 
 void gtk_widget_set_has_tooltip (GtkWidget *widget, gboolean has_tooltip);
 



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