Reads icon theme from file.
Reads icon theme file from range of IniLikeReader, e.g. acquired from iniLikeFileReader or iniLikeStringReader.
Constructs IconThemeFile with empty "Icon Theme" group.
This alias allows to call functions related to "Icon Theme" group without need to call iconTheme explicitly.
Policy about reading extension groups (those start with 'X-').
Policy about reading groups with names which meaning is unknown, i.e. it's not extension nor relative directory path.
Iterating over subdirectories of icon theme.
Set cache object.
The object of loaded cache.
Path of icon theme cache file.
Icon Theme group in underlying file.
The name of the subdirectory index.theme was loaded from.
Removes group by name. This function will not remove "Icon Theme" group.
Try to load icon cache. Loaded icon cache will be used on icon lookup.
Unset loaded cache.
Join range of multiple values into a string using comma as separator. If range is empty, then the empty string is returned.
Some keys can have multiple values, separated by comma. This function helps to parse such kind of strings into the range.
Options to manage icon theme file reading
Behavior on duplicate key in the group.
Behavior on group with duplicate name in the file.
Behavior of ini-like file reading.
Behavior of ini-like file saving.
Wrapper for internal ListMap node.
Insert group into IniLikeFile object and use its name as key. Prerequisites: group must be non-null. It also should not be held by some other IniLikeFile object.
Append group to group list without associating group name with it. Can be used to add groups with duplicated names. Prerequisites: group must be non-null. It also should not be held by some other IniLikeFile object.
Add comment before groups. This function is called only in constructor and can be reimplemented in derived classes.
Add comment for group. This function is called only in constructor and can be reimplemented in derived classes.
Add key/value pair for group. This function is called only in constructor and can be reimplemented in derived classes.
Create IniLikeGroup by groupName during file parsing.
Reimplement in derive class.
Can be used in derived classes to create instance of IniLikeGroup.
Get group by name.
Get GroupNode by groupName.
Create new group using groupName.
Remove group by name. Do nothing if group with such name does not exist.
Range of groups in order how they were defined in file.
Iterate over GroupNodes.
Save object to the file using .ini-like format.
Save object to string using .ini like format.
Use Output range or delegate to retrieve strings line by line. Those strings can be written to the file or be showed in text area. Note: Output strings don't have trailing newline character.
File path where the object was loaded from.
Leading comments.
Add leading comment. This will be appended to the list of leadingComments. Note: # will be prepended automatically if line is not empty and does not have # at the start. The last new line character will be removed if present. Others will be replaced with whitespaces.
Prepend leading comment (e.g. for setting shebang line).
Remove all coments met before groups.
Move the group to make it the first.
Move the group to make it the last.
Move group before other.
Move group after other.
1 string contents = 2 `# First comment 3 [Icon Theme] 4 Name=Hicolor 5 Name[ru]=Стандартная тема 6 Comment=Fallback icon theme 7 Comment[ru]=Резервная тема 8 Hidden=true 9 Directories=16x16/actions,32x32/animations,scalable/emblems 10 Example=folder 11 Inherits=gnome,hicolor 12 13 [16x16/actions] 14 Size=16 15 Context=Actions 16 Type=Threshold 17 18 [32x32/animations] 19 Size=32 20 Context=Animations 21 Type=Fixed 22 23 [scalable/emblems] 24 Context=Emblems 25 Size=64 26 MinSize=8 27 MaxSize=512 28 Type=Scalable 29 30 # Will be saved. 31 [X-NoName] 32 Key=Value`; 33 34 string path = buildPath(".", "test", "Tango", "index.theme"); 35 36 auto iconTheme = new IconThemeFile(iniLikeStringReader(contents), path); 37 assert(equal(iconTheme.leadingComments(), ["# First comment"])); 38 assert(iconTheme.displayName() == "Hicolor"); 39 assert(iconTheme.localizedDisplayName("ru") == "Стандартная тема"); 40 assert(iconTheme.comment() == "Fallback icon theme"); 41 assert(iconTheme.localizedComment("ru") == "Резервная тема"); 42 assert(iconTheme.hidden()); 43 assert(equal(iconTheme.directories(), ["16x16/actions", "32x32/animations", "scalable/emblems"])); 44 assert(equal(iconTheme.inherits(), ["gnome", "hicolor"])); 45 assert(iconTheme.internalName() == "Tango"); 46 assert(iconTheme.example() == "folder"); 47 assert(iconTheme.group("X-NoName") !is null); 48 49 iconTheme.removeGroup("Icon Theme"); 50 assert(iconTheme.group("Icon Theme") !is null); 51 52 assert(iconTheme.cachePath() == buildPath(".", "test", "Tango", "icon-theme.cache")); 53 54 assert(equal(iconTheme.bySubdir().map!(subdir => tuple(subdir.name(), subdir.size(), subdir.minSize(), subdir.maxSize(), subdir.context(), subdir.type() )), 55 [tuple("16x16/actions", 16, 16, 16, "Actions", IconSubDir.Type.Threshold), 56 tuple("32x32/animations", 32, 32, 32, "Animations", IconSubDir.Type.Fixed), 57 tuple("scalable/emblems", 64, 8, 512, "Emblems", IconSubDir.Type.Scalable)])); 58 59 version(iconthemeFileTest) 60 { 61 string cachePath = iconTheme.cachePath(); 62 assert(cachePath.exists); 63 64 auto cache = new IconThemeCache(cachePath); 65 66 assert(iconTheme.cache is null); 67 iconTheme.cache = cache; 68 assert(iconTheme.cache is cache); 69 iconTheme.unloadCache(); 70 assert(iconTheme.cache is null); 71 72 assert(iconTheme.tryLoadCache(Flag!"allowOutdated".yes)); 73 } 74 75 iconTheme.removeGroup("scalable/emblems"); 76 assert(iconTheme.group("scalable/emblems") is null); 77 78 auto itf = new IconThemeFile(); 79 itf.displayName = "Oxygen"; 80 itf.comment = "Oxygen theme"; 81 itf.hidden = true; 82 itf.directories = ["actions", "places"]; 83 itf.inherits = ["locolor", "hicolor"]; 84 assert(itf.displayName() == "Oxygen"); 85 assert(itf.comment() == "Oxygen theme"); 86 assert(itf.hidden()); 87 assert(equal(itf.directories(), ["actions", "places"])); 88 assert(equal(itf.inherits(), ["locolor", "hicolor"]));
Class representation of index.theme file containing an icon theme description.