我正在尝试创建一个panel applet,但是我被困在了第一步:我已经用http://developer.gnome.org/panel-applet/3.0/getting-started.example.html官方示例中的代码创建了一个file.cpp
#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)使用编译
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并复制到
/usr/lib/gnome-panel/helloworld然后我已经创建了这个文件
/usr/share/gnome-panel/4.0/applets/helloworld.panel-applet包含以下内容:
[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所有代码都取自文档,但当我尝试将applet添加到面板时,我遇到了以下错误:
** (gnome-panel:24803): WARNING **: Failed to load applet HelloWorldFactory::HelloWorldApplet: /usr/lib/gnome-panel/helloworld: cannot dynamically load executable怎么了??
发布于 2011-10-16 02:42:01
您在代码中使用了PANEL_APPLET_OUT_PROCESS_FACTORY,并将其描述为InProcess=true。
现在我意识到你的问题对我来说很眼熟,而你already solved it。因此,我在这里链接解决方案,以便其他人也能找到答案。
https://stackoverflow.com/questions/7435897
复制相似问题