aboutsummaryrefslogtreecommitdiffstats
path: root/embed/xulrunner
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/xulrunner
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/xulrunner')
-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
5 files changed, 44 insertions, 32 deletions
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;
}