Xfce Forum

Sub domains
 

You are not logged in.

#1 2011-01-01 17:34:35

Joel
Member
From: Tijuana
Registered: 2011-01-01
Posts: 5

How to call my own panel plugin

Hi there, I'm testing my panel plugin.
I have ready these files:
1.- plugintest.so
2.- plugintest.desktop
3.- plugintest.png

plugin.desktop looks like this:

[Xfce Panel]
Type=X-XFCE-PanelPlugin
Encoding=UTF-8
_Name=Plugin test
_Comment=Prueba del plugin
Icon=/usr/share/icon/plugintest.png
X-XFCE-Unique=true
X-XFCE-Module=plugintest
X-XFCE-Module-Path=/usr/lib/xfce4/panel-plugins

My question is where to save plugintest.desktop so it can be visible in the plugin list?

Offline

#2 2011-01-01 17:38:37

Nick
Dev
From: ~
Registered: 2005-02-17
Posts: 1,143
Website

Re: How to call my own panel plugin

$datadir/xfce4/panel-plugins, where $datadir is /usr/share, /usr/local/share etc.

Offline

#3 2011-01-01 18:03:25

Joel
Member
From: Tijuana
Registered: 2011-01-01
Posts: 5

Re: How to call my own panel plugin

Thanks smile

Offline

#4 2011-01-01 19:29:31

Joel
Member
From: Tijuana
Registered: 2011-01-01
Posts: 5

Re: How to call my own panel plugin

ok, my plugin now is listed, but can't load it...
this is my simple main.c

#include "main.h"

PluginStruct *plugin_new(XfcePanelPlugin *plugin)
{
    PluginStruct *ptr = panel_slice_new0(PluginStruct);
    GtkOrientation orientation = xfce_panel_plugin_get_orientation(plugin);
    ptr->plugin = plugin;
    /* init the event box widget */
    ptr->container = gtk_event_box_new();
    /* inner layout */
    ptr->hbox = xfce_hvbox_new(orientation,FALSE,0);
    gtk_container_add(GTK_CONTAINER(ptr->container),ptr->hbox);
    /* now the main widget */
    GtkWidget *label = gtk_label_new ("Joel");
    gtk_box_pack_start(GTK_BOX(ptr->hbox),label,FALSE,FALSE,0);
    return ptr;
}

void plugin_free(XfcePanelPlugin *plugin, PluginStruct *ptr)
{
    panel_slice_free(PluginStruct,ptr);
}

void plugin_constructor(XfcePanelPlugin *plugin)
{
    /* init our plugin */
    PluginStruct *ptr = plugin_new(plugin);
    /* attach our widget to the panel */
    gtk_container_add(GTK_CONTAINER(plugin),ptr->container);
    xfce_panel_plugin_add_action_widget(plugin,ptr->container);
    gtk_widget_show_all(ptr->container);
    /* plugin signal handlers */
    g_signal_connect(G_OBJECT(plugin),"free-data",G_CALLBACK(plugin_free),ptr);
}

XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL(plugin_constructor);

it generates a file called libplugintest.so which is copied to /usr/lib/xfce4/panel-plugins.
This is my desktop file:

[Xfce Panel]
Type=X-XFCE-PanelPlugin
Encoding=UTF-8
Name=Plugin test
Comment=Prueba del plugin
Icon=/usr/share/icons/plugintest.png
X-XFCE-Unique=true
X-XFCE-Module=libplugintest.so
X-XFCE-Module-Path=/usr/lib/xfce4/panel-plugins

which is saved in /usr/share/xfce4/panel-plugins/. The plugin is listed, but when I try to add it to the panel, pops an error message: "No se pudo abrir el módulo "plugintest"" which means: "Can't open module plugintest"....any ideas?

Offline

#5 2011-01-02 09:06:17

Nick
Dev
From: ~
Registered: 2005-02-17
Posts: 1,143
Website

Re: How to call my own panel plugin

X-XFCE-Module=libplugintest.so sould be X-XFCE-Module=plugintest, lib*.so is added when building the module path since it is system depended.

Offline

#6 2011-01-02 09:10:14

Nick
Dev
From: ~
Registered: 2005-02-17
Posts: 1,143
Website

Re: How to call my own panel plugin

And you use XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL, which is for external plugins (in libexecdir and compiled as an executable).

I suggest you clone the xfce4-sample-plugin which runs external or at the (internal) plugins shipped with xfce4-panel.

Offline

Board footer

Powered by FluxBB