static int update_time(int zone) { ENTER("update_time(int zone)"); time_t now, then; struct tm *ltime; char buf[200]; char fmt[100]; int gh; time(&now); ltime = localtime(&now); gh = ltime->tm_hour; then = now + delta; ltime = localtime(&then); sprintf(fmt, "%%l:%%M:%%S %%p %%b %%e %s", zone_info); strftime(buf, sizeof(buf), fmt, ltime); DPRINTF(">>>> [%s] <<<\n", buf); pgReplaceText(ttl_text, buf); if(gmt_h!=gh) { draw_timebar(gh, zone, 1); gmt_h = gh; } LEAVE; return 1; }
int btnFileOpen(struct pgEvent *evt) { const char *str; str = pgFilePicker(NULL,NULL,NULL,PG_FILEOPEN,"Open a File"); if (str) pgReplaceText(wFileOpenBtn,str); return 0; }
/* Update the name and number of the current call. If either is NULL, the * existing value is retained. */ void set_call_id(struct phonecall *call, const char *name, const char *number) { if (name) { strncpy(call->name,name,MAX_NAME_LEN); pgReplaceText(wName,call->name); } if (number) { strncpy(call->number,number,MAX_PHONENUM_LEN); set_vfd_text(wPhoneNumber,call->number); } }
/* Update the current clock time */ void updateTime(void) { time_t now; struct tm *ltime; char buf[CLKMAX]; static int blink = 0; time(&now); ltime = localtime(&now); strftime(buf,CLKMAX,blink ? currentClock.fmt1 : currentClock.fmt2,ltime); blink = !blink; pgReplaceText(currentClock.wClock,buf); pgSubUpdate(currentClock.wClock); }
/* Update the status of the current call, * setting time stamps when applicable */ void set_call_status(struct phonecall *call,int status) { if (!call) return; call->original_status = call->status = status; if (!call->begin_time && status==CALL_INPROGRESS) call->begin_time = time(NULL); if (!call->end_time && status==CALL_COMPLETED) call->end_time = time(NULL); if (call==current_call) { pgReplaceText(wCallStatus,status_messages[call->status]); pgUpdate(); } }
void PG_SetCaption(_THIS, const char *title, const char *icon) { if (title != NULL) pgReplaceText(this->hidden->wApp, title); pgUpdate(); }