[epiphany] file-helpers: add helper to launch a incognito window



commit 5bbb98ca6c5a7136585e9ce37a1ee6ea7ff79982
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Tue Jun 2 18:32:01 2015 +0300

    file-helpers: add helper to launch a incognito window
    
    https://bugzilla.gnome.org/show_bug.cgi?id=749454

 lib/ephy-file-helpers.c |   24 ++++++++++++++++++++++++
 lib/ephy-file-helpers.h |    1 +
 src/window-commands.c   |    4 +---
 3 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index eb6f743..659ed8a 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -1071,3 +1071,27 @@ ephy_sanitize_filename (char *filename)
 
        return g_strdelimit (filename, G_DIR_SEPARATOR_S, '_');
 }
+
+void
+ephy_open_incognito_window (const char *uri)
+{
+       char *command;
+       GError *error = NULL;
+
+       command = g_strdup_printf ("epiphany --incognito-mode --profile %s ", ephy_dot_dir ());
+
+       if (uri) {
+               char *str = g_strconcat (command, uri, NULL);
+               g_free (command);
+               command = str;
+       }
+
+       g_spawn_command_line_async (command, &error);
+
+       if (error) {
+               g_warning ("Couldn't open link in incognito window: %s", error->message);
+               g_error_free (error);
+       }
+
+       g_free (command);
+}
diff --git a/lib/ephy-file-helpers.h b/lib/ephy-file-helpers.h
index 5ffb5f2..a4987c7 100644
--- a/lib/ephy-file-helpers.h
+++ b/lib/ephy-file-helpers.h
@@ -96,6 +96,7 @@ char       *       ephy_file_create_data_uri_for_filename   (const char
 char       *       ephy_sanitize_filename                   (char                  *filename);
 GAppInfo   *       ephy_file_launcher_get_app_info_for_file (GFile                 *file,
                                                              const char            *mime_type);
+void               ephy_open_incognito_window               (const char *uri);
 
 G_END_DECLS
 
diff --git a/src/window-commands.c b/src/window-commands.c
index 9443e3f..f3599ed 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -920,9 +920,7 @@ void
 window_cmd_file_new_incognito_window (GtkAction *action,
                                      EphyWindow *window)
 {
-       char *str = g_strdup_printf ("epiphany --incognito-mode --profile %s", ephy_dot_dir ());
-       g_spawn_command_line_async (str, NULL);
-       g_free (str);
+       ephy_open_incognito_window (NULL);
 }
 
 void


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