#include "ev-application.h"
#include "ev-stock-icons.h"
#include "ev-file-helpers.h"
+#include <poppler.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
}
static void
-ev_window_print (EvWindow *ev_window)
+ev_window_print (EvWindow *window)
+{
+ EvPageCache *page_cache;
+ int last_page;
+
+ page_cache = ev_document_get_page_cache (window->priv->document);
+ last_page = ev_page_cache_get_n_pages (page_cache);
+
+ ev_window_print_range (window, 1, -1);
+}
+
+void
+ev_window_print_range (EvWindow *ev_window, int first_page, int last_page)
{
GnomePrintConfig *config;
GnomePrintJob *job;
GtkWidget *print_dialog;
- EvPageCache *page_cache;
gchar *pages_label;
EvPrintJob *print_job = NULL;
+ EvPageCache *page_cache;
g_return_if_fail (EV_IS_WINDOW (ev_window));
g_return_if_fail (ev_window->priv->document != NULL);
+ page_cache = ev_document_get_page_cache (ev_window->priv->document);
+ if (last_page == -1) {
+ last_page = ev_page_cache_get_n_pages (page_cache);
+ }
+
config = gnome_print_config_default ();
job = gnome_print_job_new (config);
- page_cache = ev_document_get_page_cache (ev_window->priv->document);
-
print_dialog = gnome_print_dialog_new (job, (guchar *) _("Print"),
(GNOME_PRINT_DIALOG_RANGE |
GNOME_PRINT_DIALOG_COPIES));
gnome_print_dialog_construct_range_page (GNOME_PRINT_DIALOG (print_dialog),
GNOME_PRINT_RANGE_ALL |
GNOME_PRINT_RANGE_RANGE,
- 1,
- ev_page_cache_get_n_pages (page_cache),
+ first_page, last_page,
NULL, (const guchar *)pages_label);
g_free (pages_label);
update_sizing_buttons (ev_window);
}
+static char *
+build_comments_string (void)
+{
+ PopplerBackend backend;
+ const char *backend_name;
+ const char *version;
+
+ backend = poppler_get_backend ();
+ version = poppler_get_version ();
+ switch (backend) {
+ case POPPLER_BACKEND_CAIRO:
+ backend_name = "cairo";
+ break;
+ case POPPLER_BACKEND_SPLASH:
+ backend_name = "splash";
+ break;
+ default:
+ backend_name = "unknown";
+ break;
+ }
+
+ return g_strdup_printf (_("PostScript and PDF File Viewer.\n"
+ "Using poppler %s (%s)"),
+ version, backend_name);
+}
+
static void
ev_window_cmd_help_about (GtkAction *action, EvWindow *ev_window)
{
const char *authors[] = {
- N_("Many..."),
+ "Martin Kretzschmar <m_kretzschmar@gmx.net>",
+ "Jonathan Blandford <jrb@gnome.org>",
+ "Marco Pesenti Gritti <marco@gnome.org>",
+ "Nickolay V. Shmyrev <nshmyrev@yandex.ru>",
+ "Bryan Clark <clarkbw@gnome.org>",
NULL
};
const char *documenters[] = {
- N_("Not so many..."),
+ "Nickolay V. Shmyrev <nshmyrev@yandex.ru>",
NULL
};
};
char *license_trans;
+ char *comments;
#ifdef ENABLE_NLS
const char **p;
license_trans = g_strconcat (_(license[0]), "\n", _(license[1]), "\n",
_(license[2]), "\n", NULL);
+ comments = build_comments_string ();
gtk_show_about_dialog (
GTK_WINDOW (ev_window),
_("\xc2\xa9 1996-2004 The Evince authors"),
"license", license_trans,
"website", "http://www.gnome.org/projects/evince",
- "comments", _("PostScript and PDF File Viewer."),
+ "comments", comments,
"authors", authors,
"documenters", documenters,
"translator-credits", _("translator-credits"),
NULL);
+ g_free (comments);
g_free (license_trans);
}
}
}
+static void
+activate_link_cb (EvPageAction *page_action, EvLink *link, EvWindow *window)
+{
+ g_return_if_fail (EV_IS_WINDOW (window));
+
+ ev_page_cache_set_link (window->priv->page_cache, link);
+ gtk_widget_grab_focus (window->priv->view);
+}
+
+static gboolean
+activate_label_cb (EvPageAction *page_action, char *label, EvWindow *window)
+{
+ g_return_val_if_fail (EV_IS_WINDOW (window), FALSE);
+
+ gtk_widget_grab_focus (window->priv->view);
+
+ return ev_page_cache_set_page_label (window->priv->page_cache, label);
+}
+
static void
register_custom_actions (EvWindow *window, GtkActionGroup *group)
{
"tooltip", _("Select Page"),
"visible_overflown", FALSE,
NULL);
+ g_signal_connect (action, "activate_link",
+ G_CALLBACK (activate_link_cb), window);
+ g_signal_connect (action, "activate_label",
+ G_CALLBACK (activate_label_cb), window);
gtk_action_group_add_action (group, action);
g_object_unref (action);