[easytag/wip/musicbrainz-support-merge: 47/69] Make libdiscid support optional
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/musicbrainz-support-merge: 47/69] Make libdiscid support optional
- Date: Mon, 1 Sep 2014 19:32:53 +0000 (UTC)
commit c7a5f6ac0b15d48365716f5d7667b666ece308af
Author: Abhinav <abhijangda hotmail com>
Date: Tue Aug 12 17:02:16 2014 +0530
Make libdiscid support optional
configure.ac | 13 +++++++++++++
src/musicbrainz_dialog.c | 17 +++++++++++++++++
2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9f4525d..14a1798 100644
--- a/configure.ac
+++ b/configure.ac
@@ -157,6 +157,9 @@ AC_ARG_ENABLE([nautilus_actions],
AC_ARG_ENABLE([musicbrainz],
[AS_HELP_STRING([--disable-musicbrainz], [Disable support for musicbrainz (default=auto)])])
+AC_ARG_ENABLE([libdiscid],
+ [AS_HELP_STRING([--disable-libdiscid], [Disable support for libdiscid (default=auto)])])
+
dnl -------------------------------
dnl Checks for libraries.
dnl -------------------------------
@@ -175,6 +178,15 @@ AS_IF([test "x$have_musicbrainz" != "xno"],
dnl libdiscid
LIBDISCID_DEPS="libdiscid >= 0.2.2"
+AS_IF([test "x$enable_libdiscid" != "xno"],
+ [PKG_CHECK_EXISTS([$LIBDISCID_DEPS], [have_libdiscid=yes], [have_libdiscid=no])],
+ [have_libdiscid=no])
+
+AS_IF([test "x$have_libdiscid" != "xno"],
+ [AC_DEFINE([ENABLE_LIBDISCID], [], [Define for libdiscid support])],
+ [LIBDISCID_DEPS=""
+ AS_IF([test "x$enable_libdiscid" = "xyes"],
+ [AC_MSG_ERROR([libdiscid support requested but required dependencies ($LIBDISCID_DEPS) not
found])])])
dnl libsoup
LIBSOUP_DEPS="libsoup-2.4 >= 2.4"
@@ -451,6 +463,7 @@ echo FLAC file support .......: $have_flac
echo MP4 file support ........: $have_taglib
echo WavPack support .........: $have_wavpack
echo MusicBrainz support .....: $have_musicbrainz
+echo DiscID support ..........: $have_libdiscid
echo NLS/gettext .............: $USE_NLS
echo Nautilus actions ........: $have_libnautilus_extension
echo Tests during make check .: $testing_utilities
diff --git a/src/musicbrainz_dialog.c b/src/musicbrainz_dialog.c
index b9e08c4..a563d23 100644
--- a/src/musicbrainz_dialog.c
+++ b/src/musicbrainz_dialog.c
@@ -278,12 +278,16 @@ static void
btn_selected_find_clicked (GtkWidget *widget, gpointer user_data);
static void
get_first_selected_file (ET_File **et_file);
+
+#ifdef ENABLE_LIBDISCID
static void
discid_search_callback (GObject *source, GAsyncResult *res,
gpointer user_data);
static void
discid_search_thread_func (GSimpleAsyncResult *res, GObject *obj,
GCancellable *cancellable);
+#endif /* ENABLE_LIBDISCID */
+
static void
btn_discid_search_clicked (GtkWidget *button, gpointer data);
static void
@@ -1222,6 +1226,7 @@ get_first_selected_file (ET_File **et_file)
}
}
+#ifdef ENABLE_LIBDISCID
/*
* discid_search_callback:
* @source: Source Object
@@ -1334,6 +1339,8 @@ discid_search_thread_func (GSimpleAsyncResult *res, GObject *obj,
TRUE);
}
+#endif /* ENABLE_LIBDISCID */
+
/*
* btn_discid_search_clicked:
* @button: GtkButton
@@ -1344,6 +1351,7 @@ discid_search_thread_func (GSimpleAsyncResult *res, GObject *obj,
static void
btn_discid_search_clicked (GtkWidget *button, gpointer data)
{
+#ifdef ENABLE_LIBDISCID
EtMusicBrainzDialogPrivate *mb_dialog_priv;
EtMusicBrainzDialog *dlg;
DiscIDSearchThreadData *thread_data;
@@ -1363,6 +1371,15 @@ btn_discid_search_clicked (GtkWidget *button, gpointer data)
discid_search_thread_func, 0,
mb5_search_cancellable);
et_music_brainz_dialog_stop_set_sensitive (TRUE);
+#else
+ GtkWidget *msg_dialog;
+
+ msg_dialog = gtk_message_dialog_new (GTK_WINDOW (mbDialog), GTK_DIALOG_MODAL,
+ GTK_MESSAGE_INFO, GTK_BUTTONS_OK,
+ _("libdiscid is not installed. Please install it to use DiscID
Search"));
+ gtk_dialog_run (GTK_DIALOG (msg_dialog));
+ gtk_widget_destroy (msg_dialog);
+#endif /* ENABLE_LIBDISCID */
}
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]