-
Notifications
You must be signed in to change notification settings - Fork 348
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
Settings refactor V2 #803
Settings refactor V2 #803
Conversation
Codecov Report
@@ Coverage Diff @@
## master #803 +/- ##
==========================================
+ Coverage 58.54% 60.32% +1.78%
==========================================
Files 37 39 +2
Lines 5987 6022 +35
==========================================
+ Hits 3505 3633 +128
+ Misses 2482 2389 -93
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
Nice PR.
You might want to look into #475
I'm not sure about the current state of option parsing in dunst, but I'd prefer to have uniformed string parser functions. This can be used then in further work to restructure the option parser.
Do you mean the same thing I mentioned here #803 (comment)? Then I'm totally down.
That's a good PR too. I wonder why it never got merged. There are quite a few small things in there that make the settings code better. But before we continue this implementation in C I think it's a good time to decide 2 things:
|
5775ed7
to
6153c02
Compare
8ea77b5
to
d0b4152
Compare
|
738a100
to
4ae7c22
Compare
This PR is finally in a reviewable state. I do not expect everything to work perfectly yet. There's probably some things that have changed from the old version. I will go through and test a bit more. The code is mostly ready, so you can go ahead and review it. |
f07f0e5
to
b627ee0
Compare
f54df9c
to
dcc18ba
Compare
This is implemented by giving each setting a type. Based on the type, the string will be parsed differently. A generic enum parser is used as well. Instead of having a function for every enum, only one function is needed. This will take some data with possible enum values. All data needed to parse the settings is defined in settings_data.h. This is useful for keeping all data in one place and it's easier to check if there are mistakes.
Also add format to the printed attributes
06661bf
to
6ae04b8
Compare
@bebehei The tests are now also compiled with -Werror and that's making it harder to write tests (I'm using a language extension supported by clang and gcc, but clang gives a warning about it). I think it's best to compile only dunst itself with -Werror. I tried implementing that, but now the code coverage is giving errors. If you have time, could you take a look at that? @tsipinakis Other than that, the PR is ready. You can take a look at the changes and I especially recommend looking at the first comment in this PR for a list of changes. Let me know if you don't agree with any of the choices I made |
6ae04b8
to
07810fd
Compare
…e warning from clang
b707adc
to
a9be3b1
Compare
For the record, I've already started a review on this. About half-way through but life keeps getting in the way (and this is a huge PR). |
It has taken.. official 6 months. Wow sorry for this 🙈. This has been a gigantic leap forward in the code quality and readability. Thanks a lot @fwsmit.. Now to review the others :) |
Thanks for reviewing. Those 6 months weren't all you, I was still developing the branch as well ;) |
Our current way of dealing with settings is very messy. It also involves copy and pasting a considerate amount of code for adding a setting. This PR strives to make it so that you only need to add a few lines to an array,
allowed_settings
, to add a setting or rule.This allows us to do much better checking of the settings both in the way settings are defined and the user's input.
If you make a mistake in defining a setting, this will most likely be caught by the tests, or you can easily add a test to account for this mistake. We can also easily extend the set of allowed rules without making the code more messy.
If a users misspells a setting in their dunstrc, instead of ignoring that setting dunst will warn the user that setting doesn't exist. This could also be extended to suggesting a similar setting from the list of settings.
Changes in this PR
string_parse_*
,ini_get_*
,option_get_*
(cmd_line_get_*
stays for now)string_to_color
Deprecated by this PR
[shortcuts]
,verbosity
,icon_folders
,startup_notification
, something I forgot?. (startup_notification
andverbosity
are still command line options)TODO:
Possible enhancements:
Implements: #412 #414
Fixes: #138