diff options
author | Cosimo Cecchi <cosimoc@src.gnome.org> | 2008-01-14 04:42:01 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@src.gnome.org> | 2008-01-14 04:42:01 +0800 |
commit | af1c2ceaef7d949e36a7680f463c5e25f79c43d6 (patch) | |
tree | 19c94f1df613831ed8ab92b4ac904be0c20c673f /src/ephy-session.c | |
parent | 12d96e8a6fc9eddaffdbad58754e712af5fc5fef (diff) | |
download | gsoc2013-epiphany-af1c2ceaef7d949e36a7680f463c5e25f79c43d6.tar gsoc2013-epiphany-af1c2ceaef7d949e36a7680f463c5e25f79c43d6.tar.gz gsoc2013-epiphany-af1c2ceaef7d949e36a7680f463c5e25f79c43d6.tar.bz2 gsoc2013-epiphany-af1c2ceaef7d949e36a7680f463c5e25f79c43d6.tar.lz gsoc2013-epiphany-af1c2ceaef7d949e36a7680f463c5e25f79c43d6.tar.xz gsoc2013-epiphany-af1c2ceaef7d949e36a7680f463c5e25f79c43d6.tar.zst gsoc2013-epiphany-af1c2ceaef7d949e36a7680f463c5e25f79c43d6.zip |
Drop gnome-vfs dependency. Now Epiphany depends on glib >= 2.15.1.
Also, optional Zeroconf support depends on Avahi >= 0.6.22.
Bug #507152.
svn path=/trunk/; revision=7858
Diffstat (limited to 'src/ephy-session.c')
-rw-r--r-- | src/ephy-session.c | 79 |
1 files changed, 44 insertions, 35 deletions
diff --git a/src/ephy-session.c b/src/ephy-session.c index c1b79d25d..2342d2998 100644 --- a/src/ephy-session.c +++ b/src/ephy-session.c @@ -40,6 +40,7 @@ #include "ephy-notebook.h" #include <glib/gi18n.h> +#include <gio/gio.h> #include <gtk/gtkmain.h> #include <gtk/gtkimage.h> #include <gtk/gtklabel.h> @@ -52,9 +53,6 @@ #include <libgnomeui/gnome-client.h> -#include <libgnomevfs/gnome-vfs-ops.h> -#include <libgnomevfs/gnome-vfs-utils.h> - #include <libxml/tree.h> #include <libxml/xmlwriter.h> @@ -391,10 +389,11 @@ die_cb (GnomeClient* client, /* Helper functions */ -static char * -get_session_filename (const char *filename) +static GFile * +get_session_file (const char *filename) { - char *save_to; + GFile *file; + char *path; if (filename == NULL) { @@ -403,29 +402,30 @@ get_session_filename (const char *filename) if (strcmp (filename, SESSION_CRASHED) == 0) { - save_to = g_build_filename (ephy_dot_dir (), - "session_crashed.xml", - NULL); + path = g_build_filename (ephy_dot_dir (), + "session_crashed.xml", + NULL); } else { - save_to = g_strdup (filename); + path = g_strdup (filename); } - return save_to; + file = g_file_new_for_path (path); + g_free (path); + + return file; } static void session_delete (EphySession *session, const char *filename) { - char *save_to; + GFile *file; - save_to = get_session_filename (filename); + file = get_session_file (filename); - gnome_vfs_unlink (save_to); - - g_free (save_to); + g_file_delete (file, NULL, NULL); } static void @@ -566,14 +566,17 @@ session_command_autoresume (EphySession *session, { EphySessionPrivate *priv = session->priv; GtkWidget *dialog; - char *saved_session; + GFile *saved_session_file; + char *saved_session_file_path; gboolean crashed_session; LOG ("ephy_session_autoresume"); - saved_session = get_session_filename (SESSION_CRASHED); - crashed_session = g_file_test (saved_session, G_FILE_TEST_EXISTS); - g_free (saved_session); + saved_session_file = get_session_file (SESSION_CRASHED); + saved_session_file_path = g_file_get_path (saved_session_file); + crashed_session = g_file_test (saved_session_file_path, G_FILE_TEST_EXISTS); + + g_free (saved_session_file_path); if (crashed_session == FALSE || priv->windows != NULL || @@ -1225,7 +1228,8 @@ ephy_session_save (EphySession *session, EphySessionPrivate *priv; xmlTextWriterPtr writer; GList *w; - char *save_to, *tmp_file; + GFile *save_to_file, *tmp_file; + char *tmp_file_path; int ret; g_return_val_if_fail (EPHY_IS_SESSION (session), FALSE); @@ -1245,15 +1249,15 @@ ephy_session_save (EphySession *session, return TRUE; } - save_to = get_session_filename (filename); - tmp_file = g_strconcat (save_to, ".tmp", NULL); + save_to_file = get_session_file (filename); + tmp_file_path = g_strconcat (g_file_get_path (save_to_file), ".tmp", NULL); + tmp_file = g_file_new_for_path (tmp_file_path); /* FIXME: do we want to turn on compression? */ - writer = xmlNewTextWriterFilename (tmp_file, 0); + writer = xmlNewTextWriterFilename (tmp_file_path, 0); if (writer == NULL) { - g_free (save_to); - g_free (tmp_file); + g_free (tmp_file_path); return FALSE; } @@ -1296,14 +1300,15 @@ out: if (ret >= 0) { - if (ephy_file_switch_temp_file (save_to, tmp_file) == FALSE) + if (ephy_file_switch_temp_file (save_to_file, tmp_file) == FALSE) { ret = -1; } } - g_free (save_to); - g_free (tmp_file); + g_free (tmp_file_path); + g_object_unref (save_to_file); + g_object_unref (tmp_file); STOP_PROFILER ("Saving session") @@ -1345,9 +1350,11 @@ parse_embed (xmlNodePtr child, char *escaped_url, *escaped_title; title = xmlGetProp (child, (const xmlChar *) "title"); - escaped_title = gnome_vfs_escape_string (title ? (const char*) title : _("Untitled")); + escaped_title = g_uri_escape_string (title ? (const char*) title : _("Untitled"), + NULL, TRUE); - escaped_url = gnome_vfs_escape_string ((const char *) url); + escaped_url = g_uri_escape_string ((const char *) url, + NULL, TRUE); freeme = recover_url = g_strconcat ("about:recover?u=", escaped_url, @@ -1452,14 +1459,16 @@ ephy_session_load (EphySession *session, xmlNodePtr child; EphyWindow *window; GtkWidget *widget = NULL; - char *save_to; + GFile *save_to_file; + char *save_to_path; LOG ("ephy_sesion_load %s", filename); - save_to = get_session_filename (filename); + save_to_file = get_session_file (filename); + save_to_path = g_file_get_path (save_to_file); - doc = xmlParseFile (save_to); - g_free (save_to); + doc = xmlParseFile (save_to_path); + g_free (save_to_path); if (doc == NULL) { |