A few more I found, in particular, it removes the comment saying
gtk_widget_get_toplevel may return undef, when in fact it can't :
http://library.gnome.org/devel/gtk/stable/GtkWidget.html#gtk-widget-get-toplevel

the second patch wrap a forgotten widget function.

Quentin
>From 1b47b3bd628d76293a4dfc5788729b85dd9e6922 Mon Sep 17 00:00:00 2001
From: Quentin Sculo <squen...@free.fr>
Date: Mon, 26 Apr 2010 22:19:59 +0200
Subject: [PATCH 1/3] 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 bda6de2..f8f9d51 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;
@@ -451,6 +452,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 0747802..a83d600 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)
@@ -1227,7 +1225,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);
 
-- 
1.6.4.4

>From a08fddc5abdfa272105f58882d92b4fc705b6fa8 Mon Sep 17 00:00:00 2001
From: Quentin Sculo <squen...@free.fr>
Date: Thu, 13 May 2010 22:19:30 +0200
Subject: [PATCH 2/3] wrap gtk_widget_is_composited

---
 t/GtkWidget.t   |    2 ++
 xs/GtkWidget.xs |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/t/GtkWidget.t b/t/GtkWidget.t
index f8f9d51..ccd44d4 100644
--- a/t/GtkWidget.t
+++ b/t/GtkWidget.t
@@ -418,6 +418,8 @@ SKIP: {
 
 	$widget->input_shape_combine_mask ($bitmap, 23, 42);
 	$widget->input_shape_combine_mask (undef, 0, 0);
+
+	$widget->is_composited;
 }
 
 SKIP: {
diff --git a/xs/GtkWidget.xs b/xs/GtkWidget.xs
index a83d600..8e13de7 100644
--- a/xs/GtkWidget.xs
+++ b/xs/GtkWidget.xs
@@ -1203,6 +1203,8 @@ void gtk_widget_remove_mnemonic_label (GtkWidget *widget, GtkWidget *label);
 
 void gtk_widget_input_shape_combine_mask (GtkWidget *widget, GdkBitmap_ornull *shape_mask, gint offset_x, gint offset_y);
 
+gboolean gtk_widget_is_composited (GtkWidget *widget);
+
 #endif /* 2.10 */
 
 #if GTK_CHECK_VERSION(2, 12, 0)
-- 
1.6.4.4

>From 914aa236b04a238efd1f952f2600b144f2d1f349 Mon Sep 17 00:00:00 2001
From: Quentin Sculo <squen...@free.fr>
Date: Thu, 13 May 2010 22:24:03 +0200
Subject: [PATCH 3/3] GtkIconTheme: a few undef fixes

also add a small comment for gtk_icon_theme_set_custom_theme
---
 t/GtkIconTheme.t   |    1 +
 xs/GtkIconTheme.xs |   13 +++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/t/GtkIconTheme.t b/t/GtkIconTheme.t
index ba0120c..6c785ec 100644
--- a/t/GtkIconTheme.t
+++ b/t/GtkIconTheme.t
@@ -90,6 +90,7 @@ is_deeply ([$icon_theme->get_search_path], \...@paths);
 # cannot call set_custom_theme on a default theme
 $icon_theme = Gtk2::IconTheme->new;
 $icon_theme->set_custom_theme ('crazy custom theme');
+$icon_theme->set_custom_theme (undef);
 
 # Ignore result.  Might be anything, including undef.
 $icon_theme->get_example_icon_name;
diff --git a/xs/GtkIconTheme.xs b/xs/GtkIconTheme.xs
index 6bfa719..e94c712 100644
--- a/xs/GtkIconTheme.xs
+++ b/xs/GtkIconTheme.xs
@@ -72,7 +72,12 @@ void gtk_icon_theme_append_search_path (GtkIconTheme *icon_theme, GPerlFilename_
  ## void gtk_icon_theme_prepend_search_path (GtkIconTheme *icon_theme, const gchar *path);
 void gtk_icon_theme_prepend_search_path (GtkIconTheme *icon_theme, GPerlFilename_const path);
 
-void gtk_icon_theme_set_custom_theme (GtkIconTheme *icon_theme, const gchar *theme_name);
+=for apidoc
+
+Cannot be used on a C<Gtk2::IconTheme> returned by Gtk2::IconTheme->get_default or Gtk2::IconTheme->get_for_screen.
+
+=cut
+void gtk_icon_theme_set_custom_theme (GtkIconTheme *icon_theme, const gchar_ornull *theme_name);
 
 gboolean gtk_icon_theme_has_icon (GtkIconTheme *icon_theme, const gchar *icon_name);
 
@@ -106,7 +111,7 @@ gtk_icon_theme_list_icons (GtkIconTheme * icon_theme, const gchar_ornull * conte
 	g_list_free (list);
 
  ## char * gtk_icon_theme_get_example_icon_name (GtkIconTheme *icon_theme);
-gchar_own * gtk_icon_theme_get_example_icon_name (GtkIconTheme *icon_theme);
+gchar_own_ornull * gtk_icon_theme_get_example_icon_name (GtkIconTheme *icon_theme);
 
 gboolean gtk_icon_theme_rescan_if_needed (GtkIconTheme *icon_theme);
 
@@ -189,7 +194,7 @@ MODULE = Gtk2::IconTheme	PACKAGE = Gtk2::IconInfo	PREFIX = gtk_icon_info_
 
 gint gtk_icon_info_get_base_size (GtkIconInfo *icon_info);
 
-const gchar *gtk_icon_info_get_filename (GtkIconInfo *icon_info);
+const gchar_ornull *gtk_icon_info_get_filename (GtkIconInfo *icon_info);
 
 GdkPixbuf_ornull * gtk_icon_info_get_builtin_pixbuf (GtkIconInfo *icon_info);
 
@@ -242,7 +247,7 @@ gtk_icon_info_get_attach_points (GtkIconInfo *icon_info)
 		g_free (points);
 	}
 
-const gchar *gtk_icon_info_get_display_name (GtkIconInfo *icon_info);
+const gchar_ornull *gtk_icon_info_get_display_name (GtkIconInfo *icon_info);
 
 #if GTK_CHECK_VERSION (2, 14, 0)
 
-- 
1.6.4.4

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Reply via email to