Added a sample applet

This commit is contained in:
Pierre Pronchery 2012-10-05 22:17:30 +00:00
parent 144e999ca3
commit 78cef748b2
4 changed files with 97 additions and 3 deletions

View File

@ -102,6 +102,7 @@ dist:
$(PACKAGE)-$(VERSION)/src/applets/swap.c \
$(PACKAGE)-$(VERSION)/src/applets/systray.c \
$(PACKAGE)-$(VERSION)/src/applets/tasks.c \
$(PACKAGE)-$(VERSION)/src/applets/template.c \
$(PACKAGE)-$(VERSION)/src/applets/title.c \
$(PACKAGE)-$(VERSION)/src/applets/usb.c \
$(PACKAGE)-$(VERSION)/src/applets/volume.c \

View File

@ -1,4 +1,4 @@
TARGETS = battery.so bluetooth.so clock.so close.so cpu.so cpufreq.so desktop.so gps.so gsm.so keyboard.so lock.so logout.so main.so memory.so mixer.so pager.so phone.so rotate.so separator.so spacer.so swap.so systray.so tasks.so title.so usb.so volume.so wpa_supplicant.so
TARGETS = battery.so bluetooth.so clock.so close.so cpu.so cpufreq.so desktop.so gps.so gsm.so keyboard.so lock.so logout.so main.so memory.so mixer.so pager.so phone.so rotate.so separator.so spacer.so swap.so systray.so tasks.so template.so title.so usb.so volume.so wpa_supplicant.so
PREFIX = /usr/local
DESTDIR =
LIBDIR = $(PREFIX)/lib
@ -180,6 +180,13 @@ tasks_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) `pkg-config --libs x11`
tasks.so: $(tasks_OBJS)
$(CCSHARED) -o tasks.so $(tasks_OBJS) $(tasks_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)
title_OBJS = title.o
title_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) `pkg-config --cflags x11`
title_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) `pkg-config --libs x11`
@ -277,6 +284,9 @@ systray.o: systray.c ../../include/Panel.h
tasks.o: tasks.c ../../include/Panel.h tasks.atoms
$(CC) $(tasks_CFLAGS) -c tasks.c
template.o: template.c ../../include/Panel.h
$(CC) $(template_CFLAGS) -c template.c
title.o: title.c ../../include/Panel.h
$(CC) $(title_CFLAGS) -c title.c
@ -290,7 +300,7 @@ wpa_supplicant.o: wpa_supplicant.c ../../include/Panel.h
$(CC) $(wpa_supplicant_CFLAGS) -c wpa_supplicant.c
clean:
$(RM) -- $(battery_OBJS) $(bluetooth_OBJS) $(clock_OBJS) $(close_OBJS) $(cpu_OBJS) $(cpufreq_OBJS) $(desktop_OBJS) $(gps_OBJS) $(gsm_OBJS) $(keyboard_OBJS) $(lock_OBJS) $(logout_OBJS) $(main_OBJS) $(memory_OBJS) $(mixer_OBJS) $(pager_OBJS) $(phone_OBJS) $(rotate_OBJS) $(separator_OBJS) $(spacer_OBJS) $(swap_OBJS) $(systray_OBJS) $(tasks_OBJS) $(title_OBJS) $(usb_OBJS) $(volume_OBJS) $(wpa_supplicant_OBJS)
$(RM) -- $(battery_OBJS) $(bluetooth_OBJS) $(clock_OBJS) $(close_OBJS) $(cpu_OBJS) $(cpufreq_OBJS) $(desktop_OBJS) $(gps_OBJS) $(gsm_OBJS) $(keyboard_OBJS) $(lock_OBJS) $(logout_OBJS) $(main_OBJS) $(memory_OBJS) $(mixer_OBJS) $(pager_OBJS) $(phone_OBJS) $(rotate_OBJS) $(separator_OBJS) $(spacer_OBJS) $(swap_OBJS) $(systray_OBJS) $(tasks_OBJS) $(template_OBJS) $(title_OBJS) $(usb_OBJS) $(volume_OBJS) $(wpa_supplicant_OBJS)
distclean: clean
$(RM) -- $(TARGETS)

View File

@ -1,4 +1,4 @@
targets=battery,bluetooth,clock,close,cpu,cpufreq,desktop,gps,gsm,keyboard,lock,logout,main,memory,mixer,pager,phone,rotate,separator,spacer,swap,systray,tasks,title,usb,volume,wpa_supplicant
targets=battery,bluetooth,clock,close,cpu,cpufreq,desktop,gps,gsm,keyboard,lock,logout,main,memory,mixer,pager,phone,rotate,separator,spacer,swap,systray,tasks,template,title,usb,volume,wpa_supplicant
cppflags_force=-I ../../include
#cppflags=-D EMBEDDED
cflags_force=-W `pkg-config --cflags libSystem gtk+-2.0` -fPIC
@ -205,6 +205,13 @@ install=$(LIBDIR)/Panel/applets
[tasks.c]
depends=../../include/Panel.h,tasks.atoms
[template]
type=plugin
sources=template.c
[template.c]
depends=../../include/Panel.h
[title]
type=plugin
sources=title.c

76
src/applets/template.c Normal file
View File

@ -0,0 +1,76 @@
/* $Id$ */
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
/* 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 <http://www.gnu.org/licenses/>. */
#include <System.h>
#include "Panel.h"
/* Template */
/* private */
/* types */
typedef struct _PanelApplet
{
PanelAppletHelper * helper;
} Template;
/* prototypes */
static Template * _template_init(PanelAppletHelper * helper,
GtkWidget ** widget);
static void _template_destroy(Template * template);
/* public */
/* variables */
PanelAppletDefinition applet =
{
"Template",
NULL,
NULL,
_template_init,
_template_destroy,
NULL,
FALSE,
TRUE
};
/* private */
/* functions */
/* template_init */
static Template * _template_init(PanelAppletHelper * helper,
GtkWidget ** widget)
{
Template * template;
if((template = object_new(sizeof(*template))) == NULL)
{
helper->error(NULL, error_get(), 1);
return NULL;
}
template->helper = helper;
*widget = gtk_label_new("Template");
gtk_widget_show(*widget);
return template;
}
/* template_destroy */
static void _template_destroy(Template * template)
{
object_delete(template);
}