aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2004-11-26 03:01:26 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2004-11-26 03:01:26 +0800
commite692c755dbce0092e8a012ec0555325934be5c78 (patch)
treea30943c171959b503371e6fe25f6e1f179f2110e
parente0b14f264936aa2b060abb8190d47e68fe265ba3 (diff)
downloadgsoc2013-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.
-rw-r--r--ChangeLog16
-rw-r--r--embed/Makefile.am1
-rw-r--r--lib/widgets/Makefile.am1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/bookmarks/Makefile.am1
-rw-r--r--src/window-commands.c68
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 <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.
+
2004-11-25 Christian Persch <chpe@cvs.gnome.org>
* 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);
}