#endif
};
-static const GtkTargetEntry ev_drop_types[] = {
- { "text/uri-list", 0, 0 }
-};
-
-
#define EV_WINDOW_GET_PRIVATE(object) \
(G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_WINDOW, EvWindowPrivate))
{
char *uri = window->priv->uri;
GValue page = { 0, };
+ gint n_pages;
gint new_page;
+ /* View the previously shown page, but make sure to not open a document on
+ * the last page, since closing it on the last page most likely means the
+ * user was finished reading the document. In that case, reopening should
+ * show the first page. */
if (uri && ev_metadata_manager_get (uri, "page", &page, TRUE)) {
- new_page = CLAMP (g_value_get_int (&page), 0, ev_page_cache_get_n_pages (window->priv->page_cache) - 1);
+ n_pages = ev_page_cache_get_n_pages (window->priv->page_cache);
+ new_page = CLAMP (g_value_get_int (&page), 0, n_pages - 1);
+ if (new_page == n_pages - 1)
+ new_page = 0;
ev_page_cache_set_current_page (window->priv->page_cache,
new_page);
g_value_unset (&page);
GTK_WINDOW (ev_window));
}
+ ev_document_fc_mutex_lock ();
gtk_widget_show (ev_window->priv->properties);
+ ev_document_fc_mutex_unlock ();
}
static void
NULL, G_CALLBACK (ev_attachment_popup_cmd_save_attachment_as) },
};
-static void
-drag_data_received_cb (GtkWidget *widget, GdkDragContext *context,
- gint x, gint y, GtkSelectionData *selection_data,
- guint info, guint time, gpointer gdata)
-{
- GList *uri_list = NULL;
- GSList *uris = NULL;
- gchar *uri;
-
- uri_list = gnome_vfs_uri_list_parse ((gchar *) selection_data->data);
-
- if (uri_list) {
- while (uri_list) {
- uri = gnome_vfs_uri_to_string (uri_list->data, GNOME_VFS_URI_HIDE_NONE);
- uris = g_slist_append (uris, (gpointer) uri);
-
- uri_list = g_list_next (uri_list);
- }
-
- gnome_vfs_uri_list_free (uri_list);
-
- ev_application_open_uri_list (EV_APP, uris,
- gtk_widget_get_screen (widget),
- 0);
-
- g_slist_free (uris);
- }
-}
-
static void
activate_link_cb (EvPageAction *page_action, EvLink *link, EvWindow *window)
{
static void
launch_external_uri (EvWindow *window, EvLinkAction *action)
{
- const char *uri;
- char *escaped;
-
- uri = ev_link_action_get_uri (action);
- escaped = gnome_vfs_escape_host_and_path_string (uri);
-
- gnome_vfs_url_show (escaped);
- g_free (escaped);
+ gnome_vfs_url_show (ev_link_action_get_uri (action));
}
static void
/* Give focus to the document view */
gtk_widget_grab_focus (ev_window->priv->view);
- /* Drag and Drop */
- gtk_drag_dest_unset (GTK_WIDGET (ev_window->priv->view));
- gtk_drag_dest_set (GTK_WIDGET (ev_window->priv->view),
- GTK_DEST_DEFAULT_ALL,
- ev_drop_types,
- sizeof (ev_drop_types) / sizeof (ev_drop_types[0]),
- GDK_ACTION_COPY);
- 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);
setup_chrome_from_metadata (ev_window);