view libpurple/plugins/perl/scripts/gtk_frame_test.pl @ 18916:0f46f13c0805

Proposed "attention" API, a generalization of zaps (MySpaceIM), buzzes (Yahoo), and nudges (MSN). Adds a PurpleAttentionType struct to prpl.h, which is used to describe the the attention command (some protocols, notably MySpaceIM, support more than one). Uses two reserved fields in PurplePluginProtocolInfo, one function for sending an attention command, another for getting the possible attention commands (similar to status_types). Adds serv_got_attention() to server.c, similar to serv_got_im(), used to notify of incoming or outgoing attention notices.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Mon, 13 Aug 2007 05:59:24 +0000
parents 9b954de67cf3
children
line wrap: on
line source

$MODULE_NAME = "GTK Frame Test";

use Purple;

%PLUGIN_INFO = ( 
	perl_api_version => 2, 
	name => " Perl: $MODULE_NAME", 
	version => "0.1", 
	summary => "Test plugin for the Perl interpreter.", 
	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.", 
	author => "John H. Kelm <johnhkelm\@gmail.com>", 
	url => "http://pidgin.im", 
	
	GTK_UI => TRUE,
	gtk_prefs_info => "foo",
	load => "plugin_load",
	unload => "plugin_unload",
); 


sub plugin_init { 
	return %PLUGIN_INFO; 
} 

sub button_cb {
	my $widget = shift;
	my $data = shift;
	print "Clicked button with message: " . $data . "\n";
}

sub foo {
	eval '
		use Glib;
		use Gtk2 \'-init\';
				
		$frame = Gtk2::Frame->new(\'Gtk Test Frame\');
		$button = Gtk2::Button->new(\'Print Message\');
		
		$frame->set_border_width(10);
		$button->set_border_width(150);
		$button->signal_connect("clicked" => \&button_cb, "Message Text");
		$frame->add($button);
		
		$button->show();
		$frame->show();
	';
	return $frame;
}

sub plugin_load { 
	my $plugin = shift; 
	print "#" x 80 . "\n";

	
	#########  TEST CODE HERE  ##########

	print "$MODULE_NAME: Loading...\n";
	
	
	Purple::debug_info("plugin_load()", "Testing $MODULE_NAME Completed.");
	print "#" x 80 . "\n\n";
} 

sub plugin_unload {

}