2

I've written one very simple xfce panel plugin snippet:

#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);

}

compiled it with:

gcc -Wall -shared -o libtest.so -fPIC main.c `pkg-config --cflags --libs libxfce4panel-1.0` `pkg-config --cflags --libs gtk+-2.0`

copy libtest.so to /usr/lib/xfce4/panel-plugins, and create desktop file test.desktop in /usr/share/xfce4/panel-plugins with the contents:

[Xfce Panel]
Type=X-XFCE-PanelPlugin
Encoding=UTF-8
Name=test
X-XFCE-Module=test
X-XFCE-Module-Path=/usr/lib/xfce4/panel-plugins

When I loading this plugin, I got:

(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

Where am I wrong? or What things I've missed?

Douglas Su
  • 3,214
  • 7
  • 29
  • 58

1 Answers1

2

After try and try... This problem is caused by missing of Comment entry in desktop file.

Douglas Su
  • 3,214
  • 7
  • 29
  • 58