[epiphany/gnome-3-2] webapps: ensure the webapps are shown in the shell



commit cede2ab984e13663eebf8eaa2e70c2dd85685217
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Wed Nov 30 18:42:01 2011 +0100

    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 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/embed/ephy-web-app-utils.c b/embed/ephy-web-app-utils.c
index 60ceaea..8d6a52d 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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]