Skip to content

Commit

Permalink
DesktopFileOperator: Fix a regression that unlocalized Comment key no…
Browse files Browse the repository at this point in the history
… longer loaded (#120)
  • Loading branch information
ryonakano authored Jan 27, 2024
1 parent be09777 commit 27bc3a4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Backend/DesktopFileOperator.vala
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ public class DesktopFileOperator : GLib.Object {
* Load the content of the desktop file at `path` and construct new DesktopFile through KeyFile object.
*/
public DesktopFile? load_from_file (string path) {
string locale;

string file_name = "";
string app_name = "";
string comment = "";
Expand All @@ -214,11 +212,13 @@ public class DesktopFileOperator : GLib.Object {
// Get the filename without the .desktop suffix
file_name = basename.slice (0, basename.length - DESKTOP_SUFFIX.length);

locale = keyfile.get_locale_for_key (KeyFileDesktop.GROUP, KeyFileDesktop.KEY_NAME, preferred_language);
string locale = keyfile.get_locale_for_key (KeyFileDesktop.GROUP, KeyFileDesktop.KEY_NAME, preferred_language);
app_name = keyfile.get_locale_string (KeyFileDesktop.GROUP, KeyFileDesktop.KEY_NAME, locale);

locale = keyfile.get_locale_for_key (KeyFileDesktop.GROUP, KeyFileDesktop.KEY_COMMENT, preferred_language);
if (locale != null) {
bool has_key = keyfile.has_key (KeyFileDesktop.GROUP, KeyFileDesktop.KEY_COMMENT);
// Either has a localized or unlocalized Comment key
if (locale != null || has_key) {
comment = keyfile.get_locale_string (KeyFileDesktop.GROUP, KeyFileDesktop.KEY_COMMENT, locale);
}

Expand Down

0 comments on commit 27bc3a4

Please sign in to comment.