[gnome-commander/gcmd-1-6] Makes libunique optional



commit 5f2449f3b086f89e0e6970a4af29b6ceb0b21d9f
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Sun Feb 26 21:14:01 2017 +0100

    Makes libunique optional

 configure.ac                            |   32 +++++++++++++++++-------------
 src/dialogs/gnome-cmd-options-dialog.cc |    3 +-
 src/main.cc                             |   17 +++++++++++++++-
 3 files changed, 36 insertions(+), 16 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5c6536f..4806002 100644
--- a/configure.ac
+++ b/configure.ac
@@ -214,13 +214,17 @@ AC_SUBST([GNOME_KEYRING_PREFIX])
 AC_SUBST([GNOME_KEYRING_VERSION])
 
 
-dnl Check for libUnique
-PKG_CHECK_MODULES(UNIQUE, [ unique-1.0 >= ${UNIQUE_REQ} ])
-UNIQUE_PREFIX=`pkg-config --variable=prefix unique-1.0`
-UNIQUE_VERSION=`pkg-config --modversion unique-1.0`
-AC_SUBST([UNIQUE_PREFIX])
-AC_SUBST([UNIQUE_VERSION])
-
+AC_ARG_WITH([unique], AS_HELP_STRING([--without-unique], [disable unique support]))
+AS_IF([test "x$with_unique" != "xno"],
+   [
+      PKG_CHECK_MODULES([UNIQUE], [unique-1.0 >= ${UNIQUE_REQ}], have_unique=yes, have_unique=no)
+   ],
+   [test "x$with_unique" = "xno"], [have_unique=no])
+if test "x$have_unique" = "xyes"; then
+   AC_DEFINE(HAVE_UNIQUE, 1, [Define to 1 if you have unique support])
+else
+   AC_MSG_WARN([unique >= ${UNIQUE_REQ} not found, disabling unique support])
+fi
 
 dnl Check for samba support
 AC_ARG_WITH(samba, [  --without-samba         disable SAMBA support])
@@ -499,13 +503,14 @@ echo "=========================================="
 echo ""
 echo "The following settings will be used:"
 echo ""
-echo "  host           : ${host}"
-echo "  prefix         : ${prefix}"
-echo "  module support : ${GMODULE_AVAIL}"
-echo "  compiler       : ${CC}"
-echo "  CFLAGS         : ${CFLAGS}"
-echo "  LDFLAGS        : ${LDFLAGS}"
+echo "  host             : ${host}"
+echo "  prefix           : ${prefix}"
+echo "  module support   : ${GMODULE_AVAIL}"
+echo "  compiler         : ${CC}"
+echo "  CFLAGS           : ${CFLAGS}"
+echo "  LDFLAGS          : ${LDFLAGS}"
 echo ""
+echo "  libUnique support: ${have_unique}"
 echo "  Python plugins support: ${enable_python}"
 echo ""
 echo ""
@@ -531,7 +536,6 @@ echo "  gnome          : ${GNOME_VERSION}   in ${GNOME_PREFIX}"
 echo "  gnomeui        : ${GNOMEUI_VERSION}    in ${GNOMEUI_PREFIX}"
 echo "  gnome-vfs      : ${GNOMEVFS_VERSION}   in ${GNOMEVFS_PREFIX}"
 echo "  gnome-keyring  : ${GNOME_KEYRING_VERSION}      in ${GNOME_KEYRING_PREFIX}"
-echo "  libUnique      : ${UNIQUE_VERSION}     in ${UNIQUE_PREFIX}"
 if test "x$have_pdf" = "xyes"; then
 echo "  poppler-glib   : ${POPPLER_VERSION}    in ${POPPLER_PREFIX}"
 fi
diff --git a/src/dialogs/gnome-cmd-options-dialog.cc b/src/dialogs/gnome-cmd-options-dialog.cc
index 2b8837a..d417f15 100644
--- a/src/dialogs/gnome-cmd-options-dialog.cc
+++ b/src/dialogs/gnome-cmd-options-dialog.cc
@@ -181,6 +181,7 @@ inline GtkWidget *create_general_tab (GtkWidget *parent, GnomeCmdData::Options &
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.quick_search_exact_match_end);
 
 
+#ifdef HAVE_UNIQUE
     // Multiple instances
     cat_box = create_vbox (parent, FALSE, 0);
     cat = create_category (parent, cat_box, _("Multiple instances"));
@@ -189,7 +190,7 @@ inline GtkWidget *create_general_tab (GtkWidget *parent, GnomeCmdData::Options &
     check = create_check (parent, _("Don't start a new instance"), "multiple_instance_check");
     gtk_box_pack_start (GTK_BOX (cat_box), check, FALSE, TRUE, 0);
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), !cfg.allow_multiple_instances);
-
+#endif
 
     // Save on exit
     cat_box = create_vbox (parent, FALSE, 0);
diff --git a/src/main.cc b/src/main.cc
index bc3726b..f641bd4 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -26,7 +26,9 @@ extern "C"
 
 #include <config.h>
 #include <locale.h>
+#ifdef HAVE_UNIQUE
 #include <unique/unique.h>
+#endif
 #include <libgnomeui/gnome-ui-init.h>
 
 #include "gnome-cmd-includes.h"
@@ -73,6 +75,7 @@ static const GOptionEntry options [] =
 };
 
 
+#ifdef HAVE_UNIQUE
 static UniqueResponse on_message_received (UniqueApp *app, UniqueCommand cmd, UniqueMessageData *msg, guint 
t, gpointer  user_data)
 {
     switch (cmd)
@@ -89,13 +92,16 @@ static UniqueResponse on_message_received (UniqueApp *app, UniqueCommand cmd, Un
 
     return UNIQUE_RESPONSE_OK;
 }
+#endif
 
 
 int main (int argc, char *argv[])
 {
     GnomeProgram *program;
     GOptionContext *option_context;
+#ifdef HAVE_UNIQUE
     UniqueApp *app;
+#endif
 
     main_win = NULL;
 
@@ -148,12 +154,16 @@ int main (int argc, char *argv[])
     gnome_cmd_data.migrate_all_data_to_gsettings();
     gnome_cmd_data.load();
 
+#ifdef HAVE_UNIQUE
     app = unique_app_new ("org.gnome.GnomeCommander", NULL);
+#endif
 
+#ifdef HAVE_UNIQUE
     if (!gnome_cmd_data.options.allow_multiple_instances && unique_app_is_running (app))
         unique_app_send_message (app, UNIQUE_ACTIVATE, NULL);
     else
     {
+#endif
         if (start_dir_left)
             
gnome_cmd_data.tabs[LEFT].push_back(make_pair(string(start_dir_left),make_triple(GnomeCmdFileList::COLUMN_NAME,GTK_SORT_ASCENDING,FALSE)));
 
@@ -170,9 +180,10 @@ int main (int argc, char *argv[])
 
         main_win = new GnomeCmdMainWin;
         main_win_widget = *main_win;
-
+#ifdef HAVE_UNIQUE
         unique_app_watch_window (app, *main_win);
         g_signal_connect (app, "message-received", G_CALLBACK (on_message_received), NULL);
+#endif
 
         gtk_widget_show (*main_win);
         gcmd_owner.load_async();
@@ -195,11 +206,15 @@ int main (int argc, char *argv[])
         IMAGE_free ();
 
         remove_temp_download_dir ();
+#ifdef HAVE_UNIQUE
     }
+#endif
 
     gnome_vfs_shutdown ();
 
+#ifdef HAVE_UNIQUE
     g_object_unref (app);
+#endif
     g_object_unref (program);
     g_free (debug_flags);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]