From 9522d27dfa364b64a0fe5d87585b8a3309fbb92a Mon Sep 17 00:00:00 2001 From: Sobhan Mohammadpour Date: Tue, 12 Feb 2013 22:09:39 +0330 Subject: [PATCH] gnome-shell-3.7.5-networkmanager-flag [ Alexandre Rostovtsev : * use config.js (and AC_SUBST HAVE_NETWORKMANAGER appropriately); * take care to not import ui.status.network if nm is disabled; * do not try to reassign to const variables; * no point really in fiddling with the list of installed js files; * don't build shell-mobile-providers if nm is disabled; * use "networkmanager" instead of "network_manager" because THE BIKESHED SHOULD BE BLUE, also because the upstream package name is NetworkManager, not Network_Manager. --- configure.ac | 42 ++++++++++++++++++++++++++++++++++++++++++ js/Makefile.am | 1 + js/misc/config.js.in | 2 ++ js/ui/panel.js | 12 +++++++----- js/ui/sessionMode.js | 7 ++++++- src/Makefile.am | 15 ++++++++++++--- 6 files changed, 70 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 1a2b947..683a3db 100644 --- a/configure.ac +++ b/configure.ac @@ -164,6 +164,36 @@ if test "$langinfo_ok" = "yes"; then [Define if _NL_TIME_FIRST_WEEKDAY is available]) fi +NM_MIN_VERSION=0.9.6 +AC_ARG_ENABLE(networkmanager, + AS_HELP_STRING([--disable-networkmanager], + [disable NetworkManager support @<:@default=auto@:>@]),, + [enable_networkmanager=auto]) + +if test "x$enable_networkmanager" != "xno"; then + PKG_CHECK_MODULES(NETWORKMANAGER, + [libnm-glib libnm-util gnome-keyring-1], + [have_networkmanager=yes], + [have_networkmanager=no]) + + GNOME_SHELL_CFLAGS="$GNOME_SHELL_CFLAGS $NETWORKMANAGER_CFLAGS" + GNOME_SHELL_LIBS="$GNOME_SHELL_LIBS $NETWORKMANAGER_LIBS" +else + have_networkmanager="no (disabled)" +fi + +if test "x$have_networkmanager" = "xyes"; then + AC_DEFINE(HAVE_NETWORKMANAGER, [1], [Define if we have NetworkManager]) + AC_SUBST([HAVE_NETWORKMANAGER], [1]) +else + if test "x$enable_networkmanager" = "xyes"; then + AC_MSG_ERROR([Couldn't find NetworkManager.]) + fi + AC_SUBST([HAVE_NETWORKMANAGER], [0]) +fi + +AM_CONDITIONAL(HAVE_NETWORKMANAGER, test "$have_networkmanager" = "yes") + # Sets GLIB_GENMARSHAL and GLIB_MKENUMS AM_PATH_GLIB_2_0() @@ -209,3 +239,15 @@ AC_CONFIG_FILES([ man/Makefile ]) AC_OUTPUT + +echo " +Build configuration: + + Prefix: ${prefix} + Source code location: ${srcdir} + Compiler: ${CC} + Compiler Warnings: $enable_compile_warnings + + Support for NetworkManager: $have_networkmanager + Support for GStreamer recording: $build_recorder +" diff --git a/js/Makefile.am b/js/Makefile.am index 323cd1b..d17111a 100644 --- a/js/Makefile.am +++ b/js/Makefile.am @@ -8,6 +8,7 @@ misc/config.js: misc/config.js.in Makefile sed -e "s|[@]PACKAGE_NAME@|$(PACKAGE_NAME)|g" \ -e "s|[@]PACKAGE_VERSION@|$(PACKAGE_VERSION)|g" \ -e "s|[@]HAVE_BLUETOOTH@|$(HAVE_BLUETOOTH)|g" \ + -e "s|[@]HAVE_NETWORKMANAGER@|$(HAVE_NETWORKMANAGER)|g" \ -e "s|[@]GETTEXT_PACKAGE@|$(GETTEXT_PACKAGE)|g" \ -e "s|[@]datadir@|$(datadir)|g" \ -e "s|[@]libexecdir@|$(libexecdir)|g" \ diff --git a/js/misc/config.js.in b/js/misc/config.js.in index 9769104..9c4795d 100644 --- a/js/misc/config.js.in +++ b/js/misc/config.js.in @@ -6,6 +6,8 @@ const PACKAGE_NAME = '@PACKAGE_NAME@'; const PACKAGE_VERSION = '@PACKAGE_VERSION@'; /* 1 if gnome-bluetooth is available, 0 otherwise */ const HAVE_BLUETOOTH = @HAVE_BLUETOOTH@; +/* 1 if networkmanager is available, 0 otherwise */ +const HAVE_NETWORKMANAGER = @HAVE_NETWORKMANAGER@; /* gettext package */ const GETTEXT_PACKAGE = '@GETTEXT_PACKAGE@'; /* locale dir */ diff --git a/js/ui/panel.js b/js/ui/panel.js index cfeb351..3bb13b4 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -933,11 +933,13 @@ if (Config.HAVE_BLUETOOTH) PANEL_ITEM_IMPLEMENTATIONS['bluetooth'] = imports.ui.status.bluetooth.Indicator; -try { - PANEL_ITEM_IMPLEMENTATIONS['network'] = - imports.ui.status.network.NMApplet; -} catch(e) { - log('NMApplet is not supported. It is possible that your NetworkManager version is too old'); +if (Config.HAVE_NETWORKMANAGER) { + try { + PANEL_ITEM_IMPLEMENTATIONS['network'] = + imports.ui.status.network.NMApplet; + } catch(e) { + log('NMApplet is not supported. It is possible that your NetworkManager version is too old'); + } } const Panel = new Lang.Class({ diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js index f802dbd..eec830b 100644 --- a/js/ui/sessionMode.js +++ b/js/ui/sessionMode.js @@ -10,6 +10,8 @@ const FileUtils = imports.misc.fileUtils; const Main = imports.ui.main; const Params = imports.misc.params; +const Config = imports.misc.config; + const DEFAULT_MODE = 'restrictive'; const _modes = { @@ -100,7 +102,10 @@ const _modes = { isLocked: false, isPrimary: true, unlockDialog: imports.ui.unlockDialog.UnlockDialog, - components: ['networkAgent', 'polkitAgent', 'telepathyClient', + components: Config.HAVE_NETWORKMANAGER ? + ['networkAgent', 'polkitAgent', 'telepathyClient', + 'keyring', 'recorder', 'autorunManager', 'automountManager'] : + ['polkitAgent', 'telepathyClient', 'keyring', 'recorder', 'autorunManager', 'automountManager'], panel: { left: ['activities', 'appMenu'], --- a/src/Makefile.am.old 2013-03-27 10:35:51.763616888 +0100 +++ b/src/Makefile.am 2013-03-27 10:38:09.745425152 +0100 @@ -116,7 +116,6 @@ shell-invert-lightness-effect.h \ shell-keybinding-modes.h \ shell-mount-operation.h \ - shell-network-agent.h \ shell-perf-log.h \ shell-screenshot.h \ shell-slicer.h \ @@ -129,6 +128,10 @@ shell-wm.h \ shell-xfixes-cursor.h +if HAVE_NETWORKMANAGER +shell_public_headers_h += shell-network-agent.h +endif + shell_private_sources = \ gactionmuxer.h \ gactionmuxer.c \ @@ -159,7 +162,6 @@ shell-keyring-prompt.h \ shell-keyring-prompt.c \ shell-mount-operation.c \ - shell-network-agent.c \ shell-perf-log.c \ shell-polkit-authentication-agent.h \ shell-polkit-authentication-agent.c \ @@ -177,6 +179,10 @@ shell-xfixes-cursor.c \ $(NULL) +if HAVE_NETWORKMANAGER +libgnome_shell_la_SOURCES += shell-network-agent.c +endif + libgnome_shell_la_gir_sources = \ $(filter-out %-private.h $(shell_private_sources), $(shell_public_headers_h) $(libgnome_shell_la_SOURCES)) @@ -287,7 +293,10 @@ libgnome_shell_la_CPPFLAGS = $(gnome_shell_cflags) Shell-0.1.gir: libgnome-shell.la St-1.0.gir -Shell_0_1_gir_INCLUDES = Clutter-1.0 ClutterX11-1.0 Meta-3.0 TelepathyGLib-0.12 Soup-2.4 GMenu-3.0 NetworkManager-1.0 NMClient-1.0 +Shell_0_1_gir_INCLUDES = Clutter-1.0 ClutterX11-1.0 Meta-3.0 TelepathyGLib-0.12 Soup-2.4 GMenu-3.0 +if HAVE_NETWORKMANAGER +Shell_0_1_gir_INCLUDES += NetworkManager-1.0 NMClient-1.0 +endif Shell_0_1_gir_CFLAGS = $(libgnome_shell_la_CPPFLAGS) -I $(srcdir) Shell_0_1_gir_LIBS = libgnome-shell.la Shell_0_1_gir_FILES = $(libgnome_shell_la_gir_sources)