开发者

gnome fallback applet c++

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 开发者_StackOverflow中文版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??


You are using PANEL_APPLET_OUT_PROCESS_FACTORY in your code and you are describing it as InProcess=true.

Now I realized your question looked familiar to me, and you already solved it. So, I am linking the solution here, so other can find the answer, too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜