Index: xs/GtkEntry.xs =================================================================== --- xs/GtkEntry.xs (revision 2104) +++ xs/GtkEntry.xs (working copy) @@ -227,6 +227,60 @@ #endif /* 2.14 */ + +#if GTK_CHECK_VERSION(2, 16, 0) + +# +# FIXME: Missing typemap, actually I don't think that gio is available through Perl +# +# GIcon_ornull* gtk_entry_get_gicon (GtkEntry *entry, GtkEntryIconPosition icon_pos); +# void gtk_entry_set_icon_from_gicon (GtkEntry *entry, GtkEntryIconPosition icon_pos, GIcon *icon); +# + +gboolean gtk_entry_get_icon_activatable (GtkEntry *entry, GtkEntryIconPosition icon_pos); + +gint gtk_entry_get_icon_at_pos (GtkEntry *entry, gint x, gint y); + +const gchar* gtk_entry_get_icon_name (GtkEntry *entry, GtkEntryIconPosition icon_pos); + +gboolean gtk_entry_get_icon_sensitive (GtkEntry *entry, GtkEntryIconPosition icon_pos); + +GdkPixbuf* gtk_entry_get_pixbuf (GtkEntry *entry, GtkEntryIconPosition icon_pos); + +gdouble gtk_entry_get_progress_fraction (GtkEntry *entry); + +gdouble gtk_entry_get_progress_pulse_step (GtkEntry *entry); + +void gtk_entry_progress_pulse (GtkEntry *entry); + +const gchar* gtk_entry_get_stock (GtkEntry *entry, GtkEntryIconPosition icon_pos); + +GtkImageType gtk_entry_get_storage_type (GtkEntry *entry, GtkEntryIconPosition icon_pos); + +void gtk_entry_set_icon_activatable (GtkEntry *entry, GtkEntryIconPosition icon_pos, gboolean activatable); + +void gtk_entry_set_icon_from_icon_name (GtkEntry *entry, GtkEntryIconPosition icon_pos, const gchar *icon_name); + +void gtk_entry_set_icon_from_pixbuf (GtkEntry *entry, GtkEntryIconPosition icon_pos, GdkPixbuf *pixbuf); + +void gtk_entry_set_icon_from_stock (GtkEntry *entry, GtkEntryIconPosition icon_pos, const gchar *stock_id); + +void gtk_entry_set_icon_sensitive (GtkEntry *entry, GtkEntryIconPosition icon_pos, gboolean sensitive); + +void gtk_entry_set_icon_tooltip_markup (GtkEntry *entry, GtkEntryIconPosition icon_pos, const gchar *tooltip); + +void gtk_entry_set_icon_tooltip_text (GtkEntry *entry, GtkEntryIconPosition icon_pos, const gchar *tooltip); + +void gtk_entry_set_progress_fraction (GtkEntry *entry, gdouble fraction); + +void gtk_entry_set_progress_pulse_step (GtkEntry *entry, gdouble fraction); + +void gtk_entry_unset_invisible_char (GtkEntry *entry); + + +#endif /* 2.16 */ + + ## ## hey, these are deprecated! is that new as of 2.3.x? ## Index: t/GtkEntry.t =================================================================== --- t/GtkEntry.t (revision 2104) +++ t/GtkEntry.t (working copy) @@ -1,6 +1,6 @@ #!/usr/bin/perl -w use strict; -use Gtk2::TestHelper tests => 23; +use Gtk2::TestHelper tests => 47; # $Id$ @@ -99,6 +99,99 @@ is ($entry -> get_overwrite_mode(), FALSE); } +SKIP: { + skip 'progress methods', 4 + unless Gtk2->CHECK_VERSION(2, 16, 0); + + my $entry = Gtk2::Entry -> new(); + is ($entry -> get_icon_at_pos(0, 0), -1); + + is ($entry -> get_progress_fraction(), 0.0); + is ($entry -> get_progress_pulse_step(), 0.1); + + $entry -> progress_pulse(); # We can't see the changes :( + + $entry -> set_progress_fraction(0.3); + is ($entry -> get_progress_fraction(), 0.3); + + $entry -> set_progress_pulse_step(0.2); +} + +SKIP: { + skip 'unset_invisible_char', 2 + unless Gtk2->CHECK_VERSION(2, 16, 0); + + # Try the new password methods + my $password = Gtk2::Entry -> new(); + $password -> set_visibility(FALSE); + + + # Change the default character + my $default = $password -> get_invisible_char(); + my $char = $default eq 'X' ? '?' : 'X'; + $password -> set_invisible_char($char); + is($password -> get_invisible_char(), $char); + + # Restore the default character + $password -> unset_invisible_char(); + is($password -> get_invisible_char(), $default); +} + +## +## FIXME: I'm not able to call the method that use a GtkEntryIconPosition. I +# always get the error: undefined symbol: SvGtkEntryIconPosition +## +SKIP: { + skip 'icon methods', 18 + unless Gtk2->CHECK_VERSION(2, 16, 0); + + test_icon_methods('primary'); + test_icon_methods('secondary'); +} + + +sub test_icon_methods { + my ($icon_pos) = @_; + + my $entry = Gtk2::Entry -> new(); + + is ($entry -> get_icon_activatable($icon_pos), FALSE); + is ($entry -> get_icon_name($icon_pos), undef); + is ($entry -> get_icon_sensitive($icon_pos), FALSE); + is ($entry -> get_pixbuf($icon_pos), FALSE); + is ($entry -> get_stock($icon_pos), FALSE); + + + # Activate the icon + $entry -> set_icon_activatable($icon_pos, TRUE); + is ($entry -> get_icon_activatable($icon_pos), TRUE); + + $entry -> set_icon_from_stock($icon_pos, 'gtk-yes'); + $entry -> set_icon_from_stock($icon_pos, undef); + + + # Is an 'icon name' the same as a 'stock icon'? + $entry -> set_icon_from_icon_name($icon_pos, 'gtk-yes'); + is ($entry -> get_icon_name($icon_pos), 'gtk-yes'); + $entry -> set_icon_from_stock($icon_pos, undef); + is ($entry -> get_icon_name($icon_pos), undef); + + + my $pixbuf = Gtk2::Gdk::Pixbuf->new('rgb', TRUE, 8, 16, 16); + $entry -> set_icon_from_pixbuf($icon_pos, $pixbuf); + is($entry -> get_icon_from_pixbuf($icon_pos), $pixbuf); + + + # Can't be tested, at least we call it just in case they crash + $entry -> set_icon_sensitive($icon_pos); + + $entry -> set_icon_tooltip_markup($icon_pos, "PanGo tooltip"); + $entry -> set_icon_tooltip_markup($icon_pos, undef); + + $entry -> set_icon_tooltip_text($icon_pos, "Text tooltip"); + $entry -> set_icon_tooltip_text($icon_pos, undef); +} + __END__ Copyright (C) 2003-2006 by the gtk2-perl team (see the file AUTHORS for the