updated gtk-only patch



Hello

here's a patch against today's CVS to allow it to build without gnome libs
not for inclusion obviously, just for those interested in such a thing.

Jani
=== modified file 'Makefile.am'
--- Makefile.am
+++ Makefile.am
@@ -40,7 +40,7 @@
 
 # Applications 
 
-SUBDIRS += shell thumbnailer
+SUBDIRS += shell 
 
 intltool_extra = intltool-extract.in intltool-merge.in intltool-update.in
 

=== modified file 'backend/ev-document-misc.h'
--- backend/ev-document-misc.h
+++ backend/ev-document-misc.h
@@ -41,6 +41,9 @@
 						  GdkRectangle *area,
 						  GtkBorder    *border);
 
+gboolean  document_save_helper (char *document_uri,
+			        const char  *uri,
+			        GError     **error);
 G_END_DECLS
 
 #endif /* EV_DOCUMENT_MISC_H */

=== modified file 'configure.ac'
--- configure.ac
+++ configure.ac
@@ -49,11 +49,11 @@
 LIBGNOMEUI_REQUIRED=2.6.0
 KEYRING_REQUIRED=0.4.0
 
-PKG_CHECK_MODULES(LIB, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED)
-PKG_CHECK_MODULES(BACKEND, gtk+-2.0 >= $GTK_REQUIRED gnome-vfs-2.0)
-PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libglade-2.0 poppler-glib >= $POPPLER_REQUIRED)
+PKG_CHECK_MODULES(LIB, gtk+-2.0 >= $GTK_REQUIRED libxml-2.0)
+PKG_CHECK_MODULES(BACKEND, gtk+-2.0 >= $GTK_REQUIRED )
+PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-2.0 >= $GTK_REQUIRED libglade-2.0 poppler-glib >= $POPPLER_REQUIRED)
 PKG_CHECK_MODULES(POPPLER, poppler-glib >= $POPPLER_REQUIRED)
-PKG_CHECK_MODULES(SHELL_CORE, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED gnome-vfs-2.0 libgnomeprint-2.2 >= 2.5.1 libgnomeprintui-2.2 libglade-2.0 gconf-2.0 poppler-glib >= $POPPLER_REQUIRED gnome-keyring-1 >= $KEYRING_REQUIRED)
+PKG_CHECK_MODULES(SHELL_CORE, gtk+-2.0 >= $GTK_REQUIRED gthread-2.0 libgnomeprint-2.2 >= 2.5.1 libgnomeprintui-2.2 libglade-2.0 poppler-glib >= $POPPLER_REQUIRED )
 
 GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`  
 AC_SUBST(GLIB_GENMARSHAL)
@@ -81,7 +81,7 @@
 fi
 
 SHELL_CFLAGS="$SHELL_CORE_CFLAGS $DBUS_CFLAGS"
-SHELL_LIBS="$SHELL_CORE_LIBS $DBUS_LIBS -lz"
+SHELL_LIBS="$SHELL_CORE_LIBS $DBUS_LIBS -lz -lmagic -lpopt"
 AC_SUBST(SHELL_CFLAGS)
 AC_SUBST(SHELL_LIBS)
 
@@ -124,12 +124,12 @@
 LIBS=$evince_save_LIBS
 
 dnl GConf configuration
-AM_GCONF_SOURCE_2
-
-AC_PATH_PROG([GCONFTOOL], [gconftool-2], [no])
-if test "x$GCONFTOOL" = "xno"; then
-	AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
-fi
+#AM_GCONF_SOURCE_2
+
+#AC_PATH_PROG([GCONFTOOL], [gconftool-2], [no])
+#if test "x$GCONFTOOL" = "xno"; then
+#	AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
+#fi
 
 dnl ================== portability checks ===========================================
 

=== modified file 'cut-n-paste/recent-files/egg-recent-item.c'
--- cut-n-paste/recent-files/egg-recent-item.c
+++ cut-n-paste/recent-files/egg-recent-item.c
@@ -22,8 +22,13 @@
 #include <stdio.h>
 #include <string.h>
 #include <glib.h>
+#ifdef WITH_GNOME
 #include <libgnomevfs/gnome-vfs.h>
 #include <libgnomevfs/gnome-vfs-mime-utils.h>
+#else
+#include <magic.h>
+#define GNOME_VFS_MIME_TYPE_UNKNOWN "application/octet-stream"
+#endif
 #include "egg-recent-item.h"
 
 
@@ -179,6 +184,42 @@
 }
 */
 
+#ifndef WITH_GNOME
+static char *
+gnome_vfs_get_mime_type(const char * uri)
+{
+	magic_t cookie;
+	char *mime_type = NULL;
+	char **split;
+	char *me;
+
+	cookie = magic_open(MAGIC_COMPRESS | MAGIC_MIME);
+	magic_load(cookie, NULL);
+	mime_type = (char *)magic_file(cookie, g_filename_from_uri(uri, NULL, NULL));
+	me = (char*)magic_error(cookie);
+	
+	if (mime_type) {
+		split = g_strsplit(mime_type, " ", 2);
+		mime_type = *split;
+		me = g_strdup(mime_type);
+		g_strfreev(split);
+	} else {
+		me = NULL;
+	}
+
+	magic_close(cookie);
+	return me;
+}
+
+static char *
+gnome_vfs_make_uri_from_input(const char *location)
+{
+	char * uri;
+	uri = g_strdup(location);
+	return uri;
+}
+#endif
+
 static void
 egg_recent_item_update_mime_type (EggRecentItem *item)
 {
@@ -244,12 +285,21 @@
 	return g_filename_to_utf8 (item->uri, -1, NULL, NULL, NULL);
 }
 
+#ifndef WITH_GNOME
+static char *
+gnome_vfs_format_uri_for_display(const char *uri)
+{
+	return g_filename_display_name(g_filename_from_uri(uri, NULL, NULL));
+}
+#endif
+
 gchar *
 egg_recent_item_get_uri_for_display (const EggRecentItem *item)
 {
 	return gnome_vfs_format_uri_for_display (item->uri);
 }
 
+#ifdef WITH_GNOME
 /* Stolen from gnome_vfs_make_valid_utf8() */
 static char *
 make_valid_utf8 (const char *name)
@@ -347,6 +397,7 @@
 
 	return short_name;
 }
+#endif
 
 void 
 egg_recent_item_set_mime_type (EggRecentItem *item, const gchar *mime)

=== modified file 'cut-n-paste/recent-files/egg-recent-model.c'
--- cut-n-paste/recent-files/egg-recent-model.c
+++ cut-n-paste/recent-files/egg-recent-model.c
@@ -29,11 +29,14 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/time.h>
+#include <sys/stat.h>
 #include <time.h>
 #include <gtk/gtk.h>
+#ifdef WITH_GNOME
 #include <libgnomevfs/gnome-vfs.h>
 #include <libgnomevfs/gnome-vfs-mime-utils.h>
 #include <gconf/gconf-client.h>
+#endif
 #include "egg-recent-model.h"
 #include "egg-recent-item.h"
 
@@ -60,11 +63,13 @@
 
 	char *path;			/* path to the file we store stuff in */
 
+#ifdef WITH_GNOME
 	GHashTable *monitors;
 
 	GnomeVFSMonitorHandle *monitor;
 
 	GConfClient *client;
+#endif
 	gboolean use_default_limit;
 
 	guint limit_change_notify_id;
@@ -248,6 +253,14 @@
 		tmp = tmp->next;
 	}
 }
+
+#ifndef WITH_GNOME
+static gboolean
+gnome_vfs_uris_match(const char *u1, const char *u2)
+{
+	return !strcmp(u1, u2);
+}
+#endif
 
 static gboolean
 egg_recent_model_update_item (GList *items, EggRecentItem *upd_item)
@@ -555,6 +568,7 @@
 		} else
 			pass_group_test = TRUE;
 
+#ifdef WITH_GNOME
 		/* filter by URI scheme */
 		if (pass_mime_test && pass_group_test &&
 		    model->priv->scheme_filter_values != NULL) {
@@ -568,6 +582,7 @@
 
 			g_free (scheme);
 		} else
+#endif			    
 			pass_scheme_test = TRUE;
 
 		if (pass_mime_test && pass_group_test && pass_scheme_test)
@@ -642,6 +657,7 @@
 #endif
 
 
+#ifdef WITH_GNOME	
 static gboolean
 egg_recent_model_changed_timeout (EggRecentModel *model)
 {
@@ -676,10 +692,12 @@
 			model);
 	}
 }
+#endif
 
 static void
 egg_recent_model_monitor (EggRecentModel *model, gboolean should_monitor)
 {
+#ifdef WITH_GNOME	
 	if (should_monitor && model->priv->monitor == NULL) {
 		char *uri;
 
@@ -701,6 +719,7 @@
 		gnome_vfs_monitor_cancel (model->priv->monitor);
 		model->priv->monitor = NULL;
 	}
+#endif
 }
 
 static void
@@ -964,6 +983,7 @@
 	model->priv->group_filter_values = NULL;
 
 
+#ifdef WITH_GNOME
 	if (model->priv->limit_change_notify_id)
 		gconf_client_notify_remove (model->priv->client,
 					    model->priv->limit_change_notify_id);
@@ -976,13 +996,16 @@
 
 	g_object_unref (model->priv->client);
 	model->priv->client = NULL;
+#endif
 
 
 	g_free (model->priv->path);
 	model->priv->path = NULL;
-	
+
+#ifdef WITH_GNOME	
 	g_hash_table_destroy (model->priv->monitors);
 	model->priv->monitors = NULL;
+#endif
 
 
 	g_free (model->priv);
@@ -1128,6 +1151,7 @@
 
 
 
+#ifdef WITH_GNOME
 static void
 egg_recent_model_limit_changed (GConfClient *client, guint cnxn_id,
 				GConfEntry *entry, gpointer user_data)
@@ -1163,15 +1187,18 @@
 {
 
 }
+#endif
 
 static void
 egg_recent_model_init (EggRecentModel * model)
 {
+#ifdef WITH_GNOME
 	if (!gnome_vfs_init ()) {
 		g_warning ("gnome-vfs initialization failed.");
 		return;
 	}
-	
+#endif
+
 
 	model->priv = g_new0 (EggRecentModelPrivate, 1);
 
@@ -1181,7 +1208,8 @@
 	model->priv->mime_filter_values   = NULL;
 	model->priv->group_filter_values  = NULL;
 	model->priv->scheme_filter_values = NULL;
-	
+
+#ifdef WITH_GNOME	
 	model->priv->client = gconf_client_get_default ();
 	gconf_client_add_dir (model->priv->client, EGG_RECENT_MODEL_KEY_DIR,
 			      GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
@@ -1202,7 +1230,8 @@
 					model->priv->client,
 					EGG_RECENT_MODEL_EXPIRE_KEY,
 					NULL);
-					
+#endif
+
 #if 0
 	/* keep this out, for now */
 	model->priv->limit = gconf_client_get_int (
@@ -1213,12 +1242,14 @@
 	model->priv->limit = EGG_RECENT_MODEL_DEFAULT_LIMIT;
 	model->priv->use_default_limit = FALSE;
 
+#ifdef WITH_GNOME
 	model->priv->monitors = g_hash_table_new_full (
 					g_str_hash, g_str_equal,
 					(GDestroyNotify) g_free,
 					(GDestroyNotify) gnome_vfs_monitor_cancel);
 
 	model->priv->monitor = NULL;
+#endif	
 	egg_recent_model_monitor (model, TRUE);
 }
 
@@ -1316,12 +1347,14 @@
 
 	fclose (file);
 
+#ifdef WITH_GNOME
 	if (model->priv->monitor == NULL) {
 		/* since monitoring isn't working, at least give a
 		 * local notification
 		 */
 		egg_recent_model_changed (model);
 	}
+#endif
 
 	return ret;
 }
@@ -1412,6 +1445,7 @@
 
 	fclose (file);
 
+#ifdef WITH_GNOME
 	g_hash_table_remove (model->priv->monitors, uri);
 
 	if (model->priv->monitor == NULL && ret) {
@@ -1420,6 +1454,7 @@
 		 */
 		egg_recent_model_changed (model);
 	}
+#endif
 
 	return ret;
 }

=== modified file 'cut-n-paste/recent-files/egg-recent-util.c'
--- cut-n-paste/recent-files/egg-recent-util.c
+++ cut-n-paste/recent-files/egg-recent-util.c
@@ -5,6 +5,9 @@
 #include <time.h>
 #include <unistd.h>
 #include <sys/types.h>
+#ifndef WITH_GNOME
+#define USE_STABLE_LIBGNOMEUI
+#endif
 #ifndef USE_STABLE_LIBGNOMEUI
 #include <libgnomeui/gnome-icon-theme.h>
 #include <libgnomeui/gnome-icon-lookup.h>

=== modified file 'cut-n-paste/recent-files/egg-recent-view-uimanager.c'
--- cut-n-paste/recent-files/egg-recent-view-uimanager.c
+++ cut-n-paste/recent-files/egg-recent-view-uimanager.c
@@ -28,11 +28,15 @@
 #include <string.h>
 #include <stdlib.h>
 #include <gtk/gtk.h>
+#ifdef WITH_GNOME
 #include <libgnomevfs/gnome-vfs.h>
 #ifndef USE_STABLE_LIBGNOMEUI
 #include <libgnomeui/gnome-icon-theme.h>
 #endif
 #include <gconf/gconf-client.h>
+#else
+#define USE_STABLE_LIBGNOMEUI
+#endif
 #include "egg-recent-model.h"
 #include "egg-recent-view.h"
 #include "egg-recent-view-uimanager.h"
@@ -71,7 +75,9 @@
 	gpointer        tooltip_func_data;
 
 	EggRecentModel *model;
+#ifdef WITH_GNOME	
 	GConfClient    *client;
+#endif
 	GtkIconSize     icon_size;
 };
 
@@ -419,10 +425,12 @@
 	}
 #endif
 
+#ifdef WITH_GNOME
 	if (view->client != NULL) {
 		g_object_unref (view->client);
 		view->client = NULL;
 	}
+#endif
 }
 
 static void
@@ -485,6 +493,7 @@
 	iface->do_set_model = egg_recent_view_uimanager_set_model;
 }
 
+#ifdef WITH_GNOME
 static void
 show_menus_changed_cb (GConfClient            *client,
 		       guint                   cnxn_id,
@@ -498,7 +507,7 @@
 
 	egg_recent_view_uimanager_show_icons (view, gconf_value_get_bool (value));
 }
-
+#endif
 #ifndef USE_STABLE_LIBGNOMEUI
 static void
 theme_changed_cb (GnomeIconTheme         *theme, 
@@ -512,6 +521,7 @@
 static void
 egg_recent_view_uimanager_init (EggRecentViewUIManager * view)
 {
+#ifdef WITH_GNOME	
 	view->client = gconf_client_get_default ();
 
 	view->show_icons = gconf_client_get_bool (view->client,
@@ -526,6 +536,7 @@
 				 (GConfClientNotifyFunc)show_menus_changed_cb,
 				 view, NULL, NULL);
 
+#endif
 
 	view->leading_sep = FALSE;
 	view->trailing_sep = FALSE;

=== modified file 'lib/ev-file-helpers.c'
--- lib/ev-file-helpers.c
+++ lib/ev-file-helpers.c
@@ -24,7 +24,9 @@
 
 #include <sys/stat.h>
 #include <glib.h>
+#ifdef WITH_GNOME
 #include <libgnome/gnome-init.h>
+#endif
 #include <unistd.h>
 
 #include "ev-file-helpers.h"
@@ -61,7 +63,12 @@
 	{
 		gboolean exists;
 
-		dot_dir = g_build_filename (gnome_user_dir_get (),
+		dot_dir = g_build_filename (
+#ifdef WITH_GNOME
+					   gnome_user_dir_get (),
+#else
+					   g_get_home_dir(), ".gnome2",
+#endif
 					    "evince",
 					    NULL);
 

=== modified file 'pdf/ev-poppler.cc'
--- pdf/ev-poppler.cc
+++ pdf/ev-poppler.cc
@@ -784,8 +784,9 @@
 		unimplemented_action = "POPPLER_ACTION_GOTO_REMOTE";
 		break;
 	case POPPLER_ACTION_LAUNCH:
-		link = ev_link_new_launch (title, action->launch.file_name,
-					   action->launch.params);
+//FIXME:Poppler 0.5 not released
+//		link = ev_link_new_launch (title, action->launch.file_name,
+//					   action->launch.params);
 		break;
 	case POPPLER_ACTION_URI:
 		link = ev_link_new_external (title, action->uri.uri);

=== modified file 'shell/ev-application.c'
--- shell/ev-application.c
+++ shell/ev-application.c
@@ -36,7 +36,9 @@
 #include <gtk/gtkstock.h>
 #include <gtk/gtkwidget.h>
 #include <gtk/gtkmain.h>
+#ifdef WITH_GNOME
 #include <libgnomeui/gnome-client.h>
+#endif
 #include <string.h>
 
 #ifdef ENABLE_DBUS
@@ -112,6 +114,7 @@
 	return instance;
 }
 
+#ifdef WITH_GNOME
 static void
 removed_from_session (GnomeClient *client, EvApplication *application)
 {
@@ -159,6 +162,7 @@
 	g_signal_connect (client, "die",
 			  G_CALLBACK (removed_from_session), application);
 }
+#endif
 
 gboolean
 ev_application_open_window (EvApplication  *application,
@@ -316,7 +320,9 @@
 static void
 ev_application_init (EvApplication *ev_application)
 {
+#ifdef WITH_GNOME	
 	init_session (ev_application);
+#endif
 
 	ev_application->toolbars_model = egg_toolbars_model_new ();
 

=== modified file 'shell/ev-document-types.c'
--- shell/ev-document-types.c
+++ shell/ev-document-types.c
@@ -27,11 +27,16 @@
 
 #include <string.h>
 #include <glib/gi18n.h>
+#ifdef WITH_GNOME
 #include <libgnomevfs/gnome-vfs-mime-utils.h>
 #include <libgnomevfs/gnome-vfs-file-info.h>
 #include <libgnomevfs/gnome-vfs-ops.h>
+#else
+#include <magic.h>
+#endif
 #include <gtk/gtkfilechooserdialog.h>
 
+#ifdef WITH_GNOME
 static EvDocument *
 get_document_from_uri (const char *uri, gboolean slow, gchar **mime_type, GError **error)
 {
@@ -82,6 +87,47 @@
         return document;
 }
 
+#else
+
+static EvDocument *
+get_document_from_uri (const char *uri, gboolean slow, gchar **mime_type, GError **error)
+{
+	EvDocument *document = NULL;
+	magic_t cookie;
+	char *magic_mime_type;
+	char **split;
+	char *me;
+	
+	cookie = magic_open(MAGIC_COMPRESS | MAGIC_MIME);
+	magic_load(cookie, NULL);
+	magic_mime_type = (char *)magic_file(cookie, g_filename_from_uri(uri, NULL, NULL));
+	me = (char*)magic_error(cookie);
+	//g_print("error = %s\n",me); 
+	//g_print("mime = %s\n", magic_mime_type);	
+	if (magic_mime_type == NULL || me != NULL) {
+		g_set_error(error, EV_DOCUMENT_ERROR, 0, me);
+		goto out;
+	}	
+
+	split = g_strsplit(magic_mime_type, " ", 2);
+	magic_mime_type = *split;
+	
+	
+	document = ev_document_factory_get_document (magic_mime_type);
+	if (document == NULL) {
+		g_set_error(error, EV_DOCUMENT_ERROR, 0, "Unhandled MIME type");
+	}	
+	g_strfreev(split);
+out:	
+	if (mime_type != NULL) {
+		    *mime_type = g_strdup (magic_mime_type);
+	}
+	magic_close(cookie);
+        return document;
+}
+
+#endif
+
 EvDocument *
 ev_document_types_get_document (const char *uri, gchar **mime_type, GError **error)
 {

=== modified file 'shell/ev-job-xfer.c'
--- shell/ev-job-xfer.c
+++ shell/ev-job-xfer.c
@@ -29,10 +29,12 @@
 #include <glib/gi18n.h>
 #include <glib.h>
 
+#ifdef WITH_GNOME
 #include <libgnomevfs/gnome-vfs-uri.h>
 #include <libgnomevfs/gnome-vfs-utils.h>
 #include <libgnomevfs/gnome-vfs-ops.h>
 #include <libgnomevfs/gnome-vfs-xfer.h>
+#endif
 
 static void ev_job_xfer_init    	(EvJobXfer	     *job);
 static void ev_job_xfer_class_init 	(EvJobXferClass	     *class);
@@ -92,8 +94,10 @@
 {
 	EvDocument *document;
 	GError *error = NULL;
+#ifdef WITH_GNOME	
 	GnomeVFSURI *source_uri;
 	GnomeVFSURI *target_uri;
+#endif
 
 	g_return_if_fail (EV_IS_JOB_XFER (job));
 	
@@ -111,7 +115,8 @@
 		EV_JOB (job)->finished = TRUE;
 		return;	
 	}
-	
+
+#ifdef WITH_GNOME	
 	source_uri = gnome_vfs_uri_new (job->uri);
 	if (!gnome_vfs_uri_is_local (source_uri)) {
 		char *tmp_name;
@@ -131,6 +136,7 @@
 		gnome_vfs_uri_unref (target_uri);
 	}
 	gnome_vfs_uri_unref (source_uri);
+#endif
 
 	EV_JOB (job)->finished = TRUE;
 	return;

=== modified file 'shell/ev-password.c'
--- shell/ev-password.c
+++ shell/ev-password.c
@@ -24,8 +24,10 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <glade/glade.h>
+#ifdef WITH_GNOME
 #include <gnome-keyring.h>
 #include <libgnomevfs/gnome-vfs-utils.h>
+#endif
 
 #include "ev-password.h"
 
@@ -59,6 +61,13 @@
 				                   gchar     *message);
 static void ev_password_search_in_keyring         (EvPasswordDialog *dialog, 
 						   const gchar *uri);
+#ifndef WITH_GNOME
+static char *
+gnome_vfs_format_uri_for_display(const char *uri)
+{
+	return g_filename_display_name(g_filename_from_uri(uri, NULL, NULL));
+}
+#endif
 
 static void
 ev_password_dialog_set_property (GObject      *object,
@@ -66,6 +75,7 @@
 			         const GValue *value,
 			         GParamSpec   *pspec)
 {
+#ifdef WITH_GNOME
 	EvPasswordDialog *dialog = EV_PASSWORD_DIALOG (object);
 	char *format;
 	char *markup;
@@ -97,6 +107,7 @@
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
 	}
+#endif
 }
 
 static void
@@ -173,11 +184,13 @@
 	g_signal_connect (dialog->priv->entry, "activate", G_CALLBACK (ev_password_dialog_entry_activated_cb), dialog);
 
 	ev_password_set_bad_password_label (dialog, " ");
-	
+
+#ifdef WITH_GNOME	
 	if (!gnome_keyring_is_available ()) {
 		gtk_widget_hide (dialog->priv->check_default);
 		gtk_widget_hide (dialog->priv->check_session);
 	}
+#endif
 
 	g_object_unref (xml);
 }
@@ -219,6 +232,7 @@
 	gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
 }
 
+#ifdef WITH_GNOME
 static void
 ev_password_item_created_callback (GnomeKeyringResult result,
 				   guint32            val,
@@ -227,10 +241,12 @@
 	/* Nothing yet */
 	return;
 }				   
+#endif
 
 void
 ev_password_dialog_save_password (EvPasswordDialog *dialog)
 {
+#ifdef WITH_GNOME	
 	GnomeKeyringAttributeList *attributes;
 	GnomeKeyringAttribute attribute;
 	gchar *name;
@@ -247,9 +263,12 @@
 	attribute.type = GNOME_KEYRING_ATTRIBUTE_TYPE_STRING;
 	attribute.value.string = g_strdup (dialog->priv->uri);
 	g_array_append_val (attributes, attribute);
-	
+#ifdef WITH_GNOME	
 	unescaped_uri = gnome_vfs_unescape_string_for_display (dialog->priv->uri);
-	name = g_strdup_printf (_("Password for document %s"), unescaped_uri);	
+#else
+	unescaped_uri = dialog->priv->uri;
+#endif
+	name = g_strdup_printf (_("Password for document %s"), unescaped_uri);
 
 	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->check_default))) {
 		gnome_keyring_item_create (NULL,
@@ -274,10 +293,12 @@
 	gnome_keyring_attribute_list_free (attributes);
 	g_free (name);
 	g_free (unescaped_uri);
-	
+#endif
+
 	return;
 }
 
+#ifdef WITH_GNOME
 static void 
 ev_password_keyring_found_cb (GnomeKeyringResult result,
 			      GList             *list,
@@ -320,6 +341,7 @@
 	gnome_keyring_attribute_list_free (attributes);
 	return;
 }
+#endif
 
 char *
 ev_password_dialog_get_password (EvPasswordDialog *dialog)

=== modified file 'shell/ev-view.c'
--- shell/ev-view.c
+++ shell/ev-view.c
@@ -26,7 +26,6 @@
 #include <gtk/gtkselection.h>
 #include <gtk/gtkclipboard.h>
 #include <gdk/gdkkeysyms.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
 
 #include "ev-marshal.h"
 #include "ev-view.h"

=== modified file 'shell/ev-window-title.c'
--- shell/ev-window-title.c
+++ shell/ev-window-title.c
@@ -21,7 +21,9 @@
 #include "ev-document-factory.h"
 
 #include <glib/gi18n.h>
+#ifdef WITH_GNOME
 #include <libgnomevfs/gnome-vfs-utils.h>
+#endif
 
 typedef struct
 {
@@ -55,6 +57,14 @@
 
 	return window_title;
 }
+
+#ifndef WITH_GNOME
+static char *
+gnome_vfs_format_uri_for_display(const char *uri)
+{
+	return g_filename_display_name(g_filename_from_uri(uri, NULL, NULL));
+}
+#endif
 
 static char *
 get_filename_from_uri (const char *uri)

=== modified file 'shell/ev-window.c'
--- shell/ev-window.c
+++ shell/ev-window.c
@@ -69,12 +69,15 @@
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
+#ifdef WITH_GNOME
 #include <gnome.h>
 #include <libgnomeprintui/gnome-print-dialog.h>
 #include <libgnomevfs/gnome-vfs-utils.h>
 #include <gconf/gconf-client.h>
+#endif
 
 #include <string.h>
+#include <unistd.h>
 
 typedef enum {
 	PAGE_MODE_DOCUMENT,
@@ -227,7 +230,9 @@
 	gboolean override_restrictions = FALSE;
 	gboolean can_get_text = FALSE;
 	gboolean ok_to_copy_text = FALSE;
+#ifdef WITH_GNOME	
 	GConfClient *client;
+#endif
 
 	view = EV_VIEW (ev_window->priv->view);
 
@@ -245,10 +250,12 @@
 		has_pages = has_document && n_pages > 0;
 	}
 
+#ifdef WITH_GNOME
 	client = gconf_client_get_default ();
 	override_restrictions = gconf_client_get_bool (client, 
 						       GCONF_OVERRIDE_RESTRICTIONS, 
 						       NULL);
+#endif	
 	if (!override_restrictions && info && info->fields_mask & EV_DOCUMENT_INFO_PERMISSIONS) {
 		ok_to_print = (info->permissions & EV_DOCUMENT_PERMISSIONS_OK_TO_PRINT);
 		ok_to_copy = (info->permissions & EV_DOCUMENT_PERMISSIONS_OK_TO_COPY);
@@ -261,6 +268,7 @@
 		has_properties = FALSE;
 	}
 	
+#ifdef WITH_GNOME
 	if (gconf_client_get_bool (client, GCONF_LOCKDOWN_SAVE, NULL)) {
 		ok_to_copy = FALSE;
 	}
@@ -270,6 +278,7 @@
 	}
 	
 	g_object_unref (client);
+#endif
 
 	if (has_document && ev_document_can_get_text (document)) {
 		can_get_text = TRUE;
@@ -935,6 +944,14 @@
 	    ev_window->priv->local_uri = NULL;
     }
 }
+
+#ifndef WITH_GNOME
+static char *
+gnome_vfs_format_uri_for_display(const char *uri)
+{
+	return g_filename_display_name(g_filename_from_uri(uri, NULL, NULL));
+}
+#endif
 
 /* This callback will executed when load job will be finished.
  *
@@ -1190,6 +1207,43 @@
 	gtk_widget_destroy (error_dialog);
 }
 
+gboolean
+document_save_helper (char *document_uri,
+		      const char  *uri,
+		      GError     **error)
+{
+//FIXME for nonVFS case
+#ifdef WITH_GNOME	
+	GnomeVFSResult result;
+	GnomeVFSURI *source_uri;
+	GnomeVFSURI *target_uri;
+	
+	if (document_uri)
+		return FALSE;
+	
+	source_uri = gnome_vfs_uri_new (document_uri);
+	target_uri = gnome_vfs_uri_new (uri);
+
+	result = gnome_vfs_xfer_uri (source_uri, target_uri, 
+				     GNOME_VFS_XFER_DEFAULT | GNOME_VFS_XFER_FOLLOW_LINKS,
+				     GNOME_VFS_XFER_ERROR_MODE_ABORT,
+				     GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
+				     NULL,
+				     NULL);
+	gnome_vfs_uri_unref (target_uri);
+	gnome_vfs_uri_unref (source_uri);
+    
+	if (result != GNOME_VFS_OK)
+		g_set_error (error,
+			     EV_DOCUMENT_ERROR,
+			     0,
+			     gnome_vfs_result_to_string (result));			
+	return (result == GNOME_VFS_OK);
+#else
+	return TRUE;
+#endif
+}
+
 static void
 file_save_dialog_response_cb (GtkWidget *fc,
 			      gint       response_id,
@@ -2104,7 +2158,9 @@
 
         g_return_if_fail (EV_IS_WINDOW (ev_window));
 
+#ifdef WITH_GNOME
 	gnome_help_display ("evince.xml", NULL, &error);
+#endif
 
 	if(error != NULL) {
 		g_warning (error->message);
@@ -2932,6 +2988,7 @@
 		       gint x, gint y, GtkSelectionData *selection_data,
 		       guint info, guint time, gpointer gdata)
 {
+#ifdef WITH_GNOME
 	GList  *uri_list = NULL;
 	GSList *uris = NULL;
 	gchar  *uri;
@@ -2954,6 +3011,7 @@
 
 		gtk_drag_finish (context, TRUE, FALSE, time);
 	}
+#endif
 }
 
 static void
@@ -3183,6 +3241,7 @@
 	ev_view_goto_link (EV_VIEW (window->priv->view), link);
 }
 
+#ifdef WITH_GNOME
 static void
 launch_link (EvWindow *window, EvLink *link)
 {
@@ -3229,10 +3288,12 @@
 	gnome_vfs_url_show (escaped);
 	g_free (escaped);
 }
+#endif
 
 static void
 view_external_link_cb (EvView *view, EvLink *link, EvWindow *window)
 {
+#ifdef WITH_GNOME	
 	switch (ev_link_get_link_type (link)) {
 	case EV_LINK_TYPE_EXTERNAL_URI:
 		launch_external_uri (window, link);
@@ -3243,6 +3304,7 @@
 	default:
 		g_assert_not_reached ();
 	}
+#endif
 }
 
 static void

=== modified file 'shell/main.c'
--- shell/main.c
+++ shell/main.c
@@ -28,11 +28,14 @@
 #include <gtk/gtkmain.h>
 #include <stdlib.h>
 #include <string.h>
+#include <popt.h>
+#ifdef 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>
 #include <libgnomevfs/gnome-vfs-utils.h>
+#endif
 
 #ifdef ENABLE_DBUS
 #include <dbus/dbus-glib-bindings.h>
@@ -51,6 +54,22 @@
 	{ NULL, 0, 0, NULL, 0, NULL, NULL }
 };
 
+#ifndef WITH_GNOME
+static char *
+gnome_vfs_make_uri_from_shell_arg (const char *location)
+{
+	char *uri;
+
+	g_return_val_if_fail (location != NULL, g_strdup (""));
+
+	if (g_path_is_absolute (location))
+		uri = g_strconcat("file://", location, NULL);
+	else 
+		uri = g_strconcat("file://", g_get_current_dir(), "/", location, NULL);
+	return uri;
+}
+
+#endif
 static void
 load_files (const char **files)
 {
@@ -60,7 +79,6 @@
 		ev_application_open_window (EV_APP, GDK_CURRENT_TIME, NULL);
 		return;
 	}
-
 	for (i = 0; files[i]; i++) {
 		char *uri;
 
@@ -243,9 +261,14 @@
 {
 	gboolean enable_metadata = FALSE;
 	poptContext context;
+#ifdef WITH_GNOME
         GValue context_as_value = { 0 };
 	GnomeProgram *program;
 
+#else
+	int nextopt;
+#endif
+	
 #ifdef ENABLE_NLS
 	/* Initialize the i18n stuff */
 	bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);
@@ -253,6 +276,7 @@
 	textdomain(GETTEXT_PACKAGE);
 #endif
 
+#ifdef WITH_GNOME
 	program = gnome_program_init (PACKAGE, VERSION,
                                       LIBGNOMEUI_MODULE, argc, argv,
                                       GNOME_PARAM_POPT_TABLE, popt_options,
@@ -264,6 +288,12 @@
                                g_value_init (&context_as_value, G_TYPE_POINTER));
         context = g_value_get_pointer (&context_as_value);
 
+#else
+	gtk_init(&argc, &argv);
+	context = poptGetContext(NULL, argc, (const char**)argv, popt_options, 0);
+	while ((nextopt = poptGetNextOpt(context)) > 0 || nextopt == POPT_ERROR_BADOPT);
+
+#endif
 
 #ifdef ENABLE_DBUS
 	if (!ev_application_register_service (EV_APP)) {
@@ -275,7 +305,9 @@
 	}
 #endif
 
+#ifdef WITH_GNOME
 	gnome_authentication_manager_init ();
+#endif
 
 
 	if (enable_metadata) {
@@ -294,7 +326,9 @@
 
 	gtk_main ();
 
+#ifdef WITH_GNOME
 	gnome_accelerators_sync ();
+#endif
 	poptFreeContext (context);
 	ev_file_helpers_shutdown ();
 

=== modified file 'tiff/tiff-document.c'
--- tiff/tiff-document.c
+++ tiff/tiff-document.c
@@ -30,11 +30,6 @@
 #include "ev-document-thumbnails.h"
 #include "ev-ps-exporter.h"
 
-#include <libgnomevfs/gnome-vfs-uri.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
-#include <libgnomevfs/gnome-vfs-xfer.h>
-
 struct _TiffDocumentClass
 {
   GObjectClass parent_class;
@@ -128,31 +123,7 @@
 		      GError     **error)
 {		
 	TiffDocument *tiff_document = TIFF_DOCUMENT (document);
-	GnomeVFSResult result;
-	GnomeVFSURI *source_uri;
-	GnomeVFSURI *target_uri;
-	
-	if (!tiff_document->uri)
-		return FALSE;
-	
-	source_uri = gnome_vfs_uri_new (tiff_document->uri);
-	target_uri = gnome_vfs_uri_new (uri);
-
-	result = gnome_vfs_xfer_uri (source_uri, target_uri, 
-				     GNOME_VFS_XFER_DEFAULT | GNOME_VFS_XFER_FOLLOW_LINKS,
-				     GNOME_VFS_XFER_ERROR_MODE_ABORT,
-				     GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
-				     NULL,
-				     NULL);
-	gnome_vfs_uri_unref (target_uri);
-	gnome_vfs_uri_unref (source_uri);
-    
-	if (result != GNOME_VFS_OK)
-		g_set_error (error,
-			     EV_DOCUMENT_ERROR,
-			     0,
-			     gnome_vfs_result_to_string (result));			
-	return (result == GNOME_VFS_OK);
+	return document_save_helper(tiff_document->uri, uri, error); 
 }
 
 static int



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