summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Zhao <ztuowen@gmail.com>2015-09-04 08:55:16 -0600
committerJoe Zhao <ztuowen@gmail.com>2015-09-04 08:55:16 -0600
commit4797fa9af722263307f08b386458691a5b70fa29 (patch)
treea6c7153d0278049e3c90fdbdefd5d7008ff7471c
parent1c8adbdeaf48fd9a2d7aa827a5bc761ed21b4796 (diff)
downloadpomodori-4797fa9af722263307f08b386458691a5b70fa29.tar.gz
pomodori-4797fa9af722263307f08b386458691a5b70fa29.tar.bz2
pomodori-4797fa9af722263307f08b386458691a5b70fa29.zip
misc
-rw-r--r--main.cpp2
-rw-r--r--totimer.cpp11
-rw-r--r--totimer.h3
3 files changed, 12 insertions, 4 deletions
diff --git a/main.cpp b/main.cpp
index a997880..43a7764 100644
--- a/main.cpp
+++ b/main.cpp
@@ -10,7 +10,7 @@ int main(int argc, char** argv)
notify_init("Tomodori");
tres lastres;
lastres.time=0;
- settimer(&lastres,1);
+ settimer(&lastres,POTIME);
gtk_main();
return 0;
} \ No newline at end of file
diff --git a/totimer.cpp b/totimer.cpp
index b632ebf..66a6b52 100644
--- a/totimer.cpp
+++ b/totimer.cpp
@@ -3,7 +3,7 @@
//
#include "totimer.h"
-#include<stdlib.h>
+#include<stdio.h>
void quit(NotifyNotification *note,gpointer user_data)
{
@@ -16,7 +16,7 @@ void timeup(NotifyNotification *note,const char *action,gpointer user_data){
tres* lastres = (tres*)user_data;
switch (action[0]){
case 'M':
- settimer(lastres, 5);
+ settimer(lastres, POTEXT);
break;
case 'G':
log(lastres,1);
@@ -32,7 +32,12 @@ bool notify(gpointer user_data)
{
tres* lastres = (tres*)user_data;
NotifyNotification *n;
- n = notify_notification_new ("Tomodori","Time's Up", NULL);
+ char str[20];
+ if (lastres->time>POTIME)
+ sprintf(str,"Time's up!(%d)",lastres->time-POTIME);
+ else
+ sprintf(str,"Time's up!");
+ n = notify_notification_new ("Tomodori",str, NULL);
notify_notification_set_urgency(n,NOTIFY_URGENCY_CRITICAL);
notify_notification_add_action(n,"M", "More",(NotifyActionCallback)timeup,lastres,NULL);
notify_notification_add_action(n,"G", "Good",(NotifyActionCallback)timeup,lastres,NULL);
diff --git a/totimer.h b/totimer.h
index 19c51b9..ac8f1ef 100644
--- a/totimer.h
+++ b/totimer.h
@@ -9,6 +9,9 @@
#include "logging.h"
#include "glib.h"
+#define POTIME 25
+#define POTEXT 5
+
bool notify(gpointer user_data);
int settimer(tres* lastres,guint32 wait);