Ejemplo n.º 1
0
static void
idle_handler(void)
{
  ENTER("idle_handler(void)");

  pgSetIdle(IDLE_TIME, NULL);
  redraw_all();
  pgSetIdle(IDLE_TIME, &idle_handler);

  LEAVE;
}
Ejemplo n.º 2
0
void hide_call_info(void) {
  /* Turn off the idle handler, hide everything */
  pgSetIdle(0,NULL);
  pgSetWidget(wInfoBar,PG_WP_SIZE,0,0);
  pgSetWidget(wKeypad,PG_WP_SIZE,0,0);
  pgUpdate();
}
Ejemplo n.º 3
0
int main(int argc, char **argv) {
  pghandle wPGLbar,wBattbox;
  pgInit(argc,argv);

  /* Find the applet container */
  wPGLbar = pgFindWidget("PGL-AppletBar");
  if (!wPGLbar) {
    pgMessageDialog(argv[0],"This applet requires PGL",PG_MSGICON_ERROR);
    return 1;
  }
 
  wBattbox = pgNewWidget(PG_WIDGET_BOX,PG_DERIVE_INSIDE,wPGLbar);
  pgSetWidget(PGDEFAULT,
	      PG_WP_SIDE,PG_S_RIGHT,
	      0);

  pgNewWidget(PG_WIDGET_LABEL,PG_DERIVE_INSIDE,wBattbox);
  pgSetWidget(PGDEFAULT,
	      PG_WP_TEXT,pgNewString("Batt"),
	      PG_WP_SIDE,PG_S_RIGHT,
	      0);

  wBatt = pgNewWidget(PG_WIDGET_INDICATOR,0,0);
  pgSetWidget(PGDEFAULT,
	      PG_WP_SIDE,PG_S_RIGHT,
	      0);  

  /* Run it. */
  pgSetIdle(4000,&sysIdle);
  pgEventLoop();
   
  return 0;
}
Ejemplo n.º 4
0
static void
request_refresh(int zone)
{
  ENTER("request_refresh(int zone)");
  zone_to_refresh = zone;
  pgSetIdle(1, &idle_handler);
  LEAVE;
}
Ejemplo n.º 5
0
void idleHandlerAdd (pgidlehandler func)
{
    if (idleidx == IDLEMAX)
	return;

    idle[idleidx++] = func;

    if (idleidx == 1)
	pgSetIdle(50, idleHandler);
}
Ejemplo n.º 6
0
/* Prepare settings for use in updateTime */
void mungeSettings(void) {
  unsigned long t;

  /* Set clock font */
  pgSetWidget(currentClock.wClock,
	      PG_WP_FONT,currentClock.fClockFont,
	      0);
  
  /* Figure out the necessary update time */
  if (currentClock.flashColon)
    t = 500;
  else if (currentClock.enableSeconds)
    t = 1000;
  else
    t = 60000;
  pgSetIdle(t,&updateTime);

  /* Build a format string */
  currentClock.fmt1[0] = 0;              /* Start out blank */
  if (currentClock.enableWeekDay)
    strcat(currentClock.fmt1,"%a ");
  if (currentClock.enableMonth)
    strcat(currentClock.fmt1,"%b ");
  if (currentClock.enableDay)
    strcat(currentClock.fmt1,"%e ");
  if (currentClock.enable24hour)
    strcat(currentClock.fmt1,"%k");
  else
    strcat(currentClock.fmt1,"%l");
  strcat(currentClock.fmt1,":%M");
  if (currentClock.enableSeconds)        /* Careful with the colons... */
    strcat(currentClock.fmt1,":%S ");
  else
    strcat(currentClock.fmt1," ");
  if (!currentClock.enable24hour)
    strcat(currentClock.fmt1,"%p ");
  if (currentClock.enableYear)
    strcat(currentClock.fmt1,"%Y ");
  currentClock.fmt1[strlen(currentClock.fmt1)-1] = 0;  /* Chop extra space */

  /* Make secondary format string with optional colon flashing */
  strcpy(currentClock.fmt2,currentClock.fmt1);
  if (currentClock.flashColon) {
    /* Convert all colons to blanks */
    char *p = currentClock.fmt2;
    while (p = strchr(p,':'))
      *p = ' ';
  }

  /* Resize the applet if necessary */
  updateTime();
  pgUpdate();
}
Ejemplo n.º 7
0
int main(int argc, char **argv) {
  pghandle wLoadbox,fntLabel;

  pgInit(argc,argv);
  pgRegisterApp(PG_APP_TOOLBAR,"OmniBar-Helio",0);

  /* A font for our labels */
  fntLabel = pgNewFont(NULL,10,PG_FSTYLE_FIXED);

  /* Top-level widgets */

  pgNewWidget(PG_WIDGET_BUTTON,0,0);
  pgSetWidget(PGDEFAULT,
	      PG_WP_TEXT,pgNewString("App"),
	      PG_WP_EXTDEVENTS,PG_EXEV_PNTR_DOWN,
	      0);
  pgBind(PGDEFAULT,PG_WE_PNTR_DOWN,&btnAppMenu,NULL);

  pgNewWidget(PG_WIDGET_BUTTON,0,0);
  pgSetWidget(PGDEFAULT,
	      PG_WP_TEXT,pgNewString("Sys"),
	      PG_WP_EXTDEVENTS,PG_EXEV_PNTR_DOWN,
	      0);
  pgBind(PGDEFAULT,PG_WE_PNTR_DOWN,&btnSysMenu,NULL);

  wClock = pgNewWidget(PG_WIDGET_LABEL,0,0);
  pgSetWidget(PGDEFAULT,
	      PG_WP_SIDE,PG_S_RIGHT,
	      PG_WP_FONT,fntLabel,
	      PG_WP_TRANSPARENT,0,
	      0);

  pgNewWidget(PG_WIDGET_BOX,0,0);
  pgNewWidget(PG_WIDGET_LABEL,PG_DERIVE_INSIDE,PGDEFAULT);
  pgSetWidget(PGDEFAULT,
	      PG_WP_TEXT,pgNewString("Batt:"),
	      PG_WP_SIDE,PG_S_LEFT,
	      PG_WP_TRANSPARENT,1,
	      0);
  wBatt = pgNewWidget(PG_WIDGET_INDICATOR,0,0);
  pgSetWidget(PGDEFAULT,PG_WP_SIDE,PG_S_ALL,0);

  /* Run it. */
  pgSetIdle(5000,&sysIdle);
  pgEventLoop();
   
  return 0;
}
Ejemplo n.º 8
0
/* Show and hide the call info bar */
void show_call_info(struct phonecall *call) {
  current_call = call;
  old_connect_time = -1;

  /* Display info on this call 
   *
   * FIXME: pretty-print the phone number, so the user sees "(303) 555-1234"
   *        instead of "3035551234". Make sure to look up the appropriate specs
   *        so it does local calls, long distance, 10-digit dialing,
   *        and international correctly.
   */
  set_call_status(call,call->status);
  update_call_timer();
  pgSetIdle(500,update_call_timer);
  pgSetWidget(wKeypadBtn,
	      PG_WP_ON,0,
	      0);
  set_vfd_text(wPhoneNumber,"");
  pgSetWidget(wInfoBar,
	      PG_WP_SIZE,-1,    /* Automatic sizing */
	      0);
  pgUpdate();
}
Ejemplo n.º 9
0
void idleDelete(void)
{
    idleidx = 0;
    pgSetIdle(0, NULL);
}
Ejemplo n.º 10
0
int main(int argc, char **argv) {
  pghandle wAllBox, wTXbox, wRXbox;

  /* initialise and register the application */
  pgInit(argc,argv);
  pgRegisterApp(PG_APP_NORMAL,"Network Monitor",0);
  
  /* create a box for putting all the ting inside it */
  wAllBox = pgNewWidget(PG_WIDGET_BOX,0,0);

  /* create a widget which have the name of the interface to monitor */
  wDeviceName = pgNewWidget(PG_WIDGET_BUTTON, PG_DERIVE_INSIDE, wAllBox);
  pgSetWidget (PGDEFAULT,
	       //PG_WP_DIRECTION,PG_DIR_VERTICAL,
	       PG_WP_SIDE, PG_S_RIGHT,
	       PG_WP_EXTDEVENTS, PG_EXEV_PNTR_DOWN,
	       0);
  pgReplaceTextFmt (wDeviceName, "%s", DEFAULT_NETWORK_INTERFACE);
  pgBind (PGDEFAULT, PG_WE_PNTR_DOWN, &selectInterface, NULL);

  /* create the widgets for monitor the RX traffic */
  wRXlabel = pgNewWidget(PG_WIDGET_BUTTON, 0, 0);
  pgSetWidget (PGDEFAULT,
	       PG_WP_SIDE, PG_S_TOP,
	       PG_WP_EXTDEVENTS, PG_EXEV_PNTR_DOWN,
	       0);
  pgBind (PGDEFAULT, PG_WE_PNTR_DOWN, &changeDisplay, NULL);
  wRXbox = pgNewWidget(PG_WIDGET_BOX, 0,0);

  /* create the widgets for monitor the TX traffic */
  wTXlabel = pgNewWidget(PG_WIDGET_BUTTON,0,0);
  pgSetWidget (PGDEFAULT,
	       PG_WP_SIDE, PG_S_TOP,
	       PG_WP_EXTDEVENTS, PG_EXEV_PNTR_DOWN,
	       0);
  pgBind (PGDEFAULT, PG_WE_PNTR_DOWN, &changeDisplay, NULL);
  wTXbox = pgNewWidget(PG_WIDGET_BOX,0,0);

  /* add the RX gauge */
  pgNewWidget(PG_WIDGET_LABEL, PG_DERIVE_INSIDE, wRXbox);
  pgSetWidget(PGDEFAULT,
	      PG_WP_TEXT, pgNewString("RX"),
	      PG_WP_SIDE, PG_S_RIGHT,
	      0);
  wRX = pgNewWidget(PG_WIDGET_INDICATOR, 0,0);
  pgSetWidget(PGDEFAULT,
	      PG_WP_SIDE, PG_S_ALL,
	      0);

  /* add the TX gauge */
  pgNewWidget(PG_WIDGET_LABEL, PG_DERIVE_INSIDE, wTXbox);
  pgSetWidget(PGDEFAULT,
	      PG_WP_TEXT, pgNewString("TX"),
	      PG_WP_SIDE, PG_S_RIGHT,
	      0);
  wTX = pgNewWidget(PG_WIDGET_INDICATOR, 0,0);
  pgSetWidget(PGDEFAULT,
	      PG_WP_SIDE, PG_S_ALL,
	      0);

  /* put the monitoring in the idle time */
  pgSetIdle(IDLE_TIME,&sysIdle);

  /* the main loop */
  pgEventLoop();

  /* bye */
  return 0;

}