ported from UXP: Issue #1636 - Part 1 - Decouple Gio from GConf and always build it with GTK (fc78eec9)

This commit is contained in:
2026-01-14 07:35:45 +08:00
parent fbba304a2d
commit 522108f715
14 changed files with 19 additions and 129 deletions
-2
View File
@@ -188,8 +188,6 @@ def old_configure_options(*options):
'--enable-gamepad',
'--enable-gconf',
'--enable-gczeal',
'--enable-gio',
'--enable-gnomeui',
'--enable-gold',
'--enable-hardware-aec-ns',
'--enable-icf',
-2
View File
@@ -1274,9 +1274,7 @@ hunspell.hxx
#if MOZ_SYSTEM_BZ2==1
bzlib.h
#endif
#ifdef MOZ_ENABLE_GIO
gio/gio.h
#endif
#if MOZ_SYSTEM_LIBEVENT==1
event.h
#else
+1 -4
View File
@@ -10,7 +10,4 @@ SOURCES += [
FINAL_LIBRARY = 'xul'
if CONFIG['MOZ_ENABLE_GNOMEUI']:
CXXFLAGS += CONFIG['MOZ_GNOMEUI_CFLAGS']
else:
CXXFLAGS += CONFIG['TK_CFLAGS']
CXXFLAGS += CONFIG['TK_CFLAGS']
@@ -11,9 +11,7 @@
#include "mozilla/EndianUtils.h"
#include <algorithm>
#ifdef MOZ_ENABLE_GIO
#include <gio/gio.h>
#endif
#include <gtk/gtk.h>
@@ -166,7 +164,6 @@ moz_gtk_icon_size(const char* name)
return GTK_ICON_SIZE_MENU;
}
#ifdef MOZ_ENABLE_GIO
static int32_t
GetIconSize(nsIMozIconURI* aIconURI)
{
@@ -300,7 +297,6 @@ nsIconChannel::InitWithGIO(nsIMozIconURI* aIconURI)
g_object_unref(buf);
return rv;
}
#endif // MOZ_ENABLE_GIO
nsresult
nsIconChannel::Init(nsIURI* aURI)
@@ -311,11 +307,7 @@ nsIconChannel::Init(nsIURI* aURI)
nsAutoCString stockIcon;
iconURI->GetStockIcon(stockIcon);
if (stockIcon.IsEmpty()) {
#ifdef MOZ_ENABLE_GIO
return InitWithGIO(iconURI);
#else
return NS_ERROR_NOT_AVAILABLE;
#endif
}
// Search for stockIcon
+1 -1
View File
@@ -562,7 +562,7 @@ nsIOService::GetProtocolHandler(const char* scheme, nsIProtocolHandler* *result)
return rv;
}
#ifdef MOZ_ENABLE_GIO
#ifdef MOZ_WIDGET_GTK
// check to see whether GVFS can handle this URI scheme. if it can
// create a nsIURI for the "scheme:", then we assume it has support for
// the requested protocol. otherwise, we failover to using the default
@@ -10,4 +10,4 @@ SOURCES += [
FINAL_LIBRARY = 'xul'
CXXFLAGS += CONFIG['MOZ_GIO_CFLAGS']
CXXFLAGS += CONFIG['TK_CFLAGS']
-81
View File
@@ -57,14 +57,12 @@ GLIB_VERSION=2.22
# 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.
# The macro won't be used when compiling with earlier versions anyway.
GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
GIO_VERSION=2.22
CAIRO_VERSION=1.10
GTK2_VERSION=2.18.0
GTK3_VERSION=3.4.0
GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
WINDRES_VERSION=2.14.90
W32API_VERSION=3.14
GNOMEUI_VERSION=2.2.0
GCONF_VERSION=1.2.1
STARTUP_NOTIFICATION_VERSION=0.8
DBUS_VERSION=0.60
@@ -2592,44 +2590,11 @@ dnl ========================================================
if test "$MOZ_X11"
then
dnl build the GIO extension by default only when the
dnl GTK2 toolkit is in use.
if test "$MOZ_ENABLE_GTK"
then
MOZ_ENABLE_GIO=1
MOZ_ENABLE_GCONF=1
fi
dnl ========================================================
dnl = GIO support module
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(gio,
[ --disable-gio Disable GIO support],
MOZ_ENABLE_GIO=,
MOZ_ENABLE_GIO=force)
if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
then
if test "$MOZ_WIDGET_TOOLKIT" = gtk2
then
PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
[AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
fi
PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
MOZ_ENABLE_GIO=1
AC_DEFINE(MOZ_ENABLE_GIO)
],[
if test "$MOZ_ENABLE_GIO" = "force"
then
AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
fi
MOZ_ENABLE_GIO=
])
fi
AC_SUBST(MOZ_ENABLE_GIO)
dnl ========================================================
dnl = GConf support module
dnl ========================================================
@@ -2681,38 +2646,6 @@ then
fi
AC_SUBST(MOZ_ENABLE_LIBPROXY)
dnl ========================================================
dnl = libgnomeui support module
dnl ========================================================
if test "$MOZ_ENABLE_GTK"
then
MOZ_ARG_ENABLE_BOOL(gnomeui,
[ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
MOZ_ENABLE_GNOMEUI=force,
MOZ_ENABLE_GNOMEUI=)
if test "$MOZ_ENABLE_GNOMEUI"
then
PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
[
MOZ_ENABLE_GNOMEUI=1
],[
if test "$MOZ_ENABLE_GNOMEUI" = "force"
then
AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
fi
MOZ_ENABLE_GNOMEUI=
])
fi
if test "$MOZ_ENABLE_GNOMEUI"; then
AC_DEFINE(MOZ_ENABLE_GNOMEUI)
fi
fi
AC_SUBST(MOZ_ENABLE_GNOMEUI)
dnl ========================================================
dnl = dbus support
dnl ========================================================
@@ -3793,20 +3726,6 @@ MOZ_ARG_ENABLE_STRING(extensions,
done],
MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
# Suppress warning on non-X11 platforms
if test -n "$MOZ_X11"; then
AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
fi
MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
fi
if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
MOZ_GIO_COMPONENT=1
MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
fi
AC_SUBST(MOZ_GIO_COMPONENT)
dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
dnl when trying to build a nonexistent extension.
for extension in $MOZ_EXTENSIONS; do
@@ -2651,7 +2651,7 @@ NS_IMETHODIMP nsDownload::SetRedirects(nsIArray* aRedirects) {
return NS_OK;
}
#ifdef MOZ_ENABLE_GIO
#ifdef MOZ_WIDGET_GTK
static void gio_set_metadata_done(GObject *source_obj, GAsyncResult *res, gpointer user_data)
{
GError *err = nullptr;
@@ -2820,7 +2820,7 @@ nsDownload::SetState(DownloadState aState)
#endif
}
#endif
#ifdef MOZ_ENABLE_GIO
#ifdef MOZ_WIDGET_GTK
// Use GIO to store the source URI for later display in the file manager.
GFile* gio_file = g_file_new_for_path(NS_ConvertUTF16toUTF8(path).get());
nsCString source_uri;
@@ -59,7 +59,7 @@ DownloadPlatform* DownloadPlatform::GetDownloadPlatform()
return gDownloadPlatformService;
}
#ifdef MOZ_ENABLE_GIO
#ifdef MOZ_WIDGET_GTK
static void gio_set_metadata_done(GObject *source_obj, GAsyncResult *res, gpointer user_data)
{
GError *err = nullptr;
@@ -131,7 +131,7 @@ nsresult DownloadPlatform::DownloadDone(nsIURI* aSource, nsIURI* aReferrer, nsIF
#endif
}
#endif
#ifdef MOZ_ENABLE_GIO
#ifdef MOZ_WIDGET_GTK
// Use GIO to store the source URI for later display in the file manager.
GFile* gio_file = g_file_new_for_path(NS_ConvertUTF16toUTF8(path).get());
nsCString source_uri;
+6 -5
View File
@@ -113,8 +113,8 @@ option('--enable-default-toolkit', nargs=1,
'cairo-cocoa', 'cairo-uikit', 'cairo-android', 'cairo-gonk'),
help='Select default toolkit')
@depends('--enable-default-toolkit', target)
def toolkit(value, target):
@depends('--enable-default-toolkit', target, '--help')
def toolkit(value, target, _):
# Define possible choices for each platform. The default is the first one
# listed when there are several.
os = target.os
@@ -514,13 +514,14 @@ include('nss.configure')
# Network protocol support
# ==============================================================
@depends(check_build_environment, '--help')
@depends(check_build_environment, toolkit_gtk, '--help')
@imports('os')
@imports(_from='__builtin__', _import='sorted')
def all_necko_protocols(build_env, _):
def all_necko_protocols(build_env, toolkit_gtk, _):
basedir = os.path.join(build_env.topsrcdir, 'netwerk', 'protocol')
return tuple(sorted(p for p in os.listdir(basedir)
if os.path.isdir(os.path.join(basedir, p))))
if (os.path.isdir(os.path.join(basedir, p)) and
(p != 'gio' or toolkit_gtk))))
default_necko_protocols = all_necko_protocols
+6 -10
View File
@@ -15,12 +15,11 @@ if CONFIG['MOZ_ENABLE_GCONF']:
'nsGConfService.cpp',
]
if CONFIG['MOZ_ENABLE_GIO']:
SOURCES += [
'nsGIOService.cpp',
'nsGSettingsService.cpp',
'nsPackageKitService.cpp'
]
SOURCES += [
'nsGIOService.cpp',
'nsGSettingsService.cpp',
'nsPackageKitService.cpp'
]
FINAL_LIBRARY = 'xul'
@@ -29,9 +28,6 @@ LOCAL_INCLUDES += [
]
CXXFLAGS += CONFIG['MOZ_GCONF_CFLAGS']
CXXFLAGS += CONFIG['MOZ_GIO_CFLAGS']
CXXFLAGS += CONFIG['GLIB_CFLAGS']
CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
CXXFLAGS += CONFIG['TK_CFLAGS']
CXXFLAGS += CONFIG['TK_CFLAGS']
-8
View File
@@ -12,36 +12,30 @@
#include "nsGConfService.h"
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGConfService, Init)
#endif
#ifdef MOZ_ENABLE_GIO
#include "nsGIOService.h"
#include "nsGSettingsService.h"
#include "nsPackageKitService.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsGIOService)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGSettingsService, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPackageKitService, Init)
#endif
#include "nsSystemAlertsService.h"
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemAlertsService, Init)
#ifdef MOZ_ENABLE_GCONF
NS_DEFINE_NAMED_CID(NS_GCONFSERVICE_CID);
#endif
#ifdef MOZ_ENABLE_GIO
NS_DEFINE_NAMED_CID(NS_GIOSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_GSETTINGSSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_PACKAGEKITSERVICE_CID);
#endif
NS_DEFINE_NAMED_CID(NS_SYSTEMALERTSSERVICE_CID);
static const mozilla::Module::CIDEntry kGnomeCIDs[] = {
#ifdef MOZ_ENABLE_GCONF
{ &kNS_GCONFSERVICE_CID, false, nullptr, nsGConfServiceConstructor },
#endif
#ifdef MOZ_ENABLE_GIO
{ &kNS_GIOSERVICE_CID, false, nullptr, nsGIOServiceConstructor },
{ &kNS_GSETTINGSSERVICE_CID, false, nullptr, nsGSettingsServiceConstructor },
{ &kNS_PACKAGEKITSERVICE_CID, false, nullptr, nsPackageKitServiceConstructor },
#endif
{ &kNS_SYSTEMALERTSSERVICE_CID, false, nullptr, nsSystemAlertsServiceConstructor },
{ nullptr }
};
@@ -50,11 +44,9 @@ static const mozilla::Module::ContractIDEntry kGnomeContracts[] = {
#ifdef MOZ_ENABLE_GCONF
{ NS_GCONFSERVICE_CONTRACTID, &kNS_GCONFSERVICE_CID },
#endif
#ifdef MOZ_ENABLE_GIO
{ NS_GIOSERVICE_CONTRACTID, &kNS_GIOSERVICE_CID },
{ NS_GSETTINGSSERVICE_CONTRACTID, &kNS_GSETTINGSSERVICE_CID },
{ NS_PACKAGEKITSERVICE_CONTRACTID, &kNS_PACKAGEKITSERVICE_CID },
#endif
{ NS_SYSTEMALERTSERVICE_CONTRACTID, &kNS_SYSTEMALERTSSERVICE_CID },
{ nullptr }
};
-3
View File
@@ -141,9 +141,6 @@ DIRS += [
'/other-licenses/snappy',
]
if CONFIG['MOZ_GIO_COMPONENT']:
DIRS += ['/extensions/gio']
DIRS += [
'/toolkit/library/StaticXULComponentsEnd',
'/toolkit/library',