~develop7/synapse-project/ssh-plugin-proper-wildcards-and-dupes-handling

« back to all changes in this revision

Viewing changes to src/core/desktop-file-service.vala

  • Committer: Michal Hruby
  • Date: 2012-03-18 18:31:33 UTC
  • Revision ID: michal.mhr@gmail.com-20120318183133-awhz4321n8vta9lx
Use AppInfo to make sure i18n works in cases where downstream patches change the way translations are done

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
          }
117
117
        }
118
118
 
119
 
        name = keyfile.get_locale_string (GROUP, "Name");
120
 
        exec = keyfile.get_string (GROUP, "Exec");
 
119
        DesktopAppInfo app_info;
 
120
        app_info = new DesktopAppInfo.from_keyfile (keyfile);
 
121
 
 
122
        if (app_info == null)
 
123
        {
 
124
          throw new DesktopFileError.UNINTERESTING_ENTRY ("Unable to create AppInfo");
 
125
        }
 
126
 
 
127
        name = app_info.get_name ();
 
128
        exec = app_info.get_executable ();
121
129
 
122
130
        // check for hidden desktop files
123
131
        if (keyfile.has_key (GROUP, "Hidden") &&
130
138
        {
131
139
          is_hidden = true;
132
140
        }
133
 
        if (keyfile.has_key (GROUP, "Comment"))
134
 
        {
135
 
          comment = keyfile.get_locale_string (GROUP, "Comment");
136
 
        }
137
 
        if (keyfile.has_key (GROUP, "Icon"))
138
 
        {
139
 
          icon_name = keyfile.get_locale_string (GROUP, "Icon");
140
 
          if (!Path.is_absolute (icon_name) &&
141
 
              (icon_name.has_suffix (".png") ||
142
 
              icon_name.has_suffix (".svg") ||
143
 
              icon_name.has_suffix (".xpm")))
144
 
          {
145
 
            icon_name = icon_name.substring (0, icon_name.length - 4);
146
 
          }
147
 
        }
 
141
 
 
142
        comment = app_info.get_description () ?? "";
 
143
 
 
144
        var icon = app_info.get_icon () ??
 
145
          new ThemedIcon ("application-default-icon");
 
146
        icon_name = icon.to_string ();
 
147
 
148
148
        if (keyfile.has_key (GROUP, "MimeType"))
149
149
        {
150
150
          mime_types = keyfile.get_string_list (GROUP, "MimeType");