diff options
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-embed-shell.c | 12 | ||||
-rw-r--r-- | embed/ephy-embed-shell.h | 4 | ||||
-rw-r--r-- | embed/mozilla/StartHereProtocolHandler.cpp | 19 |
3 files changed, 34 insertions, 1 deletions
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c index 69d1c98dd..679e6f663 100644 --- a/embed/ephy-embed-shell.c +++ b/embed/ephy-embed-shell.c @@ -29,6 +29,7 @@ enum { NEW_WINDOW, + COMMAND, LAST_SIGNAL }; @@ -113,6 +114,17 @@ ephy_embed_shell_class_init (EphyEmbedShellClass *klass) 2, G_TYPE_POINTER, G_TYPE_INT); + ephy_embed_shell_signals[COMMAND] = + g_signal_new ("command", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EphyEmbedShellClass, command), + NULL, NULL, + ephy_marshal_VOID__STRING_STRING, + G_TYPE_NONE, + 2, + G_TYPE_STRING, + G_TYPE_STRING); } static void diff --git a/embed/ephy-embed-shell.h b/embed/ephy-embed-shell.h index 105db27f2..e7d789d57 100644 --- a/embed/ephy-embed-shell.h +++ b/embed/ephy-embed-shell.h @@ -139,6 +139,10 @@ struct EphyEmbedShellClass EphyEmbed **new_embed, EmbedChromeMask chromemask); + void (* command) (EphyEmbedShell *shell, + char *command, + char *param); + /* Methods */ void (* get_capabilities) (EphyEmbedShell *shell, diff --git a/embed/mozilla/StartHereProtocolHandler.cpp b/embed/mozilla/StartHereProtocolHandler.cpp index 2d2bb3c35..a4548378d 100644 --- a/embed/mozilla/StartHereProtocolHandler.cpp +++ b/embed/mozilla/StartHereProtocolHandler.cpp @@ -18,6 +18,9 @@ #include "ephy-file-helpers.h" #include "ephy-start-here.h" +#include "ephy-embed-shell.h" + +#include <string.h> #include "nsCOMPtr.h" #include "nsIFactory.h" @@ -121,6 +124,19 @@ NS_IMETHODIMP GStartHereProtocolHandler::NewChannel(nsIURI *aURI, rv = aURI->GetPath(path); if (NS_FAILED(rv)) return rv; + if (g_str_has_prefix (path.get(), "import-bookmarks")) + { + g_signal_emit_by_name (embed_shell, "command", "import-bookmarks", + path.get() + strlen ("import-bookmarks?")); + return NS_ERROR_FAILURE; + } + else if (g_str_has_prefix (path.get(), "configure-network")) + { + g_signal_emit_by_name (embed_shell, "command", "configure-network", + NULL); + return NS_ERROR_FAILURE; + } + nsCOMPtr<nsIStorageStream> sStream; nsCOMPtr<nsIOutputStream> stream; @@ -131,7 +147,8 @@ NS_IMETHODIMP GStartHereProtocolHandler::NewChannel(nsIURI *aURI, if (NS_FAILED(rv)) return rv; sh = ephy_start_here_new (); - buf = ephy_start_here_get_page (sh, "index"); + buf = ephy_start_here_get_page + (sh, path.IsEmpty() ? "index" : path.get ()); aBaseURI = ephy_start_here_get_base_uri (sh); rv = stream->Write (buf, strlen (buf), &bytesWritten); |