@@ -39,6 +39,8 @@ WinMain::WinMain(BaseObjectType* cobject,
3939
4040 pe = new PythonExecutor ();
4141
42+ set_systray ();
43+
4244 // get widgets
4345 m_refGlade -> get_widget ("lblDisplay" , lblDisplay );
4446 m_refGlade -> get_widget ("lblCycle" , lblCycle );
@@ -147,9 +149,10 @@ WinMain::~WinMain()
147149 if (pe != NULL ) delete (pe );
148150}
149151
150- void WinMain ::set_systray (Glib :: RefPtr < StatusIcon > tray )
152+ void WinMain ::set_systray ()
151153{
152- systray = tray ;
154+
155+ systray = Gtk ::StatusIcon ::create_from_file (GNOMATO_DATADIR "/tomato.png" );
153156
154157 //criacao do menu para o systray
155158 actMenu = Gtk ::ActionGroup ::create ();
@@ -289,14 +292,27 @@ void WinMain::load_tasks()
289292 trvTasks -> append_column (_ ("Title" ), mdlColumn .title );
290293}
291294
295+ void WinMain ::notify_with_gray_icon (const char * message )
296+ {
297+ notify (GNOMATO_DATADIR "/tomato-gray.png" , message );
298+ }
299+
300+ void WinMain ::notify_with_green_icon (const char * message )
301+ {
302+ notify (GNOMATO_DATADIR "/tomato-green.png" , message );
303+ }
304+
292305void WinMain ::notify (const char * message )
306+ {
307+ notify (GNOMATO_DATADIR "/tomato.png" , message );
308+ }
309+
310+ void WinMain ::notify (const char * icon , const char * message )
293311{
294312 NotifyNotification * notMessage ;
295313 GError * error = NULL ;
296314
297- notMessage = notify_notification_new ("Gnomato" ,
298- message ,
299- GNOMATO_DATADIR "/tomato.png" );
315+ notMessage = notify_notification_new ("Gnomato" , message , icon );
300316
301317 notify_notification_set_timeout (notMessage ,3000 );
302318
@@ -418,13 +434,19 @@ void WinMain::on_button_start_clicked()
418434 timeout .disconnect ();
419435
420436 execute ("on_pause" );
437+ set_gray_icon ();
421438
422439 }else {
423440 started = true;
424441 btnStart -> set_label (_ ("Pause" ));
425442 timeout = Glib ::signal_timeout ().connect (timer , 1000 );
426443
427444 execute ("on_start" );
445+ if (cycle_number % 2 ) {
446+ set_red_icon ();
447+ } else {
448+ set_green_icon ();
449+ }
428450
429451 }
430452}
@@ -524,8 +546,9 @@ bool WinMain::on_timeout(int timer_number)
524546 if (cycle_number % 2 ){
525547
526548 execute ("on_break" );
527-
528549 notify (_ ("Take a break" ));
550+ set_red_icon ();
551+
529552 inc_current_task ();
530553 if (cycle_number == 7 )
531554 time_elapsed = atoi (configs .long_interval .c_str ()) * 60 ;
@@ -536,7 +559,8 @@ bool WinMain::on_timeout(int timer_number)
536559
537560 execute ("on_work" );
538561
539- notify (_ ("End of break" ));
562+ notify_with_green_icon (_ ("End of break" ));
563+ set_green_icon ();
540564 time_elapsed = atoi (configs .work_interval .c_str ()) * 60 ;
541565 }
542566
@@ -557,7 +581,7 @@ bool WinMain::on_timeout(int timer_number)
557581bool WinMain ::on_inactive_timeout (int timer_number )
558582{
559583 if (!(currentTask && started )) {
560- notify (_ ("are you not doing anything?" ));
584+ notify_with_gray_icon (_ ("are you not doing anything?" ));
561585 }
562586
563587 check_inactive .disconnect ();
@@ -681,6 +705,21 @@ Glib::ustring WinMain::get_current_list()
681705 return cmbLists -> get_active_text ();
682706}
683707
708+ void WinMain ::set_green_icon ()
709+ {
710+ systray -> set_from_file (GNOMATO_DATADIR "/tomato-green.png" );
711+ }
712+
713+ void WinMain ::set_gray_icon ()
714+ {
715+ systray -> set_from_file (GNOMATO_DATADIR "/tomato-gray.png" );
716+ }
717+
718+ void WinMain ::set_red_icon ()
719+ {
720+ systray -> set_from_file (GNOMATO_DATADIR "/tomato.png" );
721+ }
722+
684723WinMain ::TasksView ::TasksView (BaseObjectType * cobject ,
685724 const Glib ::RefPtr < Gtk ::Builder > & refGlade )
686725: Gtk ::TreeView (cobject ),
0 commit comments