/* returns: * 0 on success * 1 if data is empty * 2 if ConfigWriter cannot be initialized * */ int WriteIdentOptions (const char *filename, char *myname, IdentConfig * config, unsigned long flags) { ConfigDef *IdentConfigWriter = NULL; FreeStorageElem *Storage = NULL, **tail = &Storage; ConfigData cd ; if (config == NULL) return 1; cd.filename = filename ; if ((IdentConfigWriter = InitConfigWriter (myname, &IdentSyntax, CDT_Filename, cd)) == NULL) return 2; CopyFreeStorage (&Storage, config->more_stuff); if (config->style_defs) *tail = MyStyleDefinitionsList2free_storage (config->style_defs, &IdentSyntax); ADVANCE_LINKED_LIST_TAIL(tail); /* building free storage here */ /* writing config into the file */ cd.filename = filename ; WriteConfig (IdentConfigWriter, Storage, CDT_Filename, &cd, flags); DestroyFreeStorage (&Storage); DestroyConfig (IdentConfigWriter); if (Storage) { fprintf (stderr, "\n%s:Config Writing warning: Not all Free Storage discarded! Trying again...", myname); DestroyFreeStorage (&Storage); fprintf (stderr, (Storage != NULL) ? " failed." : " success."); } return 0; }
void DestroyBaseConfig (BaseConfig * config) { int i = MAX_TOOL_COMMANDS; destroy_string (&(config->module_path)); destroy_string (&(config->sound_path)); destroy_string (&(config->icon_path)); destroy_string (&(config->pixmap_path)); destroy_string (&(config->font_path)); destroy_string (&(config->cursor_path)); destroy_string (&(config->myname_path)); destroy_string (&(config->gtkrc_path)); destroy_string (&(config->gtkrc20_path)); destroy_string (&(config->IconTheme)); destroy_string (&(config->IconThemePath)); destroy_string (&(config->IconThemeFallback)); while (--i >= 0) { destroy_string (&(config->term_command[i])); destroy_string (&(config->browser_command[i])); destroy_string (&(config->editor_command[i])); } DestroyFreeStorage (&(config->more_stuff)); free (config); }
IdentConfig * ParseIdentOptions (const char *filename, char *myname) { ConfigData cd ; ConfigDef *IdentConfigReader ; IdentConfig *config = CreateIdentConfig (); FreeStorageElem *Storage = NULL; cd.filename = filename ; IdentConfigReader = InitConfigReader (myname, &IdentSyntax, CDT_Filename, cd, NULL); if (!IdentConfigReader) return config; PrintConfigReader (IdentConfigReader); ParseConfig (IdentConfigReader, &Storage); /* getting rid of all the crap first */ StorageCleanUp (&Storage, &(config->more_stuff), CF_DISABLED_OPTION); config->style_defs = free_storage2MyStyleDefinitionsList (Storage); DestroyConfig (IdentConfigReader); DestroyFreeStorage (&Storage); return config; }
void DestroyIdentConfig (IdentConfig * config) { DestroyMyStyleDefinitions (&(config->style_defs)); DestroyFreeStorage (&(config->more_stuff)); free (config); }
MyStyle *mystyle_find_or_get_from_file(struct ASHashTable *list, const char *name) { MyStyle *ms; if ((ms = mystyle_list_find (list, name)) == NULL) { char *fn = make_session_data_file (Session, False, S_IFREG, MYSTYLES_DIR, name, NULL ); if (fn == NULL) fn = make_session_data_file (Session, False, S_IFREG, MYSTYLES_DIR, "mystyle.", name, NULL ); if (fn == NULL) fn = make_session_data_file (Session, True, S_IFREG, MYSTYLES_DIR, name, NULL ); if (fn == NULL) fn = make_session_data_file (Session, True, S_IFREG, MYSTYLES_DIR, "mystyle.", name, NULL ); if (fn != NULL) { FreeStorageElem *Storage = NULL; MyStyleDefinition *msd = NULL; Storage = file2free_storage(fn, MyName, &MyStyleSyntax, NULL, NULL ); if( Storage ) { msd = free_storage_elem2MyStyleDefinition(Storage, name); DestroyFreeStorage (&Storage); if (msd != NULL) { ms = mystyle_create_from_definition (list, msd); DestroyMyStyleDefinitions (&msd); } } free (fn); } } return ms; }
void DestroyMyStyleDefinitions (MyStyleDefinition ** list) { if (*list) { MyStyleDefinition *pnext = *list ; while( pnext != NULL ) { MyStyleDefinition *pdef = pnext ; pnext = pdef->next ; destroy_string( &(pdef->Name)); destroy_string( &(pdef->Comment)); if (pdef->inherit) { int i = pdef->inherit_num ; while( --i >= 0 ) destroy_string( &(pdef->inherit[i])); free (pdef->inherit); } destroy_string( &(pdef->Font)); destroy_string( &(pdef->ForeColor)); destroy_string( &(pdef->BackColor)); destroy_string( &(pdef->back_pixmap)); destroy_string( &(pdef->overlay)); free_MSD_back_grad (pdef); DestroyFreeStorage (&(pdef->more_stuff)); free (pdef); } *list = NULL ; } }
ThemeConfig * ParseThemeFile (const char *filename, char *myname) { ThemeConfig *config ; ConfigData cd ; ConfigDef *ConfigReader; FreeStorageElem *Storage = NULL, *pCurr; ConfigItem item; cd.filename = filename ; ConfigReader = InitConfigReader (myname, &ThemeSyntax, CDT_Filename, cd, NULL); LOCAL_DEBUG_OUT( "ConfigReader is %p", ConfigReader ); if (!ConfigReader) return NULL; config = safecalloc( 1, sizeof(ThemeConfig ) ); PrintConfigReader (ConfigReader); ParseConfig (ConfigReader, &Storage); /* getting rid of all the crap first */ StorageCleanUp (&Storage, &(config->more_stuff), CF_DISABLED_OPTION); for (pCurr = Storage; pCurr; pCurr = pCurr->next) { if (pCurr->term == NULL) continue; if (!ReadConfigItem (&item, pCurr)) continue; switch (pCurr->term->id) { case FEEL_Function_ID : if( mystrncasecmp( item.data.string, THEME_INSTALL_FUNC_NAME, sizeof(THEME_INSTALL_FUNC_NAME))== 0 ) { if( config->install ) really_destroy_complex_func( config->install ); config->install = FreeStorage2ComplexFunction( pCurr, &item, NULL ); }else if( mystrncasecmp( item.data.string, THEME_APPLY_FUNC_NAME, sizeof(THEME_APPLY_FUNC_NAME) )== 0 ) { if( config->apply ) really_destroy_complex_func( config->apply ); config->apply = FreeStorage2ComplexFunction( pCurr, &item, NULL ); } break ; default: item.ok_to_free = 1; } } ReadConfigItem (&item, NULL); DestroyConfig (ConfigReader); DestroyFreeStorage (&Storage); return config; }
void DestroyASetRootConfig (ASetRootConfig * config) { if (config->my_desks) DestroyDeskBackConfig (&(config->my_desks)); if (config->my_backs) DestroyMyBackgroundConfig (&(config->my_backs)); DestroyMyStyleDefinitions (&(config->style_defs)); DestroyFreeStorage (&(config->more_stuff)); free (config); }
ASetRootConfig *ParseASetRootOptions (const char *filename, char *myname) { ConfigData cd; ConfigDef *ConfigReader; ASetRootConfig *config = CreateASetRootConfig (); MyBackgroundConfig **backs_tail = &(config->my_backs); DeskBackConfig **desks_tail = &(config->my_desks); FreeStorageElem *Storage = NULL, *pCurr; ConfigItem item; cd.filename = filename; ConfigReader = InitConfigReader (myname, &ASetRootSyntax, CDT_Filename, cd, NULL); if (!ConfigReader) return config; item.memory = NULL; PrintConfigReader (ConfigReader); ParseConfig (ConfigReader, &Storage); /* getting rid of all the crap first */ StorageCleanUp (&Storage, &(config->more_stuff), CF_DISABLED_OPTION); config->style_defs = free_storage2MyStyleDefinitionsList (Storage); for (pCurr = Storage; pCurr; pCurr = pCurr->next) { if (pCurr->term == NULL) continue; if (pCurr->term->id == BGR_MYBACKGROUND) { if ((*backs_tail = ParseMyBackgroundOptions (pCurr->sub, myname)) != NULL) backs_tail = &((*backs_tail)->next); continue; } if (!ReadConfigItem (&item, pCurr)) continue; switch (pCurr->term->id) { case BGR_DESK_BACK: if ((*desks_tail = ParseDeskBackOptions (&item, myname)) != NULL) desks_tail = &((*desks_tail)->next); break; default: item.ok_to_free = 1; } } ReadConfigItem (&item, NULL); FixDeskBacks (config); DestroyConfig (ConfigReader); DestroyFreeStorage (&Storage); return config; }
void DestroyAutoExecConfig (AutoExecConfig * config) { if( config->init ) really_destroy_complex_func( config->init ); if( config->restart ) really_destroy_complex_func( config->restart ); DestroyFreeStorage (&(config->more_stuff)); free (config); }
AutoExecConfig * ParseAutoExecOptions (const char *filename, char *myname) { ConfigData cd ; ConfigDef *ConfigReader; AutoExecConfig *config = CreateAutoExecConfig (); FreeStorageElem *Storage = NULL, *pCurr; ConfigItem item; cd.filename = filename ; ConfigReader = InitConfigReader (myname, &AutoExecSyntax, CDT_Filename, cd, NULL); if (!ConfigReader) return config; item.memory = NULL; PrintConfigReader (ConfigReader); ParseConfig (ConfigReader, &Storage); /* getting rid of all the crap first */ StorageCleanUp (&Storage, &(config->more_stuff), CF_DISABLED_OPTION); for (pCurr = Storage; pCurr; pCurr = pCurr->next) { if (pCurr->term == NULL) continue; if (!ReadConfigItem (&item, pCurr)) continue; switch (pCurr->term->id) { case FEEL_Function_ID : if( mystrncasecmp( item.data.string, "InitFunction", 12 ) == 0 ) { if( config->init ) really_destroy_complex_func( config->init ); config->init = FreeStorage2ComplexFunction( pCurr, &item, NULL ); }else if( mystrncasecmp( item.data.string, "RestartFunction", 15 ) == 0 ) { if( config->restart ) really_destroy_complex_func( config->restart ); config->restart = FreeStorage2ComplexFunction( pCurr, &item, NULL ); } break ; default: item.ok_to_free = 1; } } ReadConfigItem (&item, NULL); DestroyConfig (ConfigReader); DestroyFreeStorage (&Storage); return config; }
void DestroyThemeConfig (ThemeConfig * config) { if( config->install ) really_destroy_complex_func( config->install ); if( config->apply ) really_destroy_complex_func( config->apply ); DestroyFreeStorage (&(config->more_stuff)); free (config); }
void windowbox_parse (char *tline, FILE * fd, char **unused1, int *unused2) { FilePtrAndData fpd ; ConfigDef *ConfigReader ; FreeStorageElem *Storage = NULL, *more_stuff = NULL; ASWindowBox **aswbox_list = &(ASDefaultScr->Feel.window_boxes); unsigned int *count = &(ASDefaultScr->Feel.window_boxes_num); ASWindowBox *new_box ; ConfigData cd ; fpd.fp = fd ; fpd.data = safemalloc( 12+1+strlen(tline)+1+1 ) ; sprintf( fpd.data, "WindowBox %s\n", tline ); LOCAL_DEBUG_OUT( "fd(%p)->tline(\"%s\")->fpd.data(\"%s\")", fd, tline, fpd.data ); cd.fileptranddata = &fpd ; ConfigReader = InitConfigReader ((char*)get_application_name(), &WindowBoxSyntax, CDT_FilePtrAndData, cd, NULL); free( fpd.data ); if (!ConfigReader) return ; PrintConfigReader (ConfigReader); ParseConfig (ConfigReader, &Storage); /* getting rid of all the crap first */ StorageCleanUp (&Storage, &more_stuff, CF_DISABLED_OPTION); DestroyFreeStorage (&more_stuff); if( (new_box = ProcessWindowBoxOptions (Storage)) != NULL ) { int i = *count ; ++(*count) ; *aswbox_list = realloc( *aswbox_list, sizeof(ASWindowBox)*(i+1)); (*aswbox_list)[i] = *new_box ; free( new_box ); } DestroyConfig (ConfigReader); DestroyFreeStorage (&Storage); }
void flags_parse(char *tline, FILE * fd, char *myname, int *pflags, SyntaxDef *syntax, ASFlagType (*parse_flags)( FreeStorageElem *) ) { FreeStorageElem *Storage = NULL; if( pflags == NULL ) return; Storage = tline_subsyntax_parse(NULL, tline, fd, myname, syntax, NULL, NULL); if( Storage ) { *pflags = parse_flags(Storage); DestroyFreeStorage (&Storage); } }
void DestroySoundConfig (SoundConfig * config) { register int i ; for( i = EVENT_ID_END-EVENT_ID_START-1 ; i >=0 ; i-- ) if( config->sounds[i] ) free( config->sounds[i] ); if (config->pcmdevice) free (config->pcmdevice); DestroyFreeStorage (&(config->more_stuff)); free (config); }
int WriteAutoExecOptions (const char *filename, char *myname, AutoExecConfig * config, unsigned long flags) { ConfigDef *ConfigWriter = NULL; FreeStorageElem *Storage = NULL, **tail = &Storage; ConfigData cd ; if (config == NULL) return 1; cd.filename = filename ; if ((ConfigWriter = InitConfigWriter (myname, &AutoExecSyntax, CDT_Filename, cd)) == NULL) return 2; CopyFreeStorage (&Storage, config->more_stuff); if( config->init ) tail = ComplexFunction2FreeStorage( &AutoExecSyntax, tail, config->init ); if(config->restart) tail = ComplexFunction2FreeStorage( &AutoExecSyntax, tail, config->restart ); /* writing config into the file */ cd.filename = filename ; WriteConfig (ConfigWriter, Storage, CDT_Filename, &cd, flags); DestroyFreeStorage (&Storage); DestroyConfig (ConfigWriter); if (Storage) { fprintf (stderr, "\n%s:Config Writing warning: Not all Free Storage discarded! Trying again...", myname); DestroyFreeStorage (&Storage); fprintf (stderr, (Storage != NULL) ? " failed." : " success."); } return 0; }
void DestroyFeelConfig (FeelConfig * config) { register int i ; if( config->feel ) destroy_asfeel( config->feel, False ); if( config->menu_locations ) { for( i = 0 ; i < config->menu_locs_num ; i++ ) if( config->menu_locations[i] ) free( config->menu_locations[i] ); free( config->menu_locations ); } DestroyFreeStorage (&(config->more_stuff)); free (config); }
void DestroyWharfConfig (WharfConfig * config) { register int i; if (config->bg_color) free (config->bg_color); if (config->texture_color) free (config->texture_color); if (config->pixmap) free (config->pixmap); for (i = 0; i < WHEV_MAX_EVENTS; i++) if (config->sounds[i]) free (config->sounds[i]); while (config->root_folder) DestroyWharfButton (&(config->root_folder)); Destroy_balloonConfig (config->balloon_conf); DestroyFreeStorage (&(config->more_stuff)); free (config); }
/* returns: * 0 on success * 1 if data is empty * 2 if ConfigWriter cannot be initialized * */ int WriteWharfOptions (const char *filename, char *myname, WharfConfig * config, unsigned long flags) { ConfigDef *WharfConfigWriter = NULL; FreeStorageElem *Storage = NULL, **tail = &Storage; TermDef *folder_term = func2fterm (F_Folder, True); int i; if (config == NULL) return 1; folder_term->sub_syntax = &WharfSyntax; if ((WharfConfigWriter = InitConfigWriter (myname, &WharfSyntax, CDT_Filename, (void *)filename)) == NULL) return 2; CopyFreeStorage (&Storage, config->more_stuff); if (config->style_defs) *tail = MyStyleDefinitionsList2free_storage (config->style_defs, &WharfSyntax); if (config->balloon_conf) tail = balloon2FreeStorage (&WharfSyntax, tail, config->balloon_conf); /* building free storage here */ /* geometry */ if (get_flags (config->set_flags, WHARF_GEOMETRY)) tail = Geometry2FreeStorage (&WharfSyntax, tail, &(config->geometry), WHARF_Geometry_ID); if (get_flags (config->set_flags, WHARF_FORCE_SIZE)) tail = Geometry2FreeStorage (&WharfSyntax, tail, &(config->force_size), WHARF_ForceSize_ID); /* Integer values : */ /* rows */ if (get_flags (config->set_flags, WHARF_ROWS)) tail = Integer2FreeStorage (&WharfSyntax, tail, NULL, config->rows, WHARF_Rows_ID); /* columns */ if (get_flags (config->set_flags, WHARF_COLUMNS)) tail = Integer2FreeStorage (&WharfSyntax, tail, NULL, config->columns, WHARF_Columns_ID); /* withdraw_style */ if (get_flags (config->set_flags, WHARF_WITHDRAW_STYLE)) tail = Integer2FreeStorage (&WharfSyntax, tail, NULL, config->withdraw_style, WHARF_WithdrawStyle_ID); /* texture_type */ if (get_flags (config->set_flags, WHARF_TEXTURE_TYPE)) tail = Integer2FreeStorage (&WharfSyntax, tail, NULL, config->texture_type, WHARF_TextureType_ID); /* animate_steps */ if (get_flags (config->set_flags, WHARF_ANIMATE_STEPS)) tail = Integer2FreeStorage (&WharfSyntax, tail, NULL, config->animate_steps, WHARF_AnimateSteps_ID); /* animate_steps_main */ if (get_flags (config->set_flags, WHARF_ANIMATE_STEPS_MAIN)) tail = Integer2FreeStorage (&WharfSyntax, tail, NULL, config->animate_steps_main, WHARF_AnimateStepsMain_ID); /* animate_delay */ if (get_flags (config->set_flags, WHARF_ANIMATE_DELAY)) tail = Integer2FreeStorage (&WharfSyntax, tail, NULL, config->animate_delay, WHARF_AnimateDelay_ID); /* Flags : */ tail = Flags2FreeStorage (&WharfSyntax, tail, WharfFlags, 0xFFFFFFFF, config->set_flags); /* StringValues */ /* bg_color */ if (get_flags (config->set_flags, WHARF_BG_COLOR)) tail = String2FreeStorage (&WharfSyntax, tail, config->bg_color, WHARF_BgColor_ID); /* texture_color */ if (get_flags (config->set_flags, WHARF_TEXTURE_COLOR)) tail = String2FreeStorage (&WharfSyntax, tail, config->texture_color, WHARF_TextureColor_ID); /* pixmap name */ if (get_flags (config->set_flags, WHARF_PIXMAP)) tail = String2FreeStorage (&WharfSyntax, tail, config->pixmap, WHARF_Pixmap_ID); /* sound */ if (get_flags (config->set_flags, WHARF_SOUND)) for (i = 0; i < WHEV_MAX_EVENTS; i++) tail = String2FreeStorage (&WharfSyntax, tail, config->sounds[i], WHARF_Sound_ID); /* Writing Wharf Entries : */ if (config->root_folder) tail = WharfFolder2FreeStorage (&WharfSyntax, tail, config->root_folder, True); /* writing config into the file */ WriteConfig (WharfConfigWriter, Storage, CDT_Filename, (void **)&filename, flags); DestroyFreeStorage (&Storage); DestroyConfig (WharfConfigWriter); if (Storage) { fprintf (stderr, "\n%s:Config Writing warning: Not all Free Storage discarded! Trying again...", myname); DestroyFreeStorage (&Storage); fprintf (stderr, (Storage != NULL) ? " failed." : " success."); } return 0; }
WharfConfig *ParseWharfOptions (const char *filename, char *myname) { ConfigData cd; ConfigDef *ConfigReader; WharfConfig *config = CreateWharfConfig (); FreeStorageElem *Storage = NULL, *pCurr; ConfigItem item; TermDef *folder_term = func2fterm (F_Folder, False); cd.filename = filename; ConfigReader = InitConfigReader (myname, &WharfSyntax, CDT_Filename, cd, NULL /*WharfSpecialFunc */ ); if (!ConfigReader) return config; folder_term->sub_syntax = &WharfSyntax; item.memory = NULL; PrintConfigReader (ConfigReader); ParseConfig (ConfigReader, &Storage); /* getting rid of all the crap first */ StorageCleanUp (&Storage, &(config->more_stuff), CF_DISABLED_OPTION); config->balloon_conf = Process_balloonOptions (Storage, NULL, BALLOON_ID_START); config->style_defs = free_storage2MyStyleDefinitionsList (Storage); for (pCurr = Storage; pCurr; pCurr = pCurr->next) { if (pCurr->term == NULL) continue; if (ReadFlagItem (&(config->set_flags), &(config->flags), pCurr, WharfFlags)) { continue; } if (!ReadConfigItem (&item, pCurr)) continue; switch (pCurr->term->id) { case WHARF_Wharf_ID: item.ok_to_free = 1; ParseWharfFolder (&pCurr, &(config->root_folder)); break; case WHARF_Geometry_ID: set_flags (config->set_flags, WHARF_GEOMETRY); config->geometry = item.data.geometry; break; case WHARF_Rows_ID: set_flags (config->set_flags, WHARF_ROWS); config->rows = item.data.integer; break; case WHARF_Columns_ID: set_flags (config->set_flags, WHARF_COLUMNS); clear_flags (config->set_flags, WHARF_ROWS); config->columns = item.data.integer; break; case WHARF_WithdrawStyle_ID: set_flags (config->set_flags, WHARF_WITHDRAW_STYLE); config->withdraw_style = item.data.integer; break; case WHARF_ForceSize_ID: set_flags (config->set_flags, WHARF_FORCE_SIZE); config->force_size = item.data.geometry; /* errorneous value check */ if (!(config->force_size.flags & WidthValue)) config->force_size.width = 64; if (!(config->force_size.flags & HeightValue)) config->force_size.height = 64; config->force_size.flags = WidthValue | HeightValue; break; case WHARF_TextureType_ID: set_flags (config->set_flags, WHARF_TEXTURE_TYPE); config->texture_type = item.data.integer; break; case WHARF_BgColor_ID: set_string_value (&(config->bg_color), item.data.string, &(config->set_flags), WHARF_BG_COLOR); break; case WHARF_TextureColor_ID: set_string_value (&(config->texture_color), item.data.string, &(config->set_flags), WHARF_TEXTURE_COLOR); break; case WHARF_Pixmap_ID: set_string_value (&(config->pixmap), item.data.string, &(config->set_flags), WHARF_PIXMAP); break; case WHARF_AnimateStepsMain_ID: set_flags (config->set_flags, WHARF_ANIMATE_STEPS_MAIN); config->animate_steps_main = item.data.integer; break; case WHARF_AnimateSteps_ID: set_flags (config->set_flags, WHARF_ANIMATE_STEPS); config->animate_steps = item.data.integer; break; case WHARF_AnimateDelay_ID: set_flags (config->set_flags, WHARF_ANIMATE_DELAY); config->animate_delay = item.data.integer; break; case WHARF_Sound_ID: if (pCurr->sub == NULL) { if (pCurr->argc > 0) { register char *sound = mystrdup (pCurr->argv[pCurr->argc - 1]); set_string_value (&(config->sounds[WHEV_PUSH]), sound, &(config->set_flags), WHARF_SOUND); } } else if (pCurr->sub->argc > 0) { register char *sound = mystrdup (pCurr->sub->argv[0]); set_string_value (& (config-> sounds[WHEV_Id2Code (pCurr->sub->term->id)]), sound, &(config->set_flags), WHARF_SOUND); } item.ok_to_free = 1; break; ASCF_HANDLE_INTEGER_KEYWORD_CASE (WHARF, config, item, LabelLocation); ASCF_HANDLE_ALIGN_KEYWORD_CASE (WHARF, config, pCurr, AlignContents); ASCF_HANDLE_BEVEL_KEYWORD_CASE (WHARF, config, pCurr, Bevel); ASCF_HANDLE_SUBSYNTAX_KEYWORD_CASE (WHARF, config, pCurr, ShowHints, BalloonContents); ASCF_HANDLE_INTEGER_KEYWORD_CASE (WHARF, config, item, CompositionMethod); ASCF_HANDLE_INTEGER_KEYWORD_CASE (WHARF, config, item, FolderOffset); ASCF_HANDLE_INTEGER_KEYWORD_CASE (WHARF, config, item, OrthogonalFolderOffset); default: if (pCurr->term->type != TT_FLAG) item.ok_to_free = 1; } } if (get_flags (config->set_flags, WHARF_Bevel)) clear_flags (config->flags, WHARF_NO_BORDER); ReadConfigItem (&item, NULL); SHOW_CHECKPOINT; DestroyConfig (ConfigReader); SHOW_CHECKPOINT; DestroyFreeStorage (&Storage); SHOW_CHECKPOINT; return config; }
void myback_parse (char *tline, FILE * fd, char **myname, int *mylook) { FilePtrAndData fpd; ConfigDef *ConfigReader; MyBackgroundConfig *back_config = NULL; FreeStorageElem *Storage = NULL, *more_stuff = NULL; MyLook *look = (MyLook *) mylook; MyBackground *myback = NULL; ConfigData cd; if (look == NULL) look = get_screen_look (NULL); fpd.fp = fd; fpd.data = safemalloc (12 + 1 + strlen (tline) + 1 + 1); sprintf (fpd.data, "MyBackground %s\n", tline); LOCAL_DEBUG_OUT ("fd(%p)->tline(\"%s\")->fpd.data(\"%s\")", fd, tline, fpd.data); cd.fileptranddata = &fpd; ConfigReader = InitConfigReader ((char *)myname, &MyBackgroundSyntax, CDT_FilePtrAndData, cd, NULL); free (fpd.data); if (!ConfigReader) return; PrintConfigReader (ConfigReader); ParseConfig (ConfigReader, &Storage); /* getting rid of all the crap first */ StorageCleanUp (&Storage, &more_stuff, CF_DISABLED_OPTION); DestroyFreeStorage (&more_stuff); back_config = ParseMyBackgroundOptions (Storage, (char *)myname); DestroyConfig (ConfigReader); DestroyFreeStorage (&Storage); if (back_config == NULL) return; /* now we have to turn MyBackgroundConfig into MyBackground structure : */ myback = create_myback (back_config->name); if (get_flags (back_config->flags, BGFLAG_FILE)) myback->type = MB_BackImage; else if (get_flags (back_config->flags, BGFLAG_MYSTYLE)) myback->type = MB_BackMyStyle; else myback->type = MB_BackCmd; myback->data = back_config->data; back_config->data = NULL; if (get_flags (back_config->flags, BGFLAG_CUT)) myback->cut = back_config->cut; if (get_flags (back_config->flags, BGFLAG_SCALE)) { myback->scale = back_config->scale; if (!get_flags (back_config->scale.flags, WidthValue)) myback->scale.width = get_screen_width (NULL); if (!get_flags (back_config->scale.flags, HeightValue)) myback->scale.height = get_screen_height (NULL); set_flags (myback->scale.flags, WidthValue | HeightValue); } myback->tint = TINT_LEAVE_SAME; if (get_flags (back_config->flags, BGFLAG_TINT) && back_config->tint) parse_argb_color (back_config->tint, &(myback->tint)); myback->pad_color = ARGB32_Black; if (get_flags (back_config->flags, BGFLAG_PAD) && back_config->pad) parse_argb_color (back_config->pad, &(myback->pad_color)); myback->align_flags = NO_ALIGN; if (get_flags (back_config->flags, BGFLAG_PAD_HOR)) { if (get_flags (back_config->flags, BGFLAG_ALIGN_RIGHT)) myback->align_flags = ALIGN_RIGHT; else if (get_flags (back_config->flags, BGFLAG_ALIGN_CENTER)) myback->align_flags = ALIGN_HCENTER; else myback->align_flags = ALIGN_LEFT; } if (get_flags (back_config->flags, BGFLAG_PAD_VERT)) { if (get_flags (back_config->flags, BGFLAG_ALIGN_BOTTOM)) myback->align_flags |= ALIGN_BOTTOM; else if (get_flags (back_config->flags, BGFLAG_ALIGN_CENTER)) myback->align_flags |= ALIGN_VCENTER; else myback->align_flags = ALIGN_TOP; } LOCAL_DEBUG_OUT ("myback added: name(\"%s\")->type(%d)->data(\"%s\")", myback->name, myback->type, myback->data); add_myback (look, myback); /* final cleanup : */ DestroyMyBackgroundConfig (&back_config); }
SoundConfig * ParseSoundOptions (const char *filename, char *myname) { ConfigData cd ; ConfigDef *SoundConfigReader; SoundConfig *config = CreateSoundConfig (); FreeStorageElem *Storage = NULL, *pCurr; ConfigItem item; cd.filename = filename ; SoundConfigReader = InitConfigReader (myname, &SoundSyntax, CDT_Filename, cd, NULL); if (!SoundConfigReader) return config; item.memory = NULL; PrintConfigReader (SoundConfigReader); ParseConfig (SoundConfigReader, &Storage); /* getting rid of all the crap first */ StorageCleanUp (&Storage, &(config->more_stuff), CF_DISABLED_OPTION); for (pCurr = Storage; pCurr; pCurr = pCurr->next) { if (pCurr->term == NULL) continue; { if (!ReadConfigItem (&item, pCurr)) continue; switch (pCurr->term->id) { case SOUND_SOUND_ID: if( pCurr->sub ) { if( pCurr->sub->term && pCurr->sub->argv ) if( pCurr->sub->term->id >= EVENT_ID_START && pCurr->sub->term->id < EVENT_ID_END ) set_string( &(config->sounds[pCurr->sub->term->id-EVENT_ID_START]), mystrdup( pCurr->sub->argv[0] )); } break; case SOUND_PCMDEVICE_ID: //set_string( &(config->pcmdevice), item.data.string ); config->pcmdevice = item.data.string; break; case SOUND_PATH_ID: config->path = item.data.string; break; case SOUND_DEBUG_ID: config->debug = (int)item.data.integer; break; /* case SOUND_DELAY_ID: set_flags( config->set_flags, SOUND_SET_DELAY ); config->delay = (int)item.data.integer; break; */ /* case SOUND_RPLAY_HOST_ID: set_string_value( &(config->rplay_host), item.data.string, &(config->set_flags), SOUND_SET_RPLAY_HOST ); break; case SOUND_RPLAY_PRI_ID: set_flags( config->set_flags, SOUND_SET_RPLAY_PRIORITY ); config->rplay_priority = (int)item.data.integer; break; case SOUND_RPLAY_VOL_ID: set_flags( config->set_flags, SOUND_SET_RPLAY_VOLUME ); config->rplay_volume = (int)item.data.integer; break; */ default: item.ok_to_free = 1; } } } ReadConfigItem (&item, NULL); DestroyConfig (SoundConfigReader); DestroyFreeStorage (&Storage); return config; }
int WriteSoundOptions (const char *filename, char *myname, SoundConfig * config, unsigned long flags) { ConfigDef *SoundConfigWriter = NULL; FreeStorageElem *Storage = NULL, **tail = &Storage; register int i ; ConfigData cd ; if (config == NULL) return 1; cd.filename = filename ; if ((SoundConfigWriter = InitConfigWriter (myname, &SoundSyntax, CDT_Filename, cd)) == NULL) return 2; CopyFreeStorage (&Storage, config->more_stuff); /* building free storage here */ /* PCM Device */ if( config->pcmdevice ) tail = String2FreeStorage (&SoundSyntax, tail, config->pcmdevice, SOUND_PCMDEVICE_ID); if (config->debug) tail = Integer2FreeStorage (&SoundSyntax, tail, NULL, config->debug, SOUND_DEBUG_ID); /* delay */ /* if( get_flags(config->set_flags, SOUND_SET_DELAY) ) tail = Integer2FreeStorage (&SoundSyntax, tail, NULL, config->delay, SOUND_DELAY_ID); */ /* rplay_host */ // if (get_flags(config->set_flags, SOUND_SET_RPLAY_HOST) && config->rplay_host) // tail = String2FreeStorage (&SoundSyntax, tail, config->rplay_host, SOUND_RPLAY_HOST_ID); /* rplay_priority */ // if (get_flags(config->set_flags, SOUND_SET_RPLAY_PRIORITY)) // tail = Integer2FreeStorage (&SoundSyntax, tail, NULL, config->rplay_priority, SOUND_RPLAY_PRI_ID); /* rplay_volume */ // if( get_flags(config->set_flags, SOUND_SET_RPLAY_VOLUME) ) // tail = Integer2FreeStorage (&SoundSyntax, tail, NULL, config->rplay_volume, SOUND_RPLAY_VOL_ID); /* line structure */ for( i = EVENT_ID_END-EVENT_ID_START-1 ; i >=0 ; i-- ) if( config->sounds[i] ) { FreeStorageElem **dtail = tail ; tail = Flag2FreeStorage (&SoundSyntax, tail, SOUND_SOUND_ID); if( *dtail ) Path2FreeStorage (&SoundEventsSyntax, &((*dtail)->sub), NULL, config->sounds[i], EVENT_ID_START + i); } /* writing config into the file */ WriteConfig (SoundConfigWriter, Storage, CDT_Filename, &cd, flags); DestroyFreeStorage (&Storage); DestroyConfig (SoundConfigWriter); if (Storage) { fprintf (stderr, "\n%s:Config Writing warning: Not all Free Storage discarded! Trying again...", myname); DestroyFreeStorage (&Storage); fprintf (stderr, (Storage != NULL) ? " failed." : " success."); } return 0; }
BaseConfig *ParseBaseOptions (const char *filename, char *myname) { BaseConfig *config = CreateBaseConfig (); FreeStorageElem *Storage = NULL, *pCurr; ConfigItem item; Storage = file2free_storage (filename, myname, &BaseSyntax, NULL, &(config->more_stuff)); if (Storage == NULL) return config; item.memory = NULL; for (pCurr = Storage; pCurr; pCurr = pCurr->next) { if (pCurr->term == NULL) continue; if (ReadFlagItem (&(config->set_flags), &(config->flags), pCurr, BaseFlags)) continue; if (!ReadConfigItem (&item, pCurr)) continue; switch (pCurr->term->id) { case BASE_MODULE_PATH_ID: set_string (&(config->module_path), item.data.string); break; case BASE_SOUND_PATH_ID: set_string (&(config->sound_path), item.data.string); break; case BASE_ICON_PATH_ID: set_string (&(config->icon_path), item.data.string); break; case BASE_PIXMAP_PATH_ID: set_string (&(config->pixmap_path), item.data.string); break; case BASE_FONT_PATH_ID: set_string (&(config->font_path), item.data.string); break; case BASE_CURSOR_PATH_ID: set_string (&(config->cursor_path), item.data.string); break; case BASE_MYNAME_PATH_ID: set_string (&(config->myname_path), item.data.string); break; case BASE_GTKRC_PATH_ID: set_string (&(config->gtkrc_path), item.data.string); break; case BASE_GTKRC20_PATH_ID: set_string (&(config->gtkrc20_path), item.data.string); break; case BASE_DESKTOP_SIZE_ID: set_flags (config->set_flags, BASE_DESKTOP_SIZE_SET); config->desktop_size = item.data.geometry; /* errorneous value check */ if (!(config->desktop_size.flags & WidthValue)) config->desktop_size.width = 1; if (!(config->desktop_size.flags & HeightValue)) config->desktop_size.height = 1; config->desktop_size.flags = WidthValue | HeightValue; break; case BASE_DESKTOP_SCALE_ID: set_flags (config->set_flags, BASE_DESKTOP_SCALE_SET); config->desktop_scale = item.data.integer; /* errorneous value check */ if (config->desktop_scale < 1) config->desktop_scale = 1; break; case BASE_NoModuleNameCollisions_ID: set_flags (config->set_flags, BASE_NoModuleNameCollisions_SET); config->NoModuleNameCollisions = item.data.integer; break; case BASE_TermCommand_ID: if (item.index < MAX_TOOL_COMMANDS && item.index >= 0) set_string (&(config->term_command[item.index]), item.data.string); else item.ok_to_free = 1; break; case BASE_BrowserCommand_ID: if (item.index < MAX_TOOL_COMMANDS && item.index >= 0) set_string (&(config->browser_command[item.index]), item.data.string); else item.ok_to_free = 1; break; case BASE_EditorCommand_ID: if (item.index < MAX_TOOL_COMMANDS && item.index >= 0) set_string (&(config->editor_command[item.index]), item.data.string); else item.ok_to_free = 1; break; case BASE_IconTheme_ID: set_string (&(config->IconTheme), item.data.string); break; case BASE_IconThemePath_ID: set_string (&(config->IconThemePath), item.data.string); break; case BASE_IconThemeFallback_ID: set_string (&(config->IconThemeFallback), item.data.string); break; default: item.ok_to_free = 1; } } ReadConfigItem (&item, NULL); DestroyFreeStorage (&Storage); return config; }
/* returns: * 0 on success * 1 if data is empty * 2 if ConfigWriter cannot be initialized * */ int WriteBaseOptions (const char *filename, char *myname, BaseConfig * config, unsigned long flags) { ConfigDef *BaseConfigWriter = NULL; FreeStorageElem *Storage = NULL, **tail = &Storage; ConfigData cd; if (config == NULL) return 1; cd.filename = filename; if ((BaseConfigWriter = InitConfigWriter (myname, &BaseSyntax, CDT_Filename, cd)) == NULL) return 2; CopyFreeStorage (&Storage, config->more_stuff); /* building free storage here */ /* module_path */ tail = String2FreeStorage (&BaseSyntax, tail, config->module_path, BASE_MODULE_PATH_ID); /* icon_path */ tail = String2FreeStorage (&BaseSyntax, tail, config->icon_path, BASE_ICON_PATH_ID); /* pixmap_path */ tail = String2FreeStorage (&BaseSyntax, tail, config->pixmap_path, BASE_PIXMAP_PATH_ID); /* cursor_path */ tail = String2FreeStorage (&BaseSyntax, tail, config->cursor_path, BASE_CURSOR_PATH_ID); /* sound_path */ tail = String2FreeStorage (&BaseSyntax, tail, config->sound_path, BASE_SOUND_PATH_ID); /* myname_path */ tail = String2FreeStorage (&BaseSyntax, tail, config->myname_path, BASE_MYNAME_PATH_ID); /* IconTheme */ tail = String2FreeStorage (&BaseSyntax, tail, config->IconTheme, BASE_IconTheme_ID); /* IconThemePath */ tail = String2FreeStorage (&BaseSyntax, tail, config->IconThemePath, BASE_IconThemePath_ID); /* IconThemeFallback */ tail = String2FreeStorage (&BaseSyntax, tail, config->IconThemeFallback, BASE_IconThemeFallback_ID); /* desktop_size */ tail = Geometry2FreeStorage (&BaseSyntax, tail, &(config->desktop_size), BASE_DESKTOP_SIZE_ID); /* desktop_scale */ tail = Integer2FreeStorage (&BaseSyntax, tail, NULL, config->desktop_scale, BASE_DESKTOP_SCALE_ID); cd.filename = filename; /* writing config into the file */ WriteConfig (BaseConfigWriter, Storage, CDT_Filename, &cd, flags); DestroyFreeStorage (&Storage); DestroyConfig (BaseConfigWriter); return 0; }
/* returns: * 0 on success * 1 if data is empty * 2 if ConfigWriter cannot be initialized * */ int WriteFeelOptions (const char *filename, char *myname, FeelConfig * config, unsigned long flags) { ConfigDef *ConfigWriter = NULL; FreeStorageElem *Storage = NULL, **tail = &Storage; int i ; if (config == NULL) return 1; if ((ConfigWriter = InitConfigWriter (myname, &FeelSyntax, CDT_Filename, (void *) filename)) == NULL) return 2; CopyFreeStorage (&Storage, config->more_stuff); /* building free storage here */ /* flags : */ tail = Flags2FreeStorage (&FeelSyntax, tail, FeelFlagsXref, config->feel->flags, config->feel->flags); /* integer parameters : */ if (get_flags (config->feel->set_flags, FEEL_ClickTime)) tail = Integer2FreeStorage (&FeelSyntax, tail, NULL, config->feel->ClickTime, FEEL_ClickTime_ID); if (get_flags (config->feel->set_flags, FEEL_OpaqueMove)) tail = Integer2FreeStorage (&FeelSyntax, tail, NULL, config->feel->OpaqueMove, FEEL_OpaqueMove_ID); if (get_flags (config->feel->set_flags, FEEL_OpaqueResize)) tail = Integer2FreeStorage (&FeelSyntax, tail, NULL, config->feel->OpaqueResize, FEEL_OpaqueResize_ID); if (get_flags (config->feel->set_flags, FEEL_AutoRaise)) tail = Integer2FreeStorage (&FeelSyntax, tail, NULL, config->feel->AutoRaiseDelay, FEEL_AutoRaise_ID); if (get_flags (config->feel->set_flags, FEEL_AutoReverse)) tail = Integer2FreeStorage (&FeelSyntax, tail, NULL, config->feel->AutoReverse, FEEL_AutoReverse_ID); if (get_flags (config->feel->set_flags, FEEL_DeskAnimationType)) tail = Integer2FreeStorage (&FeelSyntax, tail, NULL, config->feel->DeskAnimationType, FEEL_DeskAnimationType_ID); if (get_flags (config->feel->set_flags, FEEL_DeskAnimationSteps)) tail = Integer2FreeStorage (&FeelSyntax, tail, NULL, config->feel->DeskAnimationSteps, FEEL_DeskAnimationSteps_ID); if (get_flags (config->feel->set_flags, FEEL_ShadeAnimationSteps)) tail = Integer2FreeStorage (&FeelSyntax, tail, NULL, config->feel->ShadeAnimationSteps, FEEL_ShadeAnimationSteps_ID); if (get_flags (config->feel->set_flags, FEEL_XorValue)) tail = Integer2FreeStorage (&FeelSyntax, tail, NULL, config->feel->XorValue, FEEL_XorValue_ID); if (get_flags (config->feel->set_flags, FEEL_Xzap)) tail = Integer2FreeStorage (&FeelSyntax, tail, NULL, config->feel->Xzap, FEEL_Xzap_ID); if (get_flags (config->feel->set_flags, FEEL_Yzap)) tail = Integer2FreeStorage (&FeelSyntax, tail, NULL, config->feel->Yzap, FEEL_Yzap_ID); for( i = 0 ; i < MAX_CURSORS ; i++ ) { if (config->feel->standard_cursors[i] != 0) tail = Integer2FreeStorage (&FeelSyntax, tail, &i, config->feel->standard_cursors[i], FEEL_Cursor_ID); if (config->feel->custom_cursors[i] != NULL) tail = ASCursor2FreeStorage (&FeelSyntax, tail, i, config->feel->custom_cursors[i], FEEL_CustomCursor_ID); } if (get_flags (config->feel->set_flags, FEEL_ClickToRaise)) Bitlist2FreeStorage( &FeelSyntax, tail, config->feel->RaiseButtons, FEEL_ClickToRaise_ID); if (get_flags (config->feel->set_flags, FEEL_EdgeScroll)) Integer2FreeStorage( &FeelSyntax, tail, &(config->feel->EdgeScrollX), config->feel->EdgeScrollY, FEEL_EdgeScroll_ID); if (get_flags (config->feel->set_flags, FEEL_EdgeResistance)) Integer2FreeStorage( &FeelSyntax, tail, &(config->feel->EdgeResistanceScroll), config->feel->EdgeResistanceMove, FEEL_EdgeResistance_ID); /* complex functions : */ if( config->feel->funcs_list ) if( config->feel->funcs_list->items_num ) { ComplexFunction **list ; list = safecalloc( config->feel->funcs_list->items_num, sizeof(ComplexFunction*)); if( (i = sort_hash_items( config->feel->funcs_list, NULL, (void**)list, 0 )) > 0 ) while ( --i >= 0 ) tail = ComplexFunction2FreeStorage( &FeelSyntax, tail, list[i]); free( list ); } /* menus */ /* menus writing require additional work due to the nature of the problem - * menus can come from file or directory or from feel file itself. * plus there has to be some mechanismus in place in order to preserve * .include configuration when menu is saved as directory. * Sasha. */ /* this is preliminary code that only saves menus into feel file itself - make sure * you remove all the other menus from the feel->menus_list prior to calling this */ if( config->feel->menus_list ) if( config->feel->menus_list->items_num ) { MenuData **list ; register int i ; list = safecalloc( config->feel->menus_list->items_num, sizeof(MenuData*)); if( (i = sort_hash_items( config->feel->menus_list, NULL, (void**)list, 0 )) > 0 ) while ( --i >= 0 ) tail = MenuData2FreeStorage( &FeelSyntax, tail, list[i]); free( list ); } /* mouse bindings : */ for( i = 0 ; i < MAX_MOUSE_BUTTONS+1 ; i++ ) { char btn_id[2] ; btn_id[0] = '0'+i ; btn_id[1] = '\0' ; tail = Contexts2FreeStorage( &FeelSyntax, tail, btn_id, &(config->feel->mouse[i]), FEEL_Mouse_ID ); } /* keyboard bindings : */ if( config->feel->keyboard ) if( config->feel->keyboard->items_num > 0 ) { ASHashableValue *keys; ASInputContexts **contexts; unsigned int items_num = config->feel->keyboard->items_num ; keys = safecalloc( items_num, sizeof(ASHashableValue) ); contexts = safecalloc( items_num, sizeof(ASInputContexts*) ); items_num = sort_hash_items( config->feel->keyboard, keys, (void**)contexts, 0 ); for( i = 0 ; i < items_num ; i++ ) { KeySym keysym = (KeySym)keys[i]; tail = Contexts2FreeStorage( &FeelSyntax, tail, XKeysymToString(keysym), contexts[i], FEEL_Key_ID ); } } /* writing config into the file */ WriteConfig (ConfigWriter, Storage, CDT_Filename, (void **) &filename, flags); DestroyFreeStorage (&Storage); DestroyConfig (ConfigWriter); if (Storage) { fprintf (stderr, "\n%s:Config Writing warning: Not all Free Storage discarded! Trying again...", myname); DestroyFreeStorage (&Storage); fprintf (stderr, (Storage != NULL) ? " failed." : " success."); } return 0; }
FeelConfig * ParseFeelOptions (const char *filename, char *myname) { ConfigData cd ; ConfigDef *ConfigReader; FeelConfig *config = CreateFeelConfig (); FreeStorageElem *Storage = NULL, *pCurr; ConfigItem item; cd.filename = filename ; ConfigReader = InitConfigReader (myname, &FeelSyntax, CDT_Filename, cd, BindingSpecialFunc); if (!ConfigReader) return config; item.memory = NULL; PrintConfigReader (ConfigReader); ParseConfig (ConfigReader, &Storage); /* getting rid of all the crap first */ StorageCleanUp (&Storage, &(config->more_stuff), CF_DISABLED_OPTION); for (pCurr = Storage; pCurr; pCurr = pCurr->next) { if (pCurr->term == NULL) continue; if (ReadFlagItem (NULL, &(config->feel->flags), pCurr, FeelFlagsXref)) continue; if (!ReadConfigItem (&item, pCurr)) continue; switch (pCurr->term->id) { case FEEL_ClickTime_ID : config->feel->ClickTime = item.data.integer; set_flags (config->feel->set_val_flags, FEEL_ClickTime); break ; case FEEL_OpaqueMove_ID : config->feel->OpaqueMove = item.data.integer; set_flags (config->feel->set_val_flags, FEEL_OpaqueMove); break ; case FEEL_OpaqueResize_ID : config->feel->OpaqueResize = item.data.integer; set_flags (config->feel->set_val_flags, FEEL_OpaqueResize); break ; case FEEL_AutoRaise_ID : config->feel->AutoRaiseDelay = item.data.integer; set_flags (config->feel->set_val_flags, FEEL_AutoRaise); break ; case FEEL_AutoReverse_ID : config->feel->AutoReverse = item.data.integer; set_flags (config->feel->set_val_flags, FEEL_AutoReverse); break ; case FEEL_ShadeAnimationSteps_ID : config->feel->ShadeAnimationSteps = item.data.integer; set_flags (config->feel->set_val_flags, FEEL_ShadeAnimationSteps); break ; case FEEL_XorValue_ID : config->feel->XorValue = item.data.integer; set_flags (config->feel->set_val_flags, FEEL_XorValue); break ; case FEEL_Xzap_ID : config->feel->Xzap = item.data.integer; set_flags (config->feel->set_val_flags, FEEL_Xzap); break ; case FEEL_Yzap_ID : config->feel->Yzap = item.data.integer; set_flags (config->feel->set_val_flags, FEEL_Yzap); break ; case FEEL_Cursor_ID : /* TT_INTEGER */ /* TODO: backport from as-devel : */ /*if ( item.index > 0 && item.index < MAX_CURSORS) config->feel->standard_cursors[item.index] = item.data.integer ; */ break ; case FEEL_CustomCursor_ID : /* TT_BUTTON */ /* TODO: backport from as-devel : */ /* if ( item.index > 0 && item.index < MAX_CURSORS) { if( config->feel->custom_cursors[item.index] ) destroy_ascursor( &(config->feel->custom_cursors[item.index])); config->feel->custom_cursors[item.index] = item.data.cursor ; } */ break ; case FEEL_ClickToRaise_ID : /* TT_BITLIST */ config->feel->RaiseButtons = item.data.integer ; set_flags (config->feel->set_val_flags, FEEL_ClickToRaise); set_flags (config->feel->set_flags, ClickToRaise); set_flags (config->feel->flags, ClickToRaise); break ; case FEEL_EdgeScroll_ID : /* TT_INTARRAY*/ item.ok_to_free = 1; if( item.data.int_array.size > 0 ) { config->feel->EdgeScrollX = item.data.int_array.array[0]; if( item.data.int_array.size > 1 ) config->feel->EdgeScrollY = item.data.int_array.array[1]; set_flags (config->feel->set_val_flags, FEEL_EdgeScroll ); } break ; case FEEL_EdgeResistance_ID : /* TT_INTARRAY*/ item.ok_to_free = 1; if( item.data.int_array.size > 0 ) { config->feel->EdgeResistanceScroll = item.data.int_array.array[0]; if( item.data.int_array.size > 1 ) config->feel->EdgeResistanceMove = item.data.int_array.array[1]; set_flags (config->feel->set_val_flags, FEEL_EdgeResistance ); } break ; case FEEL_Popup_ID : /* TODO: backport from as-devel : */ /* FreeStorage2MenuData( pCurr, &item, config->feel->Popups ); */ break ; case FEEL_Function_ID : FreeStorage2ComplexFunction( pCurr, &item, config->feel->ComplexFunctions ); break ; case FEEL_Mouse_ID : if( item.data.binding.sym ) if( isdigit( (int)item.data.binding.sym[0] ) && pCurr->sub ) { int button_num = item.data.binding.sym[0] - '0' ; if( button_num >= 0 && button_num <= MAX_MOUSE_BUTTONS && pCurr->sub->term->type == TT_FUNCTION ) { ConfigItem func_item ; func_item.memory = NULL ; if( ReadConfigItem( &func_item, pCurr->sub ) ) { MouseButton *tmp = safecalloc( 1, sizeof(MouseButton) ); tmp->Button = button_num ; tmp->Modifier = item.data.binding.mods ; tmp->Context = item.data.binding.context ; tmp->fdata = func_item.data.function ; func_item.data.function = NULL ; tmp->NextButton = config->feel->MouseButtonRoot ; config->feel->MouseButtonRoot = tmp ; } if( func_item.data.function ) { func_item.ok_to_free = 1; ReadConfigItem( &func_item, NULL ); } } } item.ok_to_free = 1; break ; case FEEL_Key_ID : ParseKeyBinding( &item, pCurr->sub, &(config->feel->FuncKeyRoot) ); break ; default: item.ok_to_free = 1; } } ReadConfigItem (&item, NULL); DestroyConfig (ConfigReader); DestroyFreeStorage (&Storage); return config; }