Rework the handling of catalog loading in locale kit :

Instead of computing the mime signature and giving this to the catalog system,
give an entry_ref instead. The default catalog add-on can thus look at the
right place when searching local catalogs (embedded as resources, or stored
as files next to the executable.
  * This allows different versions of the same app to each have their own
catalog set,
  * And also make the embedded/local catalog searching work for add-ons and
libs, instead it only worked for apps because of a getAppInfo call.

Fix cpufrequency to make use of it properly (that wouldhave worked without the
change, but nowit's mandatory, since loading a catlog by mimesignature is not
possible anymore).

Should fix #8037.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43021 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues
2011-10-31 08:57:09 +00:00
parent ef9641e111
commit 54fad654ce
12 changed files with 110 additions and 142 deletions
+2 -2
View File
@@ -20,7 +20,7 @@ struct entry_ref;
class BCatalog {
public:
BCatalog();
BCatalog(const char* signature,
BCatalog(const entry_ref& catalogOwner,
const char* language = NULL,
uint32 fingerprint = 0);
virtual ~BCatalog();
@@ -42,7 +42,7 @@ public:
status_t GetLanguage(BString* language);
status_t GetFingerprint(uint32* fingerprint);
status_t SetCatalog(const char* signature,
status_t SetCatalog(const entry_ref& catalogOwner,
uint32 fingerprint);
status_t InitCheck() const;
+3 -3
View File
@@ -24,7 +24,7 @@ namespace BPrivate {
*/
class DefaultCatalog : public BHashMapCatalog {
public:
DefaultCatalog(const char *signature, const char *language,
DefaultCatalog(const entry_ref &catalogOwner, const char *language,
uint32 fingerprint);
// constructor for normal use
DefaultCatalog(entry_ref *appOrAddOnRef);
@@ -45,10 +45,10 @@ class DefaultCatalog : public BHashMapCatalog {
status_t WriteToResource(entry_ref *appOrAddOnRef);
status_t SetRawString(const CatKey& key, const char *translated);
void SetSignature(const entry_ref &catalogOwner);
static BCatalogAddOn *Instantiate(const char *signature,
static BCatalogAddOn *Instantiate(const entry_ref& catalogOwner,
const char *language, uint32 fingerprint);
static BCatalogAddOn *InstantiateEmbedded(entry_ref *appOrAddOnRef);
static BCatalogAddOn *Create(const char *signature,
const char *language);
+2 -4
View File
@@ -48,10 +48,9 @@ public:
status_t GetSystemCatalog(BCatalogAddOn** catalog) const;
BCatalogAddOn* LoadCatalog(const char* signature,
BCatalogAddOn* LoadCatalog(const entry_ref& catalogOwner,
const char* language = NULL,
int32 fingerprint = 0) const;
BCatalogAddOn* LoadEmbeddedCatalog(entry_ref* appOrAddOnRef);
status_t UnloadCatalog(BCatalogAddOn* addOn);
BCatalogAddOn* CreateCatalog(const char* type,
@@ -60,7 +59,7 @@ public:
};
typedef BCatalogAddOn* (*InstantiateCatalogFunc)(const char* name,
typedef BCatalogAddOn* (*InstantiateCatalogFunc)(const entry_ref& catalogOwner,
const char* language, uint32 fingerprint);
typedef BCatalogAddOn* (*CreateCatalogFunc)(const char* name,
@@ -77,7 +76,6 @@ typedef status_t (*GetAvailableLanguagesFunc)(BMessage*, const char*,
*/
struct CatalogAddOnInfo {
InstantiateCatalogFunc fInstantiateFunc;
InstantiateEmbeddedCatalogFunc fInstantiateEmbeddedFunc;
CreateCatalogFunc fCreateFunc;
GetAvailableLanguagesFunc fLanguagesFunc;