-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Save as dialog #133
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution @Maaxxs. I'm not against it but there are few things to change.
- Can you squash all your commits into 1?
- Make sure
clang-format
is run on all the files you're changing. - Please have a look at my comments and suggestions.
2dc2642
to
cc173c2
Compare
thanks for your suggestions! Other points:
todo:
|
cc173c2
to
07e9e45
Compare
src/application.c
Outdated
filename_suggestion = format_filename(state->config->save_filename_format); | ||
|
||
dialog = gtk_file_chooser_dialog_new(NULL, state->ui->window, action, | ||
("_Cancel"), GTK_RESPONSE_CANCEL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why you're putting the "_Cancel"
and "_Save"
between parenthesis?
Regarding translating those, I'm not sure. The gtk doc seems to indicate what you are doing is valid. But I don't know if it means it's properly translated and using the base gtk po
files. I'd need to research.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've switched to French, and the Close / Save do not seem to be translated. You'll have to use gettext
I guess? I don't know if the ninja target will be smart enough to catch those. (I don't think there any translation done in the .c
files. It's only in the ui
files for now.)
Good luck. :)
1c3eaa2
to
3083bb7
Compare
07e9e45
to
18a899a
Compare
I had some time again, so I continued here. I added some code for the initialization of The initial step to include the translation for the dialog buttons is done. |
Allow to save snapshots with a different name and under a different location than specified in the configuration as default. Signed-off-by: Max Kunzelmann <[email protected]>
18a899a
to
e670f72
Compare
// set locales according to environment variables
setlocale(LC_ALL, ""); The default of
I think it would be nice to do this, although it's not necessary as swappy is not using time, number units or similar where the formatting depends on the locale. AFAIU, this would enable an user of swappy to just set $ LC_ALL=de_DE swappy -f ~/Pictures/swappytest.png
$ LANG=de_DE swappy -f ~/Pictures/swappytest.png
$ LC_ALL=en_US LANG=de_DE swappy -f ~/Pictures/swappytest.png
$ LC_ALL=en_US LANG=de_DE LANGUAGE=fr_FR swappy -f ~/Pictures/swappytest.png The first two commands set the language to German. The third one sets it to English because (according to the manpage)
However, if I'm happy to remove this if you don't agree. // set base directory for translated messages
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); This is the most important call that caused me some headache, too. The default prefix on my archlinux system is // explicitly set encoding of message translations to UTF-8
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); this forces the codeset to UTF-8. I think this is ok as the translation files are all UTF-8 as well. For instance, if we don't do this, then I get the following warnings if only $ LC_ALL=de_DE swappy -f ~/Pictures/swappytest.png
(swappy:179132): Pango-WARNING **: 14:07:42.612: Invalid UTF-8 string passed to pango_layout_set_text()
(swappy:179132): Pango-WARNING **: 14:07:42.624: Invalid UTF-8 string passed to pango_layout_set_text() btw, should I continue to force push changes in that one commit or squash the commits in the end? (I always feel kinda bad when doing a force push :) ). |
Thank you @Maaxxs. I'll have a look when I get some time. You can definitely keep "force pushing", it's your branch on your own fork you can do whatever you want with it. |
Sure. Thanks!
Ok. My thinking was that it may be easier for you to review changes. And I think GitHub get confused sometimes when you do a force push and there are open reviews. |
hi @jtheoof have you had time for another look at this? |
nice to see some activity here. Not sure what I can do to push this further. I'm running with these changes since I proposed them and so far (~2 years :) ) it works well. |
Would be really nice to see indeed! |
I am not sure whats causing the delay either, lets wait for the review |
I'd really love to have this feature, too. Would make swappy an even greater replacement for flameshot. |
I'm still hesitating to merge this. I think the part that I'm not a fan of is the fact that it clutters the UI. I want this tool to be simple and we're adding an extra button. I would be down to merge if you remove the UI bits and just use the ctrl+shift+s shortcut + document it properly in the README and the manpage |
are there other functions that are only accessible by keyboard shortcut? |
char *filename; | ||
filename = format_filename(filename_format); | ||
if (filename == NULL) return; | ||
|
||
g_snprintf(path, MAX_PATH, "%s/%s", folder, filename); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in this case we actually should abort if this fails. We do not want to write to a truncated filename as this could potentially overwrite some file the user did not intend to overwrite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for taking a look at the code!
I hope I get around to taking another look at this at the weekend but I have lots of other things on my mind currently.
@jtheoof you have the authority here but if I may add my 0.02$ here then I do not think this change is cluttering the UI too much. It just adds one small button in the area that has plenty of space anyway. I would like to have that functionality merged, though, so if you still feel you don't want the UI then I think having just the key shortcut is better than nothing so if @Maaxxs wont do this I would modify his PR to suit your request. But maybe there's still a chance you could change your mind? :) |
I understand. I'm a huge fan of simple and clean tools. However, I don't think that adding this button clutters the UI.
I'd probably do this if you were strictly against adding the button. As was previously said it's better than not having this feature at all. I use it all the time when taking screenshots for different projects meaning that the directory I'm saving the screenshot to changes every time. |
As mentioned in issue #125 it would be nice to save images to a different location than the default.
I thought so, too and came up with the following solution.
I tried to keep everything clean and simple.
Save
button with the "official" save_as image.Todo:
ctrl+shift+s
for the save_as dialog. I think that'd be useful, too.