summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2011-11-30 18:42:01 +0100
committerClaudio Saavedra <csaavedra@igalia.com>2011-11-30 18:48:16 +0100
commitcede2ab984e13663eebf8eaa2e70c2dd85685217 (patch)
tree3a64b24b6c246ba8bc58c953e7d500390e775ada
parent9fc146350177a00c5e7b1994a7aef54c676d20b6 (diff)
downloadepiphany-cede2ab984e13663eebf8eaa2e70c2dd85685217.tar.gz
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.c20
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;