diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2004-11-26 03:01:26 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2004-11-26 03:01:26 +0800 |
commit | e692c755dbce0092e8a012ec0555325934be5c78 (patch) | |
tree | a30943c171959b503371e6fe25f6e1f179f2110e /src/window-commands.c | |
parent | e0b14f264936aa2b060abb8190d47e68fe265ba3 (diff) | |
download | gsoc2013-epiphany-e692c755dbce0092e8a012ec0555325934be5c78.tar gsoc2013-epiphany-e692c755dbce0092e8a012ec0555325934be5c78.tar.gz gsoc2013-epiphany-e692c755dbce0092e8a012ec0555325934be5c78.tar.bz2 gsoc2013-epiphany-e692c755dbce0092e8a012ec0555325934be5c78.tar.lz gsoc2013-epiphany-e692c755dbce0092e8a012ec0555325934be5c78.tar.xz gsoc2013-epiphany-e692c755dbce0092e8a012ec0555325934be5c78.tar.zst gsoc2013-epiphany-e692c755dbce0092e8a012ec0555325934be5c78.zip |
reviewed by: Christian Persch <chpe@cvs.gnome.org>
2004-11-25 Marco Pesenti Gritti <marco@gnome.org>
reviewed by: Christian Persch <chpe@cvs.gnome.org>
* embed/Makefile.am:
* lib/widgets/Makefile.am:
* src/Makefile.am:
* src/bookmarks/Makefile.am:
Fix build out of src directory.
* src/window-commands.c: (editor_open_uri),
(window_cmd_view_page_source):
Rework the code to not use deprecated API.
Diffstat (limited to 'src/window-commands.c')
-rw-r--r-- | src/window-commands.c | 68 |
1 files changed, 11 insertions, 57 deletions
diff --git a/src/window-commands.c b/src/window-commands.c index 6f88248f5..0f89e32b7 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -644,19 +644,6 @@ window_cmd_view_zoom_normal (GtkAction *action, ephy_window_set_zoom (window, 1.0); } -static GnomeVFSMimeApplication * -get_editor_application (void) -{ - GnomeVFSMimeApplication *app; - - app = gnome_vfs_mime_get_default_application ("text/plain"); - if (app == NULL) - { - g_warning ("Cannot find a text editor."); - } - return app; -} - static void editor_open_uri (const char *address) { @@ -668,12 +655,18 @@ editor_open_uri (const char *address) uris = g_list_append (uris, canonical); - app = get_editor_application (); + app = gnome_vfs_mime_get_default_application ("text/plain"); if (app) { gnome_vfs_mime_application_launch (app, uris); gnome_vfs_mime_application_free (app); } + else + { + /* FIXME We should really warn the user here */ + + g_warning ("Cannot find a text editor."); + } g_free (canonical); g_list_free (uris); @@ -692,48 +685,6 @@ save_source_completed_cb (EphyEmbedPersist *persist) editor_open_uri (dest); } -static gboolean -editor_can_open_uri (char *address) -{ - GnomeVFSMimeApplication *app; - GnomeVFSURI *uri; - const char *scheme; - gboolean result = FALSE; - - app = get_editor_application (); - - uri = gnome_vfs_uri_new (address); - scheme = uri ? gnome_vfs_uri_get_scheme (uri) : NULL; - - /* Open directly only read/write protocols, otherwise - you just get extra network overhead without any advantage */ - if (scheme && strcmp (scheme, "file") != 0) - { - scheme = NULL; - } - - if (scheme && app && app->supported_uri_schemes) - { - if (g_list_find_custom (app->supported_uri_schemes, - scheme, (GCompareFunc) strcmp)) - { - result = TRUE; - } - } - - if (uri) - { - gnome_vfs_uri_unref (uri); - } - - if (app) - { - gnome_vfs_mime_application_free (app); - } - - return result; -} - static void save_temp_source (EphyEmbed *embed) { @@ -778,13 +729,15 @@ window_cmd_view_page_source (GtkAction *action, { EphyEmbed *embed; char *address; + char *scheme; embed = ephy_window_get_active_embed (window); g_return_if_fail (embed != NULL); address = ephy_embed_get_location (embed, TRUE); + scheme = gnome_vfs_get_uri_scheme (address); - if (editor_can_open_uri (address)) + if (strcmp (scheme, "file") == 0) { editor_open_uri (address); } @@ -793,6 +746,7 @@ window_cmd_view_page_source (GtkAction *action, save_temp_source (embed); } + g_free (scheme); g_free (address); } |