[perl-Gtk2] Make Gtk2::FontButton->new and Gtk2::ColorButton->new more flexible
- From: Torsten Schönfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Gtk2] Make Gtk2::FontButton->new and Gtk2::ColorButton->new more flexible
- Date: Sun, 11 Apr 2010 13:59:52 +0000 (UTC)
commit 05d51f8529f007550560fe44ba94b37c4e6e8b79
Author: Quentin Sculo <squentin free fr>
Date: Mon Feb 8 03:57:25 2010 +0100
Make Gtk2::FontButton->new and Gtk2::ColorButton->new more flexible
When called with an argument, turn new() into new_with_color() or
new_with_font(), respectively.
t/GtkColorButton.t | 6 +++++-
t/GtkFontButton.t | 6 +++++-
xs/GtkColorButton.xs | 2 +-
xs/GtkFontButton.xs | 2 +-
4 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/t/GtkColorButton.t b/t/GtkColorButton.t
index 2dd7854..2bb45ac 100644
--- a/t/GtkColorButton.t
+++ b/t/GtkColorButton.t
@@ -3,7 +3,7 @@
# $Id$
use Gtk2::TestHelper
- tests => 8,
+ tests => 10,
at_least_version => [2, 4, 0, "GtkColorButton is new in 2.4"],
;
@@ -25,6 +25,10 @@ $cbn = Gtk2::ColorButton->new_with_color ($color);
isa_ok ($cbn, "Gtk2::ColorButton");
ok (color_eq ($color, $cbn->get_color));
+$cbn = Gtk2::ColorButton->new ($color);
+isa_ok ($cbn, "Gtk2::ColorButton");
+ok (color_eq ($color, $cbn->get_color));
+
$color = Gtk2::Gdk::Color->new (65535, 0, 0);
$cbn->set_color ($color);
diff --git a/t/GtkFontButton.t b/t/GtkFontButton.t
index 8797679..e8a7a03 100644
--- a/t/GtkFontButton.t
+++ b/t/GtkFontButton.t
@@ -3,7 +3,7 @@
# $Id$
use Gtk2::TestHelper
- tests => 12,
+ tests => 15,
at_least_version => [2, 4, 0, "GtkFontButton is new in 2.4"],
;
@@ -12,6 +12,10 @@ $fbn = Gtk2::FontButton->new;
isa_ok ($fbn, 'Gtk2::FontButton');
$fbn = Gtk2::FontButton->new_with_font ("monospace");
isa_ok ($fbn, 'Gtk2::FontButton');
+like ($fbn->get_font_name, qr/monospace/i);
+$fbn = Gtk2::FontButton->new ("monospace");
+isa_ok ($fbn, 'Gtk2::FontButton');
+like ($fbn->get_font_name, qr/monospace/i);
$fbn->set_title ("slartibartfast");
diff --git a/xs/GtkColorButton.xs b/xs/GtkColorButton.xs
index e4f796d..1729285 100644
--- a/xs/GtkColorButton.xs
+++ b/xs/GtkColorButton.xs
@@ -17,7 +17,7 @@ gtk_color_button_new (class, GdkColor*color=NULL)
ALIAS:
new_with_color = 1
CODE:
- if (ix == 1)
+ if (items == 2)
RETVAL = gtk_color_button_new_with_color (color);
else
RETVAL = gtk_color_button_new ();
diff --git a/xs/GtkFontButton.xs b/xs/GtkFontButton.xs
index e66b1f3..24e9785 100644
--- a/xs/GtkFontButton.xs
+++ b/xs/GtkFontButton.xs
@@ -17,7 +17,7 @@ gtk_font_button_new (class, const gchar * fontname=NULL)
ALIAS:
new_with_font = 1
CODE:
- RETVAL = ix == 1
+ RETVAL = items == 2
? gtk_font_button_new_with_font (fontname)
: gtk_font_button_new ();
OUTPUT:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]