GtkPrintSettings *print_settings;
GtkPageSetup *print_page_setup;
gboolean close_after_print;
+#ifdef WITH_GCONF
+ GConfClient *gconf_client;
+#endif
};
#define EV_WINDOW_GET_PRIVATE(object) \
#define ZOOM_CONTROL_ACTION "ViewZoom"
#define NAVIGATION_ACTION "Navigation"
+#define GCONF_LOCKDOWN_DIR "/desktop/gnome/lockdown"
#define GCONF_OVERRIDE_RESTRICTIONS "/apps/evince/override_restrictions"
#define GCONF_LOCKDOWN_SAVE "/desktop/gnome/lockdown/disable_save_to_disk"
#define GCONF_LOCKDOWN_PRINT "/desktop/gnome/lockdown/disable_printing"
+#define GCONF_LOCKDOWN_PRINT_SETUP "/desktop/gnome/lockdown/disable_print_setup"
#define PRESENTATION_TIMEOUT 5
{
EvDocument *document = ev_window->priv->document;
const EvDocumentInfo *info = NULL;
-
gboolean has_document = FALSE;
gboolean ok_to_print = TRUE;
+ gboolean ok_to_print_setup = TRUE;
gboolean ok_to_copy = TRUE;
gboolean has_properties = TRUE;
gboolean override_restrictions = TRUE;
gboolean can_get_text = FALSE;
gboolean has_pages = FALSE;
gboolean can_find = FALSE;
-#ifdef WITH_GCONF
- GConfClient *client;
-#endif
if (document) {
has_document = TRUE;
}
#ifdef WITH_GCONF
- client = gconf_client_get_default ();
- override_restrictions = gconf_client_get_bool (client,
- GCONF_OVERRIDE_RESTRICTIONS,
- NULL);
+ if (has_document)
+ override_restrictions = gconf_client_get_bool (ev_window->priv->gconf_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_print = FALSE;
#ifdef WITH_GCONF
- if (gconf_client_get_bool (client, GCONF_LOCKDOWN_SAVE, NULL)) {
+ if (has_document &&
+ gconf_client_get_bool (ev_window->priv->gconf_client, GCONF_LOCKDOWN_SAVE, NULL)) {
ok_to_copy = FALSE;
}
- if (gconf_client_get_bool (client, GCONF_LOCKDOWN_PRINT, NULL)) {
+ if (has_document &&
+ gconf_client_get_bool (ev_window->priv->gconf_client, GCONF_LOCKDOWN_PRINT, NULL)) {
ok_to_print = FALSE;
}
- g_object_unref (client);
+ if (has_document &&
+ gconf_client_get_bool (ev_window->priv->gconf_client, GCONF_LOCKDOWN_PRINT_SETUP, NULL)) {
+ ok_to_print_setup = FALSE;
+ }
#endif
/* File menu */
ev_window_set_action_sensitive (ev_window, "FileOpenCopy", has_document);
ev_window_set_action_sensitive (ev_window, "FileSaveAs", has_document && ok_to_copy);
- ev_window_set_action_sensitive (ev_window, "FilePageSetup", has_pages && ok_to_print);
+#if !GTK_CHECK_VERSION (2, 17, 4)
+ ev_window_set_action_sensitive (ev_window, "FilePageSetup", has_pages && ok_to_print && ok_to_print_setup);
+#endif
ev_window_set_action_sensitive (ev_window, "FilePrint", has_pages && ok_to_print);
ev_window_set_action_sensitive (ev_window, "FileProperties", has_document && has_properties);
ev_job_scheduler_push_job (ev_window->priv->thumbnail_job, EV_JOB_PRIORITY_NONE);
}
+#ifdef WITH_GCONF
+static void
+lockdown_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ EvWindow *ev_window)
+{
+ ev_window_setup_action_sensitivity (ev_window);
+}
+#endif /* WITH_GCONF */
+
static gboolean
ev_window_setup_document (EvWindow *ev_window)
{
ev_window_title_set_document (ev_window->priv->title, document);
ev_window_title_set_uri (ev_window->priv->title, ev_window->priv->uri);
+#ifdef WITH_GCONF
+ if (!ev_window->priv->gconf_client)
+ ev_window->priv->gconf_client = gconf_client_get_default ();
+ gconf_client_add_dir (ev_window->priv->gconf_client,
+ GCONF_LOCKDOWN_DIR,
+ GCONF_CLIENT_PRELOAD_ONELEVEL,
+ NULL);
+ gconf_client_add_dir (ev_window->priv->gconf_client,
+ GCONF_OVERRIDE_RESTRICTIONS,
+ GCONF_CLIENT_PRELOAD_NONE,
+ NULL);
+ gconf_client_notify_add (ev_window->priv->gconf_client,
+ GCONF_LOCKDOWN_DIR,
+ (GConfClientNotifyFunc)lockdown_changed,
+ ev_window, NULL, NULL);
+ gconf_client_notify_add (ev_window->priv->gconf_client,
+ GCONF_OVERRIDE_RESTRICTIONS,
+ (GConfClientNotifyFunc)lockdown_changed,
+ ev_window, NULL, NULL);
+#endif /* WITH_GCONF */
+
ev_window_setup_action_sensitivity (ev_window);
if (ev_window->priv->history)
* it helps to resolve some mime types, say cbz.
*/
base_name = g_file_get_basename (source_file);
- template = g_build_filename ("document.XXXXXX-%s", base_name, NULL);
+ template = g_strdup_printf ("document.XXXXXX-%s", base_name);
g_free (base_name);
tmp_file = ev_mkstemp_file (template, &err);
+ g_free (template);
if (tmp_file == NULL) {
ev_window_error_message (ev_window, err,
"%s", _("Failed to load remote file."));
target_file = g_file_new_for_uri (ev_window->priv->local_uri);
g_file_copy_async (source_file, target_file,
- 0, G_PRIORITY_DEFAULT,
+ G_FILE_COPY_OVERWRITE,
+ G_PRIORITY_DEFAULT,
ev_window->priv->progress_cancellable,
(GFileProgressCallback)window_open_file_copy_progress_cb,
ev_window,
ev_application_open_uri_list (EV_APP, uris,
gtk_window_get_screen (GTK_WINDOW (ev_window)),
- GDK_CURRENT_TIME);
+ gtk_get_current_event_time ());
g_slist_foreach (uris, (GFunc)g_free, NULL);
g_slist_free (uris);
ev_application_open_uri_at_dest (EV_APP, uri,
gtk_window_get_screen (GTK_WINDOW (window)),
- NULL, 0, NULL, GDK_CURRENT_TIME);
+ NULL, 0, NULL, gtk_get_current_event_time ());
}
static void
{
ev_application_open_uri_at_dest (EV_APP, uri,
gtk_window_get_screen (GTK_WINDOW (window)),
- NULL, 0, NULL, GDK_CURRENT_TIME);
+ NULL, 0, NULL, gtk_get_current_event_time ());
}
static void
print_settings = ev_print_operation_get_print_settings (op);
ev_window_save_print_settings (ev_window, print_settings);
+
+ if (ev_print_operation_get_embed_page_setup (op)) {
+ GtkPageSetup *page_setup;
+
+ page_setup = ev_print_operation_get_default_page_setup (op);
+ ev_window_save_print_page_setup (ev_window, page_setup);
+ }
}
break;
ev_print_operation_set_current_page (op, current_page);
ev_print_operation_set_print_settings (op, print_settings);
ev_print_operation_set_default_page_setup (op, print_page_setup);
+#ifdef WITH_GCONF
+ ev_print_operation_set_embed_page_setup (op, !gconf_client_get_bool (ev_window->priv->gconf_client,
+ GCONF_LOCKDOWN_PRINT_SETUP,
+ NULL));
+#else
+ ev_print_operation_set_embed_page_setup (op, TRUE);
+#endif
g_object_unref (print_settings);
g_object_unref (print_page_setup);
gtk_show_uri (gtk_window_get_screen (GTK_WINDOW (ev_window)),
"ghelp:evince",
- GDK_CURRENT_TIME,
+ gtk_get_current_event_time (),
&error);
if (error) {
ev_window_error_message (ev_window, error,
g_source_remove (priv->setup_document_idle);
priv->setup_document_idle = 0;
}
-
+
+#ifdef WITH_GCONF
+ if (priv->gconf_client) {
+ g_object_unref (priv->gconf_client);
+ priv->gconf_client = NULL;
+ }
+#endif
+
if (priv->monitor) {
g_object_unref (priv->monitor);
priv->monitor = NULL;
G_CALLBACK (ev_window_cmd_scroll_forward) },
{ "ShiftReturn", NULL, "", "<shift>Return", NULL,
G_CALLBACK (ev_window_cmd_scroll_backward) },
+ { "p", GTK_STOCK_GO_UP, "", "p", NULL,
+ G_CALLBACK (ev_window_cmd_go_previous_page) },
+ { "n", GTK_STOCK_GO_DOWN, "", "n", NULL,
+ G_CALLBACK (ev_window_cmd_go_next_page) },
{ "Plus", GTK_STOCK_ZOOM_IN, NULL, "plus", NULL,
G_CALLBACK (ev_window_cmd_view_zoom_in) },
{ "CtrlEqual", GTK_STOCK_ZOOM_IN, NULL, "<control>equal", NULL,
context = G_APP_LAUNCH_CONTEXT (gdk_app_launch_context_new ());
gdk_app_launch_context_set_screen (GDK_APP_LAUNCH_CONTEXT (context),
gtk_window_get_screen (GTK_WINDOW (window)));
- gdk_app_launch_context_set_timestamp (GDK_APP_LAUNCH_CONTEXT (context), GDK_CURRENT_TIME);
+ gdk_app_launch_context_set_timestamp (GDK_APP_LAUNCH_CONTEXT (context),
+ gtk_get_current_event_time ());
file_list.data = file;
if (!g_app_info_launch (app_info, &file_list, context, &error)) {
g_object_unref (app_info);
g_object_unref (file);
+ /* FIXMEchpe: unref launch context? */
/* According to the PDF spec filename can be an executable. I'm not sure
allowing to launch executables is a good idea though. -- marco */
gdk_app_launch_context_set_screen (GDK_APP_LAUNCH_CONTEXT (context),
gtk_window_get_screen (GTK_WINDOW (window)));
gdk_app_launch_context_set_timestamp (GDK_APP_LAUNCH_CONTEXT (context),
- GDK_CURRENT_TIME);
+ gtk_get_current_event_time ());
if (!g_strstr_len (uri, strlen (uri), "://") &&
!g_str_has_prefix (uri, "mailto:")) {
/* Not a valid uri, assuming it's http */
http = g_strdup_printf ("http://%s", uri);
- ret = g_app_info_launch_default_for_uri (http, NULL, &error);
+ ret = g_app_info_launch_default_for_uri (http, context, &error);
g_free (http);
} else {
- ret = g_app_info_launch_default_for_uri (uri, NULL, &error);
+ ret = g_app_info_launch_default_for_uri (uri, context, &error);
}
if (ret == FALSE) {
"%s", _("Unable to open external link"));
g_error_free (error);
}
+
+ /* FIXMEchpe: unref launch context? */
}
static void
ev_link_action_get_dest (action),
0,
NULL,
- GDK_CURRENT_TIME);
+ gtk_get_current_event_time ());
g_free (uri);
}
attachment = (EvAttachment *) l->data;
- ev_attachment_open (attachment, screen, GDK_CURRENT_TIME, &error);
+ ev_attachment_open (attachment, screen, gtk_get_current_event_time (), &error);
if (error) {
ev_window_error_message (window, error,
g_error_free (error);
}
g_free (ui_path);
-
+
+#if GTK_CHECK_VERSION (2, 17, 4)
+ {
+ GtkAction *action;
+
+ action = gtk_action_group_get_action (ev_window->priv->action_group,
+ "FilePageSetup");
+ g_object_set (action, "visible", FALSE, "sensitive", FALSE, NULL);
+ }
+#endif
+
ev_window->priv->recent_manager = gtk_recent_manager_get_default ();
ev_window->priv->recent_action_group = NULL;
ev_window->priv->recent_ui_id = 0;