[easytag/wip/musicbrainz-support-merge: 51/75] libdiscid is optional
- From: Abhinav Jangda <abhijangda src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/musicbrainz-support-merge: 51/75] libdiscid is optional
- Date: Fri, 15 Aug 2014 19:13:06 +0000 (UTC)
commit 64d4f8ff6b2a3a2cb23261992db35712a6fefab3
Author: Abhinav <abhijangda hotmail com>
Date: Tue Aug 12 17:02:16 2014 +0530
libdiscid is 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 61a3244..7464ff7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -141,6 +141,9 @@ AC_ARG_ENABLE([wavpack],
AC_ARG_ENABLE([libmusicbrainz],
[AS_HELP_STRING([--disable-libmusicbrainz], [Disable support for libmusicbrainz
(default=auto)])])
+AC_ARG_ENABLE([libdiscid],
+ [AS_HELP_STRING([--disable-libdiscid], [Disable support for libdiscid (default=auto)])])
+
dnl -------------------------------
dnl Checks for libraries.
dnl -------------------------------
@@ -305,6 +308,15 @@ AS_IF([test "x$have_wavpack" != "xno"],
dnl Check for 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 Check for libsoup
LIBSOUP_DEPS="libsoup-2.4 >= 2.4"
@@ -415,6 +427,7 @@ echo FLAC file support .......: $have_flac
echo MP4 file support ........: $have_taglib
echo WavPack support .........: $have_wavpack
echo MusicBrainz support .....: $have_libmusicbrainz
+echo DiscID support ..........: $have_libdiscid
echo NLS/gettext .............: $USE_NLS
echo Tests during make check .: $testing_utilities
echo Install prefix ..........: $prefix
diff --git a/src/musicbrainz_dialog.c b/src/musicbrainz_dialog.c
index 3355c53..87fef42 100755
--- a/src/musicbrainz_dialog.c
+++ b/src/musicbrainz_dialog.c
@@ -265,12 +265,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
@@ -1194,6 +1198,7 @@ get_first_selected_file (ET_File **et_file)
}
}
+#ifdef ENABLE_libdiscid
/*
* discid_search_callback:
* @source: Source Object
@@ -1306,6 +1311,8 @@ discid_search_thread_func (GSimpleAsyncResult *res, GObject *obj,
TRUE);
}
+#endif /* ENABLE_libdiscid */
+
/*
* btn_discid_search_clicked:
* @button: GtkButton
@@ -1316,6 +1323,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;
@@ -1335,6 +1343,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]