Re: gnome fallback panel applet creation problem



Il 16/09/2011 10:13, Carlos Garcia Campos ha scritto:
Excerpts from Syco's message of vie sep 16 09:26:53 +0200 2011:
I'm trying to create a panel applet, but I'm stuck at the first step:
I've created a file.cpp with the code from the official example at
http://developer.gnome.org/panel-applet/3.0/getting-started.example.html

|#include <gtk/gtk.h>
#include <panel-applet.h>
static gboolean hello_world_applet_start (PanelApplet *applet) {
    GtkWidget *label;
    label = gtk_label_new ("Hello World");
    gtk_container_add (GTK_CONTAINER (applet), label);
    gtk_widget_show_all (GTK_WIDGET (applet));
    return TRUE;
}
static gboolean hello_world_factory_callback (PanelApplet  *applet, const gchar *iid, gpointer data) {
    gboolean retval = FALSE;
    if (g_strcmp0 (iid, "HelloWorldApplet") == 0)
        retval = hello_world_applet_start (applet);
    return retval;
}
PANEL_APPLET_OUT_PROCESS_FACTORY ("HelloWorldFactory", PANEL_TYPE_APPLET, hello_world_factory_callback, NULL)
|


compiled with

|g++ -Wall -DGTK_DISABLE_SINGLE_INCLUDES -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE `pkg-config --cflags --libs gtk+-3.0 libpanelapplet-4.0` *.cpp -o helloworld
|


and copied under

|/usr/lib/gnome-panel/helloworld|


then I've created the file

|/usr/share/gnome-panel/4.0/applets/helloworld.panel-applet|

with this content:

|[Applet Factory]
Id=HelloWorldFactory
InProcess=true
Location=/usr/lib/gnome-panel/helloworld
Name=Hello World Applet Factory
Description=Factory for the window navigation related applets

[HelloWorldApplet]
Name=Hello World
Description=Factory for the Hello World applet example
Icon=hello-world-icon
|


all the code is taken from the documentation, but when I try to add the
applet to the panel I had this error:

|** (gnome-panel:24803): WARNING **: Failed to load applet HelloWorldFactory::HelloWorldApplet: /usr/lib/gnome-panel/helloworld: cannot dynamically load executable|


what's wrong??
The problem is that you are creating an out of process applet, using
PANEL_APPLET_OUT_PROCESS_FACTORY, but defining it as in process in the
panel-applet file, InProcess=true. You can just remove both keys
InProcess and Location from the panel-applet file and use a dbus
service file to activate the applet.

Thanks.
Regards, 

thanks a lot,
I've have removed those lines from .panel-applet file and created

    /usr/share/dbus-1/services/org.gnome.panel.applet.WindowManagerFactory.service

with

    [D-BUS Service]
    Name=org.gnome.panel.applet.HelloWorldFactory
    Exec=/usr/lib/gnome-panel/helloworld


now it works.
Someone could insert this procedure in the official guide, it's not so clear how to procede.
Anyway, thanks.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]