Closed eugenesan closed 3 years ago
* tfmt, dfmt need to be of type gchar (see https://developer.gnome.org/gio/stable)/GSettings.html#g-settings-get-string) * You need to free tfmt and dfmt with g_free * You need to free gchar* when overwriting them * You should use g_strcmp0 (https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strcmp0) instead of strcmp (it is null safe)
Oppsie, silly me. I was in such a rush that I forgot we are in "gnome" environment and stuff needs to be released ;-) I am sure going to apply all your recommendations.
Also, I wonder if I can skip checking return value of g_date_time_format()? Looks like it always outputs proper string. If the parsing fails, it just outputs input string. Worst case scenario the user will see that and correct.
P.S. I did some more testing and looks like g_date_time_format() eats every input. in worst case scenario special characters disrupted HTML formatting of g_strdup_printf() but I don't think there is anything we can do aside of doing full parsing verification of the format. Updated PR patch.
@mbkma Are your concerns solved?
@eugenesan Any chance to fix this indent issues?
@raveit65 Sorry for the delay (I was away). I've pushed requested changes.
This change allows modification of default time and date format defined by current locale. Closes https://github.com/mate-desktop/mate-screensaver/issues/100
Default ('local') settings maintains old behavior. User is able to use any format defined by https://developer.gnome.org/glib/stable/glib-GDateTime.html#g-date-time-format.
Examples: %R for time means 24H format. %F for date means YYYY-MM-DD (ISO 8601 format).