Bug 418131 - "Need a way to detect GTK+ version so we don't break users on major update" [p=ventnor.bugzilla@yahoo.com.au (Michael Ventnor) r=bsmedberg sr=dveditz a=blocking-firefox3+]

This commit is contained in:
reed@reedloden.com 2008-03-05 02:30:30 -08:00
Родитель aa8206b53b
Коммит ded0cb6cab
3 изменённых файлов: 32 добавлений и 6 удалений

Просмотреть файл

@ -1022,18 +1022,26 @@ function UpdateService() {
LOG("UpdateService", "XPCOM ABI unknown: updates are not possible."); LOG("UpdateService", "XPCOM ABI unknown: updates are not possible.");
} }
try { var osVersion;
var sysInfo = var sysInfo = Components.classes["@mozilla.org/system-info;1"]
Components.classes["@mozilla.org/system-info;1"]
.getService(Components.interfaces.nsIPropertyBag2); .getService(Components.interfaces.nsIPropertyBag2);
try {
gOSVersion = encodeURIComponent(sysInfo.getProperty("name") + " " + osVersion = sysInfo.getProperty("name") + " " + sysInfo.getProperty("version");
sysInfo.getProperty("version"));
} }
catch (e) { catch (e) {
LOG("UpdateService", "OS Version unknown: updates are not possible."); LOG("UpdateService", "OS Version unknown: updates are not possible.");
} }
if (osVersion) {
try {
osVersion += " (" + sysInfo.getProperty("secondaryLibrary") + ")";
}
catch (e) {
// Not all platforms have a secondary widget library, so an error is nothing to worry about.
}
gOSVersion = encodeURIComponent(osVersion);
}
#ifdef XP_MACOSX #ifdef XP_MACOSX
// Mac universal build should report a different ABI than either macppc // Mac universal build should report a different ABI than either macppc
// or mactel. // or mactel.

Просмотреть файл

@ -146,3 +146,7 @@ include $(topsrcdir)/config/rules.mk
DEFINES += -D_IMPL_NS_COM DEFINES += -D_IMPL_NS_COM
ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
CXXFLAGS += $(MOZ_GTK2_CFLAGS)
endif

Просмотреть файл

@ -39,6 +39,11 @@
#include "nsSystemInfo.h" #include "nsSystemInfo.h"
#include "prsystem.h" #include "prsystem.h"
#include "nsString.h" #include "nsString.h"
#include "prprf.h"
#ifdef MOZ_WIDGET_GTK2
#include <gtk/gtk.h>
#endif
nsSystemInfo::nsSystemInfo() nsSystemInfo::nsSystemInfo()
{ {
@ -75,6 +80,15 @@ nsSystemInfo::Init()
NS_WARNING("PR_GetSystemInfo failed"); NS_WARNING("PR_GetSystemInfo failed");
} }
#ifdef MOZ_WIDGET_GTK2
// This must be done here because NSPR can only separate OS's when compiled, not libraries.
char gtkver[15];
PR_snprintf(gtkver, sizeof(gtkver), "GTK %d.%d.%d", gtk_major_version, gtk_minor_version, gtk_micro_version);
rv = SetPropertyAsACString(NS_ConvertASCIItoUTF16("secondaryLibrary"),
nsDependentCString(gtkver));
NS_ENSURE_SUCCESS(rv, rv);
#endif
return NS_OK; return NS_OK;
} }