[Conkeror] [PATCH] download manager automatic open behavior
Morgan Veyret
patzy at appart.kicks-ass.net
Sat Sep 20 02:28:01 PDT 2008
And this additional patch fixes the invalid docstring.
On 11:18 Sat 20 Sep , Morgan Veyret wrote:
> Hello,
>
> here is a small patch that changes the download manager automatic buffer
> opening behavior.
>
> It adds a new preference:
>
> download_buffer_automatic_open_in_own_window
>
> which defaults to false.
>
> When true, automatic open with target being OPEN_NEW_BUFFER or
> OPEN_NEW_BUFFER_BACKGROUND, the download buffer are created in a
> separate download manager window. So the first time a window is created
> and subsequent download buffers are opened in the existing window.
>
> I'm new to js and xul so feel free to comment this and tell me this is
> crap :).
>
> Here it uses a tag for the download manager window thanks to jbms on #conkeror
> (thanks for his help).
>
> Anyway here is the patch.
> --
>
> Morgan Veyret (patzy at appart.kicks-ass.net)
> http://appart.kicks-ass.net/patzy
> >From 3688491e78a1e222c7d197db313edf61af298a02 Mon Sep 17 00:00:00 2001
> From: Morgan Veyret <patzy at appart.kicks-ass.net>
> Date: Sat, 20 Sep 2008 11:12:18 +0200
> Subject: [PATCH] Added new download manager window automatic open behavior.
>
> When target is set to OPEN_NEW_BUFFER or OPEN_NEW_BUFFER_BACKGROUND
> the preference variable download_buffer_automatic_open_in_own_window control wether
> an existing download manager window should be used instead of the current window.
> ---
> modules/download-manager.js | 21 +++++++++++++++++++--
> 1 files changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/modules/download-manager.js b/modules/download-manager.js
> index cdd9ee9..318c26d 100644
> --- a/modules/download-manager.js
> +++ b/modules/download-manager.js
> @@ -1011,14 +1011,31 @@ define_variable("download_buffer_automatic_open_target", OPEN_NEW_WINDOW,
> "This variable takes effect only if `open_download_buffer_auotmatically' is in " +
> "`download_added_hook', as it is by default.");
>
> +define_variable("download_buffer_automatic_open_in_own_window", false,
> + "Target for download buffers created by the `open_download_buffer_automatically' function.\n" +
> + "This variable takes effect only if `open_download_buffer_auotmatically' is in " +
> + "`download_added_hook', as it is by default.");
> +
> +
> function open_download_buffer_automatically(info) {
> var buf = info.source_buffer;
> var target = download_buffer_automatic_open_target;
> + var own_window = download_buffer_automatic_open_in_own_window;
> if (buf == null)
> - target = OPEN_NEW_WINDOW;
> + target = OPEN_NEW_WINDOW;
> if (info.temporary_status == DOWNLOAD_NOT_TEMPORARY ||
> !(download_temporary_file_open_buffer_delay > 0))
> - create_buffer(buf, buffer_creator(download_buffer, $info = info), target);
> + if ( (target == OPEN_NEW_BUFFER || target == OPEN_NEW_BUFFER_BACKGROUND )
> + && (own_window == true)) {
> + var window = get_window_by_tag("download-manager");
> + if ( window == null ) {
> + window = make_window(buffer_creator(download_buffer, $info = info),"download-manager");
> + }
> + create_buffer(window, buffer_creator(download_buffer, $info = info), target);
> + }
> + else {
> + create_buffer(buf, buffer_creator(download_buffer, $info = info), target);
> + }
> else {
> var timer = null;
> function finish() {
> --
> 1.5.5.1
>
> _______________________________________________
> Conkeror mailing list
> Conkeror at mozdev.org
> https://www.mozdev.org/mailman/listinfo/conkeror
--
Morgan Veyret (patzy at appart.kicks-ass.net)
http://appart.kicks-ass.net/patzy
-------------- next part --------------
>From 3fa4efb60af3ac96c9ffae2e3bca9fec7e9a411b Mon Sep 17 00:00:00 2001
From: Morgan Veyret <patzy at appart.kicks-ass.net>
Date: Sat, 20 Sep 2008 11:27:08 +0200
Subject: [PATCH] Fixed docstring for download_buffer_automatic_open_in_own_window variable.
---
modules/download-manager.js | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/modules/download-manager.js b/modules/download-manager.js
index 318c26d..6c8b157 100644
--- a/modules/download-manager.js
+++ b/modules/download-manager.js
@@ -1012,9 +1012,8 @@ define_variable("download_buffer_automatic_open_target", OPEN_NEW_WINDOW,
"`download_added_hook', as it is by default.");
define_variable("download_buffer_automatic_open_in_own_window", false,
- "Target for download buffers created by the `open_download_buffer_automatically' function.\n" +
- "This variable takes effect only if `open_download_buffer_auotmatically' is in " +
- "`download_added_hook', as it is by default.");
+ "If true OPEN_NEW_BUFFER and OPEN_NEW_BUFFER_BACKGROUND targets for download buffers are "+
+ "created in a single separate window.\n Defaults to false.\n")
function open_download_buffer_automatically(info) {
--
1.5.5.1
More information about the Conkeror
mailing list