Mercurial > pidgin.yaz
comparison plugins/perl/scripts/plugin_pref.pl @ 11170:0e9e2b923d09
[gaim-migrate @ 13271]
Fixed some bugs and made some additions to the XSUBS. Added some of my test scripts which are incomplete, but mostly functional. GaimPluginPrefs and GaimGtkPluginPrefs--using evals to do the Gtk widgets with gtk2-perl--work. Plugin actions can now be added, but only one for now.
committer: Tailor Script <tailor@pidgin.im>
author | John H. Kelm <johnkelm@gmail.com> |
---|---|
date | Fri, 29 Jul 2005 13:38:00 +0000 |
parents | |
children | 6fd82071a7b8 |
comparison
equal
deleted
inserted
replaced
11169:778d5464a9b8 | 11170:0e9e2b923d09 |
---|---|
1 $MODULE_NAME = "Prefs Functions Test"; | |
2 use Gaim; | |
3 # All the information Gaim gets about our nifty plugin | |
4 %PLUGIN_INFO = ( | |
5 perl_api_version => 2, | |
6 name => " Perl: $MODULE_NAME", | |
7 version => "0.1", | |
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.", | |
10 author => "John H. Kelm <johnhkelm\@gmail.com>", | |
11 url => "http://sourceforge.net/users/johnhkelm/", | |
12 | |
13 load => "plugin_load", | |
14 unload => "plugin_unload", | |
15 prefs_info => "foo" | |
16 ); | |
17 | |
18 # These names must already exist | |
19 my $GROUP = "UIUC Buddies"; | |
20 my $USERNAME = "johnhkelm2"; | |
21 | |
22 # We will create these on load then destroy them on unload | |
23 my $TEST_GROUP = "perlTestGroup"; | |
24 my $TEST_NAME = "perlTestName"; | |
25 my $TEST_ALIAS = "perlTestAlias"; | |
26 my $PROTOCOL_ID = "prpl-oscar"; | |
27 | |
28 sub foo { | |
29 $frame = Gaim::Pref::frame_new(); | |
30 | |
31 $ppref = Gaim::Pref::new_with_label("boolean"); | |
32 Gaim::Pref::frame_add($frame, $ppref); | |
33 | |
34 $ppref = Gaim::Pref::new_with_name_and_label("/plugins/core/perl_test/bool", "Boolean Preference"); | |
35 Gaim::Pref::frame_add($frame, $ppref); | |
36 | |
37 | |
38 $ppref = Gaim::Pref::new_with_name_and_label("/plugins/core/perl_test/choice", "Choice Preference"); | |
39 Gaim::Pref::set_type($ppref, 1); | |
40 Gaim::Pref::add_choice($ppref, "foo", $frame); | |
41 Gaim::Pref::add_choice($ppref, "bar", $frame); | |
42 Gaim::Pref::frame_add($frame, $ppref); | |
43 | |
44 $ppref = Gaim::Pref::new_with_name_and_label("/plugins/core/perl_test/text", "Text Box Preference"); | |
45 Gaim::Pref::set_max_length($ppref, 16); | |
46 Gaim::Pref::frame_add($frame, $ppref); | |
47 | |
48 return $frame; | |
49 } | |
50 | |
51 sub plugin_init { | |
52 | |
53 return %PLUGIN_INFO; | |
54 } | |
55 | |
56 | |
57 # This is the sub defined in %PLUGIN_INFO to be called when the plugin is loaded | |
58 # Note: The plugin has a reference to itself on top of the argument stack. | |
59 sub plugin_load { | |
60 my $plugin = shift; | |
61 print "#" x 80 . "\n\n"; | |
62 | |
63 | |
64 ######### TEST CODE HERE ########## | |
65 | |
66 Gaim::Prefs::add_none("/plugins/core/perl_test"); | |
67 Gaim::Prefs::add_bool("/plugins/core/perl_test/bool", 1); | |
68 Gaim::Prefs::add_string("/plugins/core/perl_test/choice", "bar"); | |
69 Gaim::Prefs::add_string("/plugins/core/perl_test/text", "Foo"); | |
70 | |
71 | |
72 print "\n\n" . "#" x 80 . "\n\n"; | |
73 } | |
74 | |
75 sub plugin_unload { | |
76 my $plugin = shift; | |
77 | |
78 print "#" x 80 . "\n\n"; | |
79 | |
80 | |
81 ######### TEST CODE HERE ########## | |
82 | |
83 | |
84 print "\n\n" . "#" x 80 . "\n\n"; | |
85 } | |
86 |