summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-07-25 15:08:47 +0200
committerinfirit <[email protected]>2014-07-25 15:08:47 +0200
commit9432c69d9bd5826bc975221f18427a4ba228574b (patch)
tree21ac6693474d338107f8d4d96d7817d05fd2ba6a
parentfa13dcadb1c4a47be4b9caf9edcd4cd3833bd1a5 (diff)
downloadeom-9432c69d9bd5826bc975221f18427a4ba228574b.tar.bz2
eom-9432c69d9bd5826bc975221f18427a4ba228574b.tar.xz
Make newly saved images user writable
Doesn't occur for existing files only when saving creates a new file. Eog bug http://bugzilla.gnome.org/show_bug.cgi?id=589921 Based on eog commit 00075ab25d5bd3656a2f5f89773bd56e091d5b47 From Javier Sánchez <[email protected]>
-rw-r--r--src/eom-jobs.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/eom-jobs.c b/src/eom-jobs.c
index 48afc1c..1ddfc4f 100644
--- a/src/eom-jobs.c
+++ b/src/eom-jobs.c
@@ -709,6 +709,9 @@ eom_job_save_as_run (EomJob *ejob)
EomJobSaveAs *saveas_job;
GList *it;
guint n_images;
+ guint file_permissions = 00000;
+ guint permissions_mask = 00600;
+ GFileInfo *info;
g_return_if_fail (EOM_IS_JOB_SAVE_AS (ejob));
@@ -780,6 +783,26 @@ eom_job_save_as_run (EomJob *ejob)
dest_info,
&ejob->error);
+ /* get file permissions */
+ info = g_file_query_info (saveas_job->file,
+ G_FILE_ATTRIBUTE_UNIX_MODE,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ NULL);
+
+ file_permissions = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_MODE);
+
+ /* apply permission mask to file permissions */
+ file_permissions |= permissions_mask;
+
+ g_file_set_attribute_uint32 (saveas_job->file,
+ G_FILE_ATTRIBUTE_UNIX_MODE,
+ file_permissions,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ NULL);
+
+ g_object_unref (info);
if (src_info)
g_object_unref (src_info);