diff options
author | Claudio Saavedra <csaavedra@igalia.com> | 2011-12-01 01:42:01 +0800 |
---|---|---|
committer | Claudio Saavedra <csaavedra@igalia.com> | 2011-12-01 01:44:59 +0800 |
commit | 3dca36516253cf3332627861efda6ec4f6d79a8c (patch) | |
tree | 44ae8d04f9e680764ca8168adeabf637ad348243 | |
parent | 4bd76258dfb086976c7daf1d854aab852c422c85 (diff) | |
download | gsoc2013-epiphany-3dca36516253cf3332627861efda6ec4f6d79a8c.tar gsoc2013-epiphany-3dca36516253cf3332627861efda6ec4f6d79a8c.tar.gz gsoc2013-epiphany-3dca36516253cf3332627861efda6ec4f6d79a8c.tar.bz2 gsoc2013-epiphany-3dca36516253cf3332627861efda6ec4f6d79a8c.tar.lz gsoc2013-epiphany-3dca36516253cf3332627861efda6ec4f6d79a8c.tar.xz gsoc2013-epiphany-3dca36516253cf3332627861efda6ec4f6d79a8c.tar.zst gsoc2013-epiphany-3dca36516253cf3332627861efda6ec4f6d79a8c.zip |
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
-rw-r--r-- | embed/ephy-web-app-utils.c | 20 |
1 files 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; |