aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@src.gnome.org>2008-01-14 04:42:01 +0800
committerCosimo Cecchi <cosimoc@src.gnome.org>2008-01-14 04:42:01 +0800
commitaf1c2ceaef7d949e36a7680f463c5e25f79c43d6 (patch)
tree19c94f1df613831ed8ab92b4ac904be0c20c673f /embed
parent12d96e8a6fc9eddaffdbad58754e712af5fc5fef (diff)
downloadgsoc2013-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 'embed')
-rw-r--r--embed/downloader-view.c5
-rw-r--r--embed/ephy-base-embed.c132
-rw-r--r--embed/ephy-download.c11
-rw-r--r--embed/ephy-favicon-cache.c118
-rw-r--r--embed/ephy-history.c25
-rw-r--r--embed/mozilla/ContentHandler.cpp19
-rw-r--r--embed/mozilla/ContentHandler.h4
-rw-r--r--embed/mozilla/EphyHeaderSniffer.cpp4
-rw-r--r--embed/mozilla/MozDownload.cpp16
-rw-r--r--embed/mozilla/MozDownload.h2
-rw-r--r--embed/mozilla/mozilla-embed-single.cpp43
-rw-r--r--embed/webkit/webkit-embed-single.c1
-rw-r--r--embed/webkit/webkit-embed.c2
-rw-r--r--embed/xulrunner/components/ContentHandler.cpp17
-rw-r--r--embed/xulrunner/components/ContentHandler.h2
-rw-r--r--embed/xulrunner/components/MozDownload.cpp16
-rw-r--r--embed/xulrunner/embed/EphyHeaderSniffer.cpp3
-rw-r--r--embed/xulrunner/embed/mozilla-embed-single.cpp38
18 files changed, 236 insertions, 222 deletions
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index 0d6dbbf29..b0292fe0b 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -48,7 +48,6 @@
#include <gtk/gtkmenu.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkstatusicon.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomeui/gnome-icon-lookup.h>
@@ -465,7 +464,7 @@ update_download_row (DownloaderView *dv, EphyDownload *download)
total = ephy_download_get_total_progress (download);
current = ephy_download_get_current_progress (download);
- cur_progress = gnome_vfs_format_file_size_for_display (current);
+ cur_progress = g_format_size_for_display (current);
name = ephy_download_get_name (download);
@@ -501,7 +500,7 @@ update_download_row (DownloaderView *dv, EphyDownload *download)
{
char *total_progress;
- total_progress = gnome_vfs_format_file_size_for_display (total);
+ total_progress = g_format_size_for_display (total);
/* translators: first %s is filename, "%s of %s" is current/total file size */
file = g_strdup_printf (_("%s\n%s of %s"), name,
cur_progress, total_progress);
diff --git a/embed/ephy-base-embed.c b/embed/ephy-base-embed.c
index 2d695a0b8..4d57c496c 100644
--- a/embed/ephy-base-embed.c
+++ b/embed/ephy-base-embed.c
@@ -23,8 +23,7 @@
#include "config.h"
#include <glib/gi18n.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
+#include <gio/gio.h>
#include <string.h>
#include "eel-gconf-extensions.h"
@@ -77,7 +76,8 @@ struct _EphyBaseEmbedPrivate {
GdkPixbuf *icon;
/* File watch */
- GnomeVFSMonitorHandle *monitor;
+ GFileMonitor *monitor;
+ gboolean monitor_directory;
guint reload_scheduled_id;
guint reload_delay_ticks;
@@ -922,6 +922,7 @@ ephy_base_embed_init (EphyBaseEmbed *self)
priv->address_expire = EPHY_EMBED_ADDRESS_EXPIRE_NOW;
priv->is_blank = TRUE;
priv->title = g_strdup (EMPTY_PAGE);
+ priv->monitor_directory = FALSE;
}
static void
@@ -1000,27 +1001,13 @@ ephy_base_embed_set_address (EphyBaseEmbed *embed,
g_object_notify (object, "address");
}
-static char *
+static char*
get_title_from_address (const char *address)
{
- GnomeVFSURI *uri;
- char *title;
-
- if (address == NULL) return NULL;
-
- uri = gnome_vfs_uri_new (address);
- if (uri == NULL) return g_strdup (address);
-
- title = gnome_vfs_uri_to_string (uri,
- (GnomeVFSURIHideOptions)
- (GNOME_VFS_URI_HIDE_USER_NAME |
- GNOME_VFS_URI_HIDE_PASSWORD |
- GNOME_VFS_URI_HIDE_HOST_PORT |
- GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD |
- GNOME_VFS_URI_HIDE_FRAGMENT_IDENTIFIER));
- gnome_vfs_uri_unref (uri);
-
- return title;
+ if (g_str_has_prefix (address, "file://"))
+ return g_strdup (address + 7);
+ else
+ return ephy_string_get_host_name (address);
}
void
@@ -1069,19 +1056,13 @@ ensure_page_info (EphyBaseEmbed *embed, const char *address)
static void
update_net_state_message (EphyBaseEmbed *embed, const char *uri, EphyEmbedNetState flags)
{
- GnomeVFSURI *vfs_uri = NULL;
const char *msg = NULL;
- const char *host = NULL;
-
- if (uri != NULL) {
- vfs_uri = gnome_vfs_uri_new (uri);
- }
+ char *host = NULL;
- if (vfs_uri != NULL) {
- host = gnome_vfs_uri_get_host_name (vfs_uri);
- }
+ if (uri != NULL)
+ host = ephy_string_get_host_name (uri);
- if (host == NULL || host[0] == '\0') goto out;
+ if (host == NULL) goto out;
/* IS_REQUEST and IS_NETWORK can be both set */
if (flags & EPHY_EMBED_STATE_IS_REQUEST) {
@@ -1116,9 +1097,7 @@ update_net_state_message (EphyBaseEmbed *embed, const char *uri, EphyEmbedNetSta
}
out:
- if (vfs_uri != NULL) {
- gnome_vfs_uri_unref (vfs_uri);
- }
+ g_free (host);
}
static void
@@ -1288,8 +1267,8 @@ ephy_base_embed_file_monitor_cancel (EphyBaseEmbed *embed)
if (priv->monitor != NULL) {
LOG ("Cancelling file monitor");
-
- gnome_vfs_monitor_cancel (priv->monitor);
+
+ g_file_monitor_cancel (G_FILE_MONITOR (priv->monitor));
priv->monitor = NULL;
}
@@ -1334,39 +1313,32 @@ ephy_base_embed_file_monitor_reload_cb (EphyBaseEmbed *embed)
}
static void
-ephy_base_embed_file_monitor_cb (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
+ephy_base_embed_file_monitor_cb (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
EphyBaseEmbed *embed)
{
- gboolean uri_is_directory;
gboolean should_reload;
- char *local_path;
EphyBaseEmbedPrivate *priv = embed->priv;
- LOG ("File '%s' has changed, scheduling reload", monitor_uri);
-
- local_path = gnome_vfs_get_local_path_from_uri (monitor_uri);
- uri_is_directory = g_file_test (local_path, G_FILE_TEST_IS_DIR);
- g_free (local_path);
-
switch (event_type) {
/* These events will always trigger a reload: */
- case GNOME_VFS_MONITOR_EVENT_CHANGED:
- case GNOME_VFS_MONITOR_EVENT_CREATED:
+ case G_FILE_MONITOR_EVENT_CHANGED:
+ case G_FILE_MONITOR_EVENT_CREATED:
should_reload = TRUE;
break;
- /* These events will only trigger a reload for directories: */
- case GNOME_VFS_MONITOR_EVENT_DELETED:
- case GNOME_VFS_MONITOR_EVENT_METADATA_CHANGED:
- should_reload = uri_is_directory;
+ /* These events will only trigger a reload for directories: */
+ case G_FILE_MONITOR_EVENT_DELETED:
+ case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
+ should_reload = priv->monitor_directory;
break;
- /* These events don't trigger a reload: */
- case GNOME_VFS_MONITOR_EVENT_STARTEXECUTING:
- case GNOME_VFS_MONITOR_EVENT_STOPEXECUTING:
+ /* These events don't trigger a reload: */
+ case G_FILE_MONITOR_EVENT_PRE_UNMOUNT:
+ case G_FILE_MONITOR_EVENT_UNMOUNTED:
+ case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
default:
should_reload = FALSE;
break;
@@ -1399,10 +1371,11 @@ ephy_base_embed_update_file_monitor (EphyBaseEmbed *embed,
const gchar *address)
{
EphyBaseEmbedPrivate *priv = embed->priv;
- GnomeVFSMonitorHandle *handle = NULL;
gboolean local;
- char *local_path;
- GnomeVFSMonitorType monitor_type;
+ GFile *file;
+ GFileType file_type;
+ GFileInfo *file_info;
+ GFileMonitor *monitor = NULL;
if (priv->monitor != NULL &&
priv->address != NULL && address != NULL &&
@@ -1415,21 +1388,32 @@ ephy_base_embed_update_file_monitor (EphyBaseEmbed *embed,
local = g_str_has_prefix (address, "file://");
if (local == FALSE) return;
-
- local_path = gnome_vfs_get_local_path_from_uri (address);
- monitor_type = g_file_test (local_path, G_FILE_TEST_IS_DIR)
- ? GNOME_VFS_MONITOR_DIRECTORY
- : GNOME_VFS_MONITOR_FILE;
- g_free (local_path);
-
- if (gnome_vfs_monitor_add (&handle, address,
- monitor_type,
- (GnomeVFSMonitorCallback)ephy_base_embed_file_monitor_cb,
- embed) == GNOME_VFS_OK) {
+
+ file = g_file_new_for_uri (address);
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ 0, NULL, NULL);
+ file_type = g_file_info_get_file_type (file_info);
+ g_object_unref (file_info);
+
+ if (file_type == G_FILE_TYPE_DIRECTORY) {
+ monitor = g_file_monitor_directory (file, 0, NULL);
+ g_signal_connect (monitor, "changed",
+ G_CALLBACK (ephy_base_embed_file_monitor_cb),
+ embed);
+ priv->monitor_directory = TRUE;
+ LOG ("Installed monitor for directory '%s'", address);
+ }
+ else if (file_type == G_FILE_TYPE_REGULAR) {
+ monitor = g_file_monitor_file (file, 0, NULL);
+ g_signal_connect (monitor, "changed",
+ G_CALLBACK (ephy_base_embed_file_monitor_cb),
+ embed);
+ priv->monitor_directory = FALSE;
LOG ("Installed monitor for file '%s'", address);
-
- priv->monitor = handle;
}
+ priv->monitor = monitor;
+ g_object_unref (file);
}
void
diff --git a/embed/ephy-download.c b/embed/ephy-download.c
index a6f420a3d..fac8ce7ae 100644
--- a/embed/ephy-download.c
+++ b/embed/ephy-download.c
@@ -22,7 +22,7 @@
#include "ephy-download.h"
-#include <libgnomevfs/gnome-vfs-uri.h>
+#include <glib/gi18n.h>
#define EPHY_DOWNLOAD_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_DOWNLOAD, EphyDownloadPrivate))
@@ -115,21 +115,18 @@ ephy_download_new (void)
char *
ephy_download_get_name (EphyDownload *download)
{
- GnomeVFSURI *uri;
char *target;
char *result;
target = ephy_download_get_target (download);
- uri = gnome_vfs_uri_new (target);
- if (uri)
+ if (target)
{
- result = gnome_vfs_uri_extract_short_name (uri);
- gnome_vfs_uri_unref (uri);
+ result = g_path_get_basename (target);
}
else
{
- result = g_strdup ("Unknown");
+ result = g_strdup (_("Unknown"));
}
g_free (target);
diff --git a/embed/ephy-favicon-cache.c b/embed/ephy-favicon-cache.c
index 06af26e56..35e3f0809 100644
--- a/embed/ephy-favicon-cache.c
+++ b/embed/ephy-favicon-cache.c
@@ -39,9 +39,8 @@
#include "ephy-glib-compat.h"
#include <glib/gstdio.h>
+#include <gio/gio.h>
#include <libgnomeui/libgnomeui.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
-#include <libgnomevfs/gnome-vfs-directory.h>
#define EPHY_FAVICON_CACHE_XML_ROOT (const xmlChar *)"ephy_favicons_cache"
#define EPHY_FAVICON_CACHE_XML_VERSION (const xmlChar *)"1.1"
@@ -250,7 +249,10 @@ remove_obsolete_icons (EphyFaviconCache *cache,
(kid, EPHY_NODE_FAVICON_PROP_FILENAME);
path = g_build_filename (priv->directory,
filename, NULL);
- gnome_vfs_unlink (path);
+ if (g_unlink (path) < 0)
+ {
+ g_warning ("Unable to delete %s", path);
+ }
g_free (path);
ephy_node_unref (kid);
@@ -412,29 +414,28 @@ kill_download (const char *key,
return TRUE;
}
-static gboolean
-delete_file (const char *rel_path,
- GnomeVFSFileInfo *info,
- gboolean rec_will_loop,
- EphyFaviconCache *cache,
- gboolean *recurse)
+static void
+delete_file (GFile *dir,
+ GFileInfo *file_info)
{
- EphyFaviconCachePrivate *priv = cache->priv;
- char *path;
-
- *recurse = FALSE;
-
- g_return_val_if_fail (info != NULL, TRUE);
-
- if ((info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) == 0 ||
- info->type != GNOME_VFS_FILE_TYPE_REGULAR) return TRUE;
-
- path = g_build_filename (priv->directory, rel_path, NULL);
- gnome_vfs_unlink (path);
- g_free (path);
-
- /* continue with the visit */
- return TRUE;
+ GFileType type;
+
+ type = g_file_info_get_file_type (file_info);
+
+ if (type == G_FILE_TYPE_REGULAR)
+ {
+ char *path;
+
+ path = g_build_filename (g_file_get_path (dir),
+ g_file_info_get_name (file_info),
+ NULL);
+ if (g_unlink (path) < 0)
+ {
+ g_warning ("Unable to delete %s", path);
+ }
+
+ g_free (path);
+ }
}
static void
@@ -509,8 +510,11 @@ favicon_download_cancelled_cb (EphyEmbedPersist *persist,
g_hash_table_remove (cache->priv->downloads_hash, url);
/* remove a partially downloaded file */
- dest = ephy_embed_persist_get_dest (persist);
- gnome_vfs_unlink (dest);
+ dest = ephy_embed_persist_get_dest (persist);
+ if (g_unlink (dest) < 0)
+ {
+ g_warning ("Unable to delete %s", dest);
+ }
/* FIXME: re-schedule to try again after n days? */
@@ -700,29 +704,35 @@ ephy_favicon_cache_get (EphyFaviconCache *cache,
(int) checklevel);
}
- /* Now check the type. We renamed the file above, so gnome-vfs does NOT
+ /* Now check the type. We renamed the file above, so glib does NOT
* fall back to extension checking if the slow mime check fails for
* whatever reason
*/
if (checklevel & NEEDS_TYPE_CHECK)
{
- GnomeVFSFileInfo *info;
- gboolean valid = FALSE, is_ao = FALSE;;
-
+ GFile *file;
+ GFileInfo *file_info;
+ const char *mime_type;
+ gboolean valid = FALSE, is_ao = FALSE;
+
+ file = g_file_new_for_path (pix_file);
+
/* Sniff mime type and check if it's safe to open */
- info = gnome_vfs_file_info_new ();
- if (gnome_vfs_get_file_info (pix_file, info,
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
- GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE) == GNOME_VFS_OK &&
- (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE) &&
- info->mime_type != NULL)
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ 0, NULL, NULL);
+ mime_type = g_file_info_get_content_type (file_info);
+ if (file_info == NULL)
{
- valid = strcmp (info->mime_type, "image/x-ico") == 0 ||
- strcmp (info->mime_type, "image/png") == 0 ||
- strcmp (info->mime_type, "image/gif") == 0;
- is_ao = strcmp (info->mime_type, "application/octet-stream") == 0;
+ return NULL;
}
- gnome_vfs_file_info_unref (info);
+ valid = strcmp (mime_type, "image/x-ico") == 0 ||
+ strcmp (mime_type, "image/png") == 0 ||
+ strcmp (mime_type, "image/gif") == 0;
+ is_ao = strcmp (mime_type, "application/octet-stream") == 0;
+
+ g_object_unref (file_info);
+ g_object_unref (file);
/* As a special measure, we try to load an application/octet-stream file
* as an ICO file, since we cannot detect a ICO file without .ico extension
@@ -835,6 +845,9 @@ ephy_favicon_cache_get (EphyFaviconCache *cache,
void
ephy_favicon_cache_clear (EphyFaviconCache *cache)
{
+ GFileEnumerator *file_enum;
+ GFile *dir;
+ GFileInfo *file_info = NULL;
EphyFaviconCachePrivate *priv = cache->priv;
g_return_if_fail (EPHY_IS_FAVICON_CACHE (cache));
@@ -843,10 +856,19 @@ ephy_favicon_cache_clear (EphyFaviconCache *cache)
ephy_favicon_cache_save (cache);
/* Now remove any remaining files from the cache directory */
- gnome_vfs_directory_visit (priv->directory,
- GNOME_VFS_FILE_INFO_DEFAULT,
- GNOME_VFS_DIRECTORY_VISIT_SAMEFS |
- GNOME_VFS_DIRECTORY_VISIT_LOOPCHECK,
- (GnomeVFSDirectoryVisitFunc) delete_file,
- cache);
+ dir = g_file_new_for_path (priv->directory);
+ file_enum = g_file_enumerate_children (dir,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_NAME ","
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ 0, NULL, NULL);
+ file_info = g_file_enumerator_next_file (file_enum, NULL, NULL);
+ while (file_info != NULL)
+ {
+ delete_file (dir, file_info);
+ file_info = g_file_enumerator_next_file (file_enum, NULL, NULL);
+ g_object_unref (file_info);
+ }
+ g_object_unref (dir);
+ g_file_enumerator_close (file_enum, NULL, NULL);
}
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
index f7fdcc669..127d97656 100644
--- a/embed/ephy-history.c
+++ b/embed/ephy-history.c
@@ -30,11 +30,11 @@
#include "eel-gconf-extensions.h"
#include "ephy-prefs.h"
#include "ephy-glib-compat.h"
+#include "ephy-string.h"
#include <time.h>
#include <string.h>
#include <glib/gi18n.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
#define EPHY_HISTORY_XML_ROOT (const xmlChar *)"ephy_history"
#define EPHY_HISTORY_XML_VERSION (const xmlChar *)"1.0"
@@ -658,11 +658,10 @@ ephy_history_host_visited (EphyHistory *eh,
static EphyNode *
internal_get_host (EphyHistory *eh, const char *url, gboolean create)
{
- GnomeVFSURI *vfs_uri = NULL;
EphyNode *host = NULL;
- const char *host_name = NULL;
+ char *host_name = NULL;
GList *host_locations = NULL, *l;
- const char *scheme = NULL;
+ char *scheme = NULL;
GTime now;
g_return_val_if_fail (url != NULL, NULL);
@@ -674,24 +673,22 @@ internal_get_host (EphyHistory *eh, const char *url, gboolean create)
now = time (NULL);
- vfs_uri = gnome_vfs_uri_new (url);
-
- if (vfs_uri)
+ if (url)
{
- scheme = gnome_vfs_uri_get_scheme (vfs_uri);
- host_name = gnome_vfs_uri_get_host_name (vfs_uri);
+ scheme = g_uri_get_scheme (url);
+ host_name = ephy_string_get_host_name (url);
}
/* Build an host name */
if (scheme == NULL || host_name == NULL)
{
- host_name = _("Others");
+ host_name = g_strdup (_("Others"));
host_locations = g_list_append (host_locations,
g_strdup ("about:blank"));
}
else if (strcmp (scheme, "file") == 0)
{
- host_name = _("Local files");
+ host_name = g_strdup (_("Local files"));
host_locations = g_list_append (host_locations,
g_strdup ("file:///"));
}
@@ -766,10 +763,8 @@ internal_get_host (EphyHistory *eh, const char *url, gboolean create)
ephy_history_host_visited (eh, host, now);
}
- if (vfs_uri)
- {
- gnome_vfs_uri_unref (vfs_uri);
- }
+ g_free (scheme);
+ g_free (host_name);
g_list_foreach (host_locations, (GFunc)g_free, NULL);
g_list_free (host_locations);
diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp
index 0510aa3f1..5b7a5ac0e 100644
--- a/embed/mozilla/ContentHandler.cpp
+++ b/embed/mozilla/ContentHandler.cpp
@@ -25,14 +25,13 @@
#include "config.h"
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include <gtk/gtkbutton.h>
#include <gtk/gtkdialog.h>
#include <gtk/gtkimage.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkmessagedialog.h>
#include <gtk/gtkstock.h>
-#include <libgnomevfs/gnome-vfs-mime.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
#include <nsStringAPI.h>
@@ -254,7 +253,7 @@ NS_METHOD GContentHandler::MIMEConfirmAction ()
{
GtkWidget *dialog, *button, *image;
const char *action_label;
- const char *mime_description;
+ char *mime_description;
nsCString file_name;
nsCOMPtr<nsIDOMWindow> parentDOMWindow = do_GetInterface (mContext);
@@ -264,12 +263,12 @@ NS_METHOD GContentHandler::MIMEConfirmAction ()
(mAction == CONTENT_ACTION_OPEN_TMP) ?
GTK_STOCK_OPEN : STOCK_DOWNLOAD;
- mime_description = gnome_vfs_mime_get_description (mMimeType.get());
+ mime_description = g_content_type_get_description (mMimeType.get());
if (mime_description == NULL)
{
/* Translators: The text before the "|" is context to help you decide on
* the correct translation. You MUST OMIT it in the translated string. */
- mime_description = Q_("File Type:|Unknown");
+ mime_description = g_strdup (Q_("File Type:|Unknown"));
}
/* We have one tiny, minor issue, the filename can be empty (""),
@@ -309,7 +308,7 @@ NS_METHOD GContentHandler::MIMEConfirmAction ()
Second %s is the file name,
Third %s is the application used to open the file */
_("File Type: “%s”.\n\nYou can open “%s” using “%s” or save it."),
- mime_description, file_name.get(), mHelperApp->name);
+ mime_description, file_name.get(), g_app_info_get_name (mHelperApp));
}
else
{
@@ -327,6 +326,8 @@ NS_METHOD GContentHandler::MIMEConfirmAction ()
mime_description, file_name.get());
}
+ g_free (mime_description);
+
button = gtk_button_new_with_label (_("_Save As..."));
image = gtk_image_new_from_stock (GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_BUTTON);
gtk_button_set_image (GTK_BUTTON (button), image);
@@ -367,7 +368,7 @@ NS_METHOD GContentHandler::MIMEInitiateAction (void)
auto_downloads = eel_gconf_get_boolean (CONF_AUTO_DOWNLOADS);
- mHelperApp = gnome_vfs_mime_get_default_application (mMimeType.get());
+ mHelperApp = g_app_info_get_default_for_type (mMimeType.get(), TRUE);
mPermission = ephy_file_check_mime (mMimeType.get());
/* HACK! Check that this 'helper application' isn't Epiphany itself,
@@ -375,7 +376,7 @@ NS_METHOD GContentHandler::MIMEInitiateAction (void)
*/
if (mHelperApp)
{
- const char *id = gnome_vfs_mime_application_get_desktop_id (mHelperApp);
+ const char *id = g_app_info_get_id (mHelperApp);
/* FIXME! menu editing can make this check fail!!!! */
if (id && strcmp (id, "epiphany.desktop") == 0)
@@ -426,7 +427,7 @@ NS_METHOD GContentHandler::MIMEDoAction (void)
g_return_val_if_fail (mHelperApp, NS_ERROR_FAILURE);
const char *id;
- id = gnome_vfs_mime_application_get_desktop_id (mHelperApp);
+ id = g_app_info_get_id (mHelperApp);
/* The current time is fine here as the user has just clicked
* a button (it is used as the time for the application opening)
diff --git a/embed/mozilla/ContentHandler.h b/embed/mozilla/ContentHandler.h
index 113e29070..366aae482 100644
--- a/embed/mozilla/ContentHandler.h
+++ b/embed/mozilla/ContentHandler.h
@@ -22,7 +22,7 @@
#ifndef CONTENT_HANDLER_H
#define CONTENT_HANDLER_H
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
+#include <gio/gio.h>
#include <nsCOMPtr.h>
#include <nsIFile.h>
@@ -70,7 +70,7 @@ class GContentHandler : public nsIHelperAppLauncherDialog
nsCOMPtr<nsIHelperAppLauncher> mLauncher;
nsCOMPtr<nsISupports> mContext;
- GnomeVFSMimeApplication *mHelperApp;
+ GAppInfo *mHelperApp;
EphyMimePermission mPermission;
nsCString mUrl;
diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp
index 3ba938254..f09a6ee0e 100644
--- a/embed/mozilla/EphyHeaderSniffer.cpp
+++ b/embed/mozilla/EphyHeaderSniffer.cpp
@@ -43,7 +43,6 @@
#include "config.h"
#include <glib/gi18n.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
#include <nsStringAPI.h>
@@ -382,8 +381,7 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI)
/* FIXME: do better here by using nsITextToSubURI service, like in
* http://lxr.mozilla.org/seamonkey/source/xpfe/communicator/resources/content/contentAreaUtils.js#763
*/
- char *filename;
- filename = gnome_vfs_unescape_string (default_name, NULL);
+ char *filename = g_uri_unescape_string (default_name, NULL);
if (!g_utf8_validate (filename, -1, NULL))
{
diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp
index 254738f18..bdce1212f 100644
--- a/embed/mozilla/MozDownload.cpp
+++ b/embed/mozilla/MozDownload.cpp
@@ -47,6 +47,8 @@
#include <stdlib.h>
#include <glib/gi18n.h>
+#include <gio/gdesktopappinfo.h>
+#include <gio/gio.h>
#include <nsStringAPI.h>
@@ -351,7 +353,7 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest,
#ifdef HAVE_GECKO_1_9
return NS_OK;
#else
- GnomeVFSMimeApplication *helperApp;
+ GDesktopAppInfo *helperApp;
NS_ENSURE_TRUE (mMIMEInfo, NS_ERROR_FAILURE);
nsString description;
@@ -371,16 +373,22 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest,
char *end;
guint32 user_time = strtoul (str[1], &end, 0);
- helperApp = gnome_vfs_mime_application_new_from_desktop_id (str[2]);
+ helperApp = g_desktop_app_info_new (str[2]);
if (!helperApp) return NS_ERROR_FAILURE;
nsCString aDest;
rv = mDestination->GetSpec (aDest);
NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
+
+ GFile* file;
+ GList* list = NULL;
- ephy_file_launch_application (helperApp, destSpec.get (), user_time);
+ file = g_file_new_for_uri (destSpec.get ());
+ list = g_list_append (list, file);
+ ephy_file_launch_application (G_APP_INFO (helperApp), list, user_time, NULL);
- gnome_vfs_mime_application_free (helperApp);
+ g_list_free (list);
+ g_object_unref (file);
g_strfreev (str);
}
else if (g_str_has_prefix (cDesc.get(), "gnome-browse-to-file:"))
diff --git a/embed/mozilla/MozDownload.h b/embed/mozilla/MozDownload.h
index 27fef41c7..411230bdb 100644
--- a/embed/mozilla/MozDownload.h
+++ b/embed/mozilla/MozDownload.h
@@ -42,8 +42,6 @@
#ifndef MozDownload_h__
#define MozDownload_h__
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-
#include <nsCOMPtr.h>
#include <nsIInterfaceRequestor.h>
#include <nsITransfer.h>
diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp
index 1d07ab548..05f081fac 100644
--- a/embed/mozilla/mozilla-embed-single.cpp
+++ b/embed/mozilla/mozilla-embed-single.cpp
@@ -29,7 +29,7 @@
#include <glib.h>
#include <glib/gi18n.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
+#include <gio/gio.h>
#include <nsStringAPI.h>
@@ -79,10 +79,10 @@
#include "ephy-debug.h"
#include "ephy-embed-prefs.h"
#include "ephy-embed-shell.h"
-#include "ephy-file-helpers.h"
#include "ephy-langs.h"
#include "ephy-password-manager.h"
#include "ephy-permission-manager.h"
+#include "ephy-string.h"
#include "mozilla-embed.h"
#include "mozilla-notifiers.h"
#include "mozilla-x509-cert.h"
@@ -114,7 +114,7 @@ struct MozillaEmbedSinglePrivate
char *user_css_file;
guint user_css_enabled_notifier_id;
- EphyFileMonitor *user_css_file_monitor;
+ GFileMonitor *user_css_file_monitor;
guint user_css_enabled : 1;
guint online : 1;
@@ -263,7 +263,8 @@ mozilla_init_plugin_add_unique_path (GList *list,
if (path == NULL)
return list;
- canon = gnome_vfs_make_path_name_canonical (path);
+ canon = ephy_string_canonicalize_pathname (path);
+
for (l = list; l != NULL; l = l->next) {
if (g_str_equal (list->data, canon) != FALSE) {
/* The path is already in the list */
@@ -470,14 +471,15 @@ user_css_unregister (MozillaEmbedSingle *single)
}
static void
-user_css_file_monitor_func (EphyFileMonitor *,
- const char *,
- GnomeVFSMonitorEventType event_type,
- MozillaEmbedSingle *single)
+user_css_file_monitor_changed_cb (GFileMonitor *file_monitor,
+ GFile *file,
+ GFile *other_file,
+ gint event_type,
+ MozillaEmbedSingle *single)
{
LOG ("Reregistering the user style sheet");
- if (event_type == GNOME_VFS_MONITOR_EVENT_DELETED)
+ if (event_type == G_FILE_MONITOR_EVENT_DELETED)
{
user_css_unregister (single);
}
@@ -505,27 +507,28 @@ user_css_enabled_notify (GConfClient *client,
if (enabled)
{
- char *uri;
+ GFile *file;
user_css_register (single);
- uri = gnome_vfs_get_uri_from_local_path (priv->user_css_file);
+ file = g_file_new_for_path (priv->user_css_file);
g_assert (priv->user_css_file_monitor == NULL);
priv->user_css_file_monitor =
- ephy_file_monitor_add (uri,
- GNOME_VFS_MONITOR_FILE,
- USER_CSS_LOAD_DELAY,
- (EphyFileMonitorFunc) user_css_file_monitor_func,
- NULL,
- single);
- g_free (uri);
+ g_file_monitor_file (file,
+ G_FILE_MONITOR_NONE, NULL);
+ g_file_monitor_set_rate_limit (priv->user_css_file_monitor,
+ USER_CSS_LOAD_DELAY);
+ g_signal_connect (priv->user_css_file_monitor, "changed",
+ G_CALLBACK (user_css_file_monitor_changed_cb),
+ single);
+ g_object_unref (file);
}
else
{
if (priv->user_css_file_monitor != NULL)
{
- ephy_file_monitor_cancel (priv->user_css_file_monitor);
+ g_file_monitor_cancel (priv->user_css_file_monitor);
priv->user_css_file_monitor = NULL;
}
@@ -563,7 +566,7 @@ mozilla_stylesheet_shutdown (MozillaEmbedSingle *single)
if (priv->user_css_file_monitor != NULL)
{
- ephy_file_monitor_cancel (priv->user_css_file_monitor);
+ g_file_monitor_cancel (priv->user_css_file_monitor);
priv->user_css_file_monitor = NULL;
}
diff --git a/embed/webkit/webkit-embed-single.c b/embed/webkit/webkit-embed-single.c
index 36cb29c2c..07c6a9729 100644
--- a/embed/webkit/webkit-embed-single.c
+++ b/embed/webkit/webkit-embed-single.c
@@ -21,7 +21,6 @@
#include "config.h"
#include <glib/gi18n.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
#include <webkit.h>
diff --git a/embed/webkit/webkit-embed.c b/embed/webkit/webkit-embed.c
index 82cb865ae..b99770693 100644
--- a/embed/webkit/webkit-embed.c
+++ b/embed/webkit/webkit-embed.c
@@ -27,8 +27,6 @@
#include "ephy-string.h"
#include "ephy-embed-event.h"
-#include <libgnomevfs/gnome-vfs.h>
-
#include <webkit.h>
#include <string.h>
diff --git a/embed/xulrunner/components/ContentHandler.cpp b/embed/xulrunner/components/ContentHandler.cpp
index 051f5e077..ef8ca62a8 100644
--- a/embed/xulrunner/components/ContentHandler.cpp
+++ b/embed/xulrunner/components/ContentHandler.cpp
@@ -25,14 +25,13 @@
#include "config.h"
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include <gtk/gtkbutton.h>
#include <gtk/gtkdialog.h>
#include <gtk/gtkimage.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkmessagedialog.h>
#include <gtk/gtkstock.h>
-#include <libgnomevfs/gnome-vfs-mime.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
#include <nsStringGlue.h>
@@ -254,7 +253,7 @@ NS_METHOD GContentHandler::MIMEConfirmAction ()
{
GtkWidget *dialog, *button, *image;
const char *action_label;
- const char *mime_description;
+ char *mime_description;
nsCString file_name;
nsCOMPtr<nsIDOMWindow> parentDOMWindow = do_GetInterface (mContext);
@@ -264,12 +263,12 @@ NS_METHOD GContentHandler::MIMEConfirmAction ()
(mAction == CONTENT_ACTION_OPEN_TMP) ?
GTK_STOCK_OPEN : STOCK_DOWNLOAD;
- mime_description = gnome_vfs_mime_get_description (mMimeType.get());
+ mime_description = g_content_type_get_description (mMimeType.get());
if (mime_description == NULL)
{
/* Translators: The text before the "|" is context to help you decide on
* the correct translation. You MUST OMIT it in the translated string. */
- mime_description = Q_("File Type:|Unknown");
+ mime_description = g_strdup (Q_("File Type:|Unknown"));
}
/* We have one tiny, minor issue, the filename can be empty (""),
@@ -327,6 +326,8 @@ NS_METHOD GContentHandler::MIMEConfirmAction ()
mime_description, file_name.get());
}
+ g_free (mime_description);
+
button = gtk_button_new_with_label (_("_Save As..."));
image = gtk_image_new_from_stock (GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_BUTTON);
gtk_button_set_image (GTK_BUTTON (button), image);
@@ -367,7 +368,7 @@ NS_METHOD GContentHandler::MIMEInitiateAction (void)
auto_downloads = eel_gconf_get_boolean (CONF_AUTO_DOWNLOADS);
- mHelperApp = gnome_vfs_mime_get_default_application (mMimeType.get());
+ mHelperApp = g_app_info_get_default_for_type (mMimeType.get(), TRUE);
mPermission = ephy_file_check_mime (mMimeType.get());
/* HACK! Check that this 'helper application' isn't Epiphany itself,
@@ -375,7 +376,7 @@ NS_METHOD GContentHandler::MIMEInitiateAction (void)
*/
if (mHelperApp)
{
- const char *id = gnome_vfs_mime_application_get_desktop_id (mHelperApp);
+ const char *id = g_app_info_get_id (mHelperApp);
/* FIXME! menu editing can make this check fail!!!! */
if (id && strcmp (id, "epiphany.desktop") == 0)
@@ -426,7 +427,7 @@ NS_METHOD GContentHandler::MIMEDoAction (void)
g_return_val_if_fail (mHelperApp, NS_ERROR_FAILURE);
const char *id;
- id = gnome_vfs_mime_application_get_desktop_id (mHelperApp);
+ id = g_app_info_get_id (mHelperApp);
/* The current time is fine here as the user has just clicked
* a button (it is used as the time for the application opening)
diff --git a/embed/xulrunner/components/ContentHandler.h b/embed/xulrunner/components/ContentHandler.h
index 113e29070..52813e0c5 100644
--- a/embed/xulrunner/components/ContentHandler.h
+++ b/embed/xulrunner/components/ContentHandler.h
@@ -70,7 +70,7 @@ class GContentHandler : public nsIHelperAppLauncherDialog
nsCOMPtr<nsIHelperAppLauncher> mLauncher;
nsCOMPtr<nsISupports> mContext;
- GnomeVFSMimeApplication *mHelperApp;
+ GAppInfo *mHelperApp;
EphyMimePermission mPermission;
nsCString mUrl;
diff --git a/embed/xulrunner/components/MozDownload.cpp b/embed/xulrunner/components/MozDownload.cpp
index d6d28ec59..7b935f5aa 100644
--- a/embed/xulrunner/components/MozDownload.cpp
+++ b/embed/xulrunner/components/MozDownload.cpp
@@ -47,6 +47,8 @@
#include <stdlib.h>
#include <glib/gi18n.h>
+#include <gio/gdesktopappinfo.h>
+#include <gio/gio.h>
#include <nsStringGlue.h>
@@ -347,7 +349,7 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest,
// FIXMEchpe fix this!
return NS_OK;
#else
- GnomeVFSMimeApplication *helperApp;
+ GDesktopAppInfo *helperApp;
NS_ENSURE_TRUE (mMIMEInfo, NS_ERROR_FAILURE);
nsString description;
@@ -367,16 +369,22 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest,
char *end;
guint32 user_time = strtoul (str[1], &end, 0);
- helperApp = gnome_vfs_mime_application_new_from_desktop_id (str[2]);
+ helperApp = g_desktop_app_info_new (str[2]);
if (!helperApp) return NS_ERROR_FAILURE;
nsCString aDest;
rv = mDestination->GetSpec (aDest);
NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
+
+ GFile* file;
+ GList* list = NULL;
- ephy_file_launch_application (helperApp, destSpec.get (), user_time);
+ file = g_file_new_for_uri (destSpec.get ());
+ list = g_list_append (list, file);
+ ephy_file_launch_application (G_APP_INFO (helperApp), list, user_time, NULL);
- gnome_vfs_mime_application_free (helperApp);
+ g_list_free (list);
+ g_object_unref (file);
g_strfreev (str);
}
else if (g_str_has_prefix (cDesc.get(), "gnome-browse-to-file:"))
diff --git a/embed/xulrunner/embed/EphyHeaderSniffer.cpp b/embed/xulrunner/embed/EphyHeaderSniffer.cpp
index 263ec2e36..1429ef02e 100644
--- a/embed/xulrunner/embed/EphyHeaderSniffer.cpp
+++ b/embed/xulrunner/embed/EphyHeaderSniffer.cpp
@@ -43,7 +43,6 @@
#include "config.h"
#include <glib/gi18n.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
#include <nsStringGlue.h>
@@ -377,7 +376,7 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI)
* http://lxr.mozilla.org/seamonkey/source/xpfe/communicator/resources/content/contentAreaUtils.js#763
*/
char *filename;
- filename = gnome_vfs_unescape_string (default_name, NULL);
+ filename = g_uri_unescape_string (default_name, NULL);
if (!g_utf8_validate (filename, -1, NULL))
{
diff --git a/embed/xulrunner/embed/mozilla-embed-single.cpp b/embed/xulrunner/embed/mozilla-embed-single.cpp
index ab0373085..437d656bf 100644
--- a/embed/xulrunner/embed/mozilla-embed-single.cpp
+++ b/embed/xulrunner/embed/mozilla-embed-single.cpp
@@ -29,7 +29,7 @@
#include <glib.h>
#include <glib/gi18n.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
+#include <gio/gio.h>
#include <nsStringGlue.h>
@@ -87,6 +87,7 @@
#include "ephy-langs.h"
#include "ephy-password-manager.h"
#include "ephy-permission-manager.h"
+#include "ephy-string.h"
#include "mozilla-embed.h"
#include "mozilla-notifiers.h"
#include "mozilla-x509-cert.h"
@@ -267,7 +268,8 @@ mozilla_init_plugin_add_unique_path (GList *list,
if (path == NULL)
return list;
- canon = gnome_vfs_make_path_name_canonical (path);
+ canon = ephy_string_canonicalize_pathname (path);
+
for (l = list; l != NULL; l = l->next) {
if (g_str_equal (list->data, canon) != FALSE) {
/* The path is already in the list */
@@ -464,14 +466,15 @@ user_css_unregister (MozillaEmbedSingle *single)
}
static void
-user_css_file_monitor_func (EphyFileMonitor *,
- const char *,
- GnomeVFSMonitorEventType event_type,
- MozillaEmbedSingle *single)
+user_css_file_monitor_changed_cb (GFileMonitor *file_monitor,
+ GFile *file,
+ GFile *other_file,
+ gint event_type,
+ MozillaEmbedSingle *single)
{
LOG ("Reregistering the user style sheet");
- if (event_type == GNOME_VFS_MONITOR_EVENT_DELETED)
+ if (event_type == G_FILE_MONITOR_EVENT_DELETED)
{
user_css_unregister (single);
}
@@ -499,27 +502,28 @@ user_css_enabled_notify (GConfClient *client,
if (enabled)
{
- char *uri;
+ GFile *file;
user_css_register (single);
- uri = gnome_vfs_get_uri_from_local_path (priv->user_css_file);
+ file = g_file_new_for_path (priv->user_css_file);
g_assert (priv->user_css_file_monitor == NULL);
priv->user_css_file_monitor =
- ephy_file_monitor_add (uri,
- GNOME_VFS_MONITOR_FILE,
- USER_CSS_LOAD_DELAY,
- (EphyFileMonitorFunc) user_css_file_monitor_func,
- NULL,
- single);
- g_free (uri);
+ g_file_monitor_file (file,
+ G_FILE_MONITOR_NONE, NULL);
+ g_file_monitor_set_rate_limit (priv->user_css_file_monitor,
+ USER_CSS_LOAD_DELAY);
+ g_signal_connect (priv->user_css_file_monitor, "changed",
+ G_CALLBACK (user_css_file_monitor_changed_cb),
+ single);
+ g_object_unref (file);
}
else
{
if (priv->user_css_file_monitor != NULL)
{
- ephy_file_monitor_cancel (priv->user_css_file_monitor);
+ g_file_monitor_cancel (priv->user_css_file_monitor);
priv->user_css_file_monitor = NULL;
}