Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross@openedhand.com>2007-05-04 15:17:37 (GMT)
committer Ross Burton <rburton@src.gnome.org>2007-05-04 15:17:37 (GMT)
commit64153d3fe6c59d09f13131db5f376df550f966ac (patch)
treed51ed3f2d6c9ea3c55d4ca9994306a41f2bcd458
parentc31fd74da4f237f783d2fc2ef7c614cf5db7ba28 (diff)
Add --without-libgnome, check for libgnome and libgnomeui separately, and
2007-05-04 Ross Burton <ross@openedhand.com> * configure.ac: Add --without-libgnome, check for libgnome and libgnomeui separately, and add them to the symbols as required. * libdocument/ev-file-helpers.c: When building without libgnome, use g_get_user_config_dir instead of gnome_user_dir_get. * shell/ev-application.c: When building without libgnome, don't use session management. * shell/main.c: When building without libgnome, don't use GnomeProgram or initialise the authentication manager. This fixes #328842. svn path=/trunk/; revision=2436
-rw-r--r--ChangeLog19
-rw-r--r--configure.ac40
-rw-r--r--libdocument/ev-file-helpers.c9
-rw-r--r--shell/ev-application.c10
-rw-r--r--shell/main.c36
5 files changed, 102 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 99c8bb1..4e9a614 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
2007-05-04 Ross Burton <ross@openedhand.com>
+ * configure.ac:
+ Add --without-libgnome, check for libgnome and libgnomeui
+ separately, and add them to the symbols as required.
+
+ * libdocument/ev-file-helpers.c:
+ When building without libgnome, use g_get_user_config_dir instead
+ of gnome_user_dir_get.
+
+ * shell/ev-application.c:
+ When building without libgnome, don't use session management.
+
+ * shell/main.c:
+ When building without libgnome, don't use GnomeProgram or
+ initialise the authentication manager.
+
+ This fixes #328842.
+
+2007-05-04 Ross Burton <ross@openedhand.com>
+
* shell/ev-window.c:
Don't use libgnome to open help, instead call Yelp directly.
diff --git a/configure.ac b/configure.ac
index b418a54..8962561 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,13 +54,26 @@ LIBXML_REQUIRED=2.5.0
GTK_PRINT_REQUIRED=2.10.0
-PKG_CHECK_MODULES(LIB, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED)
-PKG_CHECK_MODULES(BACKEND, gtk+-2.0 >= $GTK_REQUIRED gnome-vfs-2.0 libgnome-2.0 >= $LIBGNOME_REQUIRED)
-PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libglade-2.0 gnome-vfs-2.0)
-PKG_CHECK_MODULES(SHELL_CORE, libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gnome-vfs-2.0 libglade-2.0 gconf-2.0 gnome-keyring-1 >= $KEYRING_REQUIRED)
+PKG_CHECK_MODULES(LIB, gtk+-2.0 >= $GTK_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED)
+PKG_CHECK_MODULES(BACKEND, gtk+-2.0 >= $GTK_REQUIRED gnome-vfs-2.0)
+PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-2.0 >= $GTK_REQUIRED libglade-2.0 gnome-vfs-2.0)
+PKG_CHECK_MODULES(SHELL_CORE, libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gnome-vfs-2.0 libglade-2.0 gconf-2.0 gnome-keyring-1 >= $KEYRING_REQUIRED)
+
+AC_ARG_WITH(libgnome,
+ AC_HELP_STRING([--without-libgnome],[disable the use of libgnome]),
+ [case "${withval}" in
+ yes) WITH_GNOME=yes ;;
+ no) WITH_GNOME=no ;;
+ *) AC_MSG_ERROR(bad value ${withval} for --with-libgnome) ;;
+ esac],
+ [WITH_GNOME=yes]) dnl Default value
+AM_CONDITIONAL(WITH_GNOME, test x$WITH_GNOME = "xyes")
-BACKEND_CFLAGS="$BACKEND_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE"
-AC_SUBST(BACKEND_CFLAGS)
+if test x$WITH_GNOME = "xyes"; then
+ PKG_CHECK_MODULES(GNOME, libgnome-2.0 >= $LIBGNOME_REQUIRED)
+ PKG_CHECK_MODULES(GNOMEUI, libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED)
+ AC_DEFINE([WITH_GNOME],[1],[Define if GNOME support is enabled])
+fi
GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
AC_SUBST(GLIB_GENMARSHAL)
@@ -134,8 +147,18 @@ if test "x$enable_dbus" = "xyes" ; then
AC_DEFINE([ENABLE_DBUS],[1],[Define if DBUS support is enabled])
fi
-SHELL_CFLAGS="$SHELL_CORE_CFLAGS $DBUS_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE"
-SHELL_LIBS="$SHELL_CORE_LIBS $DBUS_LIBS -lz"
+LIB_CFLAGS="$LIB_CFLAGS $GNOME_CFLAGS"
+LIB_LIBS="$LIB_LIBS $GNOME_LIBS"
+AC_SUBST(LIB_CFLAGS)
+AC_SUBST(LIB_LIBS)
+
+BACKEND_CFLAGS="$BACKEND_CFLAGS $GNOME_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE"
+BACKEND_LIBS="$BACKEND_LIBS $GNOME_LIBS"
+AC_SUBST(BACKEND_CFLAGS)
+AC_SUBST(BACKEND_LIBS)
+
+SHELL_CFLAGS="$SHELL_CORE_CFLAGS $DBUS_CFLAGS $GNOMEUI_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE"
+SHELL_LIBS="$SHELL_CORE_LIBS $DBUS_LIBS $GNOMEUI_LIBS -lz"
AC_SUBST(SHELL_CFLAGS)
AC_SUBST(SHELL_LIBS)
@@ -468,6 +491,7 @@ AC_OUTPUT
echo "
Configure summary:
+ GNOME Support......: $WITH_GNOME
Print Support......: $enable_print
DBUS Support.......: $enable_dbus
Nautilus Plugin....: $HAVE_NAUTILUS
diff --git a/libdocument/ev-file-helpers.c b/libdocument/ev-file-helpers.c
index d9b6448..5e83b3b 100644
--- a/libdocument/ev-file-helpers.c
+++ b/libdocument/ev-file-helpers.c
@@ -33,7 +33,10 @@
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-ops.h>
#include <libgnomevfs/gnome-vfs-xfer.h>
+
+#if WITH_GNOME
#include <libgnome/gnome-init.h>
+#endif
#include "ev-file-helpers.h"
@@ -63,9 +66,15 @@ ev_dot_dir (void)
if (dot_dir == NULL) {
gboolean exists;
+#if WITH_GNOME
dot_dir = g_build_filename (gnome_user_dir_get (),
"evince",
NULL);
+#else
+ dot_dir = g_build_filename (g_get_user_config_dir (),
+ "evince",
+ NULL);
+#endif
exists = ensure_dir_exists (dot_dir);
if (!exists)
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 99ab0da..75c2247 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -33,14 +33,18 @@
#include <gtk/gtkstock.h>
#include <gtk/gtkwidget.h>
#include <gtk/gtkmain.h>
+
+#if WITH_GNOME
#include <libgnomeui/gnome-client.h>
-#include <string.h>
+#endif
#ifdef ENABLE_DBUS
#include "ev-application-service.h"
#include <dbus/dbus-glib-bindings.h>
#endif
+#include <string.h>
+
struct _EvApplication {
GObject base_instance;
@@ -137,6 +141,7 @@ ev_application_get_instance (void)
return instance;
}
+#if WITH_GNOME
static void
removed_from_session (GnomeClient *client, EvApplication *application)
{
@@ -184,6 +189,7 @@ init_session (EvApplication *application)
g_signal_connect (client, "die",
G_CALLBACK (removed_from_session), application);
}
+#endif
/**
* ev_display_open_if_needed:
@@ -603,7 +609,9 @@ ev_application_class_init (EvApplicationClass *ev_application_class)
static void
ev_application_init (EvApplication *ev_application)
{
+#if WITH_GNOME
init_session (ev_application);
+#endif
ev_application->toolbars_model = egg_toolbars_model_new ();
diff --git a/shell/main.c b/shell/main.c
index 090b6bf..64b86df 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -27,10 +27,15 @@
#include <gtk/gtkmain.h>
#include <stdlib.h>
#include <string.h>
+
+#if WITH_GNOME
#include <libgnome/gnome-program.h>
#include <libgnomeui/gnome-ui-init.h>
#include <libgnomeui/gnome-app-helper.h>
#include <libgnomeui/gnome-authentication-manager.h>
+#endif
+
+#include <libgnomevfs/gnome-vfs-init.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#ifdef ENABLE_DBUS
@@ -282,7 +287,11 @@ main (int argc, char *argv[])
gboolean enable_metadata = FALSE;
GOptionContext *context;
GHashTable *args;
+#if WITH_GNOME
GnomeProgram *program;
+#else
+ GError *error = NULL;
+#endif
context = g_option_context_new (_("GNOME Document Viewer"));
@@ -296,12 +305,24 @@ main (int argc, char *argv[])
g_option_context_add_main_entries (context, goption_options, NULL);
#endif
+#if WITH_GNOME
program = gnome_program_init (PACKAGE, VERSION,
LIBGNOMEUI_MODULE, argc, argv,
GNOME_PARAM_GOPTION_CONTEXT, context,
GNOME_PARAM_HUMAN_READABLE_NAME, _("Evince"),
GNOME_PARAM_APP_DATADIR, GNOMEDATADIR,
NULL);
+#else
+ g_option_context_add_group (context, gtk_get_option_group (TRUE));
+ if (!g_option_context_parse (context, &argc, &argv, &error)) {
+ g_warning ("Cannot parse arguments: %s", error->message);
+ g_error_free (error);
+ return 1;
+ }
+ g_option_context_free (context);
+
+ gnome_vfs_init ();
+#endif
args = arguments_parse ();
@@ -309,16 +330,19 @@ main (int argc, char *argv[])
if (!ev_application_register_service (EV_APP)) {
if (load_files_remote (file_arguments, args)) {
g_hash_table_destroy (args);
+#if WITH_GNOME
g_object_unref (program);
-
+#endif
return 0;
}
} else {
enable_metadata = TRUE;
}
#endif
-
+
+#if WITH_GNOME
gnome_authentication_manager_init ();
+#endif
if (enable_metadata) {
ev_metadata_manager_init ();
@@ -336,13 +360,19 @@ main (int argc, char *argv[])
gtk_main ();
+#if WITH_GNOME
gnome_accelerators_sync ();
+#endif
+
ev_file_helpers_shutdown ();
if (enable_metadata) {
ev_metadata_manager_shutdown ();
}
- g_object_unref (program);
+#if WITH_GNOME
+ g_object_unref (program);
+#endif
+
return 0;
}