summaryrefslogtreecommitdiff
blob: 9caaf18042b94ef8a45f15ce09949a98add5fa99 (plain)
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
From 674d9284bd09a9378f99ff19b2d2ffb8032ce8ea Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek.chauhan@gmail.com>
Date: Tue, 16 Mar 2010 10:58:55 +0530
Subject: [PATCH] Make avahi support build-time configureable

---
 configure.ac                               |   21 ++++++++++++++++++++-
 src/gdu-gtk/gdu-connect-to-server-dialog.c |    7 +++++++
 2 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 01be5f0..95f2087 100644
--- a/configure.ac
+++ b/configure.ac
@@ -150,7 +150,26 @@ PKG_CHECK_MODULES(LIBNOTIFY, [libnotify  >= $LIBNOTIFY_REQUIRED])
 PKG_CHECK_MODULES(UDISKS, [udisks  >= $UDISKS_REQUIRED udisks < $UDISKS_NEXT_ABI_INCOMPATIBLE_VERSION])
 PKG_CHECK_MODULES(X11, [x11])
 PKG_CHECK_MODULES(LIBATASMART, [libatasmart >= 0.14])
-PKG_CHECK_MODULES(AVAHI_UI, [avahi-ui >= $AVAHI_UI_REQUIRED])
+
+# *************
+# Avahi
+# *************
+
+have_avahi_ui=no
+AC_ARG_ENABLE(avahi-ui, AS_HELP_STRING([--disable-avahi-ui], [disable use of Avahi for server searching]))
+
+if test "x$enable_avahi_ui" != "xno"; then
+	PKG_CHECK_MODULES(AVAHI_UI, avahi-ui >= $AVAHI_UI_REQUIRED,
+			  [AC_DEFINE(HAVE_AVAHI_UI, 1, [Define if avahi-ui is available])
+			  have_avahi_ui=yes], have_avahi_ui=no)
+	if test "x$have_avahi_ui" = xno -a "x$enable_avahi_ui" = xyes; then
+		AC_MSG_ERROR([avahi-ui support requested but libraries not found])
+	fi
+fi
+
+AC_SUBST(AVAHI_UI_LIBS)
+AC_SUBST(AVAHI_UI_CFLAGS)
+AM_CONDITIONAL(ENABLE_AVAHI_UI, [test "$have_avahi_ui" = "yes"])
 
 # *************
 # Remote Access
diff --git a/src/gdu-gtk/gdu-connect-to-server-dialog.c b/src/gdu-gtk/gdu-connect-to-server-dialog.c
index 9ecf08c..5ad47bb 100644
--- a/src/gdu-gtk/gdu-connect-to-server-dialog.c
+++ b/src/gdu-gtk/gdu-connect-to-server-dialog.c
@@ -24,7 +24,10 @@
 
 #include "config.h"
 #include <glib/gi18n-lib.h>
+
+#ifdef HAVE_AVAHI_UI
 #include <avahi-ui/avahi-ui.h>
+#endif
 
 #include "gdu-connect-to-server-dialog.h"
 
@@ -143,6 +146,7 @@ gdu_connect_to_server_dialog_get_address  (GduConnectToServerDialog *dialog)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
+#ifdef HAVE_AVAHI_UI
 static void
 on_dns_sd_clicked (GtkButton *button,
                    gpointer   user_data)
@@ -171,6 +175,7 @@ on_dns_sd_clicked (GtkButton *button,
 
         gtk_widget_destroy (service_dialog);
 }
+#endif
 
 /* ---------------------------------------------------------------------------------------------------- */
 
@@ -218,6 +223,7 @@ gdu_connect_to_server_dialog_constructed (GObject *object)
                                         GTK_STOCK_CONNECT,
                                         GTK_RESPONSE_OK);
 
+#ifdef HAVE_AVAHI_UI
         button = gtk_button_new_with_mnemonic (_("_Browse..."));
         image = gtk_image_new_from_stock (GTK_STOCK_NETWORK, GTK_ICON_SIZE_BUTTON);
         gtk_button_set_image (GTK_BUTTON (button), image);
@@ -235,6 +241,7 @@ gdu_connect_to_server_dialog_constructed (GObject *object)
                           "clicked",
                           G_CALLBACK (on_dns_sd_clicked),
                           dialog);
+#endif
 
         content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
 
-- 
1.6.4.4