Remove broken ShellAppSystem API and all consumers

In commit 9bd22dc0, I introduced an API to load an arbitrary
.desktop file, not necessarily from the menu path.  It turns
out this function was broken because it created ShellApp instances
that were *different* from ones that were cached normally.

As far as I can tell, we didn't initially use it.  Then later
Util.spawnDesktop was created which used this function.

Remove this broken function and all callers; if we're loading
.desktop files from *outside* the menu path, we can look at
readding.

This patch also kills off Util.spawnDesktop in favor of callers
talking to ShellAppSystem directly, now that the latter reports
errors.

https://bugzilla.gnome.org/show_bug.cgi?id=644402
This commit is contained in:
Colin Walters
2011-03-10 12:19:10 -05:00
parent 4bf1df0894
commit fea8b6da2f
8 changed files with 29 additions and 108 deletions

View File

@ -159,20 +159,6 @@ shell_app_info_new_from_window (MetaWindow *window)
return info;
}
static ShellAppInfo *
shell_app_info_new_from_keyfile_take_ownership (GKeyFile *keyfile,
const char *path)
{
ShellAppInfo *info;
info = g_slice_alloc0 (sizeof (ShellAppInfo));
info->type = SHELL_APP_INFO_TYPE_DESKTOP_FILE;
info->refcount = 1;
info->keyfile = keyfile;
info->keyfile_path = g_strdup (path);
return info;
}
static void shell_app_system_class_init(ShellAppSystemClass *klass)
{
GObjectClass *gobject_class = (GObjectClass *)klass;
@ -576,44 +562,6 @@ _shell_app_system_register_app (ShellAppSystem *self,
g_object_weak_ref (G_OBJECT (app), shell_app_system_on_app_weakref, ref);
}
ShellAppInfo *
shell_app_system_load_from_desktop_file (ShellAppSystem *system,
const char *filename,
GError **error)
{
ShellAppInfo *appinfo;
GKeyFile *keyfile;
char *full_path = NULL;
gboolean success;
keyfile = g_key_file_new ();
if (strchr (filename, '/') != NULL)
{
success = g_key_file_load_from_file (keyfile, filename, G_KEY_FILE_NONE, error);
full_path = g_strdup (filename);
}
else
{
char *app_path = g_build_filename ("applications", filename, NULL);
success = g_key_file_load_from_data_dirs (keyfile, app_path, &full_path,
G_KEY_FILE_NONE, error);
g_free (app_path);
}
if (!success)
{
g_key_file_free (keyfile);
g_free (full_path);
return NULL;
}
appinfo = shell_app_info_new_from_keyfile_take_ownership (keyfile, full_path);
g_free (full_path);
return appinfo;
}
/**
* shell_app_system_create_from_window:
*
@ -1386,12 +1334,23 @@ shell_app_info_launch_full (ShellAppInfo *info,
shell_app = shell_app_system_get_app (shell_app_system_get_default (),
shell_app_info_get_id (info));
ret = g_desktop_app_info_launch_uris_as_manager (gapp, uris,
G_APP_LAUNCH_CONTEXT (context),
G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
NULL, NULL,
_gather_pid_callback, shell_app,
error);
/* In the case where we know an app, we handle reaping the child internally,
* in the window tracker.
*/
if (shell_app != NULL)
ret = g_desktop_app_info_launch_uris_as_manager (gapp, uris,
G_APP_LAUNCH_CONTEXT (context),
G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
NULL, NULL,
_gather_pid_callback, shell_app,
error);
else
ret = g_desktop_app_info_launch_uris_as_manager (gapp, uris,
G_APP_LAUNCH_CONTEXT (context),
G_SPAWN_SEARCH_PATH,
NULL, NULL,
NULL, NULL,
error);
g_object_unref (G_OBJECT (gapp));

View File

@ -81,9 +81,6 @@ ShellApp *shell_app_system_get_app_for_window (ShellAppSystem *sel
ShellApp *shell_app_system_lookup_heuristic_basename (ShellAppSystem *system,
const char *id);
ShellAppInfo *shell_app_system_load_from_desktop_file (ShellAppSystem *system,
const char *filename,
GError **error);
ShellAppInfo *shell_app_system_create_from_window (ShellAppSystem *system,
MetaWindow *window);