Added a plug-in template

This commit is contained in:
Pierre Pronchery 2012-10-12 00:17:19 +00:00
parent 67b12a6e22
commit 65f62c3c13
4 changed files with 105 additions and 4 deletions

View File

@ -103,6 +103,7 @@ dist:
$(PACKAGE)-$(VERSION)/src/plugins/profiles.c \
$(PACKAGE)-$(VERSION)/src/plugins/smscrypt.c \
$(PACKAGE)-$(VERSION)/src/plugins/systray.c \
$(PACKAGE)-$(VERSION)/src/plugins/template.c \
$(PACKAGE)-$(VERSION)/src/plugins/ussd.c \
$(PACKAGE)-$(VERSION)/src/plugins/Makefile \
$(PACKAGE)-$(VERSION)/src/plugins/project.conf \

View File

@ -1,5 +1,5 @@
SUBDIRS = 16x16 24x24 32x32 48x48
TARGETS = blacklist.so debug.so engineering.so gprs.so gps.so locker.so n900.so openmoko.so oss.so panel.so profiles.so smscrypt.so systray.so ussd.so
TARGETS = blacklist.so debug.so engineering.so gprs.so gps.so locker.so n900.so openmoko.so oss.so panel.so profiles.so smscrypt.so systray.so template.so ussd.so
PREFIX = /usr/local
DESTDIR =
LIBDIR = $(PREFIX)/lib
@ -113,6 +113,13 @@ systray_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
systray.so: $(systray_OBJS)
$(CCSHARED) -o systray.so $(systray_OBJS) $(systray_LDFLAGS)
template_OBJS = template.o
template_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
template_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
template.so: $(template_OBJS)
$(CCSHARED) -o template.so $(template_OBJS) $(template_LDFLAGS)
ussd_OBJS = ussd.o
ussd_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
ussd_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
@ -159,16 +166,19 @@ smscrypt.o: smscrypt.c ../../include/Phone.h
systray.o: systray.c ../../include/Phone.h ../../config.h
$(CC) $(systray_CFLAGS) -c systray.c
template.o: template.c ../../include/Phone.h
$(CC) $(template_CFLAGS) -c template.c
ussd.o: ussd.c ../../include/Phone.h
$(CC) $(ussd_CFLAGS) -c ussd.c
clean:
@for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean) || exit; done
$(RM) -- $(blacklist_OBJS) $(debug_OBJS) $(engineering_OBJS) $(gprs_OBJS) $(gps_OBJS) $(locker_OBJS) $(n900_OBJS) $(openmoko_OBJS) $(oss_OBJS) $(panel_OBJS) $(profiles_OBJS) $(smscrypt_OBJS) $(systray_OBJS) $(ussd_OBJS)
$(RM) -- $(blacklist_OBJS) $(debug_OBJS) $(engineering_OBJS) $(gprs_OBJS) $(gps_OBJS) $(locker_OBJS) $(n900_OBJS) $(openmoko_OBJS) $(oss_OBJS) $(panel_OBJS) $(profiles_OBJS) $(smscrypt_OBJS) $(systray_OBJS) $(template_OBJS) $(ussd_OBJS)
distclean:
@for i in $(SUBDIRS); do (cd $$i && $(MAKE) distclean) || exit; done
$(RM) -- $(blacklist_OBJS) $(debug_OBJS) $(engineering_OBJS) $(gprs_OBJS) $(gps_OBJS) $(locker_OBJS) $(n900_OBJS) $(openmoko_OBJS) $(oss_OBJS) $(panel_OBJS) $(profiles_OBJS) $(smscrypt_OBJS) $(systray_OBJS) $(ussd_OBJS)
$(RM) -- $(blacklist_OBJS) $(debug_OBJS) $(engineering_OBJS) $(gprs_OBJS) $(gps_OBJS) $(locker_OBJS) $(n900_OBJS) $(openmoko_OBJS) $(oss_OBJS) $(panel_OBJS) $(profiles_OBJS) $(smscrypt_OBJS) $(systray_OBJS) $(template_OBJS) $(ussd_OBJS)
$(RM) -- $(TARGETS)
install: $(TARGETS)

View File

@ -1,5 +1,5 @@
subdirs=16x16,24x24,32x32,48x48
targets=blacklist,debug,engineering,gprs,gps,locker,n900,openmoko,oss,panel,profiles,smscrypt,systray,ussd
targets=blacklist,debug,engineering,gprs,gps,locker,n900,openmoko,oss,panel,profiles,smscrypt,systray,template,ussd
cppflags_force=-I ../../include
cppflags=
cflags_force=-W `pkg-config --cflags libSystem gtk+-2.0`
@ -119,6 +119,13 @@ install=$(LIBDIR)/Phone/plugins
[systray.c]
depends=../../include/Phone.h,../../config.h
[template]
type=plugin
sources=template.c
[template.c]
depends=../../include/Phone.h
[ussd]
type=plugin
sources=ussd.c

83
src/plugins/template.c Normal file
View File

@ -0,0 +1,83 @@
/* $Id$ */
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Phone */
/* 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 <http://www.gnu.org/licenses/>. */
#include <System.h>
#include <Desktop.h>
#include "Phone.h"
/* Template */
/* private */
/* types */
typedef struct _PhonePlugin
{
PhonePluginHelper * helper;
} TemplatePhonePlugin;
/* prototypes */
/* plug-in */
static TemplatePhonePlugin * _template_init(PhonePluginHelper * helper);
static void _template_destroy(TemplatePhonePlugin * template);
static int _template_event(TemplatePhonePlugin * template, PhoneEvent * event);
/* public */
/* variables */
PhonePluginDefinition plugin =
{
"Template",
NULL,
NULL,
_template_init,
_template_destroy,
_template_event,
NULL
};
/* private */
/* functions */
/* template_init */
static TemplatePhonePlugin * _template_init(PhonePluginHelper * helper)
{
TemplatePhonePlugin * template;
if((template = object_new(sizeof(*template))) == NULL)
return NULL;
template->helper = helper;
return template;
}
/* template_destroy */
static void _template_destroy(TemplatePhonePlugin * template)
{
object_delete(template);
}
/* template_event */
static int _template_event(TemplatePhonePlugin * template, PhoneEvent * event)
{
switch(event->type)
{
default:
break;
}
return 0;
}