Ignore:
Timestamp:
01/06/13 20:38:43 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Added half of the support for AppSched? Triggers ABOUT, HELP and PREFERENCES. This includes support in roarpluginrunner

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarpluginrunner.c

    r5823 r5836  
    3535}; 
    3636 
     37#define OPTION_NONE        0x0000 
     38#define OPTION_TOUCH       0x0001 
     39#define OPTION_ABOUT       0x0100 
     40#define OPTION_HELP        0x0200 
     41#define OPTION_PREFERENCES 0x0400 
     42 
    3743static struct roar_dl_librarypara * g_para  = NULL; 
    3844static struct roar_scheduler      * g_sched = NULL; 
     
    5662        ); 
    5763 
     64 fprintf(stderr, "\nRunner Options:\n\n"); 
     65 fprintf(stderr, "    --option-touch       - Do not keep the plugin running:" 
     66                 "                           Do a single UPDATE cycle.\n" 
     67                 "    --option-no-touch    - Disable touch option.\n" 
     68                 "    --option-about       - Show an about dialog after startup.\n" 
     69                 "    --option-no-about    - Disable about option.\n" 
     70                 "    --option-help        - Show onlion help after startup.\n" 
     71                 "    --option-no-help     - Disable help option.\n" 
     72                 "    --option-preferences - Show preferences dialog after startup.\n" 
     73                 "    --option-no-preferences\n" 
     74                 "                         - Disable preferences option.\n" 
     75        ); 
     76 
    5877 fprintf(stderr, "\nCPI Options:\n\n"); 
    5978 fprintf(stderr, " -t --tcp                - Use TCP listen socket\n" 
     
    6988} 
    7089 
    71 static int do_run(const char * name) { 
     90static int do_run(const char * name, int options) { 
    7291 struct roar_scheduler_source s_container; 
    7392 struct roar_plugincontainer * cont = roar_plugincontainer_new(g_para); 
     
    92111 roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_INIT); 
    93112 
    94  roar_scheduler_run(g_sched); 
     113 if ( options & OPTION_ABOUT ) { 
     114  if ( roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_ABOUT) == -1 ) { 
     115   ROAR_WARN("Can not call ABOUT trigger: %s", roar_errorstring); 
     116  } 
     117 } 
     118 
     119 if ( options & OPTION_HELP ) { 
     120  if ( roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_HELP) == -1 ) { 
     121   ROAR_WARN("Can not call HELP trigger: %s", roar_errorstring); 
     122  } 
     123 } 
     124 
     125 if ( options & OPTION_PREFERENCES ) { 
     126  if ( roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_PREFERENCES) == -1 ) { 
     127   ROAR_WARN("Can not call PREFERENCES trigger: %s", roar_errorstring); 
     128  } 
     129 } 
     130 
     131 
     132 if ( !(options & OPTION_TOUCH) ) 
     133  roar_scheduler_run(g_sched); 
    95134 
    96135 roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_UPDATE); 
     
    303342} 
    304343 
    305 static int do_plugin(enum action action, const char * name) { 
     344static int do_plugin(enum action action, const char * name, int options) { 
    306345 switch (action) { 
    307346  case EXPLAIN: 
     
    310349  case RUN: 
    311350  case RUN_AS_APPLICATION: 
    312     return do_run(name); 
     351    return do_run(name, options); 
    313352   break; 
    314353  default: 
     
    558597 int cpi_touched = 0; 
    559598 const char * cpi_host = NULL; 
     599 int options = OPTION_NONE; 
    560600 
    561601 g_sched = roar_scheduler_new(ROAR_SCHEDULER_FLAG_NONE, ROAR_SCHEDULER_STRATEGY_DEFAULT); 
     
    618658   } 
    619659 
     660#define _option(name) \ 
     661  } else if ( !strcasecmp(k, "--option-" #name) ) { \ 
     662   options |= OPTION_ ## name; \ 
     663  } else if ( !strcasecmp(k, "--option-no-" #name) ) { \ 
     664   options |= OPTION_ ## name; \ 
     665   options -= OPTION_ ## name; 
     666#define __fix_vim_syntax_highlight } 
     667  _option(TOUCH) 
     668  _option(ABOUT) 
     669  _option(HELP) 
     670  _option(PREFERENCES) 
     671 
    620672  } else if ( !strcmp(k, "--appname") ) { 
    621673   appname = argv[++i]; 
     
    640692   } else { 
    641693    roar_err_set(ROAR_ERROR_NONE); 
    642     if ( do_plugin(action, k) == -1 ) { 
     694    if ( do_plugin(action, k, options) == -1 ) { 
    643695     fprintf(stderr, "Error loading plugin: %s\n", 
    644696                     roar_error != ROAR_ERROR_NONE ? roar_error2str(roar_error) : roar_dl_errstr(NULL)); 
Note: See TracChangeset for help on using the changeset viewer.