+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:
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)
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)
echo "
Configure summary:
+ GNOME Support......: $WITH_GNOME
Print Support......: $enable_print
DBUS Support.......: $enable_dbus
Nautilus Plugin....: $HAVE_NAUTILUS
#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"
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)
#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;
return instance;
}
+#if WITH_GNOME
static void
removed_from_session (GnomeClient *client, EvApplication *application)
{
g_signal_connect (client, "die",
G_CALLBACK (removed_from_session), application);
}
+#endif
/**
* ev_display_open_if_needed:
static void
ev_application_init (EvApplication *ev_application)
{
+#if WITH_GNOME
init_session (ev_application);
+#endif
ev_application->toolbars_model = egg_toolbars_model_new ();
#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
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"));
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 ();
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 ();
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;
}