diff --git a/Makefile b/Makefile index 9bd652a..055730e 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ PACKAGE = Panel VERSION = 0.2.5 -SUBDIRS = data include po src +SUBDIRS = data include po src tools RM = rm -f LN = ln -f TAR = tar -czvf @@ -95,6 +95,8 @@ dist: $(PACKAGE)-$(VERSION)/src/applets/Makefile \ $(PACKAGE)-$(VERSION)/src/applets/tasks.atoms \ $(PACKAGE)-$(VERSION)/src/applets/project.conf \ + $(PACKAGE)-$(VERSION)/tools/test.c \ + $(PACKAGE)-$(VERSION)/tools/project.conf \ $(PACKAGE)-$(VERSION)/COPYING \ $(PACKAGE)-$(VERSION)/Makefile \ $(PACKAGE)-$(VERSION)/config.h \ diff --git a/po/fr.po b/po/fr.po index 59f5499..a04501e 100644 --- a/po/fr.po +++ b/po/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Panel 0.0.5\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-04-16 02:08+0200\n" +"POT-Creation-Date: 2011-05-10 15:30+0200\n" "PO-Revision-Date: 2010-04-22 12:45+0200\n" "Last-Translator: Pierre Pronchery \n" "Language-Team: French\n" @@ -277,3 +277,7 @@ msgstr "Usage: run\n" #: ../src/window.c:58 msgid "Invalid panel size" msgstr "Taille invalide pour le panel" + +#, fuzzy +#~ msgid "USB host mode is enabled" +#~ msgstr "Bluetooth actif" diff --git a/project.conf b/project.conf index 339af83..bb2daf1 100644 --- a/project.conf +++ b/project.conf @@ -2,5 +2,5 @@ package=Panel version=0.2.5 config=h,sh -subdirs=data,include,po,src +subdirs=data,include,po,src,tools dist=COPYING,Makefile,config.h,config.sh diff --git a/tools/.cvsignore b/tools/.cvsignore new file mode 100644 index 0000000..997fd66 --- /dev/null +++ b/tools/.cvsignore @@ -0,0 +1,2 @@ +.cvsignore +panel_test diff --git a/tools/Makefile b/tools/Makefile new file mode 100644 index 0000000..c4af726 --- /dev/null +++ b/tools/Makefile @@ -0,0 +1,39 @@ +TARGETS = panel_test +PREFIX = /usr/local +DESTDIR = +BINDIR = $(PREFIX)/bin +CC = cc +CPPFLAGSF= +CPPFLAGS= +CFLAGSF = -W `pkg-config --cflags gtk+-2.0` +CFLAGS = -Wall -g -O2 +LDFLAGSF= `pkg-config --libs libSystem gtk+-2.0` +RM = rm -f +LN = ln -f +MKDIR = mkdir -p +INSTALL = install + + +all: $(TARGETS) + +panel_test_OBJS = test.o +panel_test_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) +panel_test_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) + +panel_test: $(panel_test_OBJS) + $(CC) -o panel_test $(panel_test_OBJS) $(panel_test_LDFLAGS) + +test.o: test.c + $(CC) $(panel_test_CFLAGS) -c test.c + +clean: + $(RM) -- $(panel_test_OBJS) + +distclean: clean + $(RM) -- $(TARGETS) + +install: $(TARGETS) + +uninstall: + +.PHONY: all clean distclean install uninstall diff --git a/tools/project.conf b/tools/project.conf new file mode 100644 index 0000000..a01b811 --- /dev/null +++ b/tools/project.conf @@ -0,0 +1,8 @@ +targets=panel_test +cflags_force=-W `pkg-config --cflags gtk+-2.0` +cflags=-Wall -g -O2 +ldflags_force=`pkg-config --libs libSystem gtk+-2.0` + +[panel_test] +type=binary +sources=test.c diff --git a/tools/test.c b/tools/test.c new file mode 100644 index 0000000..d249483 --- /dev/null +++ b/tools/test.c @@ -0,0 +1,122 @@ +/* $Id$ */ +/* Copyright (c) 2011 Pierre Pronchery */ +/* This file is part of DeforaOS Desktop Panel */ +/* This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + + + +#include +#include +#include +#include +#include +#include +#include +#include +#include "../config.h" + + +/* constants */ +#ifndef PREFIX +# define PREFIX "/usr/local" +#endif + + +/* private */ +/* functions */ +static char const * _helper_config_get(Panel * panel, char const * section, + char const * variable); + +static int _test(char * applets[]) +{ + char const path[] = PREFIX "/lib/Panel/applets/"; + char const so[] = ".so"; + GtkWidget * window; + GtkWidget * box; + GtkWidget * widget; + size_t i; + size_t len; + char * p = NULL; + char * q; + void * dl; + PanelAppletHelper helper; + PanelApplet * pa; + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK( + gtk_main_quit), NULL); + gtk_window_set_title(GTK_WINDOW(window), "Applet tester"); + box = gtk_hbox_new(FALSE, 4); + memset(&helper, 0, sizeof(helper)); + helper.icon_size = GTK_ICON_SIZE_SMALL_TOOLBAR; + helper.config_get = _helper_config_get; + for(i = 0; applets[i] != NULL; i++) + { + len = sizeof(path) + strlen(applets[i]) + sizeof(so); + if((q = realloc(p, len)) == NULL) + break; + p = q; + snprintf(p, len, "%s%s%s", path, applets[i], so); + if((dl = dlopen(p, RTLD_LAZY)) == NULL) + continue; + if((pa = dlsym(dl, "applet")) == NULL) + { + dlclose(dl); + continue; + } + pa->helper = &helper; + if((widget = pa->init(pa)) != NULL) + gtk_box_pack_start(GTK_BOX(box), widget, pa->expand, + pa->fill, 0); + } + free(p); + gtk_container_add(GTK_CONTAINER(window), box); + gtk_widget_show_all(window); + return 0; +} + +static char const * _helper_config_get(Panel * panel, char const * section, + char const * variable) +{ + return NULL; +} + + +/* usage */ +static int _usage(void) +{ + fputs("Usage: test applet...\n", stderr); + return 1; +} + + +/* public */ +/* functions */ +/* main */ +int main(int argc, char * argv[]) +{ + int o; + + gtk_init(&argc, &argv); + while((o = getopt(argc, argv, "")) != -1) + switch(o) + { + default: + return _usage(); + } + if(optind == argc) + return _usage(); + _test(&argv[optind]); + gtk_main(); + return 0; +}