2011-09-15 3 views
2

내가 패널 애플릿을 만들려고 해요,하지만 난 첫 번째 단계에 붙어있어 : 을 나는 공식 예제 코드와 file.cpp을 만든 http://developer.gnome.org/panel-applet/3.0/getting-started.example.html그놈 대체 애플릿 C++

#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 

모든 코드가 문서에서 가져온 것입니다,하지만 난 패널에 애플릿을 추가하려고하면이 오류가 있었다 :

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

무엇이 잘못 되었나요 ??

답변

0

PANEL_APPLET_OUT_PROCESS_FACTORY 코드에 InProcess=true으로 표시되어 있습니다.

이제 귀하의 질문이 나를 잘 알고있는 것으로 알고 있습니다. 그리고 already solved it. 그래서 저는 여기에 해결책을 연결하고 있습니다. 그래서 다른 사람들도 답을 찾을 수 있습니다.