diff options
-rw-r--r-- | embed/ephy-web-app-utils.c | 28 | ||||
-rw-r--r-- | embed/ephy-web-app-utils.h | 2 | ||||
-rw-r--r-- | embed/ephy-web-view.c | 5 |
3 files changed, 26 insertions, 9 deletions
diff --git a/embed/ephy-web-app-utils.c b/embed/ephy-web-app-utils.c index e64eb1ac0..c1c9856cd 100644 --- a/embed/ephy-web-app-utils.c +++ b/embed/ephy-web-app-utils.c @@ -78,6 +78,27 @@ out: } /** + * ephy_web_application_get_directory: + * @app_name: the application name + * + * Gets the directory whre the profile for @app_name is meant + * to be stored. + * + * Returns: (transfer full): A newly allocated string. + **/ +char * +ephy_web_application_get_profile_directory (const char *app_name) +{ + char *app_dir, *profile_dir; + + app_dir = g_strconcat (EPHY_WEB_APP_PREFIX, app_name, NULL); + profile_dir = g_build_filename (ephy_dot_dir (), app_dir, NULL); + g_free (app_dir); + + return profile_dir; +} + +/** * ephy_delete_web_application: * @name: the name of the web application do delete * @@ -89,16 +110,14 @@ out: gboolean ephy_delete_web_application (const char *name) { - char *app_dir = NULL, *profile_dir = NULL; + char *profile_dir = NULL; char *desktop_file = NULL, *desktop_path = NULL; GFile *profile = NULL, *launcher = NULL; gboolean return_value = FALSE; g_return_val_if_fail (name, FALSE); - app_dir = g_strconcat (EPHY_WEB_APP_PREFIX, name, NULL); - profile_dir = g_build_filename (ephy_dot_dir (), app_dir, NULL); - + profile_dir = ephy_web_application_get_profile_directory (name); /* If there's no profile dir for this app, it means it does not * exist. */ if (!g_file_test (profile_dir, G_FILE_TEST_IS_DIR)) { @@ -125,7 +144,6 @@ out: if (profile) g_object_unref (profile); g_free (profile_dir); - g_free (app_dir); if (launcher) g_object_unref (launcher); diff --git a/embed/ephy-web-app-utils.h b/embed/ephy-web-app-utils.h index a28ae76b1..ef8d88f53 100644 --- a/embed/ephy-web-app-utils.h +++ b/embed/ephy-web-app-utils.h @@ -32,6 +32,8 @@ G_BEGIN_DECLS gboolean ephy_delete_web_application (const char *name); +char *ephy_web_application_get_profile_directory (const char *app_name); + G_END_DECLS #endif diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index ef87f193d..30127b86e 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -3806,7 +3806,6 @@ create_cookie_jar_for_domain (EphyWebView *view, const char *directory) char * ephy_web_view_create_web_application (EphyWebView *view, const char *title, GdkPixbuf *icon) { - char *app_dir; char *profile_dir = NULL; char *toolbar_path = NULL; char *desktop_file_path = NULL; @@ -3816,9 +3815,7 @@ ephy_web_view_create_web_application (EphyWebView *view, const char *title, GdkP /* If there's already a WebApp profile for the contents of this * view, do nothing. TODO: create a method to check this and use it * to ask the user if she wants to overwrite the existing WebApp. */ - app_dir = g_strconcat (EPHY_WEB_APP_PREFIX, title, NULL); - profile_dir = g_build_filename (ephy_dot_dir (), app_dir, NULL); - g_free (app_dir); + profile_dir = ephy_web_application_get_profile_directory (title); if (g_file_test (profile_dir, G_FILE_TEST_IS_DIR)) goto out; |