Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2005-04-14 15:41:30 (GMT)
committer Marco Pesenti Gritti <marco@src.gnome.org>2005-04-14 15:41:30 (GMT)
commit1561766454d8a06d887da5c2955b8c4d1dddd9a3 (patch)
tree85e839740013b1cd263cb2c151ab82d90de42d13 /shell
parentcfce03c7e1db82c1abad3ba4b39652986589e2a3 (diff)
Fix the crash when trying to copy in backends that doesnt support it. We
2005-04-14 Marco Pesenti Gritti <mpg@redhat.com> * backend/ev-document.h: * djvu/djvu-document.c: (djvu_document_can_get_text), (djvu_document_document_iface_init): * dvi/dvi-document.c: (dvi_document_can_get_text), (dvi_document_document_iface_init): * pdf/ev-poppler.cc: * pixbuf/pixbuf-document.c: (pixbuf_document_can_get_text), (pixbuf_document_document_iface_init): * ps/ps-document.c: (ps_document_can_get_text), (ps_document_document_iface_init): * shell/ev-view.c: (ev_view_copy), (ev_view_primary_get_cb): * shell/ev-window.c: (update_action_sensitivity): Fix the crash when trying to copy in backends that doesnt support it. We can implement a better solution once we do real text selection.
Diffstat (limited to 'shell')
-rw-r--r--shell/ev-view.c8
-rw-r--r--shell/ev-window.c7
2 files changed, 13 insertions, 2 deletions
diff --git a/shell/ev-view.c b/shell/ev-view.c
index 5678fc2..b615b6c 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -620,6 +620,10 @@ ev_view_copy (EvView *ev_view)
GtkClipboard *clipboard;
char *text;
+ if (!ev_document_can_get_text (ev_view->document)) {
+ return;
+ }
+
g_mutex_lock (EV_DOC_MUTEX);
text = ev_document_get_text (ev_view->document,
ev_view->current_page,
@@ -641,6 +645,10 @@ ev_view_primary_get_cb (GtkClipboard *clipboard,
EvView *ev_view = EV_VIEW (data);
char *text;
+ if (!ev_document_can_get_text (ev_view->document)) {
+ return;
+ }
+
g_mutex_lock (EV_DOC_MUTEX);
text = ev_document_get_text (ev_view->document,
ev_view->current_page,
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 734846f..4d03050 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -183,6 +183,7 @@ update_action_sensitivity (EvWindow *ev_window)
EvDocument *document;
EvWindowPageMode page_mode;
EvView *view;
+ gboolean sensitive;
document = ev_window->priv->document;
page_mode = ev_window->priv->page_mode;
@@ -195,8 +196,10 @@ update_action_sensitivity (EvWindow *ev_window)
/* "FileCloseWindow": always sensitive */
/* Edit menu */
- set_action_sensitive (ev_window, "EditCopy", document!=NULL);
- set_action_sensitive (ev_window, "EditSelectAll", document!=NULL);
+
+ sensitive = document && ev_document_can_get_text (document);
+ set_action_sensitive (ev_window, "EditCopy", sensitive);
+ set_action_sensitive (ev_window, "EditSelectAll", sensitive);
if (document)
set_action_sensitive (ev_window, "EditFind", EV_IS_DOCUMENT_FIND (document));