2 * Public domain source code.
5 * Joseph "looncraz" Groover <looncraz@satx.rr.com>
11 #include <Directory.h>
14 #include <ObjectList.h>
24 // NOTE: DecorInfo itself is not thread-safe
28 DecorInfo(const BString
& path
);
29 DecorInfo(const entry_ref
& ref
);
32 status_t
SetTo(const entry_ref
& ref
);
33 status_t
SetTo(BString path
);
34 status_t
InitCheck() const;
37 bool IsDefault() const;
40 // Returns "Default" for the default decorator
42 const entry_ref
* Ref() const;
43 // Returns NULL if virtual (default) or InitCheck() != B_OK
44 // The ref returned may NOT be the same as the one given to
45 // SetTo or the constructor - we may have traversed a Symlink!
48 BString
ShortcutName() const;
50 BString
Authors() const;
51 BString
ShortDescription() const;
52 BString
LongDescription() const;
53 BString
LicenseURL() const;
54 BString
LicenseName() const;
55 BString
SupportURL() const;
57 float Version() const;
58 time_t ModificationTime() const;
60 bool CheckForChanges(bool &deleted
);
63 void _Init(bool is_update
= false);
71 BString fShortDescription
;
72 BString fLongDescription
;
79 time_t fModificationTime
;
85 class DecorInfoUtility
{
87 DecorInfoUtility(bool scanNow
= true);
88 // NOTE: When scanNow is passed false,
89 // scanning will be performed lazily, such
90 // as in CountDecorators() and other
95 status_t
ScanDecorators();
96 // Can also be used to rescan for changes.
97 // Warning: potentially destructive as we
98 // will remove all DecorInfo objects which
99 // no longer have a file system cousin.
100 // TODO: Would a call-back mechanism be
103 int32
CountDecorators();
105 DecorInfo
* DecoratorAt(int32
);
107 DecorInfo
* FindDecorator(const BString
& string
);
108 // Checks for ref.name, path, fName, and
109 // "Default," an empty-string returns the
110 // current decorator NULL on match failure
112 DecorInfo
* CurrentDecorator();
113 DecorInfo
* DefaultDecorator();
115 bool IsCurrentDecorator(DecorInfo
* decor
);
117 status_t
SetDecorator(DecorInfo
* decor
);
118 status_t
SetDecorator(int32
);
120 status_t
Preview(DecorInfo
* decor
, BWindow
* window
);
123 DecorInfo
* _FindDecor(const BString
& path
);
125 status_t
_ScanDecorators(BDirectory decoratorDirectory
);
128 BObjectList
<DecorInfo
> fList
;
134 } // namespace BPrivate
137 using BPrivate::DecorInfo
;
138 using BPrivate::DecorInfoUtility
;
141 #endif // DECOR_INFO_H