aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2003-11-03 06:31:18 +0800
committerXan Lopez <xan@src.gnome.org>2003-11-03 06:31:18 +0800
commit2f10c10cd81abd29f24ace8c128a5b5d3244fbdd (patch)
tree76254bd0c48969e4840a2b97eec3fdb6d527f251
parentbce28d78b08a72c11b9cbb8a798d7b59564fe1f2 (diff)
downloadgsoc2013-epiphany-2f10c10cd81abd29f24ace8c128a5b5d3244fbdd.tar
gsoc2013-epiphany-2f10c10cd81abd29f24ace8c128a5b5d3244fbdd.tar.gz
gsoc2013-epiphany-2f10c10cd81abd29f24ace8c128a5b5d3244fbdd.tar.bz2
gsoc2013-epiphany-2f10c10cd81abd29f24ace8c128a5b5d3244fbdd.tar.lz
gsoc2013-epiphany-2f10c10cd81abd29f24ace8c128a5b5d3244fbdd.tar.xz
gsoc2013-epiphany-2f10c10cd81abd29f24ace8c128a5b5d3244fbdd.tar.zst
gsoc2013-epiphany-2f10c10cd81abd29f24ace8c128a5b5d3244fbdd.zip
Remove the "show_details in downloader" schema.
* data/epiphany.schemas.in: Remove the "show_details in downloader" schema. * embed/ephy-embed-popup-control.c: (save_url): * embed/mozilla/ContentHandler.cpp: * embed/mozilla/EphyHeaderSniffer.cpp: * lib/ephy-prefs.h: * src/popup-commands.c: (save_property_url): Implement the new downloading mechanism in CH, also rename CONF_STATE_DOWNLOADING_DIR to CONF_STATE_DOWNLOAD_DIR.
-rw-r--r--ChangeLog15
-rw-r--r--data/epiphany.schemas.in11
-rw-r--r--embed/ephy-embed-popup-control.c2
-rw-r--r--embed/mozilla/ContentHandler.cpp86
-rw-r--r--embed/mozilla/EphyHeaderSniffer.cpp4
-rw-r--r--lib/ephy-prefs.h2
-rw-r--r--src/popup-commands.c2
7 files changed, 53 insertions, 69 deletions
diff --git a/ChangeLog b/ChangeLog
index 7ee145703..0e5da1f88 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2003-11-02 Xan Lopez <xan@masilla.org>
+
+ * data/epiphany.schemas.in:
+
+ Remove the "show_details in downloader" schema.
+
+ * embed/ephy-embed-popup-control.c: (save_url):
+ * embed/mozilla/ContentHandler.cpp:
+ * embed/mozilla/EphyHeaderSniffer.cpp:
+ * lib/ephy-prefs.h:
+ * src/popup-commands.c: (save_property_url):
+
+ Implement the new downloading mechanism in CH, also rename
+ CONF_STATE_DOWNLOADING_DIR to CONF_STATE_DOWNLOAD_DIR.
+
2003-11-02 Christian Persch <chpe@cvs.gnome.org>
* lib/ephy-dialog.c: (impl_run):
diff --git a/data/epiphany.schemas.in b/data/epiphany.schemas.in
index 1bcae6033..d7f6fded5 100644
--- a/data/epiphany.schemas.in
+++ b/data/epiphany.schemas.in
@@ -217,17 +217,6 @@
</locale>
</schema>
<schema>
- <key>/schemas/apps/epiphany/dialogs/downloader_show_details</key>
- <applyto>/apps/epiphany/dialogs/downloader_show_details</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Show download details</short>
- <long>Show download details.</long>
- </locale>
- </schema>
- <schema>
<key>/schemas/apps/epiphany/web/cache_size</key>
<applyto>/apps/epiphany/web/cache_size</applyto>
<owner>epiphany</owner>
diff --git a/embed/ephy-embed-popup-control.c b/embed/ephy-embed-popup-control.c
index 650534d86..9c816840f 100644
--- a/embed/ephy-embed-popup-control.c
+++ b/embed/ephy-embed-popup-control.c
@@ -496,7 +496,7 @@ save_url (EphyEmbedPopupControl *popup,
ephy_embed_persist_set_flags
(persist, ask_dest ? EMBED_PERSIST_ASK_DESTINATION : 0);
ephy_embed_persist_set_persist_key
- (persist, CONF_STATE_DOWNLOADING_DIR);
+ (persist, CONF_STATE_DOWNLOAD_DIR);
ephy_embed_persist_set_source (persist, location);
ephy_embed_persist_save (persist);
diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp
index f79aa43bd..affcf0ccd 100644
--- a/embed/mozilla/ContentHandler.cpp
+++ b/embed/mozilla/ContentHandler.cpp
@@ -150,8 +150,6 @@
#endif
#include "ContentHandler.h"
-
-#include "FilePicker.h"
#include "MozillaPrivate.h"
#include "nsCOMPtr.h"
@@ -187,6 +185,7 @@
#include <libgnome/gnome-config.h>
#include <libgnome/gnome-util.h>
#include <libgnomevfs/gnome-vfs-mime.h>
+#include <libgnomevfs/gnome-vfs-utils.h>
#include <bonobo/bonobo-i18n.h>
class GContentHandler;
@@ -275,66 +274,47 @@ NS_IMETHODIMP GContentHandler::PromptForSaveToFile(
const PRUnichar *aSuggestedFileExtension,
nsILocalFile **_retval)
{
- nsresult rv;
+ char *path, *download_dir;
- mContext = aWindowContext;
-
- nsCOMPtr<nsIDOMWindowInternal> windowInternal =
- do_QueryInterface (aWindowContext);
-
- nsCOMPtr<nsILocalFile> saveDir;
- char *dirName;
-
- dirName = eel_gconf_get_string (CONF_STATE_DOWNLOADING_DIR);
- if (dirName == NULL)
+ download_dir = eel_gconf_get_string (CONF_STATE_DOWNLOAD_DIR);
+ if (!download_dir)
{
- dirName = g_strdup (g_get_home_dir());
+ /* Emergency download destination */
+ download_dir = g_strdup (g_get_home_dir ());
}
- saveDir = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID);
- saveDir->InitWithPath (NS_ConvertUTF8toUCS2(dirName));
- g_free (dirName);
-
- nsCOMPtr <nsILocalFile> saveFile (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
-
- PRInt16 okToSave = nsIFilePicker::returnCancel;
-
- nsCOMPtr<nsIFilePicker> filePicker =
- do_CreateInstance (G_FILEPICKER_CONTRACTID);
-
- const nsAString &title = NS_ConvertUTF8toUCS2(_("Select the destination filename"));
-
- filePicker->Init (windowInternal,
- PromiseFlatString(title).get(),
- nsIFilePicker::modeSave);
- filePicker->SetDefaultString (aDefaultFile);
- filePicker->SetDisplayDirectory (saveDir);
-
- filePicker->Show (&okToSave);
-
- if (okToSave == nsIFilePicker::returnOK)
+ if (!strcmp (download_dir, "Desktop"))
{
- filePicker->GetFile (getter_AddRefs(saveFile));
-
- nsString uFileName;
- saveFile->GetPath(uFileName);
- const nsCString &aFileName = NS_ConvertUCS2toUTF8(uFileName);
-
- char *dir = g_path_get_dirname (aFileName.get());
-
- eel_gconf_set_string (CONF_STATE_DOWNLOADING_DIR, dir);
- g_free (dir);
-
- nsCOMPtr<nsIFile> directory;
- rv = saveFile->GetParent (getter_AddRefs(directory));
-
- NS_IF_ADDREF (*_retval = saveFile);
- return NS_OK;
+ if (eel_gconf_get_boolean (CONF_DESKTOP_IS_HOME_DIR))
+ {
+ path = g_build_filename
+ (g_get_home_dir (),
+ NS_ConvertUCS2toUTF8 (aDefaultFile).get(),
+ NULL);
+ }
+ else
+ {
+ path = g_build_filename
+ (g_get_home_dir (), "Desktop",
+ NS_ConvertUCS2toUTF8 (aDefaultFile).get(),
+ NULL);
+ }
}
else
{
- return NS_ERROR_FAILURE;
+ path = g_build_filename
+ (gnome_vfs_expand_initial_tilde (download_dir),
+ NS_ConvertUCS2toUTF8 (aDefaultFile).get(),
+ NULL);
}
+ g_free (download_dir);
+
+ nsCOMPtr <nsILocalFile> destFile (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
+ destFile->InitWithNativePath (nsDependentCString (path));
+ g_free (path);
+
+ NS_IF_ADDREF (*_retval = destFile);
+ return NS_OK;
}
#if MOZILLA_SNAPSHOT < 10
diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp
index 939394bd1..9ac0c0eca 100644
--- a/embed/mozilla/EphyHeaderSniffer.cpp
+++ b/embed/mozilla/EphyHeaderSniffer.cpp
@@ -292,7 +292,7 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI)
dialog = ephy_file_chooser_new (title ? title: _("Save"),
GTK_WIDGET (window),
GTK_FILE_CHOOSER_ACTION_SAVE,
- key ? key : CONF_STATE_DOWNLOADING_DIR);
+ key ? key : CONF_STATE_DOWNLOAD_DIR);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog),
NS_ConvertUCS2toUTF8 (defaultFileName).get());
@@ -308,7 +308,7 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI)
/* FIXME: how to inform user of failed save ? */
- download_dir = eel_gconf_get_string (CONF_STATE_DOWNLOADING_DIR);
+ download_dir = eel_gconf_get_string (CONF_STATE_DOWNLOAD_DIR);
if (!download_dir)
{
/* Emergency download destination */
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index bac1e56a2..cdb7271da 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
#define CONF_STATE_SAVE_DIR "/apps/epiphany/directories/save"
#define CONF_STATE_SAVE_IMAGE_DIR "/apps/epiphany/directories/saveimage"
#define CONF_STATE_OPEN_DIR "/apps/epiphany/directories/open"
-#define CONF_STATE_DOWNLOADING_DIR "/apps/epiphany/directories/download"
+#define CONF_STATE_DOWNLOAD_DIR "/apps/epiphany/directories/download"
#define CONF_STATE_UPLOAD_DIR "/apps/epiphany/directories/upload"
/* System prefs */
diff --git a/src/popup-commands.c b/src/popup-commands.c
index 38613e216..8771274c6 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -289,7 +289,7 @@ save_property_url (GtkAction *action,
ephy_embed_persist_set_flags
(persist, ask_dest ? EMBED_PERSIST_ASK_DESTINATION : 0);
ephy_embed_persist_set_persist_key
- (persist, CONF_STATE_DOWNLOADING_DIR);
+ (persist, CONF_STATE_DOWNLOAD_DIR);
ephy_embed_persist_set_source (persist, location);
ephy_embed_persist_save (persist);