linuxmint / xviewer

A generic Image viewer
GNU General Public License v2.0
75 stars 37 forks source link

When saving to another file format, an existing filename having that format pre-populates in the "Save As" dialog #171

Open user23108947023948 opened 2 years ago

user23108947023948 commented 2 years ago
 * Xviewer version (xviewer --version)
 * Distribution - (Mint 17.2, Arch, Fedora 25, etc...)

Issue When saving to another file format, an existing filename having that format pre-populates in the "Save As" dialog

Steps to reproduce

  1. Put a gif file named giffy.gif in a directory.
  2. Put a jpg file named jpeggy.jpg in the same directory.
  3. Open giffy.gif in xviewer.
  4. Click File > Save As.
  5. Click the drop down arrow in the "supported image files" box.
  6. The "Save As" dialog box will have the file name of an existing .jpg file pre-populated as the output filename. If you're not careful, you'll overwrite that existing file!!!

Expected behaviour

At step 6, there should either be NO prepoulated filename, or there should be a prepopulated filename based on the name of the open file (minus the original extension).

Other information

N/A

programmer-ceds commented 2 years ago

Linux Mint 20.3 xviewer 3.2.7

If I add a step 5a = select the "JPEG (*.jpeg)" option then the "Name" box contents changes to a jpeg/jpg file in the folder. This I think is the same thing as you are seeing.

I have added a GTK filechooser to a small GTK test program that I have and this behaves in the same way. I have no callbacks from the filechooser dialog so the application isn't being called when the file type is changed. xviewer has callbacks for the dialog response and for preview updates - but I have caused the latter simply to return so that there is no possibility that it is messing with the file name when the file type is changed.

I think, therefore, that this may well not be a problem in xviewer as such but in the lower level code - GTK. Interestingly pix behaves in the same way.

user23108947023948 commented 2 years ago

I'm not a developer. Any idea how to report this issue to the appropriate place?

programmer-ceds commented 2 years ago

@user23108947023948 you could report the issue here https://gitlab.gnome.org/GNOME/gtk but if you wish I will do so when I have spent a bit more time looking at the issue. I didn't find any open or closed issues for filechooser that seemed to be about this issue but I find it hard to believe that a problem like this has gone unnoticed/unreported for so long. I will re-check the list of issues. When I report the issue I could post the small amount of code for the program that I have that demonstrates the issue - better than just saying that it occurs in xviewer.

Like you at step 6 I would expect the first part of the file name to remain unaltered but the extension to change to that selected by the file type selection box.

Update: I have created an issue for GTK - https://gitlab.gnome.org/GNOME/gtk/-/issues/5101

Update 14.8.2022 @user23108947023948 I have updated my system to Mint 21.0 which has allowed me to install GTK4. I have modified my small test program from GTK3 to 4 and shown that the problem still exists. I have posted the files required to demonstrate the problem on the gtk gitlab site and re-opened this issue (since I have tested against the latest released version of GTK they can't say that it isn't supported this time!)

I am convinced that this problem lies within GTK and is not something that can be resolved in xviewer (without writing a dedicated file save dialog instead of using the one supplied by GTK).

I think that this xviewer issue should, therefore, be closed.

It is possible that the gtk developers will point out that the error lies in my code, although I feel that this is unlikely. However, should this be the case the same error is almost certainly going to apply to the xviewer code which I can then fix.

Note that even if the GTK developers fix the problem it is very unlikely to be back-ported to the version 3 GTK code. So unless the change is included in GTK 4 and xviewer is ported to GTK 4 then this will remain an issue.