#include "ev-window.h"
#include "ev-window-title.h"
+#include "ev-navigation-action.h"
#include "ev-page-action.h"
#include "ev-sidebar.h"
#include "ev-sidebar-links.h"
#include "ev-password.h"
#include "ev-password-view.h"
#include "ev-properties-dialog.h"
-#include "ev-ps-exporter.h"
+#include "ev-file-exporter.h"
#include "ev-document-thumbnails.h"
#include "ev-document-links.h"
#include "ev-document-fonts.h"
#include "ev-file-helpers.h"
#include "ev-utils.h"
#include "ev-debug.h"
+#include "ev-history.h"
#ifdef WITH_GNOME_PRINT
#include "ev-print-job.h"
#include <gtk/gtkprintunixdialog.h>
#endif
+#ifdef ENABLE_PDF
#include <poppler.h>
+#endif
#include <glib/gstdio.h>
#include <glib/gi18n.h>
GtkWidget *fullscreen_toolbar;
GtkWidget *fullscreen_popup;
guint fullscreen_timeout_id;
-
+
/* Popup link */
GtkWidget *view_popup;
EvLink *link;
gboolean unlink_temp_file;
EvDocument *document;
-
+ EvHistory *history;
EvPageCache *page_cache;
EvWindowPageMode page_mode;
EvWindowTitle *title;
#define PAGE_SELECTOR_ACTION "PageSelector"
#define ZOOM_CONTROL_ACTION "ViewZoom"
+#define NAVIGATION_ACTION "Navigation"
#define GCONF_OVERRIDE_RESTRICTIONS "/apps/evince/override_restrictions"
#define GCONF_LOCKDOWN_SAVE "/desktop/gnome/lockdown/disable_save_to_disk"
ok_to_copy = (info->permissions & EV_DOCUMENT_PERMISSIONS_OK_TO_COPY);
}
- if (has_document && !EV_IS_PS_EXPORTER(document))
+ if (has_document && !EV_IS_FILE_EXPORTER(document))
ok_to_print = FALSE;
/* Toolbar-specific actions: */
ev_window_set_action_sensitive (ev_window, PAGE_SELECTOR_ACTION, has_pages);
ev_window_set_action_sensitive (ev_window, ZOOM_CONTROL_ACTION, has_pages);
+ ev_window_set_action_sensitive (ev_window, NAVIGATION_ACTION, has_pages);
ev_window_update_actions (ev_window);
}
gint page,
EvWindow *ev_window)
{
+ gchar *label;
+
ev_window_update_actions (ev_window);
+
+ if (ev_window->priv->history) {
+ label = ev_page_cache_get_page_label (ev_window->priv->page_cache, page);
+ ev_history_add_page (ev_window->priv->history, page, label);
+ g_free (label);
+ }
if (!ev_window_is_empty (ev_window))
ev_metadata_manager_set_int (ev_window->priv->uri, "page", page);
ev_page_action_set_document (EV_PAGE_ACTION (action), document);
ev_window_setup_action_sensitivity (ev_window);
+ if (ev_window->priv->history)
+ g_object_unref (ev_window->priv->history);
+ ev_window->priv->history = ev_history_new ();
+ action = gtk_action_group_get_action (ev_window->priv->action_group, NAVIGATION_ACTION);
+ ev_navigation_action_set_history (EV_NAVIGATION_ACTION (action), ev_window->priv->history);
+ ev_navigation_action_set_window (EV_NAVIGATION_ACTION (action), ev_window);
+
if (ev_window->priv->properties) {
ev_properties_dialog_set_document (EV_PROPERTIES_DIALOG (ev_window->priv->properties),
ev_window->priv->document);
{
GnomeVFSURI *uri;
gchar *filename;
- gchar *dir;
+ const gchar *tempdir;
if (!ev_window->priv->uri)
return;
if (!filename)
return;
- dir = g_path_get_dirname (filename);
- if (g_ascii_strcasecmp (dir, g_get_tmp_dir ()) == 0) {
+ tempdir = g_get_tmp_dir ();
+ if (g_ascii_strncasecmp (filename, tempdir, strlen (tempdir)) == 0) {
g_unlink (filename);
}
- g_free (dir);
g_free (filename);
}
}
static gchar *
-ev_window_get_copy_tmp_name (const gchar *filename)
+ev_window_create_tmp_symlink (const gchar *filename, GError **error)
{
gchar *tmp_filename = NULL;
gchar *name;
+ gint res;
guint i = 0;
name = g_path_get_basename (filename);
do {
gchar *basename;
- basename = g_strdup_printf ("%s-%d", name, i);
- tmp_filename = g_build_filename (g_get_tmp_dir (),
+ if (tmp_filename)
+ g_free (tmp_filename);
+
+ basename = g_strdup_printf ("%s-%d", name, i++);
+ tmp_filename = g_build_filename (ev_tmp_dir (),
basename, NULL);
+
g_free (basename);
- } while (g_file_test (tmp_filename, G_FILE_TEST_EXISTS));
+ } while ((res = symlink (filename, tmp_filename)) != 0 && errno == EEXIST);
g_free (name);
+ if (res != 0 && errno != EEXIST) {
+ if (error) {
+ *error = g_error_new (G_FILE_ERROR,
+ g_file_error_from_errno (errno),
+ _("Couldn't create symlink ā%sā: %s"),
+ tmp_filename, strerror (errno));
+ }
+
+ g_free (tmp_filename);
+
+ return NULL;
+ }
+
return tmp_filename;
}
static void
ev_window_cmd_file_open_copy_at_dest (EvWindow *window, EvLinkDest *dest)
{
+ GError *error = NULL;
gchar *symlink_uri;
gchar *old_filename;
gchar *new_filename;
old_filename = g_filename_from_uri (window->priv->uri, NULL, NULL);
- new_filename = ev_window_get_copy_tmp_name (old_filename);
-
- if (symlink (old_filename, new_filename) != 0) {
- gchar *msg;
- GError *error;
-
- msg = g_strdup_printf (_("Cannot open a copy."));
- error = g_error_new (G_FILE_ERROR,
- g_file_error_from_errno (errno),
- _("Couldn't create symlink ā%sā: %s"),
- new_filename, strerror (errno));
- ev_window_error_dialog (GTK_WINDOW (window), msg, error);
- g_free (msg);
- g_error_free (error);
+ new_filename = ev_window_create_tmp_symlink (old_filename, &error);
+
+ if (error) {
+ ev_window_error_dialog (GTK_WINDOW (window),
+ _("Cannot open a copy."),
+ error);
+ g_error_free (error);
g_free (old_filename);
g_free (new_filename);
gdouble width;
gdouble height;
GtkPrintPages print_pages;
+ const gchar *file_format;
if (response != GTK_RESPONSE_OK) {
gtk_widget_destroy (GTK_WIDGET (dialog));
window->priv->print_page_setup = g_object_ref (
gtk_print_unix_dialog_get_page_setup (GTK_PRINT_UNIX_DIALOG (dialog)));
+ file_format = gtk_print_settings_get (window->priv->print_settings,
+ GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT);
+
if (!gtk_printer_accepts_ps (window->priv->printer)) {
GtkWidget *msgdialog;
reverse = gtk_print_settings_get_reverse (window->priv->print_settings);
window->priv->print_job = ev_job_print_new (window->priv->document,
+ file_format ? file_format : "ps",
width, height,
ranges, n_ranges,
page_set,
void
ev_window_print_range (EvWindow *ev_window, int first_page, int last_page)
{
- GtkWidget *dialog;
- EvPageCache *page_cache;
- gint current_page;
- gint document_last_page;
+ GtkWidget *dialog;
+ EvPageCache *page_cache;
+ gint current_page;
+ gint document_last_page;
+ GtkPrintCapabilities capabilities;
g_return_if_fail (EV_IS_WINDOW (ev_window));
g_return_if_fail (ev_window->priv->document != NULL);
dialog = gtk_print_unix_dialog_new (_("Print"), GTK_WINDOW (ev_window));
ev_window->priv->print_dialog = dialog;
+
+ capabilities = GTK_PRINT_CAPABILITY_PAGE_SET |
+ GTK_PRINT_CAPABILITY_COPIES |
+ GTK_PRINT_CAPABILITY_COLLATE |
+ GTK_PRINT_CAPABILITY_REVERSE |
+ GTK_PRINT_CAPABILITY_SCALE |
+ GTK_PRINT_CAPABILITY_GENERATE_PS;
+
+ if (EV_IS_FILE_EXPORTER (ev_window->priv->document) &&
+ ev_file_exporter_format_supported (EV_FILE_EXPORTER (ev_window->priv->document),
+ EV_FILE_FORMAT_PDF)) {
+ capabilities |= GTK_PRINT_CAPABILITY_GENERATE_PDF;
+ }
+
gtk_print_unix_dialog_set_manual_capabilities (GTK_PRINT_UNIX_DIALOG (dialog),
- GTK_PRINT_CAPABILITY_PAGE_SET |
- GTK_PRINT_CAPABILITY_COPIES |
- GTK_PRINT_CAPABILITY_COLLATE |
- GTK_PRINT_CAPABILITY_REVERSE |
- GTK_PRINT_CAPABILITY_SCALE |
- GTK_PRINT_CAPABILITY_GENERATE_PS);
+ capabilities);
gtk_print_unix_dialog_set_current_page (GTK_PRINT_UNIX_DIALOG (dialog),
current_page);
{
EvView *view = EV_VIEW (window->priv->view);
- if (!view || !ev_view_get_fullscreen (EV_VIEW (view)))
+ if (!view ||
+ (!ev_view_get_fullscreen (EV_VIEW (view)) &&
+ !ev_view_get_presentation (EV_VIEW (view))))
return FALSE;
-
+
update_chrome_flag (window, EV_CHROME_FULLSCREEN_TOOLBAR, FALSE);
ev_view_hide_cursor (EV_VIEW (window->priv->view));
window->priv->fullscreen_timeout_id = 0;
window);
fullscreen_set_timeout (window);
+ ev_application_screensaver_disable (EV_APP);
+
if (!ev_window_is_empty (window))
ev_metadata_manager_set_boolean (window->priv->uri, "presentation", TRUE);
}
window);
fullscreen_clear_timeout (window);
+ ev_application_screensaver_enable (EV_APP);
+
if (!ev_window_is_empty (window))
ev_metadata_manager_set_boolean (window->priv->uri, "presentation", FALSE);
}
static char *
build_comments_string (void)
{
+#ifdef ENABLE_PDF
PopplerBackend backend;
const char *backend_name;
const char *version;
break;
}
- return g_strdup_printf (_("PostScript and PDF File Viewer.\n"
+ return g_strdup_printf (_("Document Viewer.\n"
"Using poppler %s (%s)"),
version, backend_name);
+#else
+ return g_strdup_printf (_("Document Viewer"));
+#endif
}
static void
"name", _("Evince"),
"version", VERSION,
"copyright",
- _("\xc2\xa9 1996-2005 The Evince authors"),
+ _("\xc2\xa9 1996-2007 The Evince authors"),
"license", license_trans,
"website", "http://www.gnome.org/projects/evince",
"comments", comments,
priv->dest = NULL;
}
+ if (priv->history) {
+ g_object_unref (priv->history);
+ priv->history = NULL;
+ }
+
if (priv->fullscreen_timeout_id) {
g_source_remove (priv->fullscreen_timeout_id);
priv->fullscreen_timeout_id = 0;
/* Edit menu */
{ "EditCopy", GTK_STOCK_COPY, NULL, "<control>C", NULL,
G_CALLBACK (ev_window_cmd_edit_copy) },
- { "EditSelectAll", NULL, N_("Select _All"), "<control>A", NULL,
+ { "EditSelectAll", GTK_STOCK_SELECT_ALL, N_("Select _All"), "<control>A", NULL,
G_CALLBACK (ev_window_cmd_edit_select_all) },
{ "EditFind", GTK_STOCK_FIND, N_("_Find..."), "<control>F",
N_("Find a word or phrase in the document"),
G_CALLBACK (ev_window_cmd_edit_find_previous) },
{ "EditToolbar", NULL, N_("T_oolbar"), NULL, NULL,
G_CALLBACK (ev_window_cmd_edit_toolbar) },
- { "EditRotateLeft", "object-rotate-left", N_("Rotate _Left"), NULL, NULL,
+ { "EditRotateLeft", EV_STOCK_ROTATE_LEFT, N_("Rotate _Left"), NULL, NULL,
G_CALLBACK (ev_window_cmd_edit_rotate_left) },
- { "EditRotateRight", "object-rotate-right", N_("Rotate _Right"), NULL, NULL,
+ { "EditRotateRight", EV_STOCK_ROTATE_RIGHT, N_("Rotate _Right"), NULL, NULL,
G_CALLBACK (ev_window_cmd_edit_rotate_right) },
/* View menu */
G_CALLBACK (zoom_control_changed_cb), window);
gtk_action_group_add_action (group, action);
g_object_unref (action);
+
+ action = g_object_new (EV_TYPE_NAVIGATION_ACTION,
+ "name", NAVIGATION_ACTION,
+ "label", _("Navigation"),
+ "is_important", TRUE,
+ "short_label", _("Back"),
+ "stock_id", GTK_STOCK_GO_DOWN,
+ "tooltip", _("Move across visited pages"),
+ NULL);
+ gtk_action_group_add_action (group, action);
+ g_object_unref (action);
}
static void
g_signal_connect_swapped (G_OBJECT (ev_window->priv->view), "drag-data-received",
G_CALLBACK (drag_data_received_cb),
ev_window);
-
+
/* Set it user interface params */
ev_window_setup_recent (ev_window);