зеркало из https://github.com/mozilla/pjs.git
Bug 670275 - Downloading a file should put it in the system's recently-used list. r=karlt
This commit is contained in:
Родитель
b48d6eb215
Коммит
abf0e5ccf6
|
@ -78,3 +78,5 @@ endif
|
|||
TEST_DIRS += test
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
CXXFLAGS += $(TK_CFLAGS)
|
||||
|
|
|
@ -87,6 +87,10 @@
|
|||
#include "AndroidBridge.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
#define DOWNLOAD_MANAGER_BUNDLE "chrome://mozapps/locale/downloads/downloads.properties"
|
||||
|
@ -2261,7 +2265,7 @@ nsDownload::SetState(DownloadState aState)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_ANDROID)
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GTK2)
|
||||
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(mTarget);
|
||||
nsCOMPtr<nsIFile> file;
|
||||
nsAutoString path;
|
||||
|
@ -2271,8 +2275,8 @@ nsDownload::SetState(DownloadState aState)
|
|||
file &&
|
||||
NS_SUCCEEDED(file->GetPath(path))) {
|
||||
|
||||
#ifdef XP_WIN
|
||||
// On windows, add the download to the system's "recent documents"
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK2)
|
||||
// On Windows and Gtk, add the download to the system's "recent documents"
|
||||
// list, with a pref to disable.
|
||||
{
|
||||
bool addToRecentDocs = true;
|
||||
|
@ -2281,7 +2285,17 @@ nsDownload::SetState(DownloadState aState)
|
|||
|
||||
if (addToRecentDocs &&
|
||||
!nsDownloadManager::gDownloadManagerService->mInPrivateBrowsing) {
|
||||
#ifdef XP_WIN
|
||||
::SHAddToRecentDocs(SHARD_PATHW, path.get());
|
||||
#elif defined(MOZ_WIDGET_GTK2)
|
||||
GtkRecentManager* manager = gtk_recent_manager_get_default();
|
||||
|
||||
gchar* uri = g_filename_to_uri(NS_ConvertUTF16toUTF8(path).get(), NULL, NULL);
|
||||
if (uri) {
|
||||
gtk_recent_manager_add_item(manager, uri);
|
||||
g_free(uri);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче