2016-09-05 16 views
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 

我在哪裏錯了?或者我錯過了什麼?

回答

0

經過嘗試並嘗試...此問題是由於缺少Comment條目桌面文件引起的。