diff options
Diffstat (limited to 'libview')
-rw-r--r-- | libview/ev-job-scheduler.c | 38 | ||||
-rw-r--r-- | libview/ev-jobs.c | 154 | ||||
-rw-r--r-- | libview/ev-jobs.h | 6 | ||||
-rw-r--r-- | libview/ev-pixbuf-cache.c | 22 | ||||
-rw-r--r-- | libview/ev-print-operation.c | 72 | ||||
-rw-r--r-- | libview/ev-print-operation.h | 2 | ||||
-rw-r--r-- | libview/ev-timeline.c | 2 | ||||
-rw-r--r-- | libview/ev-timeline.h | 2 | ||||
-rw-r--r-- | libview/ev-transition-animation.c | 2 | ||||
-rw-r--r-- | libview/ev-transition-animation.h | 2 | ||||
-rw-r--r-- | libview/ev-view-private.h | 8 | ||||
-rw-r--r-- | libview/ev-view.c | 160 | ||||
-rw-r--r-- | libview/ev-web-view.c | 58 | ||||
-rw-r--r-- | libview/ev-web-view.h | 4 |
14 files changed, 266 insertions, 266 deletions
diff --git a/libview/ev-job-scheduler.c b/libview/ev-job-scheduler.c index 2fea0224..99213d8e 100644 --- a/libview/ev-job-scheduler.c +++ b/libview/ev-job-scheduler.c @@ -56,12 +56,12 @@ ev_job_queue_push (EvSchedulerJob *job, EvJobPriority priority) { ev_debug_message (DEBUG_JOBS, "%s priority %d", EV_GET_TYPE_NAME (job->job), priority); - + g_mutex_lock (&job_queue_mutex); g_queue_push_tail (job_queue[priority], job); g_cond_broadcast (&job_queue_cond); - + g_mutex_unlock (&job_queue_mutex); } @@ -70,7 +70,7 @@ ev_job_queue_get_next_unlocked (void) { gint i; EvSchedulerJob *job = NULL; - + for (i = EV_JOB_PRIORITY_URGENT; i < EV_JOB_N_PRIORITIES; i++) { job = (EvSchedulerJob *) g_queue_pop_head (job_queue[i]); if (job) @@ -86,7 +86,7 @@ static gpointer ev_job_scheduler_init (gpointer data) { g_thread_new ("EvJobScheduler", ev_job_thread_proxy, NULL); - + return NULL; } @@ -94,12 +94,12 @@ static void ev_scheduler_job_list_add (EvSchedulerJob *job) { ev_debug_message (DEBUG_JOBS, "%s", EV_GET_TYPE_NAME (job->job)); - + G_LOCK (job_list); job_list = g_slist_prepend (job_list, job); job->job_link = job_list; - + G_UNLOCK (job_list); } @@ -107,11 +107,11 @@ static void ev_scheduler_job_list_remove (EvSchedulerJob *job) { ev_debug_message (DEBUG_JOBS, "%s", EV_GET_TYPE_NAME (job->job)); - + G_LOCK (job_list); job_list = g_slist_delete_link (job_list, job->job_link); - + G_UNLOCK (job_list); } @@ -131,7 +131,7 @@ ev_scheduler_job_destroy (EvSchedulerJob *job) ev_debug_message (DEBUG_JOBS, "%s", EV_GET_TYPE_NAME (job->job)); if (job->job->run_mode == EV_JOB_RUN_MAIN_LOOP) { - g_signal_handlers_disconnect_by_func (job->job, + g_signal_handlers_disconnect_by_func (job->job, G_CALLBACK (ev_scheduler_job_destroy), job); } else { @@ -139,7 +139,7 @@ ev_scheduler_job_destroy (EvSchedulerJob *job) G_CALLBACK (ev_scheduler_thread_job_cancelled), job); } - + ev_scheduler_job_list_remove (job); ev_scheduler_job_free (job); } @@ -149,7 +149,7 @@ ev_scheduler_thread_job_cancelled (EvSchedulerJob *job, GCancellable *cancellable) { GList *list; - + ev_debug_message (DEBUG_JOBS, "%s", EV_GET_TYPE_NAME (job->job)); g_mutex_lock (&job_queue_mutex); @@ -157,7 +157,7 @@ ev_scheduler_thread_job_cancelled (EvSchedulerJob *job, /* If the job is not still running, * remove it from the job queue and job list. * If the job is currently running, it will be - * destroyed as soon as it finishes. + * destroyed as soon as it finishes. */ list = g_queue_find (job_queue[job->priority], job); if (list) { @@ -213,7 +213,7 @@ ev_job_thread_proxy (gpointer data) continue; } g_mutex_unlock (&job_queue_mutex); - + ev_job_thread (job->job); ev_scheduler_job_destroy (job); } @@ -237,7 +237,7 @@ ev_job_scheduler_push_job (EvJob *job, s_job->priority = priority; ev_scheduler_job_list_add (s_job); - + switch (ev_job_get_run_mode (job)) { case EV_JOB_RUN_THREAD: g_signal_connect_swapped (job->cancellable, "cancelled", @@ -275,7 +275,7 @@ ev_job_scheduler_update_job (EvJob *job, return; ev_debug_message (DEBUG_JOBS, "%s pirority %d", EV_GET_TYPE_NAME (job), priority); - + G_LOCK (job_list); for (l = job_list; l; l = l->next) { @@ -286,14 +286,14 @@ ev_job_scheduler_update_job (EvJob *job, break; } } - + G_UNLOCK (job_list); if (need_resort) { GList *list; - + g_mutex_lock (&job_queue_mutex); - + list = g_queue_find (job_queue[s_job->priority], s_job); if (list) { ev_debug_message (DEBUG_JOBS, "Moving job %s from pirority %d to %d", @@ -302,7 +302,7 @@ ev_job_scheduler_update_job (EvJob *job, g_queue_push_tail (job_queue[priority], s_job); g_cond_broadcast (&job_queue_cond); } - + g_mutex_unlock (&job_queue_mutex); } } diff --git a/libview/ev-jobs.c b/libview/ev-jobs.c index 607bc2c2..134324e4 100644 --- a/libview/ev-jobs.c +++ b/libview/ev-jobs.c @@ -176,14 +176,14 @@ emit_finished (EvJob *job) ev_debug_message (DEBUG_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); job->idle_finished_id = 0; - + if (job->cancelled) { ev_debug_message (DEBUG_JOBS, "%s (%p) job was cancelled, do not emit finished", EV_GET_TYPE_NAME (job), job); } else { ev_profiler_stop (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); g_signal_emit (job, job_signals[FINISHED], 0); } - + return FALSE; } @@ -196,9 +196,9 @@ ev_job_emit_finished (EvJob *job) ev_debug_message (DEBUG_JOBS, "%s (%p) job was cancelled, returning", EV_GET_TYPE_NAME (job), job); return; } - + job->finished = TRUE; - + if (job->run_mode == EV_JOB_RUN_THREAD) { job->idle_finished_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, @@ -215,7 +215,7 @@ gboolean ev_job_run (EvJob *job) { EvJobClass *class = EV_JOB_GET_CLASS (job); - + return class-> run (job); } @@ -227,7 +227,7 @@ ev_job_cancel (EvJob *job) ev_debug_message (DEBUG_JOBS, "job %s (%p) cancelled", EV_GET_TYPE_NAME (job), job); ev_profiler_stop (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); - + /* This should never be called from a thread */ job->cancelled = TRUE; g_cancellable_cancel (job->cancellable); @@ -247,22 +247,22 @@ ev_job_failed (EvJob *job, { va_list args; gchar *message; - + if (job->failed || job->finished) return; ev_debug_message (DEBUG_JOBS, "job %s (%p) failed", EV_GET_TYPE_NAME (job), job); - + job->failed = TRUE; - + va_start (args, format); message = g_strdup_vprintf (format, args); va_end (args); - + job->error = g_error_new_literal (domain, code, message); g_free (message); - - ev_job_emit_finished (job); + + ev_job_emit_finished (job); } /** @@ -278,7 +278,7 @@ ev_job_failed_from_error (EvJob *job, { if (job->failed || job->finished) return; - + ev_debug_message (DEBUG_JOBS, "job %s (%p) failed", EV_GET_TYPE_NAME (job), job); job->failed = TRUE; @@ -294,7 +294,7 @@ ev_job_succeeded (EvJob *job) return; ev_debug_message (DEBUG_JOBS, "job %s (%p) succeeded", EV_GET_TYPE_NAME (job), job); - + job->failed = FALSE; ev_job_emit_finished (job); } @@ -337,7 +337,7 @@ ev_job_links_dispose (GObject *object) EvJobLinks *job; ev_debug_message (DEBUG_JOBS, NULL); - + job = EV_JOB_LINKS (object); if (job->model) { @@ -387,7 +387,7 @@ ev_job_links_run (EvJob *job) ev_debug_message (DEBUG_JOBS, NULL); ev_profiler_start (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); - + ev_document_doc_mutex_lock (); job_links->model = ev_document_links_get_links_model (EV_DOCUMENT_LINKS (job->document)); ev_document_doc_mutex_unlock (); @@ -395,7 +395,7 @@ ev_job_links_run (EvJob *job) gtk_tree_model_foreach (job_links->model, (GtkTreeModelForeachFunc)fill_page_labels, job); ev_job_succeeded (job); - + return FALSE; } @@ -418,7 +418,7 @@ ev_job_links_new (EvDocument *document) job = g_object_new (EV_TYPE_JOB_LINKS, NULL); job->document = g_object_ref (document); - + return job; } @@ -435,7 +435,7 @@ ev_job_attachments_dispose (GObject *object) EvJobAttachments *job; ev_debug_message (DEBUG_JOBS, NULL); - + job = EV_JOB_ATTACHMENTS (object); if (job->attachments) { @@ -484,7 +484,7 @@ ev_job_attachments_new (EvDocument *document) job = g_object_new (EV_TYPE_JOB_ATTACHMENTS, NULL); job->document = g_object_ref (document); - + return job; } @@ -610,11 +610,11 @@ ev_job_render_run (EvJob *job) ev_debug_message (DEBUG_JOBS, "page: %d (%p)", job_render->page, job); ev_profiler_start (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); - + ev_document_doc_mutex_lock (); ev_profiler_start (EV_PROFILE_JOBS, "Rendering page %d", job_render->page); - + ev_document_fc_mutex_lock (); ev_page = ev_document_get_page (job->document, job_render->page); @@ -622,7 +622,7 @@ ev_job_render_run (EvJob *job) if ( job->document->iswebdocument == TRUE ) { return TRUE; - + if (g_cancellable_is_cancelled (job->cancellable)) { ev_document_fc_mutex_unlock (); ev_document_doc_mutex_unlock (); @@ -630,7 +630,7 @@ ev_job_render_run (EvJob *job) return FALSE; } - + ev_document_fc_mutex_unlock (); ev_document_doc_mutex_unlock (); ev_job_succeeded (job); @@ -670,9 +670,9 @@ ev_job_render_run (EvJob *job) ev_document_fc_mutex_unlock (); ev_document_doc_mutex_unlock (); - + ev_job_succeeded (job); - + return FALSE; } @@ -697,7 +697,7 @@ ev_job_render_new (EvDocument *document, EvJobRender *job; ev_debug_message (DEBUG_JOBS, "page: %d", page); - + job = g_object_new (EV_TYPE_JOB_RENDER, NULL); EV_JOB (job)->document = g_object_ref (document); @@ -830,7 +830,7 @@ ev_job_thumbnail_dispose (GObject *object) job = EV_JOB_THUMBNAIL (object); ev_debug_message (DEBUG_JOBS, "%d (%p)", job->page, job); - + if (job->thumbnail) { g_object_unref (job->thumbnail); job->thumbnail = NULL; @@ -941,7 +941,7 @@ ev_job_thumbnail_run (EvJob *job) if (job->document->iswebdocument == TRUE) { GtkWidget *webview; GtkWidget *offscreenwindow; - + webview = webkit_web_view_new (); offscreenwindow = gtk_offscreen_window_new (); @@ -957,7 +957,7 @@ ev_job_thumbnail_run (EvJob *job) g_object_ref (job_thumb)); webkit_web_view_load_uri (WEBKIT_WEB_VIEW (webview), (gchar*) rc->page->backend_page); } - else + else #endif /* ENABLE_EPUB */ { ev_document_doc_mutex_lock (); @@ -967,7 +967,7 @@ ev_job_thumbnail_run (EvJob *job) ev_job_succeeded (job); } g_object_unref (rc); - + return FALSE; } @@ -990,7 +990,7 @@ ev_job_thumbnail_new (EvDocument *document, EvJobThumbnail *job; ev_debug_message (DEBUG_JOBS, "%d", page); - + job = g_object_new (EV_TYPE_JOB_THUMBNAIL, NULL); EV_JOB (job)->document = g_object_ref (document); @@ -1015,11 +1015,11 @@ ev_job_fonts_run (EvJob *job) EvDocumentFonts *fonts = EV_DOCUMENT_FONTS (job->document); ev_debug_message (DEBUG_JOBS, NULL); - + /* Do not block the main loop */ if (!ev_document_doc_mutex_trylock ()) return TRUE; - + if (!ev_document_fc_mutex_trylock ()) { ev_document_doc_mutex_unlock (); return TRUE; @@ -1040,7 +1040,7 @@ ev_job_fonts_run (EvJob *job) if (job_fonts->scan_completed) ev_job_succeeded (job); - + return !job_fonts->scan_completed; } @@ -1048,9 +1048,9 @@ static void ev_job_fonts_class_init (EvJobFontsClass *class) { EvJobClass *job_class = EV_JOB_CLASS (class); - + job_class->run = ev_job_fonts_run; - + job_fonts_signals[FONTS_UPDATED] = g_signal_new ("updated", EV_TYPE_JOB_FONTS, @@ -1068,7 +1068,7 @@ ev_job_fonts_new (EvDocument *document) EvJobFonts *job; ev_debug_message (DEBUG_JOBS, NULL); - + job = g_object_new (EV_TYPE_JOB_FONTS, NULL); EV_JOB (job)->document = g_object_ref (document); @@ -1089,7 +1089,7 @@ ev_job_load_dispose (GObject *object) EvJobLoad *job = EV_JOB_LOAD (object); ev_debug_message (DEBUG_JOBS, "%s", job->uri); - + if (job->uri) { g_free (job->uri); job->uri = NULL; @@ -1108,10 +1108,10 @@ ev_job_load_run (EvJob *job) { EvJobLoad *job_load = EV_JOB_LOAD (job); GError *error = NULL; - + ev_debug_message (DEBUG_JOBS, "%s", job_load->uri); ev_profiler_start (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); - + ev_document_fc_mutex_lock (); /* This job may already have a document even if the job didn't complete @@ -1124,7 +1124,7 @@ ev_job_load_run (EvJob *job) ev_document_security_set_password (EV_DOCUMENT_SECURITY (job->document), job_load->password); } - + job->failed = FALSE; job->finished = FALSE; g_clear_error (&job->error); @@ -1167,7 +1167,7 @@ ev_job_load_new (const gchar *uri) EvJobLoad *job; ev_debug_message (DEBUG_JOBS, "%s", uri); - + job = g_object_new (EV_TYPE_JOB_LOAD, NULL); job->uri = g_strdup (uri); @@ -1178,7 +1178,7 @@ void ev_job_load_set_uri (EvJobLoad *job, const gchar *uri) { ev_debug_message (DEBUG_JOBS, "%s", uri); - + if (job->uri) g_free (job->uri); job->uri = g_strdup (uri); @@ -1207,7 +1207,7 @@ ev_job_save_dispose (GObject *object) EvJobSave *job = EV_JOB_SAVE (object); ev_debug_message (DEBUG_JOBS, "%s", job->uri); - + if (job->uri) { g_free (job->uri); job->uri = NULL; @@ -1229,7 +1229,7 @@ ev_job_save_run (EvJob *job) gchar *tmp_filename = NULL; gchar *local_uri; GError *error = NULL; - + ev_debug_message (DEBUG_JOBS, "uri: %s, document_uri: %s", job_save->uri, job_save->document_uri); ev_profiler_start (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); @@ -1257,7 +1257,7 @@ ev_job_save_run (EvJob *job) g_free (local_uri); ev_job_failed_from_error (job, error); g_error_free (error); - + return FALSE; } @@ -1268,11 +1268,11 @@ ev_job_save_run (EvJob *job) EvCompressionType ctype = EV_COMPRESSION_NONE; const gchar *ext; gchar *uri_comp; - + ext = g_strrstr (job_save->document_uri, ".gz"); if (ext && g_ascii_strcasecmp (ext, ".gz") == 0) ctype = EV_COMPRESSION_GZIP; - + ext = g_strrstr (job_save->document_uri, ".bz2"); if (ext && g_ascii_strcasecmp (ext, ".bz2") == 0) ctype = EV_COMPRESSION_BZIP2; @@ -1294,7 +1294,7 @@ ev_job_save_run (EvJob *job) g_free (local_uri); ev_job_failed_from_error (job, error); g_error_free (error); - + return FALSE; } @@ -1310,7 +1310,7 @@ ev_job_save_run (EvJob *job) } else { ev_job_succeeded (job); } - + return FALSE; } @@ -1376,7 +1376,7 @@ ev_job_find_dispose (GObject *object) if (job->results) { g_free(job->results); } - + (* G_OBJECT_CLASS (ev_job_find_parent_class)->dispose) (object); } @@ -1388,11 +1388,11 @@ ev_job_find_run (EvJob *job) EvPage *ev_page; GList *matches; ev_debug_message (DEBUG_JOBS, NULL); - + /* Do not block the main loop */ if (!ev_document_doc_mutex_trylock ()) return TRUE; - + #ifdef EV_ENABLE_DEBUG /* We use the #ifdef in this case because of the if */ if (job_find->current_page == job_find->start_page) @@ -1406,11 +1406,11 @@ ev_job_find_run (EvJob *job) job_find->case_sensitive); }else { matches = ev_document_find_find_text (find, ev_page, job_find->text, - job_find->case_sensitive); + job_find->case_sensitive); } - + g_object_unref (ev_page); - + ev_document_doc_mutex_unlock (); if (!job_find->has_results && !job->document->iswebdocument) { @@ -1425,7 +1425,7 @@ ev_job_find_run (EvJob *job) } g_signal_emit (job_find, job_find_signals[FIND_UPDATED], 0, job_find->current_page); - + job_find->current_page = (job_find->current_page + 1) % job_find->n_pages; if (job_find->current_page == job_find->start_page) { ev_job_succeeded (job); @@ -1441,10 +1441,10 @@ ev_job_find_class_init (EvJobFindClass *class) { EvJobClass *job_class = EV_JOB_CLASS (class); GObjectClass *gobject_class = G_OBJECT_CLASS (class); - + job_class->run = ev_job_find_run; gobject_class->dispose = ev_job_find_dispose; - + job_find_signals[FIND_UPDATED] = g_signal_new ("updated", EV_TYPE_JOB_FIND, @@ -1464,9 +1464,9 @@ ev_job_find_new (EvDocument *document, gboolean case_sensitive) { EvJobFind *job; - + ev_debug_message (DEBUG_JOBS, NULL); - + job = g_object_new (EV_TYPE_JOB_FIND, NULL); EV_JOB (job)->document = g_object_ref (document); @@ -1506,7 +1506,7 @@ ev_job_find_get_progress (EvJobFind *job) if (ev_job_is_finished (EV_JOB (job))) return 1.0; - + if (job->current_page > job->start_page) { pages_done = job->current_page - job->start_page + 1; } else if (job->current_page == job->start_page) { @@ -1549,7 +1549,7 @@ ev_job_layers_dispose (GObject *object) EvJobLayers *job; ev_debug_message (DEBUG_JOBS, NULL); - + job = EV_JOB_LAYERS (object); if (job->model) { @@ -1567,13 +1567,13 @@ ev_job_layers_run (EvJob *job) ev_debug_message (DEBUG_JOBS, NULL); ev_profiler_start (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); - + ev_document_doc_mutex_lock (); job_layers->model = ev_document_layers_get_layers (EV_DOCUMENT_LAYERS (job->document)); ev_document_doc_mutex_unlock (); - + ev_job_succeeded (job); - + return FALSE; } @@ -1596,7 +1596,7 @@ ev_job_layers_new (EvDocument *document) job = g_object_new (EV_TYPE_JOB_LAYERS, NULL); job->document = g_object_ref (document); - + return job; } @@ -1614,7 +1614,7 @@ ev_job_export_dispose (GObject *object) EvJobExport *job; ev_debug_message (DEBUG_JOBS, NULL); - + job = EV_JOB_EXPORT (object); if (job->rc) { @@ -1635,27 +1635,27 @@ ev_job_export_run (EvJob *job) ev_debug_message (DEBUG_JOBS, NULL); ev_profiler_start (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); - + ev_document_doc_mutex_lock (); - + ev_page = ev_document_get_page (job->document, job_export->page); if (job_export->rc) { job->failed = FALSE; job->finished = FALSE; g_clear_error (&job->error); - + ev_render_context_set_page (job_export->rc, ev_page); } else { job_export->rc = ev_render_context_new (ev_page, 0, 1.0); } g_object_unref (ev_page); - + ev_file_exporter_do_page (EV_FILE_EXPORTER (job->document), job_export->rc); - + ev_document_doc_mutex_unlock (); - + ev_job_succeeded (job); - + return FALSE; } @@ -1678,7 +1678,7 @@ ev_job_export_new (EvDocument *document) job = g_object_new (EV_TYPE_JOB_EXPORT, NULL); job->document = g_object_ref (document); - + return job; } diff --git a/libview/ev-jobs.h b/libview/ev-jobs.h index 35a378c5..284b2198 100644 --- a/libview/ev-jobs.h +++ b/libview/ev-jobs.h @@ -162,7 +162,7 @@ typedef enum { struct _EvJob { GObject parent; - + EvDocument *document; EvJobRunMode run_mode; @@ -170,7 +170,7 @@ struct _EvJob guint cancelled : 1; guint finished : 1; guint failed : 1; - + GError *error; GCancellable *cancellable; @@ -183,7 +183,7 @@ struct _EvJobClass GObjectClass parent_class; gboolean (*run) (EvJob *job); - + /* Signals */ void (* cancelled) (EvJob *job); void (* finished) (EvJob *job); diff --git a/libview/ev-pixbuf-cache.c b/libview/ev-pixbuf-cache.c index 3b353c98..d6c75354 100644 --- a/libview/ev-pixbuf-cache.c +++ b/libview/ev-pixbuf-cache.c @@ -22,13 +22,13 @@ typedef struct _CacheJobInfo /* Device scale factor of target widget */ int device_scale; - /* Selection data. + /* Selection data. * Selection_points are the coordinates encapsulated in selection. * target_points is the target selection size. */ EvRectangle target_points; EvSelectionStyle selection_style; gboolean points_set; - + cairo_surface_t *selection; gdouble selection_scale; EvRectangle selection_points; @@ -227,7 +227,7 @@ ev_pixbuf_cache_new (GtkWidget *view, EvPixbufCache *pixbuf_cache; pixbuf_cache = (EvPixbufCache *) g_object_new (EV_TYPE_PIXBUF_CACHE, NULL); - /* This is a backlink, so we don't ref this */ + /* This is a backlink, so we don't ref this */ pixbuf_cache->view = view; pixbuf_cache->model = g_object_ref (model); pixbuf_cache->document = ev_document_model_get_document (model); @@ -685,7 +685,7 @@ add_job (EvPixbufCache *pixbuf_cache, GdkColor text, base; get_selection_colors (EV_VIEW (pixbuf_cache->view), &text, &base); - ev_job_render_set_selection_info (EV_JOB_RENDER (job_info->job), + ev_job_render_set_selection_info (EV_JOB_RENDER (job_info->job), &(job_info->target_points), job_info->selection_style, &text, &base); @@ -1153,7 +1153,7 @@ static void update_job_selection (CacheJobInfo *job_info, EvViewSelection *selection) { - job_info->points_set = TRUE; + job_info->points_set = TRUE; job_info->target_points = selection->rect; job_info->selection_style = selection->style; } @@ -1209,7 +1209,7 @@ ev_pixbuf_cache_set_selection_list (EvPixbufCache *pixbuf_cache, if (((EvViewSelection *)list->data)->page == page) { selection = list->data; break; - } else if (((EvViewSelection *)list->data)->page > page) + } else if (((EvViewSelection *)list->data)->page > page) break; list = list->next; } @@ -1228,7 +1228,7 @@ ev_pixbuf_cache_set_selection_list (EvPixbufCache *pixbuf_cache, if (((EvViewSelection *)list->data)->page == page) { selection = list->data; break; - } else if (((EvViewSelection *)list->data)->page > page) + } else if (((EvViewSelection *)list->data)->page > page) break; list = list->next; } @@ -1249,7 +1249,7 @@ ev_pixbuf_cache_set_selection_list (EvPixbufCache *pixbuf_cache, if (((EvViewSelection *)list->data)->page == page) { selection = list->data; break; - } else if (((EvViewSelection *)list->data)->page > page) + } else if (((EvViewSelection *)list->data)->page > page) break; list = list->next; } @@ -1294,7 +1294,7 @@ ev_pixbuf_cache_get_selection_list (EvPixbufCache *pixbuf_cache) selection->covered_region = cairo_region_reference (pixbuf_cache->prev_job[i].selection_region); retval = g_list_prepend (retval, selection); } - + page ++; } @@ -1308,7 +1308,7 @@ ev_pixbuf_cache_get_selection_list (EvPixbufCache *pixbuf_cache) selection->covered_region = cairo_region_reference (pixbuf_cache->job_list[i].selection_region); retval = g_list_prepend (retval, selection); } - + page ++; } @@ -1324,7 +1324,7 @@ ev_pixbuf_cache_get_selection_list (EvPixbufCache *pixbuf_cache) selection->covered_region = cairo_region_reference (pixbuf_cache->next_job[i].selection_region); retval = g_list_prepend (retval, selection); } - + page ++; } diff --git a/libview/ev-print-operation.c b/libview/ev-print-operation.c index 9449dd37..be258b76 100644 --- a/libview/ev-print-operation.c +++ b/libview/ev-print-operation.c @@ -397,7 +397,7 @@ struct _EvPrintOperationExport { gboolean embed_page_setup; guint idle_id; - + /* Context */ EvFileExporterContext fc; gint n_pages_to_print; @@ -486,7 +486,7 @@ ev_print_queue_pop (EvDocument *document) queue = g_hash_table_lookup (print_queue, document); if (!queue || g_queue_is_empty (queue)) return NULL; - + op = g_queue_pop_tail (queue); g_object_unref (op); @@ -512,7 +512,7 @@ ev_print_operation_export_set_current_page (EvPrintOperation *op, EvPrintOperationExport *export = EV_PRINT_OPERATION_EXPORT (op); g_return_if_fail (current_page < export->n_pages); - + export->current_page = current_page; } @@ -619,7 +619,7 @@ clamp_ranges (EvPrintOperationExport *export) for (i = 0; i < export->n_ranges; i++) { gint n_pages; - + if ((export->ranges[i].start >= 0) && (export->ranges[i].start < export->n_pages) && (export->ranges[i].end >= 0) && @@ -639,7 +639,7 @@ clamp_ranges (EvPrintOperationExport *export) export->ranges[num_of_correct_ranges] = export->ranges[i]; num_of_correct_ranges++; } - + n_pages = export->ranges[i].end - export->ranges[i].start + 1; if (export->page_set == GTK_PAGE_SET_ALL) { n_pages_to_print += n_pages; @@ -648,13 +648,13 @@ clamp_ranges (EvPrintOperationExport *export) } else if (export->page_set == GTK_PAGE_SET_EVEN) { if (n_pages==1 && export->ranges[i].start % 2 == 0) null_flag = TRUE; - else + else n_pages_to_print += export->ranges[i].start % 2 == 0 ? n_pages / 2 : (n_pages / 2) + 1; } else if (export->page_set == GTK_PAGE_SET_ODD) { - if (n_pages==1 && export->ranges[i].start % 2 != 0) + if (n_pages==1 && export->ranges[i].start % 2 != 0) null_flag = TRUE; - else + else n_pages_to_print += export->ranges[i].start % 2 == 0 ? (n_pages / 2) + 1 : n_pages / 2; } @@ -775,7 +775,7 @@ ev_print_operation_export_run_next (EvPrintOperationExport *export) /* First pop the current job */ document = op->document; ev_print_queue_pop (document); - + next = ev_print_queue_peek (document); if (next) ev_print_operation_export_begin (EV_PRINT_OPERATION_EXPORT (next)); @@ -813,7 +813,7 @@ export_print_done (EvPrintOperationExport *export) GError *error = NULL; g_assert (export->temp_file != NULL); - + /* Some printers take into account some print settings, * and others don't. However we have exported the document * to a ps or pdf file according to such print settings. So, @@ -855,12 +855,12 @@ export_print_done (EvPrintOperationExport *export) data = g_key_file_to_data (key_file, &data_len, &error); if (data) { gint fd; - + fd = g_file_open_tmp ("print-settingsXXXXXX", &print_settings_file, &error); if (!error) g_file_set_contents (print_settings_file, data, data_len, &error); close (fd); - + g_free (data); } @@ -908,7 +908,7 @@ export_print_done (EvPrintOperationExport *export) } } else { GtkPrintJob *job; - + job = gtk_print_job_new (export->job_name, export->printer, settings, @@ -992,7 +992,7 @@ export_cancel (EvPrintOperationExport *export) g_object_unref (export->job_export); export->job_export = NULL; } - + if (export->fd != -1) { close (export->fd); export->fd = -1; @@ -1105,7 +1105,7 @@ export_print_page (EvPrintOperationExport *export) ev_job_scheduler_push_job (export->job_export, EV_JOB_PRIORITY_NONE); update_progress (export); - + return FALSE; } @@ -1116,7 +1116,7 @@ ev_print_operation_export_begin (EvPrintOperationExport *export) if (!export->temp_file) return; /* cancelled */ - + ev_document_doc_mutex_lock (); ev_file_exporter_begin (EV_FILE_EXPORTER (op->document), &export->fc); ev_document_doc_mutex_unlock (); @@ -1124,7 +1124,7 @@ ev_print_operation_export_begin (EvPrintOperationExport *export) export->idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, (GSourceFunc)export_print_page, export, - (GDestroyNotify)export_print_page_idle_finished); + (GDestroyNotify)export_print_page_idle_finished); } static void @@ -1145,7 +1145,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial gchar *filename; GError *error = NULL; EvPrintOperation *op = EV_PRINT_OPERATION (export); - + if (response != GTK_RESPONSE_OK && response != GTK_RESPONSE_APPLY) { gtk_widget_destroy (GTK_WIDGET (dialog)); @@ -1155,7 +1155,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial } export->print_preview = (response == GTK_RESPONSE_APPLY); - + printer = gtk_print_unix_dialog_get_selected_printer (GTK_PRINT_UNIX_DIALOG (dialog)); ev_print_operation_export_set_printer (export, printer); @@ -1167,24 +1167,24 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial if (!gtk_printer_accepts_ps (export->printer)) { gtk_widget_destroy (GTK_WIDGET (dialog)); - + g_set_error_literal (&export->error, GTK_PRINT_ERROR, GTK_PRINT_ERROR_GENERAL, _("Printing is not supported on this printer.")); g_signal_emit (op, signals[DONE], 0, GTK_PRINT_OPERATION_RESULT_ERROR); - + return; } file_format = gtk_print_settings_get (print_settings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT); - + filename = g_strdup_printf ("atril_print.%s.XXXXXX", file_format != NULL ? file_format : ""); export->fd = g_file_open_tmp (filename, &export->temp_file, &error); g_free (filename); if (export->fd <= -1) { gtk_widget_destroy (GTK_WIDGET (dialog)); - + g_set_error_literal (&export->error, GTK_PRINT_ERROR, GTK_PRINT_ERROR_GENERAL, @@ -1198,19 +1198,19 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial export->current_page = gtk_print_unix_dialog_get_current_page (GTK_PRINT_UNIX_DIALOG (dialog)); export->page_set = gtk_print_settings_get_page_set (print_settings); print_pages = gtk_print_settings_get_print_pages (print_settings); - + switch (print_pages) { case GTK_PRINT_PAGES_CURRENT: export->ranges = &export->one_range; - + export->ranges[0].start = export->current_page; export->ranges[0].end = export->current_page; export->n_ranges = 1; - + break; case GTK_PRINT_PAGES_RANGES: { gint i; - + export->ranges = gtk_print_settings_get_page_ranges (print_settings, &export->n_ranges); for (i = 0; i < export->n_ranges; i++) if (export->ranges[i].end == -1 || export->ranges[i].end >= export->n_pages) @@ -1225,7 +1225,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial export->ranges[0].start = 0; export->ranges[0].end = export->n_pages - 1; export->n_ranges = 1; - + break; } @@ -1247,7 +1247,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial return; } else ev_print_operation_update_status (op, -1, -1, 0.0); - + width = gtk_page_setup_get_paper_width (page_setup, GTK_UNIT_POINTS); height = gtk_page_setup_get_paper_height (page_setup, GTK_UNIT_POINTS); scale = gtk_print_settings_get_scale (print_settings) * 0.01; @@ -1257,7 +1257,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial } export->pages_per_sheet = MAX (1, gtk_print_settings_get_number_up (print_settings)); - + export->copies = gtk_print_settings_get_n_copies (print_settings); export->collate = gtk_print_settings_get_collate (print_settings); export->reverse = gtk_print_settings_get_reverse (print_settings); @@ -1300,7 +1300,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial ev_print_queue_push (op); g_signal_emit (op, signals[BEGIN_PRINT], 0); - + gtk_widget_destroy (GTK_WIDGET (dialog)); } @@ -1320,7 +1320,7 @@ ev_print_operation_export_run (EvPrintOperation *op, /* translators: Title of the print dialog */ dialog = gtk_print_unix_dialog_new (_("Print"), parent); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); - + capabilities = GTK_PRINT_CAPABILITY_PREVIEW | ev_file_exporter_get_capabilities (EV_FILE_EXPORTER (op->document)); gtk_print_unix_dialog_set_manual_capabilities (GTK_PRINT_UNIX_DIALOG (dialog), @@ -1331,10 +1331,10 @@ ev_print_operation_export_run (EvPrintOperation *op, gtk_print_unix_dialog_set_current_page (GTK_PRINT_UNIX_DIALOG (dialog), export->current_page); - + gtk_print_unix_dialog_set_settings (GTK_PRINT_UNIX_DIALOG (dialog), export->print_settings); - + if (export->page_setup) gtk_print_unix_dialog_set_page_setup (GTK_PRINT_UNIX_DIALOG (dialog), export->page_setup); @@ -1400,7 +1400,7 @@ ev_print_operation_export_finalize (GObject *object) close (export->fd); export->fd = -1; } - + if (export->ranges) { if (export->ranges != &export->one_range) g_free (export->ranges); @@ -1469,7 +1469,7 @@ ev_print_operation_export_constructor (GType type, GObject *object; EvPrintOperationExport *export; EvPrintOperation *op; - + object = G_OBJECT_CLASS (ev_print_operation_export_parent_class)->constructor (type, n_construct_properties, construct_params); diff --git a/libview/ev-print-operation.h b/libview/ev-print-operation.h index 35f14021..fa493fc7 100644 --- a/libview/ev-print-operation.h +++ b/libview/ev-print-operation.h @@ -67,5 +67,5 @@ const gchar *ev_print_operation_get_status (EvPrintOperation *o gdouble ev_print_operation_get_progress (EvPrintOperation *op); G_END_DECLS - + #endif /* __EV_PRINT_OPERATION_H__ */ diff --git a/libview/ev-timeline.c b/libview/ev-timeline.c index 62c97286..1edb9b2c 100644 --- a/libview/ev-timeline.c +++ b/libview/ev-timeline.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ diff --git a/libview/ev-timeline.h b/libview/ev-timeline.h index b51e9b33..d4f6ba78 100644 --- a/libview/ev-timeline.h +++ b/libview/ev-timeline.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ diff --git a/libview/ev-transition-animation.c b/libview/ev-transition-animation.c index a8a2e117..c3c825fa 100644 --- a/libview/ev-transition-animation.c +++ b/libview/ev-transition-animation.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ diff --git a/libview/ev-transition-animation.h b/libview/ev-transition-animation.h index a0882734..8691fd66 100644 --- a/libview/ev-transition-animation.h +++ b/libview/ev-transition-animation.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ diff --git a/libview/ev-view-private.h b/libview/ev-view-private.h index dbb99914..f1059395 100644 --- a/libview/ev-view-private.h +++ b/libview/ev-view-private.h @@ -54,7 +54,7 @@ typedef struct { gboolean autoscrolling; guint last_y; guint start_y; - guint timeout_id; + guint timeout_id; } AutoScrollInfo; /* Information for handling selection */ @@ -147,7 +147,7 @@ struct _EvView { guint vscroll_policy : 1; gint scroll_x; - gint scroll_y; + gint scroll_y; /* Delta sum for emulating normal scrolling */ gdouble total_delta; @@ -156,7 +156,7 @@ struct _EvView { EvPoint pending_point; /* Current geometry */ - + gint start_page; gint end_page; gint current_page; @@ -182,7 +182,7 @@ struct _EvView { /* Information for middle clicking and dragging around. */ DragInfo drag_info; - + /* Autoscrolling */ AutoScrollInfo scroll_info; diff --git a/libview/ev-view.c b/libview/ev-view.c index e08db24f..7703c6ed 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -262,7 +262,7 @@ static EvRectangle *ev_view_find_get_result (EvView gint page, gint result); static void jump_to_find_result (EvView *view); -static void jump_to_find_page (EvView *view, +static void jump_to_find_page (EvView *view, EvViewFindDirection direction, gint shift); /*** Selection ***/ @@ -1447,7 +1447,7 @@ location_in_text (EvView *view, if (page == -1) return FALSE; - + region = ev_page_cache_get_text_mapping (view->page_cache, page); if (region) @@ -1479,11 +1479,11 @@ location_in_selected_text (EvView *view, } static gboolean -get_doc_point_from_offset (EvView *view, - gint page, - gint x_offset, - gint y_offset, - gint *x_new, +get_doc_point_from_offset (EvView *view, + gint page, + gint x_offset, + gint y_offset, + gint *x_new, gint *y_new) { gdouble width, height; @@ -1504,7 +1504,7 @@ get_doc_point_from_offset (EvView *view, x = width - x_offset; y = height - y_offset; } else if (view->rotation == 270) { - x = height - y_offset; + x = height - y_offset; y = x_offset; } else { g_assert_not_reached (); @@ -1512,7 +1512,7 @@ get_doc_point_from_offset (EvView *view, *x_new = x; *y_new = y; - + return TRUE; } @@ -1742,7 +1742,7 @@ goto_xyz_dest (EvView *view, EvLinkDest *dest) EvPoint doc_point; gint page; gdouble zoom, left, top; - gboolean change_zoom, change_left, change_top; + gboolean change_zoom, change_left, change_top; zoom = ev_link_dest_get_zoom (dest, &change_zoom); page = ev_link_dest_get_page (dest); @@ -1775,7 +1775,7 @@ goto_dest (EvView *view, EvLinkDest *dest) return; current_page = view->current_page; - + type = ev_link_dest_get_dest_type (dest); switch (type) { @@ -1816,7 +1816,7 @@ ev_view_goto_dest (EvView *view, EvLinkDest *dest) type = ev_link_dest_get_dest_type (dest); if (type == EV_LINK_DEST_TYPE_NAMED) { - EvLinkDest *dest2; + EvLinkDest *dest2; const gchar *named_dest; named_dest = ev_link_dest_get_named_dest (dest); @@ -1832,7 +1832,7 @@ ev_view_goto_dest (EvView *view, EvLinkDest *dest) goto_dest (view, dest); } - + void ev_view_handle_link (EvView *view, EvLink *link) { @@ -1848,9 +1848,9 @@ ev_view_handle_link (EvView *view, EvLink *link) switch (type) { case EV_LINK_ACTION_TYPE_GOTO_DEST: { EvLinkDest *dest; - + g_signal_emit (view, signals[SIGNAL_HANDLE_LINK], 0, link); - + dest = ev_link_action_get_dest (action); ev_view_goto_dest (view, dest); } @@ -1900,7 +1900,7 @@ static char * tip_from_action_named (EvLinkAction *action) { const gchar *name = ev_link_action_get_name (action); - + if (g_ascii_strcasecmp (name, "FirstPage") == 0) { return g_strdup (_("Go to first page")); } else if (g_ascii_strcasecmp (name, "PrevPage") == 0) { @@ -1914,7 +1914,7 @@ tip_from_action_named (EvLinkAction *action) } else if (g_ascii_strcasecmp (name, "Find") == 0) { return g_strdup (_("Find")); } - + return NULL; } @@ -1929,10 +1929,10 @@ tip_from_link (EvView *view, EvLink *link) action = ev_link_get_action (link); title = ev_link_get_title (link); - + if (!action) return title ? g_strdup (title) : NULL; - + type = ev_link_action_get_action_type (action); switch (type) { @@ -1968,7 +1968,7 @@ tip_from_link (EvView *view, EvLink *link) msg = g_strdup (title); break; } - + return msg; } @@ -2258,15 +2258,15 @@ ev_view_form_field_text_save (EvView *view, if (!view->document) return; - + field = g_object_get_data (G_OBJECT (widget), "form-field"); - + if (field->changed) { EvFormFieldText *field_text = EV_FORM_FIELD_TEXT (field); cairo_region_t *field_region; field_region = ev_view_form_field_get_region (view, field); - + ev_document_forms_form_field_text_set_text (EV_DOCUMENT_FORMS (view->document), field, field_text->text); field->changed = FALSE; @@ -2329,7 +2329,7 @@ ev_view_form_field_text_create_widget (EvView *view, gtk_entry_set_has_frame (GTK_ENTRY (text), FALSE); gtk_entry_set_max_length (GTK_ENTRY (text), field_text->max_len); gtk_entry_set_visibility (GTK_ENTRY (text), !field_text->is_password); - + if (txt) { gtk_entry_set_text (GTK_ENTRY (text), txt); g_free (txt); @@ -2347,10 +2347,10 @@ ev_view_form_field_text_create_widget (EvView *view, break; case EV_FORM_FIELD_TEXT_MULTILINE: { GtkTextBuffer *buffer; - + text = gtk_text_view_new (); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text)); - + if (txt) { gtk_text_buffer_set_text (buffer, txt, -1); g_free (txt); @@ -2364,7 +2364,7 @@ ev_view_form_field_text_create_widget (EvView *view, field); } break; - } + } g_object_weak_ref (G_OBJECT (text), (GWeakNotify)ev_view_form_field_text_save, @@ -2381,7 +2381,7 @@ ev_view_form_field_choice_save (EvView *view, if (!view->document) return; - + field = g_object_get_data (G_OBJECT (widget), "form-field"); if (field->changed) { @@ -2413,10 +2413,10 @@ ev_view_form_field_choice_changed (GtkWidget *widget, EvFormField *field) { EvFormFieldChoice *field_choice = EV_FORM_FIELD_CHOICE (field); - + if (GTK_IS_COMBO_BOX (widget)) { gint item; - + item = gtk_combo_box_get_active (GTK_COMBO_BOX (widget)); if (!field_choice->selected_items || GPOINTER_TO_INT (field_choice->selected_items->data) != item) { @@ -2442,7 +2442,7 @@ ev_view_form_field_choice_changed (GtkWidget *widget, GtkTreeSelection *selection = GTK_TREE_SELECTION (widget); GtkTreeModel *model; GList *items, *l; - + items = gtk_tree_selection_get_selected_rows (selection, &model); g_list_free (field_choice->selected_items); field_choice->selected_items = NULL; @@ -2451,7 +2451,7 @@ ev_view_form_field_choice_changed (GtkWidget *widget, GtkTreeIter iter; GtkTreePath *path = (GtkTreePath *)l->data; gint item; - + gtk_tree_model_get_iter (model, &iter, path); gtk_tree_model_get (model, &iter, 1, &item, -1); @@ -2493,7 +2493,7 @@ ev_view_form_field_choice_create_widget (EvView *view, field_choice->selected_items = g_list_prepend (field_choice->selected_items, GINT_TO_POINTER (i)); } - + if (item) { gtk_list_store_append (GTK_LIST_STORE (model), &iter); gtk_list_store_set (GTK_LIST_STORE (model), &iter, @@ -2541,7 +2541,7 @@ ev_view_form_field_choice_create_widget (EvView *view, view); } else if (field_choice->is_editable) { /* ComboBoxEntry */ gchar *text; - + choice = gtk_combo_box_new_with_model_and_entry (model); gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (choice), 0); text = ev_document_forms_form_field_choice_get_text (EV_DOCUMENT_FORMS (view->document), field); @@ -2570,7 +2570,7 @@ ev_view_form_field_choice_create_widget (EvView *view, NULL); gtk_combo_box_set_active (GTK_COMBO_BOX (choice), selected_item); gtk_combo_box_popup (GTK_COMBO_BOX (choice)); - + g_signal_connect (choice, "changed", G_CALLBACK (ev_view_form_field_choice_changed), field); @@ -3736,7 +3736,7 @@ ev_view_size_allocate (GtkWidget *widget, ev_view_size_request (widget, &req); view->internal_size_request = FALSE; } - + view_set_adjustment_values (view, GTK_ORIENTATION_HORIZONTAL); view_set_adjustment_values (view, GTK_ORIENTATION_VERTICAL); @@ -4171,9 +4171,9 @@ get_link_area (EvView *view, x += view->scroll_x; y += view->scroll_y; - + find_page_at_location (view, x, y, &page, &x_offset, &y_offset); - + link_mapping = ev_page_cache_get_link_mapping (view->page_cache, page); ev_view_get_area_from_mapping (view, page, link_mapping, @@ -4457,7 +4457,7 @@ ev_view_button_press_event (GtkWidget *widget, ev_annotation_window_ungrab_focus (window); view->window_child_focus = NULL; } - + view->pressed_button = event->button; view->selection_info.in_drag = FALSE; @@ -4532,7 +4532,7 @@ ev_view_button_press_event (GtkWidget *widget, ev_view_pend_cursor_blink (view); } } - } + } return TRUE; case 2: /* use root coordinates as reference point because @@ -4550,7 +4550,7 @@ ev_view_button_press_event (GtkWidget *widget, ev_view_set_focused_element_at_location (view, event->x, event->y); return ev_view_do_popup_menu (view, event->x, event->y); } - + return FALSE; } @@ -4599,7 +4599,7 @@ ev_view_drag_data_get (GtkWidget *widget, pixbuf = ev_document_images_get_image (EV_DOCUMENT_IMAGES (view->document), view->image_dnd_info.image); ev_document_doc_mutex_unlock (); - + gtk_selection_data_set_pixbuf (selection_data, pixbuf); g_object_unref (pixbuf); } @@ -4614,7 +4614,7 @@ ev_view_drag_data_get (GtkWidget *widget, pixbuf = ev_document_images_get_image (EV_DOCUMENT_IMAGES (view->document), view->image_dnd_info.image); ev_document_doc_mutex_unlock (); - + tmp_uri = ev_image_save_tmp (view->image_dnd_info.image, pixbuf); g_object_unref (pixbuf); @@ -4636,10 +4636,10 @@ ev_view_drag_motion (GtkWidget *widget, gdk_drag_status (context, 0, time); else gdk_drag_status (context, gdk_drag_context_get_suggested_action (context), time); - + return TRUE; } - + static gboolean selection_update_idle_cb (EvView *view) { @@ -4653,7 +4653,7 @@ selection_update_idle_cb (EvView *view) static gboolean selection_scroll_timeout_cb (EvView *view) -{ +{ gint x, y, shift = 0; GtkWidget *widget = GTK_WIDGET (view); GtkAllocation allocation; @@ -4696,16 +4696,16 @@ ev_view_drag_update_momentum (EvView *view) int i; if (!view->drag_info.in_drag) return FALSE; - + for (i = DRAG_HISTORY - 1; i > 0; i--) { view->drag_info.buffer[i].x = view->drag_info.buffer[i-1].x; view->drag_info.buffer[i].y = view->drag_info.buffer[i-1].y; } /* Momentum is a moving average of 10ms granularity over - * the last 100ms with each 10ms stored in buffer. + * the last 100ms with each 10ms stored in buffer. */ - + view->drag_info.momentum.x = (view->drag_info.buffer[DRAG_HISTORY - 1].x - view->drag_info.buffer[0].x); view->drag_info.momentum.y = (view->drag_info.buffer[DRAG_HISTORY - 1].y - view->drag_info.buffer[0].y); @@ -4835,7 +4835,7 @@ ev_view_motion_notify_event (GtkWidget *widget, return TRUE; } } - + switch (view->pressed_button) { case 1: /* For the Atril 0.4.x release, we limit selection to un-rotated @@ -4844,22 +4844,22 @@ ev_view_motion_notify_event (GtkWidget *widget, if (view->rotation != 0) return FALSE; - /* Schedule timeout to scroll during selection and additionally + /* Schedule timeout to scroll during selection and additionally * scroll once to allow arbitrary speed. */ if (!view->selection_scroll_id) view->selection_scroll_id = g_timeout_add (SCROLL_TIME, (GSourceFunc)selection_scroll_timeout_cb, view); - else + else selection_scroll_timeout_cb (view); view->motion.x = x + view->scroll_x; view->motion.y = y + view->scroll_y; - /* Queue an idle to handle the motion. We do this because - * handling any selection events in the motion could be slower - * than new motion events reach us. We always put it in the - * idle to make sure we catch up and don't visibly lag the + /* Queue an idle to handle the motion. We do this because + * handling any selection events in the motion could be slower + * than new motion events reach us. We always put it in the + * idle to make sure we catch up and don't visibly lag the * mouse. */ if (!view->selection_update_id) view->selection_update_id = g_idle_add ((GSourceFunc)selection_update_idle_cb, view); @@ -4922,7 +4922,7 @@ ev_view_motion_notify_event (GtkWidget *widget, break; default: ev_view_handle_cursor_over_xy (view, x, y); - } + } return FALSE; } @@ -5603,7 +5603,7 @@ ev_view_enter_notify_event (GtkWidget *widget, GdkEventCrossing *event) EvView *view = EV_VIEW (widget); ev_view_handle_cursor_over_xy (view, event->x, event->y); - + return FALSE; } @@ -6608,7 +6608,7 @@ on_adjustment_value_changed (GtkAdjustment *adjustment, ev_view_window_child_move (view, child, child->x + dx, child->y + dy); } - + if (view->pending_resize) { gtk_widget_queue_draw (widget); } else { @@ -6720,7 +6720,7 @@ ev_view_autoscroll_cb (EvView *view) view->scroll_info.timeout_id = 0; return FALSE; } - + /* Replace 100 with your speed of choice: The lower the faster. * Replace 3 with another speed of choice: The higher, the faster it accelerated * based on the distance of the starting point from the mouse @@ -6730,13 +6730,13 @@ ev_view_autoscroll_cb (EvView *view) speed = -pow ((((gdouble)view->scroll_info.start_y - view->scroll_info.last_y) / 100), 3); else speed = pow ((((gdouble)view->scroll_info.last_y - view->scroll_info.start_y) / 100), 3); - + value = gtk_adjustment_get_value (view->vadjustment); value = CLAMP (value + speed, 0, gtk_adjustment_get_upper (view->vadjustment) - gtk_adjustment_get_page_size (view->vadjustment)); gtk_adjustment_set_value (view->vadjustment, value); - + return TRUE; } @@ -6745,12 +6745,12 @@ void ev_view_autoscroll_start (EvView *view) { gint x, y; - + g_return_if_fail (EV_IS_VIEW (view)); if (view->scroll_info.autoscrolling) return; - + view->scroll_info.autoscrolling = TRUE; view->scroll_info.timeout_id = g_timeout_add (20, (GSourceFunc)ev_view_autoscroll_cb, @@ -6764,7 +6764,7 @@ void ev_view_autoscroll_stop (EvView *view) { gint x, y; - + g_return_if_fail (EV_IS_VIEW (view)); if (!view->scroll_info.autoscrolling) @@ -7417,7 +7417,7 @@ jump_to_find_result (EvView *view) * @shift: Shift from current page * * Jumps to the first page that has occurences of searched word. - * Uses a direction where to look and a shift from current page. + * Uses a direction where to look and a shift from current page. * */ static void @@ -7429,16 +7429,16 @@ jump_to_find_page (EvView *view, EvViewFindDirection direction, gint shift) for (i = 0; i < n_pages; i++) { int page; - + if (direction == EV_VIEW_FIND_NEXT) page = view->current_page + i; else - page = view->current_page - i; + page = view->current_page - i; page += shift; - + if (page >= n_pages) { page = page - n_pages; - } else if (page < 0) + } else if (page < 0) page = page + n_pages; if (ev_view_find_get_n_results (view, page) > 0) { @@ -7459,7 +7459,7 @@ ev_view_find_changed (EvView *view, GList **results, gint page) { g_return_if_fail (view->current_page >= 0); view->find_pages = results; - + if (view->jump_to_find_result == TRUE) { jump_to_find_page (view, EV_VIEW_FIND_NEXT, 0); jump_to_find_result (view); @@ -7602,13 +7602,13 @@ get_selection_page_range (EvView *view, for (i = start_page; i <= end_page; i++) { GdkRectangle page_area; GtkBorder border; - + ev_view_get_page_extents (view, i, &page_area, &border); page_area.x -= border.left; page_area.y -= border.top; page_area.width += border.left + border.right; page_area.height += border.top + border.bottom; - if (gdk_rectangle_point_in (&page_area, start) || + if (gdk_rectangle_point_in (&page_area, start) || gdk_rectangle_point_in (&page_area, stop)) { if (first == -1) first = i; @@ -7930,7 +7930,7 @@ get_selected_text (EvView *view) } ev_document_doc_mutex_unlock (); - + normalized_text = g_utf8_normalize (text->str, text->len, G_NORMALIZE_NFKC); g_string_free (text, TRUE); return normalized_text; @@ -7975,7 +7975,7 @@ ev_view_primary_get_cb (GtkClipboard *clipboard, } else if (EV_IS_SELECTION (ev_view->document) && ev_view->selection_info.selections) { gchar *text; - + text = get_selected_text (ev_view); if (text) { gtk_selection_data_set_text (selection_data, text, -1); @@ -8011,7 +8011,7 @@ ev_view_update_primary_selection (EvView *ev_view) gtk_target_list_add_text_targets (target_list, 0); targets = gtk_target_table_new_from_list (target_list, &n_targets); gtk_target_list_unref (target_list); - + if (!gtk_clipboard_set_with_owner (clipboard, targets, n_targets, ev_view_primary_get_cb, @@ -8040,9 +8040,9 @@ ev_view_copy_link_address (EvView *view, EvLinkAction *action) { clear_link_selected (view); - + ev_view_clipboard_copy (view, ev_link_action_get_uri (action)); - + view->link_selected = g_object_ref (action); ev_view_update_primary_selection (view); } @@ -8115,11 +8115,11 @@ ev_view_previous_page (EvView *view) return TRUE; } - + /** * ev_view_disconnect_handlers * @view: #EvView instance - * + * * Disconnect all signal handlers from the model, to ensure error free operation of the webview, * we have an equivalent function for the webview. */ diff --git a/libview/ev-web-view.c b/libview/ev-web-view.c index 782e4ea4..2fc06791 100644 --- a/libview/ev-web-view.c +++ b/libview/ev-web-view.c @@ -64,7 +64,7 @@ struct _EvWebView gchar *hlink; }; -struct _EvWebViewClass +struct _EvWebViewClass { WebKitWebViewClass base_class; }; @@ -90,7 +90,7 @@ static void web_view_update_range_and_current_page (EvWebView *webview) { g_return_if_fail(EV_IS_WEB_VIEW(webview)); - + if (ev_document_get_n_pages (webview->document) <= 0) return; @@ -114,7 +114,7 @@ ev_web_view_dispose (GObject *object) g_object_unref(webview->model); webview->model = NULL; } - + if (webview->hlink) { g_free(webview->hlink); webview->hlink = NULL; @@ -150,7 +150,7 @@ ev_web_view_init (EvWebView *webview) webview->search->on_result = -1 ; webview->search->results = NULL; webview->search->search_jump = TRUE ; - + webview->fullscreen = FALSE; webview->inverted_stylesheet = FALSE; webview->hlink = NULL; @@ -169,7 +169,7 @@ ev_web_view_change_page (EvWebView *webview, gint new_page) { g_return_if_fail(EV_IS_WEB_VIEW(webview)); - + EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS(webview->document); webview->current_page = new_page; @@ -225,7 +225,7 @@ ev_web_view_document_changed_cb (EvDocumentModel *model, EvWebView *webview) { g_return_if_fail(EV_IS_WEB_VIEW(webview)); - + EvDocument *document = ev_document_model_get_document (model); if (document != webview->document) { @@ -240,11 +240,11 @@ ev_web_view_document_changed_cb (EvDocumentModel *model, } webview->inverted_stylesheet = FALSE; gint current_page = ev_document_model_get_page(model); - + ev_web_view_change_page (webview, current_page); - + } -} +} static void ev_web_view_inverted_colors_changed_cb (EvDocumentModel *model, @@ -255,12 +255,12 @@ ev_web_view_inverted_colors_changed_cb (EvDocumentModel *model, if (!document || !document->iswebdocument) return; - + if (ev_document_model_get_inverted_colors(model) == TRUE) { if (document == NULL) { ev_document_model_set_inverted_colors(model,FALSE); return; - } + } if (webview->inverted_stylesheet == FALSE) { ev_document_check_add_night_sheet(document); webview->inverted_stylesheet = TRUE; @@ -334,7 +334,7 @@ ev_web_view_next_page (EvWebView *webview) int page, n_pages; g_return_val_if_fail (EV_IS_WEB_VIEW (webview), FALSE); - + if (!webview->document) return FALSE; @@ -383,13 +383,13 @@ ev_web_view_previous_page (EvWebView *webview) EvPage *webpage = ev_document_get_page(webview->document,page); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),(gchar*)webpage->backend_page); return TRUE; - } else { + } else { return FALSE; } } - -void -ev_web_view_handle_link(EvWebView *webview,EvLink *link) + +void +ev_web_view_handle_link(EvWebView *webview,EvLink *link) { EvLinkAction *action = NULL; EvLinkDest *dest = NULL; @@ -400,12 +400,12 @@ ev_web_view_handle_link(EvWebView *webview,EvLink *link) return; dest = ev_link_action_get_dest(action); - + if (dest == NULL) return; dest_type = ev_link_dest_get_dest_type(dest); - + switch(dest_type) { case EV_LINK_DEST_TYPE_PAGE: { ev_document_model_set_page(webview->model,ev_link_dest_get_page(dest)); @@ -426,7 +426,7 @@ ev_web_view_handle_link(EvWebView *webview,EvLink *link) ev_document_model_set_page(webview->model,ev_link_dest_get_page(dest)); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),uri); break; - + default:return; } } @@ -492,7 +492,7 @@ ev_web_view_find_get_n_results (EvWebView *webview, gint page) * @shift: Shift from current page * * Jumps to the first page that has occurences of searched word. - * Uses a direction where to look and a shift from current page. + * Uses a direction where to look and a shift from current page. **/ static void jump_to_find_page (EvWebView *webview, EvWebViewFindDirection direction, gint shift) @@ -507,12 +507,12 @@ jump_to_find_page (EvWebView *webview, EvWebViewFindDirection direction, gint sh if (direction == EV_WEB_VIEW_FIND_NEXT) page = webview->current_page + i; else - page = webview->current_page - i; + page = webview->current_page - i; page += shift; if (page >= n_pages) { page = page - n_pages; - } else if (page < 0) + } else if (page < 0) page = page + n_pages; if (page == webview->current_page && ev_web_view_find_get_n_results(webview,page) > 0) { @@ -525,7 +525,7 @@ jump_to_find_page (EvWebView *webview, EvWebViewFindDirection direction, gint sh webview->findoptions |= WEBKIT_FIND_OPTIONS_WRAP_AROUND; else webview->findoptions &= ~WEBKIT_FIND_OPTIONS_WRAP_AROUND; - + webview->findoptions &= ~WEBKIT_FIND_OPTIONS_BACKWARDS; } @@ -550,7 +550,7 @@ jump_to_find_page (EvWebView *webview, EvWebViewFindDirection direction, gint sh void ev_web_view_find_changed (EvWebView *webview, guint *results, gchar *text,gboolean case_sensitive) { - webview->search->results = results; + webview->search->results = results; webview->search->on_result = 0; webview->search->search_string = g_strdup(text); webview->search->case_sensitive = case_sensitive; @@ -563,7 +563,7 @@ ev_web_view_find_changed (EvWebView *webview, guint *results, gchar *text,gboole } jump_to_find_page (webview, EV_WEB_VIEW_FIND_NEXT, 0); } -} +} void ev_web_view_find_next (EvWebView *webview) @@ -576,7 +576,7 @@ ev_web_view_find_next (EvWebView *webview) if (webview->search->on_result >= n_results) { webview->search->on_result = 0; jump_to_find_page (webview, EV_WEB_VIEW_FIND_NEXT, 1); - } + } else { webkit_find_controller_search_next(webview->findcontroller); } @@ -614,7 +614,7 @@ ev_web_view_find_cancel (EvWebView *webview) webkit_find_controller_search_finish (webview->findcontroller); } -void +void ev_web_view_set_handler(EvWebView *webview,gboolean visible) { if (visible) { @@ -630,7 +630,7 @@ ev_web_view_set_handler(EvWebView *webview,gboolean visible) else { g_signal_handlers_disconnect_by_func(webview, jump_to_find_results, - NULL); + NULL); g_signal_handlers_disconnect_by_func(webview, results_counted_cb, NULL); @@ -704,7 +704,7 @@ ev_web_view_zoom_reset(EvWebView *webview) /** * ev_web_view_disconnect_handlers * @webview : #EvWebView instance - * + * * This function call will disconnect all model signal handlers from the webview, to ensure smooth operation of the Atril-view. * Equivalent to function ev_view_disconnect_handlers in ev-view.c */ diff --git a/libview/ev-web-view.h b/libview/ev-web-view.h index 90892d37..16b82ba8 100644 --- a/libview/ev-web-view.h +++ b/libview/ev-web-view.h @@ -54,7 +54,7 @@ void ev_web_view_reload (EvWebView *webview); void ev_web_view_reload_page (EvWebView *webview, gint page); - + /* Navigation */ gboolean ev_web_view_next_page (EvWebView *webview); gboolean ev_web_view_previous_page (EvWebView *webview); @@ -68,7 +68,7 @@ void ev_web_view_find_previous (EvWebView *webview); void ev_web_view_find_changed (EvWebView *webview, guint *results, - gchar *text, + gchar *text, gboolean case_sensitive); void ev_web_view_find_search_changed (EvWebView *webview); |