Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2008-04-16 17:50:18 (GMT)
committer Carlos Garcia Campos <carlosgc@src.gnome.org>2008-04-16 17:50:18 (GMT)
commit526941f5d40276f39717de95010f0dd87e2e9c16 (patch)
tree6453f48a9639de811660730af516b16902600fde /shell
parentdc921b70a94249212cfb0260e0037a46afc6423f (diff)
Add GtkMountOperation (renamed to avoid conflicts) to be able to open
2008-04-16 Carlos Garcia Campos <carlosgc@gnome.org> * configure.ac: * cut-n-paste/evmountoperation/ev-mount-operation.[ch]: * shell/Makefile.am: * shell/ev-window.c: (ev_window_load_remote_failed), (mount_volume_ready_cb), (window_open_file_copy_ready_cb): Add GtkMountOperation (renamed to avoid conflicts) to be able to open documents in remote locations that are not mounted. svn path=/trunk/; revision=3007
Diffstat (limited to 'shell')
-rw-r--r--shell/Makefile.am2
-rw-r--r--shell/ev-window.c58
2 files changed, 50 insertions, 10 deletions
diff --git a/shell/Makefile.am b/shell/Makefile.am
index f4b3e0a..fce876a 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -5,6 +5,7 @@ INCLUDES= \
-I$(top_srcdir)/cut-n-paste/toolbar-editor/ \
-I$(top_srcdir)/cut-n-paste/totem-screensaver/ \
-I$(top_srcdir)/cut-n-paste/gedit-message-area/ \
+ -I$(top_srcdir)/cut-n-paste/evmountoperation/ \
-I$(top_srcdir)/libdocument \
-I$(top_srcdir)/properties \
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
@@ -90,6 +91,7 @@ evince_LDADD= \
$(top_builddir)/cut-n-paste/toolbar-editor/libtoolbareditor.la \
$(top_builddir)/cut-n-paste/totem-screensaver/libtotemscrsaver.la \
$(top_builddir)/cut-n-paste/gedit-message-area/libgeditmsgarea.la \
+ $(top_builddir)/cut-n-paste/evmountoperation/libevmountoperation.la \
$(top_builddir)/properties/libevproperties.la \
$(top_builddir)/libdocument/libevbackend.la \
$(SHELL_LIBS)
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 81c5b9e..1f78e87 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -66,6 +66,7 @@
#include "ev-history.h"
#include "ev-image.h"
#include "ev-message-area.h"
+#include "ev-mount-operation.h"
#include <gtk/gtkprintunixdialog.h>
@@ -268,6 +269,8 @@ static void find_bar_search_changed_cb (EggFindBar *find_
GParamSpec *param,
EvWindow *ev_window);
static void ev_window_do_preview_print (EvWindow *window);
+static void ev_window_load_file_remote (EvWindow *ev_window,
+ GFile *source_file);
G_DEFINE_TYPE (EvWindow, ev_window, GTK_TYPE_WINDOW)
@@ -1422,6 +1425,39 @@ ev_window_close_dialogs (EvWindow *ev_window)
}
static void
+ev_window_load_remote_failed (EvWindow *ev_window,
+ GError *error)
+{
+ ev_view_set_loading (EV_VIEW (ev_window->priv->view), FALSE);
+ ev_window->priv->in_reload = FALSE;
+ ev_window_error_message (GTK_WINDOW (ev_window),
+ _("Unable to open document"),
+ error);
+ g_free (ev_window->priv->local_uri);
+ ev_window->priv->local_uri = NULL;
+}
+
+static void
+mount_volume_ready_cb (GFile *source,
+ GAsyncResult *async_result,
+ EvWindow *ev_window)
+{
+ GError *error = NULL;
+
+ g_file_mount_enclosing_volume_finish (source, async_result, &error);
+
+ if (error) {
+ ev_window_load_remote_failed (ev_window, error);
+ g_object_unref (source);
+ g_error_free (error);
+ } else {
+ /* Volume successfully mounted,
+ try opening the file again */
+ ev_window_load_file_remote (ev_window, source);
+ }
+}
+
+static void
window_open_file_copy_ready_cb (GFile *source,
GAsyncResult *async_result,
EvWindow *ev_window)
@@ -1438,19 +1474,21 @@ window_open_file_copy_ready_cb (GFile *source,
if (error->domain == G_IO_ERROR &&
error->code == G_IO_ERROR_NOT_MOUNTED) {
- /* TODO: try to mount */
+ GMountOperation *operation;
+
+ operation = ev_mount_operation_new (GTK_WINDOW (ev_window));
+ g_file_mount_enclosing_volume (source,
+ G_MOUNT_MOUNT_NONE,
+ operation, NULL,
+ (GAsyncReadyCallback)mount_volume_ready_cb,
+ ev_window);
+ g_object_unref (operation);
+ } else {
+ ev_window_load_remote_failed (ev_window, error);
+ g_object_unref (source);
}
-
- ev_view_set_loading (EV_VIEW (ev_window->priv->view), FALSE);
- ev_window->priv->in_reload = FALSE;
- ev_window_error_message (GTK_WINDOW (ev_window),
- _("Unable to open document"),
- error);
- g_free (ev_window->priv->local_uri);
- ev_window->priv->local_uri = NULL;
g_error_free (error);
- g_object_unref (source);
}
static void