/**
 * cinnamon_app_system_lookup_heuristic_basename:
 * @system: a #CinnamonAppSystem
 * @id: Probable application identifier
 *
 * Find a valid application corresponding to a given
 * heuristically determined application identifier
 * string, or %NULL if none.
 *
 * Returns: (transfer none): A #CinnamonApp for @name
 */
CinnamonApp *
cinnamon_app_system_lookup_heuristic_basename (CinnamonAppSystem *system,
                                            const char     *name)
{
  CinnamonApp *result;
  GSList *prefix;

  result = cinnamon_app_system_lookup_app (system, name);
  if (result != NULL)
    return result;

  result = cinnamon_app_system_lookup_settings_app (system, name);
  if (result != NULL)
    return result;

  for (prefix = system->priv->known_vendor_prefixes; prefix; prefix = g_slist_next (prefix))
    {
      char *tmpid = g_strconcat ((char*)prefix->data, name, NULL);
      result = cinnamon_app_system_lookup_app (system, tmpid);
      g_free (tmpid);
      if (result != NULL)
        return result;
    }

  return NULL;
}
Ejemplo n.º 2
0
/**
 * cinnamon_app_system_lookup_settings_app_by_tree_entry:
 * @system: a #CinnamonAppSystem
 * @entry: a #GMenuTreeEntry
 *
 * Find a #CinnamonApp corresponding to a #GMenuTreeEntry.
 *
 * Return value: (transfer none): The #CinnamonApp for @entry, or %NULL if none
 */
CinnamonApp *
cinnamon_app_system_lookup_settings_app_by_tree_entry (CinnamonAppSystem  *self,
                                           GMenuTreeEntry  *entry)
{
  /* If we looked up directly in ->entry_to_app, we'd lose the
   * override of running apps.  Thus, indirect through the id.
   */
  return cinnamon_app_system_lookup_settings_app (self, gmenu_tree_entry_get_desktop_file_id (entry));
}