diff options
author | Claudio Saavedra <csaavedra@igalia.com> | 2011-09-02 03:53:55 +0800 |
---|---|---|
committer | Claudio Saavedra <csaavedra@igalia.com> | 2011-09-02 21:13:07 +0800 |
commit | 09bbf1441056fc858db9bca5452bd0ff8e83a1b1 (patch) | |
tree | 867528abd821067dda8a1dc0e788256cc4c6f4ed /embed/ephy-web-app-utils.c | |
parent | 1d507b310ad8cad41055bedec416d27a04b6f06d (diff) | |
download | gsoc2013-epiphany-09bbf1441056fc858db9bca5452bd0ff8e83a1b1.tar gsoc2013-epiphany-09bbf1441056fc858db9bca5452bd0ff8e83a1b1.tar.gz gsoc2013-epiphany-09bbf1441056fc858db9bca5452bd0ff8e83a1b1.tar.bz2 gsoc2013-epiphany-09bbf1441056fc858db9bca5452bd0ff8e83a1b1.tar.lz gsoc2013-epiphany-09bbf1441056fc858db9bca5452bd0ff8e83a1b1.tar.xz gsoc2013-epiphany-09bbf1441056fc858db9bca5452bd0ff8e83a1b1.tar.zst gsoc2013-epiphany-09bbf1441056fc858db9bca5452bd0ff8e83a1b1.zip |
Add ephy_web_application_get_profile_directory()
And factor out some code
Diffstat (limited to 'embed/ephy-web-app-utils.c')
-rw-r--r-- | embed/ephy-web-app-utils.c | 28 |
1 files changed, 23 insertions, 5 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); |