perl-Gtk2 r2158 - in trunk: . t xs



Author: tsch
Date: Tue Mar 17 18:42:54 2009
New Revision: 2158
URL: http://svn.gnome.org/viewvc/perl-Gtk2?rev=2158&view=rev

Log:
Adapt to the rename of gtk_style_get_property to gtk_style_get_style_property.
Make Gtk2::Style::get_style_property an alias for Gtk2::Style::get.


Modified:
   trunk/ChangeLog
   trunk/t/GtkStyle.t
   trunk/xs/GtkStyle.xs

Modified: trunk/t/GtkStyle.t
==============================================================================
--- trunk/t/GtkStyle.t	(original)
+++ trunk/t/GtkStyle.t	Tue Mar 17 18:42:54 2009
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 # vim: set ft=perl expandtab shiftwidth=2 softtabstop=2 :
 use strict;
-use Gtk2::TestHelper tests => 124;
+use Gtk2::TestHelper tests => 125;
 use Carp;
 
 # $Id$
@@ -135,7 +135,7 @@
 }
 
 SKIP: {
-  skip("get is new in 2.16", 12)
+  skip("get is new in 2.16", 13)
     unless (Gtk2->CHECK_VERSION(2, 16, 0));
 
   # Test different properties (gint, gboolean, gchar* and GObject)
@@ -185,6 +185,15 @@
 
 
 
+  # Test the get_style_property alias
+  is (
+    $style -> get_style_property('Gtk2::TreeView', 'even-row-color'),
+    $style -> get('Gtk2::TreeView', 'even-row-color'),
+    "get_style_property alias"
+  );
+
+
+
   # Make sure that Glib::GObject::get() and Gtk2::Style::get() can coexist.
   my $custom_style = Custom::Style -> new();
   is ($custom_style -> Glib::Object::get('perl-string'), 'empty');

Modified: trunk/xs/GtkStyle.xs
==============================================================================
--- trunk/xs/GtkStyle.xs	(original)
+++ trunk/xs/GtkStyle.xs	Tue Mar 17 18:42:54 2009
@@ -577,17 +577,19 @@
 
 =for apidoc
 =for signature list = $style->get (widget_package, ...)
+=for signature list = $style->get_style_property (widget_package, ...)
 =for arg widget_package (string) widget package name (ex: 'Gtk2::TreeView')
 =for arg ... (list) list of property names
 
 Fetch and return the values for the style properties named in I<...> for a
-widget of type I<widget_package>.
+widget of type I<widget_package>.  I<get_style_property> is an alias for
+I<get>.
 
-B<Note>: This method shadows I<Glib::Object::get>. This shouldn't be a problem
-since I<Gtk2::Style> defines no properties (as of gtk+ 2.16).  If you have a
-class that's derived from Gtk2::Style and adds a property or if a new version
-of gtk+ adds a property to I<Gtk2::Style>, the property can be accessed with
-I<get_property> which still resolves to I<Glib::Object::get_property>:
+B<Note>: The I<get> method shadows I<Glib::Object::get>. This shouldn't be a
+problem since I<Gtk2::Style> defines no properties (as of gtk+ 2.16).  If you
+have a class that's derived from Gtk2::Style and adds a property or if a new
+version of gtk+ adds a property to I<Gtk2::Style>, the property can be accessed
+with I<get_property> which still resolves to I<Glib::Object::get_property>:
 
 	my $value = $style->get_property('property');
 
@@ -596,14 +598,18 @@
 gtk_style_get (style, widget_package, ...)
 	GtkStyle *style
 	const char *widget_package
+    ALIAS:
+	get_style_property = 1
     PREINIT:
 	int i;
 	GType widget_type;
 	gpointer class;
     CODE:
 	/* Use CODE: instead of PPCODE: so we can handle the stack ourselves in
-	 * order to avoid that xsubs called by gtk_style_get_property overwrite
-	 * what we put on the stack. */
+	 * order to avoid that xsubs called by gtk_style_get_style_property
+	 * overwrite what we put on the stack. */
+
+	PERL_UNUSED_VAR (ix);
 
 	widget_type = gperl_type_from_package (widget_package);
 	if (widget_type == 0)
@@ -625,7 +631,7 @@
 
 		if (pspec) {
 			g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
-			gtk_style_get_property (style, widget_type, name, &value);
+			gtk_style_get_style_property (style, widget_type, name, &value);
 			ST (i - 2) = sv_2mortal (gperl_sv_from_value (&value));
 			g_value_unset (&value);
 		}



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