aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/MozDownload.cpp
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2004-03-01 08:58:50 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2004-03-01 08:58:50 +0800
commit2737b39233fc4cf0cfa332a233371e3344f6c99c (patch)
treebb30b97e10c2761988e08cd0408371443e5b172b /embed/mozilla/MozDownload.cpp
parent4461c9354db2be499323f99a2fe17fab73df3eba (diff)
downloadgsoc2013-epiphany-2737b39233fc4cf0cfa332a233371e3344f6c99c.tar
gsoc2013-epiphany-2737b39233fc4cf0cfa332a233371e3344f6c99c.tar.gz
gsoc2013-epiphany-2737b39233fc4cf0cfa332a233371e3344f6c99c.tar.bz2
gsoc2013-epiphany-2737b39233fc4cf0cfa332a233371e3344f6c99c.tar.lz
gsoc2013-epiphany-2737b39233fc4cf0cfa332a233371e3344f6c99c.tar.xz
gsoc2013-epiphany-2737b39233fc4cf0cfa332a233371e3344f6c99c.tar.zst
gsoc2013-epiphany-2737b39233fc4cf0cfa332a233371e3344f6c99c.zip
Keep a ref for downloads in the view.
2004-03-01 Marco Pesenti Gritti <marco@gnome.org> * embed/downloader-view.c: (downloader_view_add_download), (downloader_view_remove_download): Keep a ref for downloads in the view. * embed/mozilla/ContentHandler.cpp: * embed/mozilla/ContentHandler.h: Ensure the download directory exist. * embed/mozilla/MozDownload.cpp: * embed/mozilla/mozilla-download.cpp: * embed/mozilla/mozilla-download.h: Use a property to store MozDownload in the wrapper. The wrapper now keep a reference on the c++ implementation, that way references will be correctly propagated (unreffing the GObject will unref the c++ object). (Bug 135755)
Diffstat (limited to 'embed/mozilla/MozDownload.cpp')
-rw-r--r--embed/mozilla/MozDownload.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp
index 188169a47..f2877ce9b 100644
--- a/embed/mozilla/MozDownload.cpp
+++ b/embed/mozilla/MozDownload.cpp
@@ -128,9 +128,9 @@ MozDownload::Init(nsIURI *aSource, nsILocalFile *aTarget, const PRUnichar *aDisp
DownloaderView *dview;
dview = EPHY_DOWNLOADER_VIEW
(ephy_embed_shell_get_downloader_view (embed_shell));
- mEphyDownload = mozilla_download_new ();
- MOZILLA_DOWNLOAD (mEphyDownload)->moz_download = this;
+ mEphyDownload = mozilla_download_new (this);
downloader_view_add_download (dview, mEphyDownload);
+ g_object_unref (mEphyDownload);
}
else
{
@@ -558,10 +558,14 @@ GetFilePath (const char *filename)
if (g_utf8_collate (download_dir, "Downloads") == 0)
{
+ const char *default_dir;
+
g_free (download_dir);
- return g_build_filename (ephy_file_downloads_dir (),
- filename, NULL);
+ default_dir = ephy_file_downloads_dir ();
+ ephy_ensure_dir_exists (default_dir);
+
+ return g_build_filename (default_dir, filename, NULL);
}
converted_dp = g_filename_from_utf8 (download_dir, -1, NULL, NULL, NULL);
@@ -570,6 +574,7 @@ GetFilePath (const char *filename)
if (converted_dp)
{
expanded = gnome_vfs_expand_initial_tilde (converted_dp);
+ ephy_ensure_dir_exists (expanded);
path = g_build_filename (expanded, filename, NULL);
g_free (expanded);