Perl 在Pidgin插件中将Purple::Conversation转换为GTK2::TextView?
在加载插件时调用的子例程中,我有以下内容:Perl 在Pidgin插件中将Purple::Conversation转换为GTK2::TextView?,perl,gtk2,pidgin,Perl,Gtk2,Pidgin,在加载插件时调用的子例程中,我有以下内容: my $plugin = shift; my $purple_handle = Purple::Conversations::get_handle(); Purple::Signal::connect($purple_handle, "conversation-updated", $plugin, \&conversation_updated_cb, ""); my $conv = shift; my $entry = $conv.entr
my $plugin = shift;
my $purple_handle = Purple::Conversations::get_handle();
Purple::Signal::connect($purple_handle, "conversation-updated", $plugin, \&conversation_updated_cb, "");
my $conv = shift;
my $entry = $conv.entry; # $entry defined for convenience of explanation
my $spell = Gtk2::Spell->get_from_text_view($entry);
在对话_updated _cb中,我有以下内容:
my $plugin = shift;
my $purple_handle = Purple::Conversations::get_handle();
Purple::Signal::connect($purple_handle, "conversation-updated", $plugin, \&conversation_updated_cb, "");
my $conv = shift;
my $entry = $conv.entry; # $entry defined for convenience of explanation
my $spell = Gtk2::Spell->get_from_text_view($entry);
我收到以下错误消息,其中第38行是我的$spell=Gtk2::spell->get…:
我假设$entry必须是GTK2::TextView,但我不知道如何做到这一点,我的搜索失败了
~/.purple/plugins/testplugin.pl中的完整代码:
use Purple;
use Gtk2::Spell;
# this part taken from Hello World perl example on pidgin.im
%PLUGIN_INFO = (
perl_api_version => 2,
name => "A Perl Test Plugin",
version => "0.1",
summary => "Test plugin for the Perl interpreter.",
description => "Your description here",
author => "John H. Kelm <johnhkelm\@gmail.com",
url => "http://pidgin.im",
load => "plugin_load",
unload => "plugin_unload"
);
sub plugin_init {
return %PLUGIN_INFO;
}
sub plugin_load {
my $plugin = shift;
Purple::Debug::info("testplugin", "plugin_load() - Test Plugin Loaded.\n");
my $purple_handle = Purple::Conversations::get_handle();
Purple::Signal::connect($purple_handle, "conversation-updated", $plugin, \&conversation_updated_cb, "");
}
sub plugin_unload {
my $plugin = shift;
Purple::Debug::info("testplugin", "plugin_unload() - Test Plugin Unloaded.\n");
}
sub conversation_updated_cb {
my $conv = shift;
my $entry = $conv.entry;
Purple::Debug::info("Test Plugin", Dumper( \%{ref ($conv)."::" }));
Purple::Debug::info("Test Plugin", Dumper( \%{ref ($conv.entry)."::" }));
my $spell = Gtk2::Spell->get_from_text_view($entry);
Purple::Debug::info("Test Plugin", Dumper( \%{ref ($conv.entry)."::" }));
}
重现这个问题太难了。提供完整的代码和说明。请注意,这里没有人拥有您已经拥有的关于插件编写的知识,您必须与他人分享。谢谢。我想知道为什么我被否决了。一个有目的的对话和一个GtkWidget没有任何关系。已经有一段时间了,但iirc需要从PurpleConversation获取ui_数据。这应该是PidginIMConversation或PidginChatConversation。然后您应该能够从那里获得历史记录或条目小部件。