1
我已经写了一个非常简单的XFCE面板插件片段时足够的参数传递到包装,:严重错误:不加载我的XFCE插件
gcc -Wall -shared -o libtest.so -fPIC main.c `pkg-config --cflags --libs libxfce4panel-1.0` `pkg-config --cflags --libs gtk+-2.0`
:
#include <gtk/gtk.h>
#include <libxfce4panel/xfce-panel-plugin.h>
static void system_monitor_construct(XfcePanelPlugin *plugin);
XFCE_PANEL_PLUGIN_REGISTER(system_monitor_construct);
static void system_monitor_construct(XfcePanelPlugin *plugin)
{
GtkWidget *hvbox;
GtkWidget *label;
GtkOrientation orientation;
orientation = xfce_panel_plugin_get_orientation (plugin);
hvbox = xfce_hvbox_new (orientation, FALSE, 2);
gtk_widget_show(hvbox);
gtk_container_add (GTK_CONTAINER (plugin), hvbox);
label = gtk_label_new ("Hello GNOME!");
gtk_container_add (GTK_CONTAINER (hvbox), GTK_WIDGET (label));
gtk_widget_show(label);
}
编译它libtest.so复制到/usr/lib/xfce4/panel-plugins
,并在桌面上创建文件test.desktop在/usr/share/xfce4/panel-plugins
与内容:
[Xfce Panel]
Type=X-XFCE-PanelPlugin
Encoding=UTF-8
Name=test
X-XFCE-Module=test
X-XFCE-Module-Path=/usr/lib/xfce4/panel-plugins
当我加载这个插件,我得到:
(process:5700): xfce4-panel-wrapper-CRITICAL **: Not enough arguments are passed to the wrapper
xfce4-panel(external): test-8: child exited with status 512
(xfce4-panel:5695): xfce4-panel-WARNING **: Plugin test-8 exited with status 2, removing from panel configuration
xfce4-panel(external): test-8: plugin unrealized; quiting child
xfce4-panel(application): saving /panels/panel-2: ids=true, providers=false
(xfce4-panel:5695): GLib-CRITICAL **: g_child_watch_add_full: assertion 'pid > 0' failed
(xfce4-panel:5695): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GtkObject'
(xfce4-panel:5695): exo-CRITICAL **: IA__exo_gtk_object_destroy_later: assertion 'GTK_IS_OBJECT (object)' failed
我在哪里错了?或者我错过了什么?