source: titan/plugins/permtime/permtime.c @ 13130

Last change on this file since 13130 was 13130, checked in by gost, 12 years ago

[titan] add lcdpearl1 source

  • Property svn:executable set to *
File size: 1.6 KB
Line 
1#include "../../titan/struct.h"
2#include "../../titan/debug.h"
3#include "../../titan/skinfunc.h"
4#include "../../titan/header.h"
5
6char pluginname[] = "Permanent Time";
7char plugindesc[] = "Extensions";
8char pluginpic[] = "%pluginpath%/permtime/plugin.png";
9
10int pluginaktiv = 0;
11//struct skin* pluginmenu = NULL;
12//int pluginflag = 1; //don't show the plugin in pluginmanager
13
14struct stimerthread* permtimethread = NULL;
15
16void permtime_thread()
17{
18       
19        char* tmpstr = NULL;
20        struct skin* framebuffer = getscreen("framebuffer");
21        struct skin* permtime = getscreen("permtime");
22        char* bg = NULL;
23       
24        setnodeattr(permtime, framebuffer);
25        bg = savescreen(permtime);
26       
27        while (permtimethread->aktion != STOP) {
28                tmpstr = gettime("%H:%M");
29                changetext(permtime, tmpstr);
30                drawscreen(permtime, 0);
31                free(tmpstr); tmpstr = NULL;
32                sleep(1);
33        }
34        restorescreen(bg, permtime);
35        blitfb();
36        permtimethread = NULL;
37  return;
38}
39
40void permtime_main()
41{
42        if(permtimethread == NULL)
43        {
44                permtimethread = addtimer(&permtime_thread, START, 10000, 1, NULL, NULL, NULL);
45        }
46        else
47        {
48                permtimethread->aktion = STOP;
49        }
50}       
51                       
52//wird beim laden ausgefuehrt
53void init(void)
54{
55        char* tmpstr = NULL;
56        pluginaktiv = 1;
57       
58        tmpstr = ostrcat(getconfig("pluginpath", NULL), "/permtime/skin.xml", 0, 0);
59        readscreen(tmpstr, 115, 1);
60        free(tmpstr); tmpstr = NULL;
61       
62        debug(10, "Permanent Time Plugin loadet !!!");
63}
64
65//wird beim entladen ausgefuehrt
66void deinit(void)
67{
68        delmarkedscreen(115);
69        pluginaktiv = 0;
70        debug(10, "Permanent Time removed !!!");
71}
72
73
74//wird in der Pluginverwaltung bzw Menue ausfeguehrt
75void start(void)
76{
77        permtime_main();
78}
Note: See TracBrowser for help on using the repository browser.