Ejemplo n.º 1
0
void gui_load()
{
    debug_start();

    pnd_app_get_list();
    cfg_gui_read();
    gui_load_skin();

    if ( ! ( nh = pnd_notify_init() ) )
    {
        debug_error ( "PND INOTIFY init problem spotted\n" );
    }

    if ( ! ( nh2 = pnd_dbusnotify_init() ) )
    {
        debug_error ( "PND DBUSINOTIFY init problem spotted\n" );
    }

    initStatusCalls();
    cpuUsage();
    getCPULoad();

    set_cpu( pmenu->cpu_mhz );

    debug_end();
}
Ejemplo n.º 2
0
void setup_notifications ( void ) {
  searchpath = notifypath;

  // if this is first time through, we can just set it up; for subsequent times
  // through, we need to close existing fd and re-open it, since we're too lame
  // to store the list of watches and 'rm' them
#if 1
  if ( nh ) {
    pnd_notify_shutdown ( nh );
    nh = 0;
  }
#endif

  // set up a new set of notifies
  if ( ! nh ) {
    nh = pnd_notify_init();
  }

  if ( ! nh ) {
    pnd_log ( pndn_rem, "INOTIFY failed to init.\n" );
    exit ( -1 );
  }

#if 0
  pnd_log ( pndn_rem, "INOTIFY is up.\n" );
#endif

  SEARCHPATH_PRE
  {

    pnd_log ( pndn_rem, "Watching path '%s' and its descendents.\n", buffer );
    pnd_notify_watch_path ( nh, buffer, PND_NOTIFY_RECURSE );

    //pnd_notify_watch_path ( nh, buffer, 0 /* no recurse */ );

  }
  SEARCHPATH_POST

#if 0
  sleep ( 1 ); // wait for events to trigger?

  // clear out any notifies we just created
  while ( pnd_notify_rediscover_p ( nh ) ) {
    usleep ( 100 ); // spin
  } // while
#endif

  return;
}
Ejemplo n.º 3
0
int main ( int argc, char *argv[] ) {

  pnd_notify_handle nh;

  nh = pnd_notify_init();

  if ( ! nh ) {
    printf ( "INOTIFY failed to init.\n" );
    exit ( 0 );
  }

  printf ( "INOTIFY is up.\n" );

  /* do it!
   */

  unsigned int countdown = 10;

  while ( countdown ) {
    printf ( "Countdown = %u\n", countdown );

    if ( pnd_notify_rediscover_p ( nh ) ) {
      printf ( "Must do a rediscover!\n" );
      break;
    }

    countdown--;
  }

  /* do it!
   */

  pnd_notify_shutdown ( nh );

  return ( 0 );
}