[gthumb: 1/20] make the libunique dependency optional
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb: 1/20] make the libunique dependency optional
- Date: Thu, 12 May 2011 20:21:55 +0000 (UTC)
commit 7d34606b3abe7f7581869d2cd458e5b5dda6e822
Author: Paolo Bacchilega <paobac src gnome org>
Date: Wed May 11 12:27:31 2011 +0200
make the libunique dependency optional
configure.ac | 18 +++++++++++++++++-
gthumb/Makefile.am | 2 ++
gthumb/main.c | 29 +++++++++++++++++++++++++++--
3 files changed, 46 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0d7c3b5..c4c2e85 100644
--- a/configure.ac
+++ b/configure.ac
@@ -136,7 +136,6 @@ PKG_CHECK_MODULES(GTHUMB, [
gio-unix-2.0
gtk+-2.0 >= $GTK_REQUIRED
gconf-2.0 >= $GCONF_REQUIRED
- unique-1.0 >= $UNIQUE_REQUIRED
libpng
])
AC_SUBST(GTHUMB_LIBS)
@@ -159,6 +158,22 @@ AC_SUBST(M_LIBS)
dnl ===========================================================================
+AC_ARG_ENABLE([unique],
+ [AS_HELP_STRING([--disable-unique],[do not compile code that uses the libunique library])],,
+ [enable_unique=yes])
+
+if test x$enable_unique = xyes ; then
+ PKG_CHECK_MODULES(UNIQUE,
+ unique-1.0 >= $UNIQUE_REQUIRED,
+ [enable_unique=yes],
+ [enable_unique=no])
+fi
+AC_SUBST(UNIQUE_LIBS)
+AC_SUBST(UNIQUE_CFLAGS)
+AM_CONDITIONAL(ENABLE_UNIQUE, test "x$enable_unique" = xyes)
+
+dnl ===========================================================================
+
AC_ARG_ENABLE([exiv2],
[AS_HELP_STRING([--disable-exiv2],[do not compile code that uses the exiv2 library])],,
[enable_exiv2=yes])
@@ -663,6 +678,7 @@ Configuration:
Debug : $ENABLE_DEBUG
Run in place : ${enable_run_in_place}
Build tests : $ENABLE_TEST_SUITE
+ Use libunique : ${enable_unique}
Exiv2 support : ${enable_exiv2}
JPEG tools : ${enable_jpeg}
TIFF tools : ${enable_tiff}
diff --git a/gthumb/Makefile.am b/gthumb/Makefile.am
index 7e978a7..f56e81c 100644
--- a/gthumb/Makefile.am
+++ b/gthumb/Makefile.am
@@ -256,6 +256,7 @@ gthumb_LDADD = \
$(GTHUMB_LIBS) \
$(M_LIBS) \
$(EXIV2_LIBS) \
+ $(UNIQUE_LIBS) \
$(JPEG_LIBS) \
$(TIFF_LIBS) \
$(CLUTTER_LIBS) \
@@ -283,6 +284,7 @@ endif
gthumb_CFLAGS = \
$(GTHUMB_CFLAGS) \
$(EXIV2_CFLAGS) \
+ $(UNIQUE_CFLAGS) \
$(JPEG_CFLAGS) \
$(TIFF_CFLAGS) \
$(CLUTTER_CFLAGS) \
diff --git a/gthumb/main.c b/gthumb/main.c
index 1ea5522..b25f5ad 100644
--- a/gthumb/main.c
+++ b/gthumb/main.c
@@ -23,7 +23,9 @@
#include <glib/gi18n.h>
#include <glib/gprintf.h>
#include <gtk/gtk.h>
+#ifdef HAVE_UNIQUE
#include <unique/unique.h>
+#endif
#ifdef HAVE_CLUTTER
#include <clutter/clutter.h>
#include <clutter-gtk/clutter-gtk.h>
@@ -270,6 +272,8 @@ show_window (GtkWindow *window,
}
+#ifdef HAVE_UNIQUE
+
static UniqueResponse
unique_app_message_received_cb (UniqueApp *unique_app,
UniqueCommand command,
@@ -334,9 +338,13 @@ unique_app_message_received_cb (UniqueApp *unique_app,
}
+#endif
+
+
static void
open_browser_window (GFile *location)
{
+#ifdef HAVE_UNIQUE
if (unique_app_is_running (gthumb_app)) {
UniqueMessageData *data;
char *uri;
@@ -349,7 +357,11 @@ open_browser_window (GFile *location)
g_free (uri);
unique_message_data_free (data);
}
- else {
+ else
+
+#endif
+
+ {
GtkWidget *window;
window = gth_browser_new (NULL);
@@ -363,6 +375,7 @@ open_browser_window (GFile *location)
static void
import_photos_from_location (GFile *location)
{
+#ifdef HAVE_UNIQUE
if (unique_app_is_running (gthumb_app)) {
UniqueMessageData *data;
@@ -376,7 +389,11 @@ import_photos_from_location (GFile *location)
unique_app_send_message (gthumb_app, COMMAND_IMPORT_PHOTOS, data);
unique_message_data_free (data);
}
- else {
+ else
+
+#endif
+
+ {
GtkWidget *window;
window = gth_browser_new (NULL);
@@ -396,9 +413,11 @@ prepare_application (void)
GFile *location;
GList *scan;
+#ifdef HAVE_UNIQUE
gthumb_app = unique_app_new_with_commands ("org.gnome.gthumb", NULL,
"import-photos", COMMAND_IMPORT_PHOTOS,
NULL);
+#endif
gth_main_register_default_hooks ();
gth_main_register_file_source (GTH_TYPE_FILE_SOURCE_VFS);
@@ -409,11 +428,13 @@ prepare_application (void)
gth_main_activate_extensions ();
gth_hook_invoke ("initialize", NULL);
+#ifdef HAVE_UNIQUE
if (! unique_app_is_running (gthumb_app))
g_signal_connect (gthumb_app,
"message-received",
G_CALLBACK (unique_app_message_received_cb),
NULL);
+#endif
client = egg_sm_client_get ();
if (egg_sm_client_is_resumed (client)) {
@@ -533,8 +554,12 @@ main (int argc, char *argv[])
g_option_context_free (context);
+#ifdef HAVE_UNIQUE
if (! unique_app_is_running (gthumb_app))
gtk_main ();
+#else
+ gtk_main ();
+#endif
g_object_unref (gthumb_app);
gth_main_release ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]