paper-clip: fix compilation error caused by glib

This commit is contained in:
Pratham Patel
2024-12-29 15:54:49 +05:30
parent a968249646
commit 42e57decdf
3 changed files with 96 additions and 0 deletions
@@ -0,0 +1,66 @@
From 93e1c00bca9078fa4b21e42a4560011cce768142 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Diego=20Iv=C3=A1n=20M=2EE?= <diegoivan.mae@gmail.com>
Date: Mon, 12 Aug 2024 09:16:51 -0600
Subject: [PATCH] document: Copy using SubprocessLauncher instead of GFile API
---
io.github.diegoivan.pdf_metadata_editor.json | 7 +++----
src/Document.vala | 13 +++++++------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/io.github.diegoivan.pdf_metadata_editor.json b/io.github.diegoivan.pdf_metadata_editor.json
index ede68d1..3feb79e 100644
--- a/io.github.diegoivan.pdf_metadata_editor.json
+++ b/io.github.diegoivan.pdf_metadata_editor.json
@@ -52,10 +52,9 @@
],
"sources" : [
{
- "url" : "https://gitlab.freedesktop.org/poppler/poppler.git",
- "type" : "git",
- "tag" : "poppler-23.01.0",
- "commit" : "4259ff0c2067d302f97d87221a442eec8e88d45c"
+ "url" : "https://poppler.freedesktop.org/poppler-24.08.0.tar.xz",
+ "type" : "archive",
+ "sha256" : "97453fbddf0c9a9eafa0ea45ac710d3d49bcf23a62e864585385d3c0b4403174"
}
]
},
diff --git a/src/Document.vala b/src/Document.vala
index e52e1a7..a59fe03 100644
--- a/src/Document.vala
+++ b/src/Document.vala
@@ -445,11 +445,11 @@ public class PaperClip.Document : Object {
}
private async File create_copy_from_original () throws Error {
+ var launcher = new SubprocessLauncher (NONE);
unowned string tmp_dir = Environment.get_tmp_dir ();
string destination_path = Path.build_path (Path.DIR_SEPARATOR_S,
tmp_dir,
"copies");
-
int res = DirUtils.create_with_parents (destination_path, 0777);
if (res < 0) {
throw new IOError.FAILED (@"Could not create $destination_path");
@@ -458,14 +458,15 @@ public class PaperClip.Document : Object {
string destination_file = Path.build_filename (destination_path,
"%s".printf (original_file.get_basename ()));
- var copy_file = File.new_for_path (destination_file);
- FileCopyFlags flags = NOFOLLOW_SYMLINKS | OVERWRITE | ALL_METADATA;
-
- bool success = yield original_file.copy_async (copy_file, flags);
+ Subprocess copy_process = launcher.spawn("cp", original_file.get_path(), destination_path);
+ bool success = yield copy_process.wait_async ();
if (!success) {
- critical ("Copy Unsuccessful");
+ critical ("Processed failed");
}
+
+ var copy_file = File.new_for_path (destination_file);
+
return copy_file;
}
}
+6
View File
@@ -27,6 +27,12 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-Jdsx5ZhujP0SgEtr4NMbXsTkMYrkQj7Vs+SSYziWpiw=";
};
# Remove these patches after the version is bumped past 5.5.1
patches = [
./document-Copy-using-SubprocessLauncher-instead-of-GFile-API.patch
./vala-Solve-Vala-errors-at-C-compile-time.patch
];
nativeBuildInputs = [
desktop-file-utils
meson
@@ -0,0 +1,24 @@
From 82193146a80bfe613355706421454f879bdd496f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Diego=20Iv=C3=A1n=20M=2EE?= <diegoivan.mae@gmail.com>
Date: Mon, 5 Aug 2024 18:08:36 -0600
Subject: [PATCH] vala: Solve Vala errors at C compile time
---
src/Document.vala | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/Document.vala b/src/Document.vala
index 872309f..e52e1a7 100644
--- a/src/Document.vala
+++ b/src/Document.vala
@@ -451,7 +451,9 @@ public class PaperClip.Document : Object {
"copies");
int res = DirUtils.create_with_parents (destination_path, 0777);
- return_if_fail (res > -1);
+ if (res < 0) {
+ throw new IOError.FAILED (@"Could not create $destination_path");
+ }
string destination_file = Path.build_filename (destination_path,
"%s".printf (original_file.get_basename ()));