Rebase Papers to 48.7

Resolves: RHEL-86193
This commit is contained in:
Marek Kasik 2025-12-12 18:45:52 +01:00
parent d02ffcf806
commit e16807b854
12 changed files with 138 additions and 356 deletions

2
.gitignore vendored
View File

@ -2,3 +2,5 @@
/papers-47.0.tar.xz
/papers-5de8d26c.tar.xz
/papers-5de8d26c-vendor.tar.xz
/papers-48.7.tar.xz
/papers-48.7-vendor.tar.xz

View File

@ -1,98 +0,0 @@
From 4de71d6b8276fb82c8ccbe1ed5ed8ca69bf2d612 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Tue, 28 Jan 2025 15:58:19 +0100
Subject: [PATCH] shell: Check value of "sidebar-page" key
Papers crashes when previously removed "bookmarks" sidebar is set as default
in "sidebar-page" key.
Checking whether the value of "sidebar-page" is among expected values avoids
the crash.
---
shell/src/sidebar.rs | 56 +++++++++++++++++++++++++++-----------------
1 file changed, 34 insertions(+), 22 deletions(-)
diff --git a/shell/src/sidebar.rs b/shell/src/sidebar.rs
index 476548835..394278a9a 100644
--- a/shell/src/sidebar.rs
+++ b/shell/src/sidebar.rs
@@ -114,25 +114,46 @@ mod imp {
self.stack.visible_child_name().map(|gs| gs.to_string())
}
+ fn set_visible_child_default(&self) {
+ let Some(document) = self.document() else {
+ return;
+ };
+ if self
+ .stack
+ .child_by_name("links")
+ .unwrap()
+ .dynamic_cast_ref::<PpsSidebarPage>()
+ .unwrap()
+ .support_document(&document)
+ {
+ self.stack.set_visible_child_name("links");
+ } else {
+ self.stack.set_visible_child_name("thumbnails");
+ }
+ }
+
fn set_visible_child_name(&self, name: Option<String>) {
let Some(document) = self.document() else {
return;
};
let Some(name) = name else {
- if self
- .stack
- .child_by_name("links")
- .unwrap()
- .dynamic_cast_ref::<PpsSidebarPage>()
- .unwrap()
- .support_document(&document)
- {
- self.stack.set_visible_child_name("links");
- } else {
- self.stack.set_visible_child_name("thumbnails");
- }
+ self.set_visible_child_default();
return;
};
+
+ if ![
+ "annotations",
+ "attachments",
+ "layers",
+ "links",
+ "thumbnails",
+ ]
+ .contains(&name.as_str())
+ {
+ self.set_visible_child_default();
+ return;
+ }
+
let page = self.stack.child_by_name(&name).unwrap();
if page
@@ -141,17 +162,8 @@ mod imp {
.support_document(&document)
{
self.stack.set_visible_child(&page);
- } else if self
- .stack
- .child_by_name("links")
- .unwrap()
- .dynamic_cast_ref::<PpsSidebarPage>()
- .unwrap()
- .support_document(&document)
- {
- self.stack.set_visible_child_name("links");
} else {
- self.stack.set_visible_child_name("thumbnails");
+ self.set_visible_child_default();
}
}
}
--
2.48.1

View File

@ -1,37 +0,0 @@
From ee88fa8e3488b64f930632cefbc5115cf3a406e0 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Fri, 31 Jan 2025 12:57:37 +0100
Subject: [PATCH 2/2] shell: Extend fast navigation
Enable navigation to the beginning of the document for "go-backwards" action
even if the page number is lower than 10.
Enable the same for "go-forward" action for the end of the document.
---
shell/src/document_view/actions.rs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/shell/src/document_view/actions.rs b/shell/src/document_view/actions.rs
index a4036ab92..006b9f58f 100644
--- a/shell/src/document_view/actions.rs
+++ b/shell/src/document_view/actions.rs
@@ -655,6 +655,8 @@ impl imp::PpsDocumentView {
if current_page + 10 < n_pages {
obj.model.set_page(current_page + 10);
+ } else {
+ obj.model.set_page(n_pages - 1);
}
}
))
@@ -668,6 +670,8 @@ impl imp::PpsDocumentView {
if current_page - 10 >= 0 {
obj.model.set_page(current_page - 10);
+ } else {
+ obj.model.set_page(0);
}
}
))
--
2.48.1

View File

@ -1,30 +0,0 @@
From 91e0945415c0c4d4c4690760e2b9f64d081639fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Fri, 11 Apr 2025 00:15:21 +0200
Subject: [PATCH 075/500] libdocument/pps-signature: Fix wrong object clear
call on rect finalize
PpsRectangle is a boxed type whose free function is just g_free,
not g_object_unref.
So fix a crash on signature cleanup
---
libdocument/pps-signature.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libdocument/pps-signature.c b/libdocument/pps-signature.c
index 8b1be9fe4..26e620ed6 100644
--- a/libdocument/pps-signature.c
+++ b/libdocument/pps-signature.c
@@ -71,7 +71,7 @@ pps_signature_finalize (GObject *object)
g_clear_pointer (&priv->password, g_free);
g_clear_pointer (&priv->signature, g_free);
g_clear_pointer (&priv->signature_left, g_free);
- g_clear_object (&priv->rect);
+ g_clear_pointer (&priv->rect, g_free);
g_clear_pointer (&priv->document_owner_password, g_free);
g_clear_pointer (&priv->document_user_password, g_free);
g_clear_pointer (&priv->signature_time, g_date_time_unref);
--
2.51.0

View File

@ -1,26 +0,0 @@
From 7be0a67e000358476dda43edc74ea756d3066e18 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Fri, 31 Jan 2025 12:40:03 +0100
Subject: [PATCH 1/2] shell: Fix "go-backwards" action
The go-backwards action did not work before due to a typo in its name.
---
shell/src/document_view/actions.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/shell/src/document_view/actions.rs b/shell/src/document_view/actions.rs
index bdf744431..a4036ab92 100644
--- a/shell/src/document_view/actions.rs
+++ b/shell/src/document_view/actions.rs
@@ -659,7 +659,7 @@ impl imp::PpsDocumentView {
}
))
.build(),
- gio::ActionEntryBuilder::new("go-back")
+ gio::ActionEntryBuilder::new("go-backwards")
.activate(glib::clone!(
#[weak(rename_to = obj)]
self,
--
2.48.1

View File

@ -1,27 +0,0 @@
From fd4b99f3713218bbb0f42a3736f029ced66dbc4d Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Tue, 25 Mar 2025 14:14:59 +0100
Subject: [PATCH] help: List "search-not-found.png" in media files
"search-not-found.png" is referenced in help pages but not listed
among media files in help/meson.build. This causes that the file
is not installed and showing of the help can fail.
---
help/meson.build | 1 +
1 file changed, 1 insertion(+)
diff --git a/help/meson.build b/help/meson.build
index 42bab279c..96996a794 100644
--- a/help/meson.build
+++ b/help/meson.build
@@ -80,6 +80,7 @@ if enable_user_doc
'figures/annotations-nav-to-page.png',
'figures/emblem-system-symbolic.svg',
'figures/org.gnome.Papers.svg',
+ 'figures/search-not-found.png',
'figures/zoom.png',
]
--
2.49.0

View File

@ -1,31 +0,0 @@
From e3bb3547c6674ae354c062198ccf0f440f48e6ef Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Fri, 30 May 2025 16:01:30 +0200
Subject: [PATCH] shell: Launch target file
Launch target file instead of openning the same file again when
launch action is triggered.
---
shell/src/document_view/signals.rs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/shell/src/document_view/signals.rs b/shell/src/document_view/signals.rs
index 8f184f5e4..0e4d1219d 100644
--- a/shell/src/document_view/signals.rs
+++ b/shell/src/document_view/signals.rs
@@ -260,7 +260,11 @@ impl imp::PpsDocumentView {
// does, simply ignore it
let file = self.file().unwrap();
if file.uri() != uri {
- application::spawn(Some(&file), action.dest().as_ref(), Some(self.mode.get()));
+ application::spawn(
+ Some(&gio::File::for_uri(&uri)),
+ action.dest().as_ref(),
+ Some(self.mode.get()),
+ );
}
}
--
2.51.0

View File

@ -1,22 +0,0 @@
--- papers-47.0/meson.build
+++ papers-47.0/meson.build
@@ -140,7 +140,7 @@ po_dir = join_paths(source_root, 'po')
top_inc = include_directories('.')
glib_req_version = '>= 2.75.0'
-gtk_req_version = '>= 4.17.1'
+gtk_req_version = '>= 4.16.7'
libaw_req_version = '>= 1.6'
exempi_req_version = '>= 2.0'
--- papers-47.0/shell/resources/meson.build
+++ papers-47.0/shell/resources/meson.build
@@ -11,6 +11,6 @@ papers_resources = gnome.compile_resourc
source_dir: [data_dir, data_build_dir],
dependencies: metainfo_file,
gresource_bundle: true,
-)[0]
+)
-config_h.set_quoted('RESOURCES_FILE', papers_resources.full_path())
+config_h.set_quoted('RESOURCES_FILE', papers_resources[0].full_path())

View File

@ -1,44 +0,0 @@
From fb19401c6024d53929021bd1ad54bd1c0dd850ab Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Thu, 9 Oct 2025 12:19:36 +0200
Subject: [PATCH] shell: Fix signing when the rectangle is too small
Allow user to use the small rectangle for signature instead
of starting over.
---
shell/src/document_view/signals.rs | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/shell/src/document_view/signals.rs b/shell/src/document_view/signals.rs
index 2f3cc6601..f9b5b686d 100644
--- a/shell/src/document_view/signals.rs
+++ b/shell/src/document_view/signals.rs
@@ -775,7 +775,7 @@ impl imp::PpsDocumentView {
#[template_callback]
fn signature_rect_too_small(&self, response: &str) {
if response == "sign" {
- self.create_certificate_selection();
+ self.certificate_save_as_dialog();
return;
}
@@ -837,6 +837,7 @@ impl imp::PpsDocumentView {
self.signature_page.set(page);
self.signature_bounding_box.replace(Some(*rect));
+ signature.set_rect(rect);
// Calculate font size for main (right) signature text
let Some(font_size) = Self::calculate_font_size(
@@ -862,8 +863,6 @@ impl imp::PpsDocumentView {
signature.set_left_font_size(font_size as i32);
- signature.set_rect(rect);
-
self.certificate_save_as_dialog();
}
}
--
2.51.0

View File

@ -0,0 +1,121 @@
--- papers-48.7/meson.build
+++ papers-48.7/meson.build
@@ -140,7 +140,7 @@ po_dir = join_paths(source_root, 'po')
top_inc = include_directories('.')
glib_req_version = '>= 2.75.0'
-gtk_req_version = '>= 4.17.1'
+gtk_req_version = '>= 4.16.7'
libaw_req_version = '>= 1.6'
exempi_req_version = '>= 2.0'
@@ -270,7 +270,7 @@ elif get_option('djvu').auto()
endif
# *** PDF ***
-poppler_req_version = '>= 25.01.0'
+poppler_req_version = '>= 24.02.0'
poppler_glib_dep = dependency('poppler-glib', version: poppler_req_version, required: get_option('pdf'))
enable_pdf = poppler_glib_dep.found()
--- papers-48.7/shell/resources/meson.build
+++ papers-48.7/shell/resources/meson.build
@@ -11,6 +11,6 @@ papers_resources = gnome.compile_resourc
source_dir: [data_dir, data_build_dir],
dependencies: metainfo_file,
gresource_bundle: true,
-)[0]
+)
-config_h.set_quoted('RESOURCES_FILE', papers_resources.full_path())
+config_h.set_quoted('RESOURCES_FILE', papers_resources[0].full_path())
--- papers-48.7/libdocument/backend/pdf/pps-poppler.c
+++ papers-48.7/libdocument/backend/pdf/pps-poppler.c
@@ -4058,20 +4058,24 @@ pps_backend_query_type (void)
static PopplerCertificateInfo *
find_poppler_certificate_info (PpsCertificateInfo *certificate_info)
{
- g_autolist (PopplerCertificateInfo) signing_certificates = NULL;
+ GList *signing_certificates = poppler_get_available_signing_certificates ();
+ PopplerCertificateInfo *ret = NULL;
g_autofree char *certificate_id = NULL;
- signing_certificates = poppler_get_available_signing_certificates ();
g_object_get (certificate_info, "id", &certificate_id, NULL);
for (GList *list = signing_certificates; list != NULL && list->data != NULL; list = list->next) {
PopplerCertificateInfo *certificate_info = list->data;
- if (g_strcmp0 (certificate_id, poppler_certificate_info_get_id (certificate_info)) == 0)
- return poppler_certificate_info_copy (certificate_info);
+ if (g_strcmp0 (certificate_id, poppler_certificate_info_get_id (certificate_info)) == 0) {
+ ret = poppler_certificate_info_copy (certificate_info);
+ break;
+ }
}
- return NULL;
+ g_clear_list (&signing_certificates, (GDestroyNotify) poppler_certificate_info_free);
+
+ return ret;
}
static void
@@ -4098,8 +4102,8 @@ pdf_document_signatures_sign (PpsDocumen
gpointer user_data)
{
PdfDocument *self = PDF_DOCUMENT (document);
- g_autoptr (PopplerSigningData) signing_data = poppler_signing_data_new ();
- g_autoptr (PopplerCertificateInfo) cert_info = NULL;
+ PopplerSigningData *signing_data = poppler_signing_data_new ();
+ PopplerCertificateInfo *cert_info;
g_autoptr (PpsCertificateInfo) cinfo = NULL;
g_autoptr (GTask) task = NULL;
g_autofree gchar *uuid = NULL;
@@ -4212,7 +4216,7 @@ pdf_document_set_password_callback (PpsD
static GList *
pdf_document_get_available_signing_certificates (PpsDocumentSignatures *document)
{
- g_autolist (PopplerCertificateInfo) signing_certs = poppler_get_available_signing_certificates ();
+ GList *signing_certs = poppler_get_available_signing_certificates ();
GList *ev_certs = NULL;
for (GList *list = signing_certs; list != NULL && list->data != NULL; list = list->next) {
@@ -4225,6 +4229,8 @@ pdf_document_get_available_signing_certi
ev_certs = g_list_append (ev_certs, cert_info);
}
+ g_clear_list (&signing_certs, (GDestroyNotify) poppler_certificate_info_free);
+
return ev_certs;
}
@@ -4275,7 +4275,7 @@ pdf_document_signatures_get_signatures (
for (iter = signature_fields; iter != NULL; iter = iter->next) {
PopplerFormField *field = iter->data;
- g_autoptr (PopplerSignatureInfo) info = NULL;
+ PopplerSignatureInfo *info = NULL;
PpsSignature *signature = NULL;
PpsSignatureStatus signature_status;
PpsCertificateStatus certificate_status;
@@ -4291,8 +4291,10 @@ pdf_document_signatures_get_signatures (
POPPLER_SIGNATURE_VALIDATION_FLAG_USE_AIA_CERTIFICATE_FETCH,
NULL,
NULL);
- if (info == NULL || poppler_signature_info_get_certificate_info (info) == NULL)
+ if (info == NULL || poppler_signature_info_get_certificate_info (info) == NULL) {
+ poppler_signature_info_free (info);
continue;
+ }
switch (poppler_signature_info_get_signature_status (info)) {
case POPPLER_SIGNATURE_VALID:
@@ -4368,6 +4370,7 @@ pdf_document_signatures_get_signatures (
} else {
g_warning ("Could not get certificate info for a signature!");
}
+ poppler_signature_info_free (info);
}
g_clear_list (&signature_fields, g_object_unref);

View File

@ -1,5 +1,4 @@
%global tarball_version %%(echo %{version} | tr '~' '.')
%global commit 5de8d26c
%if 0%{?rhel}
%global bundled_rust_deps 1
@ -12,8 +11,8 @@
%global __provides_exclude_from ^(%{_libdir}/papers/.*\\.so|%{_libdir}/nautilus/extensions-4/.*\\.so)$
Name: papers
Version: 47.0
Release: %autorelease -s git%{commit}
Version: 48.7
Release: %autorelease
Summary: View multipage documents
# papers itself is:
@ -29,37 +28,19 @@ SourceLicense: GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-2.0-or-later AND
# MIT AND (MIT OR Apache-2.0)
# MIT OR Apache-2.0
# Unlicense OR MIT
License: GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-2.0-or-later AND LGPL-2.1-or-later AND MIT AND libtiff AND (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND BSD-3-Clause AND (Unlicense OR MIT)
# Zlib
License: GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-2.0-or-later AND LGPL-2.1-or-later AND MIT AND Zlib AND libtiff AND (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND BSD-3-Clause AND (Unlicense OR MIT)
URL: https://gitlab.gnome.org/GNOME/Incubator/papers
Source: papers-%{commit}.tar.xz
Source: https://download.gnome.org/sources/papers/48/papers-%{tarball_version}.tar.xz
%if 0%{?bundled_rust_deps}
# To generate vendored cargo sources:
# tar xf papers-%%{tarball_version}.tar.xz ; pushd papers-%%{tarball_version}/shell-rs ; \
# cargo vendor && tar Jcvf ../../papers-%%{tarball_version}-vendor.tar.xz ../shell-rs/vendor/ ; popd
Source1: papers-%{commit}-vendor.tar.xz
# tar xf papers-%%{tarball_version}.tar.xz ; pushd papers-%%{tarball_version} ; \
# cargo vendor && tar Jcvf ../papers-%%{tarball_version}-vendor.tar.xz vendor/ ; popd
Source1: papers-%{tarball_version}-vendor.tar.xz
%endif
# Patch to make Papers build with snapshot
Patch: papers-47.0-snapshot-5de8d26c.patch
# Patch to avoid crash when sidebar-page has unexpected value
Patch: papers-47.0-check-sidebar-page.patch
# Fix fast navigation
Patch: papers-47.0-go-backwards-action.patch
Patch: papers-47.0-fast-navigation.patch
# Fix help
Patch: papers-47.0-help.patch
# Fix openning of linked files
Patch: papers-47.0-launch-target-file.patch
# Fix crash during repeated signing
Patch: papers-47.0-fix-wrong-clear.patch
# Fix signing when too small rectangle is selected
Patch: papers-47.0-too-small-rect.patch
# Lower the requirement as we don't have the required versions
Patch: papers-48.7-lower-requirements.patch
# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
ExcludeArch: %{ix86}
@ -160,18 +141,15 @@ This package brings the Papers thumbnailer independently from Papers.
%autosetup -p1 -n papers-%{tarball_version} %{?bundled_rust_deps:-a1}
%if 0%{?bundled_rust_deps}
%cargo_prep -v shell/vendor
%cargo_prep -v vendor
%else
rm shell/Cargo.lock
%cargo_prep
%endif
%if !0%{?bundled_rust_deps}
%generate_buildrequires
cd shell
%cargo_generate_buildrequires -a -t
cd ~-
%endif
@ -185,7 +163,6 @@ cd ~-
%meson_build
cd shell
%cargo_license_summary -a
%{cargo_license -a} > LICENSE.dependencies
%if 0%{?bundled_rust_deps}
@ -200,8 +177,6 @@ cd ~-
%install
%meson_install
# Remove unused symbolic link
%find_lang papers --with-gnome
@ -215,12 +190,11 @@ desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/*.desktop
%files -f papers.lang
%doc README.md
%license COPYING
%license shell/LICENSE.dependencies
%license LICENSE.dependencies
%if 0%{?bundled_rust_deps}
%license shell/cargo-vendor.txt
%license cargo-vendor.txt
%endif
%{_bindir}/papers
# internal library not used by other apps, which is why it is not in -libs
%{_datadir}/applications/org.gnome.Papers.desktop
%{_datadir}/glib-2.0/schemas/org.gnome.Papers.gschema.xml
%{_datadir}/icons/hicolor/scalable/apps/org.gnome.Papers.svg

View File

@ -1,2 +1,2 @@
SHA512 (papers-5de8d26c.tar.xz) = b456f9c871caf8fe217c234dc41cbbe772d95822a808af2aa95c0745b35a67fe41a4d76d9accbde51f212ec1185bef3dd33db015b83e93673cda8259f6d843ff
SHA512 (papers-5de8d26c-vendor.tar.xz) = 4eee4f04eb7ee77fb36ddba5d75bccfde47c398df5086a7ffa61e7b916d0f7779a44d6596bb16ec36107a7b84d2b2f56829358c55aeb7e3a7b0ca8f3fa2f1caf
SHA512 (papers-48.7.tar.xz) = db95e3ae87cfdd99849e5bb07d77f4ec7b698dbd9f515cac60978475cbbb887cf8ee57446851139dbca9b13294f8b3e4cd106718784a6a94bdf49f545ff0c13b
SHA512 (papers-48.7-vendor.tar.xz) = 6c70a10e01d6508b82bcf5cdb9e989b95cad53d05feba569b5a3be1d88f1b82a890de3c5d29f2d6dbebadcf84bf4773115a7f8d1c15d8cd06fc4983cf587a1d6