[epiphany] e-web-app-utils: add ephy_web_application_exists
- From: Diego Escalante Urrelo <diegoe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] e-web-app-utils: add ephy_web_application_exists
- Date: Sat, 31 Mar 2012 01:42:51 +0000 (UTC)
commit 2ef933ea60bcebbab86f4ca4fe7a4bf31b48e059
Author: Alexandre Mazari <alexandre mazari gmail com>
Date: Wed Mar 28 13:55:08 2012 -0500
e-web-app-utils: add ephy_web_application_exists
Signed-off-by: Diego Escalante Urrelo <diegoe igalia com>
https://bugzilla.gnome.org/show_bug.cgi?id=658925
embed/ephy-web-app-utils.c | 19 +++++++++++++++++++
embed/ephy-web-app-utils.h | 2 ++
src/window-commands.c | 9 +--------
3 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/embed/ephy-web-app-utils.c b/embed/ephy-web-app-utils.c
index 0789f6e..aebef97 100644
--- a/embed/ephy-web-app-utils.c
+++ b/embed/ephy-web-app-utils.c
@@ -463,3 +463,22 @@ ephy_web_application_free_application_list (GList *list)
g_list_free (list);
}
+
+/**
+ * ephy_web_application_exists:
+ * @name: the potential name of the web application
+ *
+ * Returns: whether an application with @name exists.
+ **/
+gboolean
+ephy_web_application_exists (const char *name)
+{
+ char *profile_dir;
+ gboolean profile_exists;
+
+ profile_dir = ephy_web_application_get_profile_directory (name);
+ profile_exists = g_file_test (profile_dir, G_FILE_TEST_IS_DIR);
+ g_free (profile_dir);
+
+ return profile_exists;
+}
diff --git a/embed/ephy-web-app-utils.h b/embed/ephy-web-app-utils.h
index b552da3..1ec1c01 100644
--- a/embed/ephy-web-app-utils.h
+++ b/embed/ephy-web-app-utils.h
@@ -51,6 +51,8 @@ GList *ephy_web_application_get_application_list (void);
void ephy_web_application_free_application_list (GList *list);
+gboolean ephy_web_application_exists (const char *name);
+
G_END_DECLS
#endif
diff --git a/src/window-commands.c b/src/window-commands.c
index eb8c168..1443e5d 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -501,21 +501,14 @@ dialog_save_as_application_response_cb (GtkDialog *dialog,
EphyApplicationDialogData *data)
{
const char *app_name;
- char *profile_dir;
char *desktop_file;
char *message;
NotifyNotification *notification;
- gboolean profile_exists;
if (response == GTK_RESPONSE_OK) {
app_name = gtk_entry_get_text (GTK_ENTRY (data->entry));
- profile_dir = ephy_web_application_get_profile_directory (app_name);
- if (!profile_dir)
- return;
- profile_exists = g_file_test (profile_dir, G_FILE_TEST_IS_DIR);
- g_free (profile_dir);
- if (profile_exists)
+ if (ephy_web_application_exists (app_name))
{
if (confirm_web_application_overwrite (GTK_WINDOW (dialog), app_name))
ephy_web_application_delete (app_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]