diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2006-02-14 07:01:21 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2006-02-14 07:01:21 +0800 |
commit | 44d332d8c7b555b37292ba70ca9be327c1aacfe8 (patch) | |
tree | e36487e9effcce688fcf5aa9a1ec20fbbcf3012f | |
parent | 6a26e601c499f07ef80c69e72dd902490a019a59 (diff) | |
download | gsoc2013-epiphany-44d332d8c7b555b37292ba70ca9be327c1aacfe8.tar gsoc2013-epiphany-44d332d8c7b555b37292ba70ca9be327c1aacfe8.tar.gz gsoc2013-epiphany-44d332d8c7b555b37292ba70ca9be327c1aacfe8.tar.bz2 gsoc2013-epiphany-44d332d8c7b555b37292ba70ca9be327c1aacfe8.tar.lz gsoc2013-epiphany-44d332d8c7b555b37292ba70ca9be327c1aacfe8.tar.xz gsoc2013-epiphany-44d332d8c7b555b37292ba70ca9be327c1aacfe8.tar.zst gsoc2013-epiphany-44d332d8c7b555b37292ba70ca9be327c1aacfe8.zip |
Move --private-instance out of debug #ifdef.
2006-02-14 Christian Persch <chpe@cvs.gnome.org>
* lib/ephy-file-helpers.c: (ephy_file_helpers_init),
(ephy_file_helpers_shutdown), (ephy_file_delete_on_exit),
(ephy_file_monitor_cancel), (ephy_file_delete_directory):
* lib/ephy-file-helpers.h:
* src/ephy-main.c: (main):
Move --private-instance out of debug #ifdef.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | lib/ephy-file-helpers.c | 32 | ||||
-rw-r--r-- | lib/ephy-file-helpers.h | 4 | ||||
-rw-r--r-- | src/ephy-main.c | 31 |
4 files changed, 59 insertions, 18 deletions
@@ -1,3 +1,13 @@ +2006-02-14 Christian Persch <chpe@cvs.gnome.org> + + * lib/ephy-file-helpers.c: (ephy_file_helpers_init), + (ephy_file_helpers_shutdown), (ephy_file_delete_on_exit), + (ephy_file_monitor_cancel), (ephy_file_delete_directory): + * lib/ephy-file-helpers.h: + * src/ephy-main.c: (main): + + Move --private-instance out of debug #ifdef. + 2006-02-13 Christian Persch <chpe@cvs.gnome.org> * src/bookmarks/ephy-bookmarks.c: (resolve_cb), (browse_cb), diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c index 7a40fde5e..c8548bf94 100644 --- a/lib/ephy-file-helpers.c +++ b/lib/ephy-file-helpers.c @@ -34,6 +34,7 @@ #include <libgnomevfs/gnome-vfs-utils.h> #include <libgnomevfs/gnome-vfs-file-info.h> #include <libgnomevfs/gnome-vfs-ops.h> +#include <libgnomevfs/gnome-vfs-directory.h> #include <libxml/xmlreader.h> /* bug http://bugzilla.gnome.org/show_bug.cgi?id=156687 */ @@ -61,7 +62,7 @@ static GHashTable *files = NULL; static GHashTable *mime_table = NULL; static gboolean have_private_profile = FALSE; -static gboolean delete_profile_on_exit = FALSE; +static gboolean keep_temp_directory = FALSE; /* for debug purposes */ static char *dot_dir = NULL; static char *tmp_dir = NULL; static GList *del_on_exit = NULL; @@ -260,7 +261,7 @@ ephy_dot_dir (void) gboolean ephy_file_helpers_init (const char *profile_dir, gboolean private_profile, - gboolean delete_profile, + gboolean keep_temp_dir, GError **error) { const char *uuid; @@ -284,7 +285,7 @@ ephy_file_helpers_init (const char *profile_dir, (GDestroyNotify) g_free); have_private_profile = private_profile; - delete_profile_on_exit = delete_profile; + keep_temp_directory = keep_temp_dir; if (private_profile && profile_dir != NULL) { @@ -344,15 +345,23 @@ ephy_file_helpers_shutdown (void) mime_table = NULL; } + g_free (dot_dir); + dot_dir = NULL; + if (tmp_dir != NULL) { - rmdir (tmp_dir); + if (!keep_temp_directory) + { + /* recursively delete the contents */ + ephy_file_delete_directory (tmp_dir); + + /* delete the directory itself too */ + rmdir (tmp_dir); + } + g_free (tmp_dir); tmp_dir = NULL; } - - g_free (dot_dir); - dot_dir = NULL; } gboolean @@ -479,8 +488,7 @@ failed: void ephy_file_delete_on_exit (const char *path) { - del_on_exit = g_list_prepend (del_on_exit, - g_strdup (path)); + /* does nothing now */ } static void @@ -1160,3 +1168,9 @@ ephy_file_monitor_cancel (EphyFileMonitor *monitor) g_free (monitor->uri); g_free (monitor); } + +void +ephy_file_delete_directory (const char *path) +{ + /* FIXME not implemented yet */ +} diff --git a/lib/ephy-file-helpers.h b/lib/ephy-file-helpers.h index 8f9440af9..ef96d7b3e 100644 --- a/lib/ephy-file-helpers.h +++ b/lib/ephy-file-helpers.h @@ -45,7 +45,7 @@ typedef gboolean (* EphyFileMonitorDelayFunc) (EphyFileMonitor*, gpointer); gboolean ephy_file_helpers_init (const char *profile_dir, gboolean private_profile, - gboolean delete_profile_on_exit, + gboolean keep_temp_dir, GError **error); const char *ephy_file (const char *filename); @@ -99,6 +99,8 @@ EphyFileMonitor *ephy_file_monitor_add (const char *uri, void ephy_file_monitor_cancel (EphyFileMonitor *monitor); +void ephy_file_delete_directory (const char *path); + G_END_DECLS #endif /* EPHY_FILE_HELPERS_H */ diff --git a/src/ephy-main.c b/src/ephy-main.c index 1708b6272..9b97e1416 100644 --- a/src/ephy-main.c +++ b/src/ephy-main.c @@ -69,7 +69,7 @@ static char **arguments = NULL; /* Only set from options in debug builds */ static gboolean private_instance = FALSE; -static gboolean keep_profile_directory = FALSE; +static gboolean keep_temp_directory = FALSE; static char *profile_directory = NULL; static const GOptionEntry option_entries[] = @@ -86,6 +86,10 @@ static const GOptionEntry option_entries[] = N_("Load the given session file"), N_("FILE") }, { "add-bookmark", 't', 0, G_OPTION_ARG_STRING, &bookmark_url, N_("Add a bookmark"), N_("URL") }, + { "private-instance", 0, 0, G_OPTION_ARG_NONE, &private_instance, + N_("Start a private instance"), NULL }, + { "profile", 0, 0, G_OPTION_ARG_STRING, &profile_directory, + N_("Profile directory to use in the private instance"), N_("DIR") }, { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &arguments, "", "" }, { NULL } @@ -115,12 +119,8 @@ static const GOptionEntry libgnome_option_entries[] = #ifdef GNOME_ENABLE_DEBUG static GOptionEntry debug_option_entries[] = { - { "private-instance", 0, 0, G_OPTION_ARG_NONE, &private_instance, - "Start a private instance", NULL }, - { "profile", 0, 0, G_OPTION_ARG_STRING, &profile_directory, - "Profile directory to use in the private instance (default: a newly created directory in tmpdir)", "DIR" }, - { "keep-profile", 0, 0, G_OPTION_ARG_NONE, &keep_profile_directory, - "Don't delete the profile directory on exit (default: delete the temp profile on exit)", NULL }, + { "keep-tempdir", 0, 0, G_OPTION_ARG_NONE, &keep_temp_directory, + "Don't delete the temporary directory on exit", NULL }, { NULL } }; #endif /* GNOME_ENABLE_DEBUG */ @@ -542,9 +542,23 @@ main (int argc, #endif /* GNOME_PARAM_GOPTION_CONTEXT */ + /* Some argument sanity checks*/ + if (arguments != NULL && (session_filename != NULL || open_as_bookmarks_editor)) + { + g_print ("Cannot use --bookmarks-editor or --load-session with URL arguments\n"); + exit (1); + } + + if (profile_directory != NULL && private_instance == FALSE) + { + g_print ("--profile can only be used in combination with --private-instance\n"); + exit (1); + } + if (arguments != NULL && eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL)) { + g_print ("URL loading is locked down\n"); exit (1); } @@ -580,6 +594,7 @@ main (int argc, if (path != NULL) { arguments[i] = gnome_vfs_make_uri_from_shell_arg (uri); + g_free (uri); } else { @@ -662,7 +677,7 @@ main (int argc, if (!ephy_file_helpers_init (profile_directory, private_instance, - !keep_profile_directory, + keep_temp_directory, &error)) { _ephy_dbus_release (); |