Bug 635918 part 2 - Provide additional recommended properties when playing samples via libcanberra r=kinetik

--HG--
extra : transplant_source : %A1%1E%FD%85%2C%EE%E8%C0%96%E1%A7/%0BD%F3C%CB%D2%7D%EF
This commit is contained in:
Chris Coulson 2012-01-11 11:37:40 +13:00
parent 5b4e6e4a03
commit 7259b3bb98
2 changed files with 30 additions and 1 deletions

View File

@ -131,7 +131,7 @@ CXXFLAGS += $(MOZ_GCONF_CFLAGS)
endif
endif
DEFINES += -DCAIRO_GFX
DEFINES += -DCAIRO_GFX -DMOZ_APP_NAME='"$(MOZ_APP_NAME)"'
INCLUDES += \
-I$(srcdir)/../xpwidgets \

View File

@ -55,6 +55,9 @@
#include "nsDirectoryService.h"
#include "nsDirectoryServiceDefs.h"
#include "mozilla/FileUtils.h"
#include "mozilla/Services.h"
#include "nsIStringBundle.h"
#include "nsIXULAppInfo.h"
#include <stdio.h>
#include <unistd.h>
@ -148,6 +151,32 @@ ca_context_get_default()
}
}
nsCOMPtr<nsIStringBundleService> bundleService =
mozilla::services::GetStringBundleService();
if (bundleService) {
nsCOMPtr<nsIStringBundle> brandingBundle;
bundleService->CreateBundle("chrome://branding/locale/brand.properties",
getter_AddRefs(brandingBundle));
if (brandingBundle) {
nsAutoString wbrand;
brandingBundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
getter_Copies(wbrand));
NS_ConvertUTF16toUTF8 brand(wbrand);
ca_context_change_props(ctx, "application.name", brand.get(), NULL);
}
}
nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
if (appInfo) {
nsCAutoString version;
appInfo->GetVersion(version);
ca_context_change_props(ctx, "application.version", version.get(), NULL);
}
ca_context_change_props(ctx, "application.icon_name", MOZ_APP_NAME, NULL);
return ctx;
}