Mercurial > pidgin
comparison plugins/perl/scripts/plugin_pref.pl @ 12364:6fd82071a7b8
[gaim-migrate @ 14668]
sf patch #1373688, from Will Thompson
"Make the Perl bindings more Perl-ish"
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Mon, 05 Dec 2005 23:54:34 +0000 |
| parents | 0e9e2b923d09 |
| children |
comparison
equal
deleted
inserted
replaced
| 12363:f758af0373cb | 12364:6fd82071a7b8 |
|---|---|
| 1 $MODULE_NAME = "Prefs Functions Test"; | 1 $MODULE_NAME = "Prefs Functions Test"; |
| 2 use Gaim; | 2 use Gaim; |
| 3 # All the information Gaim gets about our nifty plugin | 3 # All the information Gaim gets about our nifty plugin |
| 4 %PLUGIN_INFO = ( | 4 %PLUGIN_INFO = ( |
| 5 perl_api_version => 2, | 5 perl_api_version => 2, |
| 6 name => " Perl: $MODULE_NAME", | 6 name => "Perl: $MODULE_NAME", |
| 7 version => "0.1", | 7 version => "0.1", |
| 8 summary => "Test plugin for the Perl interpreter.", | 8 summary => "Test plugin for the Perl interpreter.", |
| 9 description => "Implements a set of test proccedures to ensure all functions that work in the C API still work in the Perl plugin interface. As XSUBs are added, this *should* be updated to test the changes. Furthermore, this will function as the tutorial perl plugin.", | 9 description => "Implements a set of test proccedures to ensure all " . |
| 10 "functions that work in the C API still work in the " . | |
| 11 "Perl plugin interface. As XSUBs are added, this " . | |
| 12 "*should* be updated to test the changes. " . | |
| 13 "Furthermore, this will function as the tutorial perl " . | |
| 14 "plugin.", | |
| 10 author => "John H. Kelm <johnhkelm\@gmail.com>", | 15 author => "John H. Kelm <johnhkelm\@gmail.com>", |
| 11 url => "http://sourceforge.net/users/johnhkelm/", | 16 url => "http://sourceforge.net/users/johnhkelm/", |
| 12 | 17 |
| 13 load => "plugin_load", | 18 load => "plugin_load", |
| 14 unload => "plugin_unload", | 19 unload => "plugin_unload", |
| 24 my $TEST_NAME = "perlTestName"; | 29 my $TEST_NAME = "perlTestName"; |
| 25 my $TEST_ALIAS = "perlTestAlias"; | 30 my $TEST_ALIAS = "perlTestAlias"; |
| 26 my $PROTOCOL_ID = "prpl-oscar"; | 31 my $PROTOCOL_ID = "prpl-oscar"; |
| 27 | 32 |
| 28 sub foo { | 33 sub foo { |
| 29 $frame = Gaim::Pref::frame_new(); | 34 $frame = Gaim::PluginPref::Frame->new(); |
| 30 | 35 |
| 31 $ppref = Gaim::Pref::new_with_label("boolean"); | 36 $ppref = Gaim::PluginPref->new_with_label("boolean"); |
| 32 Gaim::Pref::frame_add($frame, $ppref); | 37 $frame->add($ppref); |
| 33 | 38 |
| 34 $ppref = Gaim::Pref::new_with_name_and_label("/plugins/core/perl_test/bool", "Boolean Preference"); | 39 $ppref = Gaim::PluginPref->new_with_name_and_label( |
| 35 Gaim::Pref::frame_add($frame, $ppref); | 40 "/plugins/core/perl_test/bool", "Boolean Preference"); |
| 41 $frame->add($ppref); | |
| 36 | 42 |
| 37 | 43 |
| 38 $ppref = Gaim::Pref::new_with_name_and_label("/plugins/core/perl_test/choice", "Choice Preference"); | 44 $ppref = Gaim::PluginPref->new_with_name_and_label( |
| 39 Gaim::Pref::set_type($ppref, 1); | 45 "/plugins/core/perl_test/choice", "Choice Preference"); |
| 40 Gaim::Pref::add_choice($ppref, "foo", $frame); | 46 $ppref->set_type(1); |
| 41 Gaim::Pref::add_choice($ppref, "bar", $frame); | 47 $ppref->add_choice("ch0", $frame); |
| 42 Gaim::Pref::frame_add($frame, $ppref); | 48 $ppref->add_choice("ch1", $frame); |
| 49 $frame->add($ppref); | |
| 43 | 50 |
| 44 $ppref = Gaim::Pref::new_with_name_and_label("/plugins/core/perl_test/text", "Text Box Preference"); | 51 $ppref = Gaim::PluginPref->new_with_name_and_label( |
| 45 Gaim::Pref::set_max_length($ppref, 16); | 52 "/plugins/core/perl_test/text", "Text Box Preference"); |
| 46 Gaim::Pref::frame_add($frame, $ppref); | 53 $ppref->set_max_length(16); |
| 54 $frame->add($ppref); | |
| 47 | 55 |
| 48 return $frame; | 56 return $frame; |
| 49 } | 57 } |
| 50 | 58 |
| 51 sub plugin_init { | 59 sub plugin_init { |
| 63 | 71 |
| 64 ######### TEST CODE HERE ########## | 72 ######### TEST CODE HERE ########## |
| 65 | 73 |
| 66 Gaim::Prefs::add_none("/plugins/core/perl_test"); | 74 Gaim::Prefs::add_none("/plugins/core/perl_test"); |
| 67 Gaim::Prefs::add_bool("/plugins/core/perl_test/bool", 1); | 75 Gaim::Prefs::add_bool("/plugins/core/perl_test/bool", 1); |
| 68 Gaim::Prefs::add_string("/plugins/core/perl_test/choice", "bar"); | 76 Gaim::Prefs::add_string("/plugins/core/perl_test/choice", "ch1"); |
| 69 Gaim::Prefs::add_string("/plugins/core/perl_test/text", "Foo"); | 77 Gaim::Prefs::add_string("/plugins/core/perl_test/text", "Foobar"); |
| 70 | 78 |
| 71 | 79 |
| 72 print "\n\n" . "#" x 80 . "\n\n"; | 80 print "\n\n" . "#" x 80 . "\n\n"; |
| 73 } | 81 } |
| 74 | 82 |
