date/time in statusbar



Hello,

I am working on an Gtkmm application that demands the
current date/time in  the application statusbar. I am
able to take the current time and put it in the
statusbar, but when I'm trying to display the current
time dynamically into the status bar, i get a
segmentation fault.

I am "using g_timeout_add" function to call at each
second the function that put time in the status bar.
Here is the code :

gboolean MainPage::checkTime(void){

time_t timp;
time(&timp);
Glib::ustring strtime(ctime(&timp));
// cout<<strtime<<endl;

status.statusBar->pop();
  Gtk::Label *timeLabel = new Gtk::Label(strtime);
  status.statusBar->pack_end(*timeLabel,
Gtk::PACK_SHRINK);
status.statusBar->push(strtime);

return true;

}

..............................................
g_timeout_add(1000,(GSourceFunc)checkTime(),NULL);

Can anyone tell me what is wrong with my code or give
me an idea how to do this?

Thank you .
    Anka 


		
____________________________________________________
Sell on Yahoo! Auctions ? no fees. Bid on great items.  
http://auctions.yahoo.com/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]