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/window-commands.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/window-commands.c')
-rw-r--r-- | src/window-commands.c | 72 |
1 files changed, 45 insertions, 27 deletions
diff --git a/src/window-commands.c b/src/window-commands.c index fb7438e58..9bc698a67 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -49,14 +49,13 @@ #include "ephy-bookmarks-ui.h" #include "ephy-link.h" #include "ephy-stock-icons.h" +#include "ephy-string.h" +#include "eel-app-launch-context.h" #include "pdm-dialog.h" #include <string.h> #include <glib.h> -#include <libgnomevfs/gnome-vfs-uri.h> -#include <libgnomevfs/gnome-vfs-utils.h> -#include <libgnomeui/gnome-stock-icons.h> -#include <libgnomevfs/gnome-vfs-mime-handlers.h> +#include <gio/gio.h> #include <gtk/gtkaboutdialog.h> #include <gtk/gtkeditable.h> #include <gtk/gtkmain.h> @@ -122,24 +121,38 @@ window_cmd_file_send_to (GtkAction *action, EphyWindow *window) { EphyEmbed *embed; - char *url, *location, *title; + char *handler, *command; + const char *location, *title; + GAppInfo *appinfo; + + if (eel_gconf_get_boolean ("/desktop/gnome/url-handlers/mailto/enabled") == FALSE) + { + /* FIXME: add some UI to inform the user? */ + return; + } embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window)); g_return_if_fail (embed != NULL); - location = gnome_vfs_escape_string (ephy_embed_get_address (embed)); - title = gnome_vfs_escape_string (ephy_embed_get_title (embed)); - - url = g_strconcat ("mailto:", - "?Subject=", title, - "&Body=", location, NULL); + location = ephy_embed_get_address (embed); + title = ephy_embed_get_title (embed); - gnome_vfs_url_show (url); + /* FIXME: better use g_app_info_get_default_for_uri_scheme () when it is + * implemented. + */ + handler = eel_gconf_get_string ("/desktop/gnome/url-handlers/mailto/command"); + command = g_strconcat (handler, "mailto:", + "?Subject=\"", title, + "\"&Body=\"", location, "\"", NULL); + + appinfo = g_app_info_create_from_commandline (command, NULL, 0, NULL); + ephy_file_launch_application (appinfo, NULL, + gtk_get_current_event_time (), + GTK_WIDGET (window)); - g_free (title); - g_free (location); - g_free (url); + g_free (handler); + g_free (command); } static gboolean @@ -564,14 +577,17 @@ save_source_completed_cb (EphyEmbedPersist *persist) { const char *dest; guint32 user_time; + GFile *file; user_time = ephy_embed_persist_get_user_time (persist); dest = ephy_embed_persist_get_dest (persist); g_return_if_fail (dest != NULL); - ephy_file_delete_on_exit (dest); + file = g_file_new_for_path (dest); + ephy_file_delete_on_exit (file); - ephy_file_launch_handler ("text/plain", dest, user_time); + ephy_file_launch_handler ("text/plain", file, user_time); + g_object_unref (file); } static void @@ -631,7 +647,12 @@ window_cmd_view_page_source (GtkAction *action, if (g_str_has_prefix (address, "file://")) { - ephy_file_launch_handler ("text/plain", address, user_time); + GFile *file; + + file = g_file_new_for_uri (address); + ephy_file_launch_handler ("text/plain", file, user_time); + + g_object_unref (file); } else { @@ -670,24 +691,21 @@ window_cmd_edit_personal_data (GtkAction *action, { PdmDialog *dialog; EphyEmbed *embed; - GnomeVFSURI *uri; - const char *host; + const char *address; + char *host; embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window)); if (embed == NULL) return; - uri = gnome_vfs_uri_new (ephy_embed_get_address (embed)); - - host = uri != NULL ? gnome_vfs_uri_get_host_name (uri) : NULL; + address = ephy_embed_get_address (embed); + + host = address != NULL ? ephy_string_get_host_name (address) : NULL; dialog = EPHY_PDM_DIALOG (ephy_shell_get_pdm_dialog (ephy_shell)); pdm_dialog_open (dialog, host); - if (uri != NULL) - { - gnome_vfs_uri_unref (uri); - } + g_free (host); } #ifdef ENABLE_CERTIFICATE_MANAGER |