Package: gnome-main-menu / 0.9.14-1

0005-Allow-building-without-NetworkManager-and-iwlib.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
From 59b4f9f4e5cdfd4f3a6b851caa1b25cc5c237679 Mon Sep 17 00:00:00 2001
From: Julian Andres Klode <jak@debian.org>
Date: Wed, 5 May 2010 16:21:01 +0200
Subject: [PATCH 5/6] Allow building without NetworkManager and iwlib.

If NetworkManager or iwlib is not available, allow
gnome-main-menu to be built without it by disabling
the network-related functionality; making it possible
to build on non-Linux architectures.

Based on a patch by Petr Salinger <Petr.Salinger@seznam.cz>.

Bug-Debian: http://bugs.debian.org/542628
---
 configure.in                 |   31 ++++++++++++++++++-------------
 main-menu/src/Makefile.am    |   14 ++++++++++----
 main-menu/src/main-menu-ui.c |    7 +++++++
 3 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/configure.in b/configure.in
index de2fedd..1129459 100644
--- a/configure.in
+++ b/configure.in
@@ -43,25 +43,30 @@ COMMON_MODULES="glib-2.0 >= $GLIB_REQUIRED	\
 		gdk-2.0				\
 		libslab >= $SLAB_REQUIRED"
 
-NM_GLIB=
-PKG_CHECK_EXISTS(libnm-glib, [ NM_GLIB=libnm-glib ])
-if test "x$NM_GLIB" = "x"; then
-	PKG_CHECK_EXISTS(libnm_glib, [ NM_GLIB=libnm_glib ], [ AC_ERROR(cannot find NetworkManager Glib library) ])
-fi
+PKG_CHECK_MODULES(MAIN_MENU, [ $COMMON_MODULES libpanelapplet-2.0 gnome-desktop-2.0 gconf-2.0 libgtop-2.0 x11 cairo ])
 
-PKG_CHECK_MODULES(MAIN_MENU, [ $COMMON_MODULES libpanelapplet-2.0 gnome-desktop-2.0 gconf-2.0 libgtop-2.0 NetworkManager $NM_GLIB >= 0.7.0 libnm-util >= 0.7.0 x11 cairo ])
+AC_SUBST(MAIN_MENU_CFLAGS)
+AC_SUBST(MAIN_MENU_LIBS)
 
-AC_CHECK_HEADERS(iwlib.h, [ AC_CHECK_LIB(iw, iw_sockets_open, have_iwlib=yes, have_iwlib=no, -lm)], have_iwlib=no)
+# Check for Network Manager
+NM_GLIB=
+PKG_CHECK_EXISTS(libnm-glib, [ NM_GLIB=libnm-glib],
+                 PKG_CHECK_EXISTS(libnm_glib, [ NM_GLIB=libnm_glib ]))
 
-if test "x$have_iwlib" != "xyes" ; then
-	AC_ERROR(cannot find iwlib)
+PKG_CHECK_MODULES(NETWORK, [NetworkManager $NM_GLIB >= 0.7.0 libnm-util >= 0.7.0], HAVE_NETWORK=1, HAVE_NETWORK=0)
+AC_CHECK_HEADERS(iwlib.h, [ AC_CHECK_LIB(iw, iw_sockets_open, , HAVE_NETWORK=0, -lm)], HAVE_NETWORK=0)
+
+if test "x$HAVE_NETWORK" != "x1" ; then
+	AC_WARN(Missing network manager or iwlib, network support disabled)
 else
-	MAIN_MENU_LIBS="$MAIN_MENU_LIBS -liw -lm"
-	AC_SUBST(MAIN_MENU_LIBS)
+	AC_DEFINE(HAVE_NETWORK, 1, [use network-manager and wireless])
+	NETWORK_LIBS="$NETWORK_LIBS -liw -lm"
 fi
 
-AC_SUBST(MAIN_MENU_CFLAGS)
-AC_SUBST(MAIN_MENU_LIBS)
+AM_CONDITIONAL(HAVE_NETWORK, test "x$HAVE_NETWORK" = "x1")
+AC_SUBST(NETWORK_LIBS)
+AC_SUBST(NETWORK_MAIN)
+
 
 PKG_CHECK_MODULES(APPLICATION_BROWSER, [ $COMMON_MODULES gnome-desktop-2.0 unique-1.0 ])
 
diff --git a/main-menu/src/Makefile.am b/main-menu/src/Makefile.am
index fdfa6e4..38ab399 100644
--- a/main-menu/src/Makefile.am
+++ b/main-menu/src/Makefile.am
@@ -1,5 +1,6 @@
 INCLUDES =								\
 	$(MAIN_MENU_CFLAGS)						\
+	$(NETWORK_CFLAGS)						\
 	$(WARN_CFLAGS)
 
 uidir = $(datadir)/$(PACKAGE)
@@ -19,14 +20,19 @@ main_menu_SOURCES =							\
 	main-menu-migration.c		main-menu-migration.h		\
 	tile-table.c			tile-table.h			\
 	hard-drive-status-tile.c	hard-drive-status-tile.h	\
-	network-status-tile.c		network-status-tile.h		\
-	network-status-agent.c		network-status-agent.h		\
-	network-status-info.c		network-status-info.h		\
 	tomboykeybinder.c		tomboykeybinder.h		\
 	eggaccelerators.c		eggaccelerators.h
 
+if HAVE_NETWORK
+main_menu_SOURCES += \
+	network-status-tile.c		network-status-tile.h		\
+	network-status-agent.c		network-status-agent.h		\
+	network-status-info.c		network-status-info.h
+endif
+
 main_menu_LDADD =							\
-	$(MAIN_MENU_LIBS)
+	$(MAIN_MENU_LIBS)						\
+	$(NETWORK_LIBS)
 
 trigger_panel_run_dialog_SOURCES =					\
 	trigger-panel-run-dialog.c
diff --git a/main-menu/src/main-menu-ui.c b/main-menu/src/main-menu-ui.c
index 67e6102..451b3f5 100644
--- a/main-menu/src/main-menu-ui.c
+++ b/main-menu/src/main-menu-ui.c
@@ -37,7 +37,10 @@
 #include <libslab/slab.h>
 
 #include "hard-drive-status-tile.h"
+
+#ifdef HAVE_NETWORK
 #include "network-status-tile.h"
+#endif
 
 #include "tile-table.h"
 
@@ -737,6 +740,7 @@ create_status_section (MainMenuUI *this)
 	gtk_container_add   (ctnr, tile);
 	gtk_widget_show_all (GTK_WIDGET (ctnr));
 
+#ifdef HAVE_NETWORK
 	ctnr = GTK_CONTAINER (gtk_builder_get_object (
 		priv->main_menu_ui, "network-status-container"));
 	priv->network_status = network_status_tile_new ();
@@ -749,6 +753,7 @@ create_status_section (MainMenuUI *this)
 
 	gtk_container_add   (ctnr, priv->network_status);
 	gtk_widget_show_all (GTK_WIDGET (ctnr));
+#endif
 
 	priv->status_section = get_widget (priv, "slab-status-section");
 
@@ -1855,7 +1860,9 @@ present_slab_window (MainMenuUI *this)
 {
 	MainMenuUIPrivate *priv = PRIVATE (this);
 
+#ifdef HAVE_NETWORK
 	network_tile_update_status (priv->network_status);
+#endif
 
 	update_recently_used_sections (this);
 
-- 
1.7.1