aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro A. F. Pereira <leandro@hardinfo.org>2007-06-30 15:08:22 +0000
committerLeandro A. F. Pereira <leandro@hardinfo.org>2007-06-30 15:08:22 +0000
commit1794035a988ed89cd8400930d75e054c6f39c5ad (patch)
treee0d65b0227f93d122a6eb4944369548879b0bbb9
parent52b133d9d7fb007075f05b8289be517db6574fd3 (diff)
Make libsoup optional (disables Network Updater if not found).
-rwxr-xr-xhardinfo2/configure10
-rw-r--r--hardinfo2/hardinfo.c2
-rw-r--r--hardinfo2/syncmanager.c12
3 files changed, 19 insertions, 5 deletions
diff --git a/hardinfo2/configure b/hardinfo2/configure
index a5ac9eb8..42dfa9ad 100755
--- a/hardinfo2/configure
+++ b/hardinfo2/configure
@@ -167,11 +167,7 @@ done
# --------------------------------------------------------------------------
if [ $SOUP -eq -1 ]; then
- echo -e "\nYou need the libsoup library, including the development stuff."
- echo "If you're using Debian, running the command as root:"
- echo -e "\n\taptitude install libsoup2.2-dev\n"
- echo "Will do the trick."
- exit 1
+ echo "Disabling libsoup support. (Network Manager won't be available.)"
fi
# --------------------------------------------------------------------------
@@ -193,6 +189,10 @@ echo "#define HOSTNAME \"`hostname`\"" >> config.h
echo "#define PREFIX \"/usr/share/hardinfo/\"" >> config.h
echo "#define LIBPREFIX \"/usr/lib/hardinfo/\"" >> config.h
+if [ "$SOUP" == "1" ]; then
+ echo "#define HAS_LIBSOUP" >> config.h
+fi
+
if [ "$RELEASE" == "1" ]; then
echo "#define DEBUG(...)" >> config.h
else
diff --git a/hardinfo2/hardinfo.c b/hardinfo2/hardinfo.c
index ea075f5d..b30244b9 100644
--- a/hardinfo2/hardinfo.c
+++ b/hardinfo2/hardinfo.c
@@ -35,9 +35,11 @@ main(int argc, char **argv)
DEBUG("HardInfo version " VERSION ". Debug version.");
+#ifdef HAS_LIBSOUP
DEBUG("g_thread_init()");
if (!g_thread_supported())
g_thread_init (NULL);
+#endif /* HAS_LIBSOUP */
/* parse all command line parameters */
parameters_init(&argc, &argv, &params);
diff --git a/hardinfo2/syncmanager.c b/hardinfo2/syncmanager.c
index 675b0a19..f1f1de04 100644
--- a/hardinfo2/syncmanager.c
+++ b/hardinfo2/syncmanager.c
@@ -21,6 +21,7 @@
#include "hardinfo.h"
#include "config.h"
+#ifdef HAS_LIBSOUP
#include <libsoup/soup.h>
#include <libsoup/soup-xmlrpc-message.h>
#include <libsoup/soup-xmlrpc-response.h>
@@ -90,18 +91,26 @@ static void sync_dialog_netarea_start_actions(SyncDialog *sd, SyncNetAction *s
sna->error = g_error_new(err_quark, code, message, \
##__VA_ARGS__); \
}
+#endif /* HAS_LIBSOUP */
void sync_manager_add_entry(SyncEntry *entry)
{
+#ifdef HAS_LIBSOUP
DEBUG("registering syncmanager entry ''%s''", entry->fancy_name);
entry->selected = TRUE;
entries = g_slist_prepend(entries, entry);
+#else
+ DEBUG("libsoup support is disabled.");
+#endif /* HAS_LIBSOUP */
}
void sync_manager_show(void)
{
+#ifndef HAS_LIBSOUP
+ g_warning("HardInfo was compiled without libsoup support. (Network Manager requires it.)");
+#else /* !HAS_LIBSOUP */
SyncDialog *sd = sync_dialog_new();
err_quark = g_quark_from_static_string("syncmanager");
@@ -117,8 +126,10 @@ void sync_manager_show(void)
}
sync_dialog_destroy(sd);
+#endif /* HAS_LIBSOUP */
}
+#ifdef HAS_LIBSOUP
static SoupXmlrpcValue *_soup_get_xmlrpc_value(SoupMessage *msg, SyncNetAction *sna)
{
SoupXmlrpcResponse *response = NULL;
@@ -736,3 +747,4 @@ static void sync_dialog_destroy(SyncDialog *sd)
sync_dialog_netarea_destroy(sd->sna);
g_free(sd);
}
+#endif /* HAS_LIBSOUP */