diff options
author | Wouter Bolsterlee <wbolster@gnome.org> | 2006-10-15 22:05:40 +0800 |
---|---|---|
committer | Wouter Bolsterlee <wbolster@src.gnome.org> | 2006-10-15 22:05:40 +0800 |
commit | c1e9da9eed75fc314c113000d7fe01e7de1ae913 (patch) | |
tree | 8fe52c695808de3066e5a3652035b0406463f0fe /embed | |
parent | ccb73eb4348e4fb957fe4a2f8ed5ca7eac6835d9 (diff) | |
download | gsoc2013-epiphany-c1e9da9eed75fc314c113000d7fe01e7de1ae913.tar gsoc2013-epiphany-c1e9da9eed75fc314c113000d7fe01e7de1ae913.tar.gz gsoc2013-epiphany-c1e9da9eed75fc314c113000d7fe01e7de1ae913.tar.bz2 gsoc2013-epiphany-c1e9da9eed75fc314c113000d7fe01e7de1ae913.tar.lz gsoc2013-epiphany-c1e9da9eed75fc314c113000d7fe01e7de1ae913.tar.xz gsoc2013-epiphany-c1e9da9eed75fc314c113000d7fe01e7de1ae913.tar.zst gsoc2013-epiphany-c1e9da9eed75fc314c113000d7fe01e7de1ae913.zip |
Automatically open a Nautilus window after downloading has finished. Fixes
2006-10-15 Wouter Bolsterlee <wbolster@gnome.org>
* embed/mozilla/ContentHandler.cpp:
* embed/mozilla/MozDownload.cpp:
* lib/ephy-file-helpers.c: (ephy_file_browse_to):
* lib/ephy-file-helpers.h:
* src/popup-commands.c: (save_property_url_completed_cb),
(save_property_url):
Automatically open a Nautilus window after downloading
has finished. Fixes bug #138876, patch by Ed Catmur.
Diffstat (limited to 'embed')
-rw-r--r-- | embed/mozilla/ContentHandler.cpp | 10 | ||||
-rw-r--r-- | embed/mozilla/MozDownload.cpp | 26 |
2 files changed, 35 insertions, 1 deletions
diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp index d6403eb90..2948514eb 100644 --- a/embed/mozilla/ContentHandler.cpp +++ b/embed/mozilla/ContentHandler.cpp @@ -406,6 +406,8 @@ NS_METHOD GContentHandler::MIMEDoAction (void) mLauncher->GetMIMEInfo(getter_AddRefs(mimeInfo)); NS_ENSURE_TRUE (mimeInfo, NS_ERROR_FAILURE); + char *info = NULL; + if (mAction == CONTENT_ACTION_OPEN) { g_return_val_if_fail (mHelperApp, NS_ERROR_FAILURE); @@ -416,9 +418,15 @@ NS_METHOD GContentHandler::MIMEDoAction (void) /* The current time is fine here as the user has just clicked * a button (it is used as the time for the application opening) */ - char *info; info = g_strdup_printf ("gnome-default:%d:%s", gtk_get_current_event_time(), id); + } + else if (mAction == CONTENT_ACTION_DOWNLOAD) + { + info = g_strdup_printf ("gnome-browse-to-file:%d", gtk_get_current_event_time()); + } + if (info != NULL) + { nsString desc; NS_CStringToUTF16 (nsCString (info), NS_CSTRING_ENCODING_UTF8, desc); diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp index 673aa5788..bf1a1c28f 100644 --- a/embed/mozilla/MozDownload.cpp +++ b/embed/mozilla/MozDownload.cpp @@ -357,6 +357,23 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest, gnome_vfs_mime_application_free (helperApp); g_strfreev (str); } + else if (g_str_has_prefix (cDesc.get(), "gnome-browse-to-file:")) + { + /* Format gnome-browse-to-file:<usertime> */ + char **str = g_strsplit (cDesc.get(), ":", -1); + g_return_val_if_fail (g_strv_length (str) == 2, NS_ERROR_FAILURE); + + char *end; + guint32 user_time = strtoul (str[1], &end, 0); + + nsCString aDest; + rv = mDestination->GetSpec (aDest); + NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); + + ephy_file_browse_to (aDest.get (), user_time); + + g_strfreev (str); + } } } @@ -519,6 +536,15 @@ nsresult InitiateMozillaDownload (nsIDOMDocument *domDocument, nsIURI *sourceURI EphyEmbedPersistFlags ephy_flags; ephy_flags = ephy_embed_persist_get_flags (EPHY_EMBED_PERSIST (embedPersist)); + if (!ephy_embed_persist_get_dest (EPHY_EMBED_PERSIST (embedPersist))) + { + nsCString cPath; + inDestFile->GetNativePath (cPath); + + ephy_embed_persist_set_dest (EPHY_EMBED_PERSIST (embedPersist), + cPath.get()); + } + PRBool isHTML = (contentType && (strcmp (contentType, "text/html") == 0 || strcmp (contentType, "text/xml") == 0 || |