After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 701179 - Add config variable to specify default file extension
Add config variable to specify default file extension
Status: RESOLVED FIXED
Product: gnome-screenshot
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gnome-screenshot-maint
gnome-screenshot-maint
Depends on:
Blocks:
 
 
Reported: 2013-05-29 08:50 UTC by sassmann
Modified: 2013-07-17 15:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-Add-config-variable-to-specify-default-file-extensio.patch (4.72 KB, patch)
2013-05-29 08:50 UTC, sassmann
reviewed Details | Review
0001-Add-config-variable-to-specify-default-file-extensio.patch v2 (4.12 KB, patch)
2013-05-31 09:19 UTC, sassmann
none Details | Review
0001-Add-config-variable-to-specify-default-file-extensio.patch v3 (4.46 KB, patch)
2013-05-31 14:10 UTC, sassmann
reviewed Details | Review
0001-Add-config-variable-to-specify-default-file-extensio.patch v4 (4.43 KB, patch)
2013-06-01 07:29 UTC, sassmann
committed Details | Review

Description sassmann 2013-05-29 08:50:11 UTC
Created attachment 245526 [details] [review]
0001-Add-config-variable-to-specify-default-file-extensio.patch

This is a first attempt to allow making non-png screenshots by default. Comments, suggestions very welcome.

What this patch does is add a new setting
org.gnome.gnome-screenshot default-file-type
which defines the file type extension screenshots should be taken with. The rest is handled by gnome-screenshot transparently. So if you set this to jpg, screenshots should be taken in jpg format instead of png.
Comment 1 Cosimo Cecchi 2013-05-29 20:21:19 UTC
Review of attachment 245526 [details] [review]:

Thanks, this looks mostly good to me; I only have a couple of minor comments below.

::: src/gnome-screenshot.convert
@@ +6,3 @@
 include-pointer = /apps/gnome-screenshot/include_pointer
+border-effect = /apps/gnome-screenshot/border_effect
+default-file-type = /apps/gnome-screenshot/default_file_type

This option never existed in GConf, so it doesn't need to be migrated.

::: src/screenshot-filename-builder.c
@@ +142,3 @@
+      file_type = g_strdup (screenshot_config->file_type);
+  else
+      file_type = g_strdup ("png");

I don't think you need to strdup these; you can just make file_type a const gchar * and avoid the g_free() later.
Comment 2 sassmann 2013-05-31 09:19:56 UTC
Created attachment 245708 [details] [review]
0001-Add-config-variable-to-specify-default-file-extensio.patch v2

Thanks for the review and comments.
The reason I used the g_strdup() is that I wanted to make sure we have a safe default in case the gconf setting is empty. I hope the new code is what you had in mind.
Comment 3 Matthias Clasen 2013-05-31 11:05:29 UTC
you can make it safe by making the setting an enum - then you know all possible values, and can safely assume you will always get 'png' or 'jpeg'
Comment 4 sassmann 2013-05-31 12:50:56 UTC
ok, I'll look into that option. If you have an example of how to use an enum that would be appreciated.
Comment 5 sassmann 2013-05-31 14:10:28 UTC
Created attachment 245742 [details] [review]
0001-Add-config-variable-to-specify-default-file-extensio.patch v3

Here's v3 with an enum.
Comment 6 Cosimo Cecchi 2013-05-31 15:46:45 UTC
Review of attachment 245742 [details] [review]:

Thanks, this looks good except a minor comment.

::: src/org.gnome.gnome-screenshot.gschema.xml.in
@@ +3,3 @@
+    <value nick="bmp" value="0"/>
+    <value nick="jpg" value="1"/>
+    <value nick="jpeg" value="2"/>

I don't think we need two different types for JPEG.
Comment 7 sassmann 2013-06-01 07:29:49 UTC
Created attachment 245811 [details] [review]
0001-Add-config-variable-to-specify-default-file-extensio.patch v4
Comment 8 Cosimo Cecchi 2013-06-01 16:08:18 UTC
Review of attachment 245811 [details] [review]:

Looks good to me, thanks.
Comment 9 sassmann 2013-07-17 09:20:40 UTC
Cosimo,
I don't see the v4 patch in the git repo. Any reason why you haven't committed it yet?
Comment 10 Cosimo Cecchi 2013-07-17 14:57:25 UTC
I wasn't aware you didn't have a GNOME git account to push this. I'll commit the patch for you later today.
Comment 11 sassmann 2013-07-17 14:59:51 UTC
Thanks a lot!
Comment 12 Cosimo Cecchi 2013-07-17 15:29:29 UTC
Pushed now.