plugins/perl/scripts/plugin_pref.pl

Mon, 03 Oct 2005 03:17:46 +0000

author
Daniel Atallah <datallah@pidgin.im>
date
Mon, 03 Oct 2005 03:17:46 +0000
changeset 11596
b066d71a508b
parent 11170
d8941580d87f
child 12364
42b44fed7423
permissions
-rw-r--r--

[gaim-migrate @ 13866]
Rewrite of the "transparency" plugin. This should suck less and now offers the option of being opaque on focus. I need to evaluate the "Always on top" functionality of the Buddy List because it may conflict wiht the WinGaim Options plugin.

11170
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
1 $MODULE_NAME = "Prefs Functions Test";
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
2 use Gaim;
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
3 # All the information Gaim gets about our nifty plugin
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
4 %PLUGIN_INFO = (
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
5 perl_api_version => 2,
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
6 name => " Perl: $MODULE_NAME",
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
7 version => "0.1",
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
8 summary => "Test plugin for the Perl interpreter.",
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
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.",
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
10 author => "John H. Kelm <johnhkelm\@gmail.com>",
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
11 url => "http://sourceforge.net/users/johnhkelm/",
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
12
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
13 load => "plugin_load",
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
14 unload => "plugin_unload",
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
15 prefs_info => "foo"
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
16 );
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
17
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
18 # These names must already exist
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
19 my $GROUP = "UIUC Buddies";
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
20 my $USERNAME = "johnhkelm2";
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
21
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
22 # We will create these on load then destroy them on unload
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
23 my $TEST_GROUP = "perlTestGroup";
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
24 my $TEST_NAME = "perlTestName";
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
25 my $TEST_ALIAS = "perlTestAlias";
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
26 my $PROTOCOL_ID = "prpl-oscar";
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
27
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
28 sub foo {
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
29 $frame = Gaim::Pref::frame_new();
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
30
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
31 $ppref = Gaim::Pref::new_with_label("boolean");
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
32 Gaim::Pref::frame_add($frame, $ppref);
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
33
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
34 $ppref = Gaim::Pref::new_with_name_and_label("/plugins/core/perl_test/bool", "Boolean Preference");
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
35 Gaim::Pref::frame_add($frame, $ppref);
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
36
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
37
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
38 $ppref = Gaim::Pref::new_with_name_and_label("/plugins/core/perl_test/choice", "Choice Preference");
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
39 Gaim::Pref::set_type($ppref, 1);
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
40 Gaim::Pref::add_choice($ppref, "foo", $frame);
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
41 Gaim::Pref::add_choice($ppref, "bar", $frame);
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
42 Gaim::Pref::frame_add($frame, $ppref);
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
43
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
44 $ppref = Gaim::Pref::new_with_name_and_label("/plugins/core/perl_test/text", "Text Box Preference");
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
45 Gaim::Pref::set_max_length($ppref, 16);
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
46 Gaim::Pref::frame_add($frame, $ppref);
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
47
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
48 return $frame;
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
49 }
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
50
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
51 sub plugin_init {
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
52
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
53 return %PLUGIN_INFO;
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
54 }
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
55
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
56
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
57 # This is the sub defined in %PLUGIN_INFO to be called when the plugin is loaded
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
58 # Note: The plugin has a reference to itself on top of the argument stack.
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
59 sub plugin_load {
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
60 my $plugin = shift;
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
61 print "#" x 80 . "\n\n";
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
62
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
63
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
64 ######### TEST CODE HERE ##########
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
65
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
66 Gaim::Prefs::add_none("/plugins/core/perl_test");
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
67 Gaim::Prefs::add_bool("/plugins/core/perl_test/bool", 1);
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
68 Gaim::Prefs::add_string("/plugins/core/perl_test/choice", "bar");
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
69 Gaim::Prefs::add_string("/plugins/core/perl_test/text", "Foo");
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
70
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
71
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
72 print "\n\n" . "#" x 80 . "\n\n";
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
73 }
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
74
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
75 sub plugin_unload {
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
76 my $plugin = shift;
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
77
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
78 print "#" x 80 . "\n\n";
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
79
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
80
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
81 ######### TEST CODE HERE ##########
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
82
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
83
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
84 print "\n\n" . "#" x 80 . "\n\n";
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
85 }
d8941580d87f [gaim-migrate @ 13271]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
86

mercurial