aboutsummaryrefslogtreecommitdiffstats
path: root/src/window-commands.c
diff options
context:
space:
mode:
authorAlexandre Mazari <alexandre.mazari@gmail.com>2012-03-29 02:37:26 +0800
committerDiego Escalante Urrelo <diegoe@igalia.com>2012-03-31 09:30:43 +0800
commitc07d7675862fb64f8addf8d92704167d2b21168d (patch)
tree84ca14817d572de859bb8869d75e504cc2609f68 /src/window-commands.c
parent71a003cab0961d03c9bbdd4452e3a4b9e921accd (diff)
downloadgsoc2013-epiphany-c07d7675862fb64f8addf8d92704167d2b21168d.tar
gsoc2013-epiphany-c07d7675862fb64f8addf8d92704167d2b21168d.tar.gz
gsoc2013-epiphany-c07d7675862fb64f8addf8d92704167d2b21168d.tar.bz2
gsoc2013-epiphany-c07d7675862fb64f8addf8d92704167d2b21168d.tar.lz
gsoc2013-epiphany-c07d7675862fb64f8addf8d92704167d2b21168d.tar.xz
gsoc2013-epiphany-c07d7675862fb64f8addf8d92704167d2b21168d.tar.zst
gsoc2013-epiphany-c07d7675862fb64f8addf8d92704167d2b21168d.zip
window-commands: get app name only once
Avoid multiple calls to gtk_entry_get_text. Signed-off-by: Diego Escalante Urrelo <diegoe@igalia.com> https://bugzilla.gnome.org/show_bug.cgi?id=658925
Diffstat (limited to 'src/window-commands.c')
-rw-r--r--src/window-commands.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/window-commands.c b/src/window-commands.c
index 9f5b95b56..eb8c16863 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -500,6 +500,7 @@ dialog_save_as_application_response_cb (GtkDialog *dialog,
gint response,
EphyApplicationDialogData *data)
{
+ const char *app_name;
char *profile_dir;
char *desktop_file;
char *message;
@@ -507,7 +508,8 @@ dialog_save_as_application_response_cb (GtkDialog *dialog,
gboolean profile_exists;
if (response == GTK_RESPONSE_OK) {
- profile_dir = ephy_web_application_get_profile_directory (gtk_entry_get_text (GTK_ENTRY (data->entry)));
+ 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);
@@ -515,23 +517,22 @@ dialog_save_as_application_response_cb (GtkDialog *dialog,
if (profile_exists)
{
- if (confirm_web_application_overwrite (GTK_WINDOW (dialog),
- gtk_entry_get_text (GTK_ENTRY (data->entry))))
- ephy_web_application_delete (gtk_entry_get_text (GTK_ENTRY (data->entry)));
+ if (confirm_web_application_overwrite (GTK_WINDOW (dialog), app_name))
+ ephy_web_application_delete (app_name);
else
return;
}
/* Create Web Application, including a new profile and .desktop file. */
desktop_file = ephy_web_application_create (webkit_web_view_get_uri (WEBKIT_WEB_VIEW (data->view)),
- gtk_entry_get_text (GTK_ENTRY (data->entry)),
+ app_name,
gtk_image_get_pixbuf (GTK_IMAGE (data->image)));
if (desktop_file)
message = g_strdup_printf (_("The application '%s' is ready to be used"),
- gtk_entry_get_text (GTK_ENTRY (data->entry)));
+ app_name);
else
message = g_strdup_printf (_("The application '%s' could not be created"),
- gtk_entry_get_text (GTK_ENTRY (data->entry)));
+ app_name);
notification = notify_notification_new (message,
NULL, NULL);