bool mod_dock_init() { if(!ioncore_register_regclass(&CLASSDESCR(WDock), (WRegionLoadCreateFn*)dock_load)){ return FALSE; } if(!mod_dock_register_exports()){ ioncore_unregister_regclass(&CLASSDESCR(WDock)); return FALSE; } dock_bindmap=ioncore_alloc_bindmap("WDock", NULL); if(dock_bindmap==NULL){ warn("Unable to allocate dock bindmap."); mod_dock_unregister_exports(); ioncore_unregister_regclass(&CLASSDESCR(WDock)); } extl_read_config("cfg_dock", NULL, TRUE); hook_add(clientwin_do_manage_alt, (WHookDummy*)clientwin_do_manage_hook); return TRUE; }
void gr_read_config() { extl_read_config("look", NULL, TRUE); /* If nothing has been loaded, try the default engine with * default settings. */ if(engines==NULL){ warn(TR("No drawing engines loaded, trying \"de\".")); gr_select_engine("de"); } }
bool ioncore_read_main_config(const char *cfgfile) { bool ret; int unset=0; if(cfgfile==NULL) cfgfile="cfg_notion"; ret=extl_read_config(cfgfile, ".", TRUE); unset+=(ioncore_screen_bindmap->nbindings==0); unset+=(ioncore_mplex_bindmap->nbindings==0); unset+=(ioncore_frame_bindmap->nbindings==0); if(unset>0){ warn(TR("Some bindmaps were empty, loading ioncore_efbb.")); extl_read_config("ioncore_efbb", NULL, TRUE); } return (ret && unset==0); }
bool mod_tiling_init() { if(!init_hooks()) goto err; mod_tiling_tiling_bindmap=ioncore_alloc_bindmap("WTiling", NULL); if(mod_tiling_tiling_bindmap==NULL) goto err; if(!mod_tiling_register_exports()) goto err; if(!register_regions()) goto err; extl_read_config("cfg_tiling", NULL, TRUE); return TRUE; err: mod_tiling_deinit(); return FALSE; }
int main(int argc, char*argv[]) { const char *mod=NULL; char *mod2=NULL; int loaded=0; int opt; bool quiet=FALSE; #ifndef CF_NO_LOCALE if(setlocale(LC_ALL, "")==NULL) warn("setlocale() call failed."); #endif configtab=extl_table_none(); libtu_init(argv[0]); #ifdef CF_RELOCATABLE_BIN_LOCATION prefix_set(argv[0], CF_RELOCATABLE_BIN_LOCATION); #endif extl_init(); if(!statusd_register_exports()) return EXIT_FAILURE; prefix_wrap_simple(extl_add_searchdir, EXTRABINDIR); prefix_wrap_simple(extl_add_searchdir, MODULEDIR); prefix_wrap_simple(extl_add_searchdir, ETCDIR); prefix_wrap_simple(extl_add_searchdir, SHAREDIR); prefix_wrap_simple(extl_add_searchdir, LCDIR); extl_set_userdirs(CF_ION_EXECUTABLE); optparser_init(argc, argv, OPTP_MIDLONG, ion_opts); extl_read_config("ioncore_luaext", NULL, TRUE); while((opt=optparser_get_opt())){ switch(opt){ /*case OPT_ID('d'): display=optparser_get_arg(); break;*/ case 's': extl_add_searchdir(optparser_get_arg()); break; /*case OPT_ID('s'): extl_set_sessiondir(optparser_get_arg()); break;*/ case 'h': help(); return EXIT_SUCCESS; case 'V': printf("%s\n", ION_VERSION); return EXIT_SUCCESS; case OPT_ID('a'): printf("%s\n\n%s", statusd_copy, TR(statusd_license)); return EXIT_SUCCESS; case 'c': { ExtlTab t; const char *f=optparser_get_arg(); if(extl_read_savefile(f, &t)){ extl_unref_table(configtab); configtab=t; }else{ warn(TR("Unable to load configuration file %s"), f); } } break; case 'q': quiet=TRUE; break; case 'm': mod=optparser_get_arg(); if(strchr(mod, '/')==NULL && strchr(mod, '.')==NULL){ mod2=scat("statusd_", mod); if(mod2==NULL) return EXIT_FAILURE; mod=mod2; } if(extl_read_config(mod, NULL, !quiet)) loaded++; if(mod2!=NULL) free(mod2); break; default: warn(TR("Invalid command line.")); help(); return EXIT_FAILURE; } } if(loaded==0 && !quiet){ warn(TR("No meters loaded.")); return EXIT_FAILURE; } mainloop(); return EXIT_SUCCESS; }