I am trying to develop my own lxpanel plugin. Right now it is just a stripped down version of example_plug and I am trying to get it to compile. I have attached a file containing all info I think might be useful, which is the source file, the Makefile (handwritten) and the output of make (without arguments). I think the problem is in the makefile and I should add something, but I don't know what. Can anyone help me?

Thanks in advance.

P.s. I asked earlier for global directions on writing a plugin and didn't get a response. I have figured out enough by myself to have come this far, if I get it to work I might write the Wiki page I mentioned in my earlier post.
##########################################################################################################################################################################################################
                                                                                
 contents of lxglobalmenu.c
##########################################################################################################################################################################################################
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <glib-2.0/glib.h>
#include <string.h>
#include <lxpanel/plugin.h>
#include <globalmenu-server.h>

typedef struct {
        unsigned int timer;
        Plugin * plugin;
        GtkWidget *main;
        GtkWidget *widget;
        GtkTooltips *tip;
        gchar* file;
        gchar* file2;
} LXGlobalMenu;

gboolean button_press_event( GtkWidget *widget, GdkEventButton* event, Plugin* 
plugin)
{
        ENTER2;

        if( event->button == 1 ) /* left button */
        {
          /* write here */
        }
        else if( event->button == 2 ) /* middle button */
        {
          /* write here */
        }
        else if( event->button == 3 )  /* right button */
        {
                GtkMenu* popup = (GtkMenu*)lxpanel_get_panel_menu( 
plugin->panel, plugin, FALSE ); /* lxpanel_menu, can be reimplemented */
                gtk_menu_popup( popup, NULL, NULL, NULL, NULL, event->button, 
event->time );
                return TRUE;
        }

        RET2(TRUE);
}

gboolean scroll_event (GtkWidget *widget, GdkEventScroll *event, Plugin* plugin)
{
        ENTER2;
        RET2(TRUE);
}

static gint update_tooltip(LXGlobalMenu *menu)
{
        char *tooltip;
        ENTER;

        tooltip = "test";
        gtk_tooltips_set_tip(menu->tip, menu->main, tooltip, NULL);
        g_free(tooltip);

        RET(TRUE);
}

static int globalmenu_constructor(Plugin *p, char** fp)
{
        LXGlobalMenu *menu;
        
        ENTER;
        /* initialization */
        menu = g_new0(LXGlobalMenu, 1);
        menu->plugin = p;
        p->priv = menu;

        p->pwid = gtk_event_box_new();
        GTK_WIDGET_SET_FLAGS( p->pwid, GTK_NO_WINDOW );
        gtk_container_set_border_width( GTK_CONTAINER(p->pwid), 2 );

        menu->widget = gtk_label_new(" ");
        
        gtk_container_add(GTK_CONTAINER(p->pwid), menu->widget);

        menu->main = p->pwid;
        menu->tip  = gtk_tooltips_new();
        update_tooltip(menu);

        g_signal_connect (G_OBJECT (p->pwid), "button_press_event", G_CALLBACK 
(button_press_event), (gpointer) p);
        g_signal_connect (G_OBJECT (p->pwid), "scroll_event", G_CALLBACK 
(scroll_event), (gpointer) p);

        if(!parse_params(menu, fp)) goto error;

        gtk_widget_show(menu->widget); /* show plugin on panel */
        RET(TRUE);
error:
        destructor( p );
        RET(FALSE);
}

gboolean parse_params (LXGlobalMenu menu, char** fp) {
        
        line s;
        s.len = 256;
        if (fp)
        {
                while (lxpanel_get_line(fp, &s) != LINE_BLOCK_END)
                {
                        if (s.type == LINE_NONE) {
                                ERR( "globalmenu: illegal token %s\n", s.str);
                                goto error;
                        }
                        if (s.type == LINE_VAR) {
                                if (!g_ascii_strcasecmp(s.t[0], "file")){
                                        menu.file = g_strdup(s.t[1]);
                                }else if (!g_ascii_strcasecmp(s.t[0], "file2")){
                                        menu.file2 = g_strdup(s.t[1]);
                                }else {
                                        ERR( "globalmenu: unknown var %s\n", 
s.t[0]);
                                        continue;
                                }
                        }
                        else {
                                ERR( "globalmenu: illegal in this context 
%s\n", s.str);
                                return FALSE;
                        }
                }
        }
        return TRUE;
error:
        destructor( menu.plugin );
        RET(FALSE);
}

static void applyConfig(Plugin* p)
{
        ENTER;
        LXGlobalMenu *menu = (LXGlobalMenu *) p->priv;
        
        update_tooltip(menu);
        RET();
}

static void config(Plugin *p, GtkWindow* parent) {
        ENTER;

        GtkWidget *dialog;
        LXGlobalMenu *menu = (LXGlobalMenu *) p->priv;
        dialog = create_generic_config_dlg(_(p->class->name),
                        GTK_WIDGET(parent),
                        (GSourceFunc) applyConfig, (gpointer) p,
                        _("File"), &menu->file, CONF_TYPE_FILE,
                   _("File"), &menu->file2, CONF_TYPE_FILE_ENTRY,
                        NULL);
        gtk_window_present(GTK_WINDOW(dialog));

        RET();
}

static void globalmenu_destructor(Plugin *p)
{
  ENTER;
  LXGlobalMenu *menu = (LXGlobalMenu *)p->priv;
  g_source_remove(menu->timer);
  g_free(menu);
  RET();
}

static void save_config( Plugin* p, FILE* fp )
{
        ENTER;
        LXGlobalMenu *menu = (LXGlobalMenu *)p->priv;

        lxpanel_put_str( fp, "file", menu->file );
        lxpanel_put_str( fp, "file2", menu->file2 );
        RET();
}

PluginClass globalmenu_plugin_class = {

        PLUGINCLASS_VERSIONING,

        type : "globalmenu",
        name : "GlobalMenu plugin",
        version: "0.1",
        description : "GlobalMenu plugin for LXPanel",

        constructor : globalmenu_constructor,
        destructor  : globalmenu_destructor,
        config    : config,
        save            : save_config,
        panel_configuration_changed : NULL
};


##########################################################################################################################################################################################################
                                                                                
 contents of Makefile
##########################################################################################################################################################################################################
LXDE_PREFIX=$(HOME)/opt/lxde
PREFIX=$(HOME)/opt/lxde
GLOBALMENU_PREFIX=$(HOME)/experimental

all:
        @echo "compiling and linking"
        gcc -pthread -I$(LXDE_PREFIX)/include 
-I$(LXDE_PREFIX)/include/menu-cache -I/usr/include/glib-2.0 
-I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include 
-I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 
-I/usr/include/gio-unix-2.0/ -I/usr/include/pixman-1 -I/usr/include/freetype2 
-I/usr/include/libpng12 -I$(GLOBALMENU_PREFIX)/include 
-I$(GLOBALMENU_PREFIX)/include/gnome-globalmenu -L$(LXDE_PREFIX)/lib 
-L$(GLOBALMENU_PREFIX)/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 
-lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lcairo -lgio-2.0 -lpango-1.0 -lfreetype 
-lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lmenu-cache 
-lglib-2.0 -o lxglobalmenu.so lxglobalmenu.c

install: all
        @echo "installing"
        install -v -m 755 lxglobalmenu.so $(PREFIX)/lib/lxpanel


##########################################################################################################################################################################################################
                                                                                
 output of make
##########################################################################################################################################################################################################
compiling and linking
gcc -pthread -I/home/toonoob2banoob/opt/lxde/include 
-I/home/toonoob2banoob/opt/lxde/include/menu-cache -I/usr/include/glib-2.0 
-I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include 
-I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 
-I/usr/include/gio-unix-2.0/ -I/usr/include/pixman-1 -I/usr/include/freetype2 
-I/usr/include/libpng12 -I/home/toonoob2banoob/experimental/include 
-I/home/toonoob2banoob/experimental/include/gnome-globalmenu 
-L/home/toonoob2banoob/opt/lxde/lib -L/home/toonoob2banoob/experimental/lib 
-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lm 
-lpangocairo-1.0 -lcairo -lgio-2.0 -lpango-1.0 -lfreetype -lfontconfig 
-lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lmenu-cache -lglib-2.0 -o 
lxglobalmenu.so lxglobalmenu.c
lxglobalmenu.c: In function ‘config’:
lxglobalmenu.c:166: warning: assignment makes pointer from integer without a 
cast
/usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
/tmp/ccmwG0gx.o: In function `button_press_event':
lxglobalmenu.c:(.text+0x6e): undefined reference to `lxpanel_get_panel_menu'
/tmp/ccmwG0gx.o: In function `globalmenu_constructor':
lxglobalmenu.c:(.text+0x33f): undefined reference to `destructor'
/tmp/ccmwG0gx.o: In function `parse_params':
lxglobalmenu.c:(.text+0x3a5): undefined reference to `destructor'
lxglobalmenu.c:(.text+0x466): undefined reference to `lxpanel_get_line'
/tmp/ccmwG0gx.o: In function `config':
lxglobalmenu.c:(.text+0x4b9): undefined reference to `_'
lxglobalmenu.c:(.text+0x4d0): undefined reference to `_'
lxglobalmenu.c:(.text+0x4ff): undefined reference to `_'
lxglobalmenu.c:(.text+0x549): undefined reference to `create_generic_config_dlg'
/tmp/ccmwG0gx.o: In function `save_config':
lxglobalmenu.c:(.text+0x5e4): undefined reference to `lxpanel_put_line'
lxglobalmenu.c:(.text+0x620): undefined reference to `lxpanel_put_line'
collect2: ld returned 1 exit status
make: *** [all] Error 1

------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
_______________________________________________
Lxde-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxde-list

Reply via email to