From e692c755dbce0092e8a012ec0555325934be5c78 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 25 Nov 2004 19:01:26 +0000 Subject: reviewed by: Christian Persch 2004-11-25 Marco Pesenti Gritti reviewed by: Christian Persch * 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. --- ChangeLog | 16 +++++++++++ embed/Makefile.am | 1 + lib/widgets/Makefile.am | 1 + src/Makefile.am | 1 + src/bookmarks/Makefile.am | 1 + src/window-commands.c | 68 ++++++++--------------------------------------- 6 files changed, 31 insertions(+), 57 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4b28936b0..9c6d8a7fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2004-11-25 Marco Pesenti Gritti + + reviewed by: Christian Persch + + * 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. + 2004-11-25 Christian Persch * src/prefs-dialog.c: (create_language_section): diff --git a/embed/Makefile.am b/embed/Makefile.am index 91ca67c0d..893575963 100644 --- a/embed/Makefile.am +++ b/embed/Makefile.am @@ -2,6 +2,7 @@ SUBDIRS = mozilla INCLUDES = \ -I$(top_srcdir)/embed/mozilla \ + -I$(top_builddir)/lib \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/lib/egg \ -I$(top_srcdir)/lib/widgets \ diff --git a/lib/widgets/Makefile.am b/lib/widgets/Makefile.am index 2f5169eb8..020d3e0b9 100644 --- a/lib/widgets/Makefile.am +++ b/lib/widgets/Makefile.am @@ -1,4 +1,5 @@ INCLUDES = \ + -I$(top_builddir)/lib \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/lib/egg \ $(EPIPHANY_DEPENDENCY_CFLAGS) \ diff --git a/src/Makefile.am b/src/Makefile.am index b2228f960..f61728381 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,7 @@ SUBDIRS = bookmarks INCLUDES = \ + -I$(top_builddir)/lib \ -I$(top_srcdir)/embed \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/lib/egg \ diff --git a/src/bookmarks/Makefile.am b/src/bookmarks/Makefile.am index 9f26dd2b4..df7a90e51 100644 --- a/src/bookmarks/Makefile.am +++ b/src/bookmarks/Makefile.am @@ -1,5 +1,6 @@ INCLUDES = \ -I$(top_srcdir)/lib \ + -I$(top_builddir)/lib \ -I$(top_srcdir)/src \ -I$(top_srcdir)/embed \ -I$(top_srcdir)/lib/widgets \ 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); } -- cgit v1.2.3