From cede2ab984e13663eebf8eaa2e70c2dd85685217 Mon Sep 17 00:00:00 2001 From: Claudio Saavedra Date: Wed, 30 Nov 2011 18:42:01 +0100 Subject: webapps: ensure the webapps are shown in the shell Make sure the applications directory in XDG_DATA_HOME exists before creating a symlink for the application desktop file. https://bugzilla.gnome.org/show_bug.cgi?id=664751 --- embed/ephy-web-app-utils.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/embed/ephy-web-app-utils.c b/embed/ephy-web-app-utils.c index 60ceaea2a..8d6a52dbb 100644 --- a/embed/ephy-web-app-utils.c +++ b/embed/ephy-web-app-utils.c @@ -154,10 +154,11 @@ create_desktop_file (EphyWebView *view, GKeyFile *file; char *exec_string; char *data; - char *filename, *desktop_file_path; + char *filename, *apps_path, *desktop_file_path; char *link_path; char *wm_class; GFile *link; + GError *error = NULL; g_return_val_if_fail (profile_dir, NULL); @@ -207,11 +208,18 @@ create_desktop_file (EphyWebView *view, /* Create a symlink in XDG_DATA_DIR/applications for the Shell to * pick up this application. */ - link_path = g_build_filename (g_get_user_data_dir (), "applications", filename, NULL); - link = g_file_new_for_path (link_path); - g_free (link_path); - g_file_make_symbolic_link (link, desktop_file_path, NULL, NULL); - g_object_unref (link); + apps_path = g_build_filename (g_get_user_data_dir (), "applications", NULL); + if (ephy_ensure_dir_exists (apps_path, &error)) { + link_path = g_build_filename (apps_path, filename, NULL); + link = g_file_new_for_path (link_path); + g_free (link_path); + g_file_make_symbolic_link (link, desktop_file_path, NULL, NULL); + g_object_unref (link); + } else { + g_warning ("Error creating application symlink: %s", error->message); + g_error_free (error); + } + g_free (apps_path); g_free (filename); return desktop_file_path; -- cgit v1.2.1