[Xfce4-commits] <midori:master> Show configured tool in command line DM description
Christian Dywan
noreply at xfce.org
Thu Sep 20 23:46:01 CEST 2012
Updating branch refs/heads/master
to 01c68cb0a493300137169cb9454297144cf7c886 (commit)
from f449cc62eb0b982c0fd873a9edebb35c1cf862bf (commit)
commit 01c68cb0a493300137169cb9454297144cf7c886
Author: Christian Dywan <christian at twotoasts.de>
Date: Thu Sep 20 21:41:04 2012 +0200
Show configured tool in command line DM description
extensions/external-download-manager.vala | 29 +++++++++++++++++++++++++++--
midori/midori.vapi | 1 +
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/extensions/external-download-manager.vala b/extensions/external-download-manager.vala
index b8c6014..672e6d4 100644
--- a/extensions/external-download-manager.vala
+++ b/extensions/external-download-manager.vala
@@ -232,6 +232,7 @@ namespace EDM {
switch (response_id) {
case ResponseType.APPLY:
this.commandline.set_string ("commandline", this.input.get_text ());
+ this.commandline.update_description (this.commandline.get_app ());
this.destroy ();
break;
case ResponseType.CANCEL:
@@ -286,16 +287,40 @@ namespace EDM {
return false;
}
+ #if HAVE_WIN32
+ string default_commandline = "\"%s\\FlashGet\\flashget.exe\" {URL}".printf (Environment.get_variable ("ProgramFiles"));
+ #else
+ const string default_commandline = "wget --no-check-certificate --referer={REFERER} --header={COOKIES} {URL}";
+ #endif
+
+ static string description_with_command (string commandline) {
+ string command;
+ try {
+ string[] argvp;
+ Shell.parse_argv (commandline, out argvp);
+ command = argvp[0];
+ }
+ catch (Error error) {
+ command = commandline.split (" ")[0];
+ }
+ return _("Download files with \"%s\" or a custom command").printf (command);
+ }
+
+ internal void update_description (Midori.App app) {
+ this.description = description_with_command (get_string ("commandline"));
+ }
+
internal CommandLine () {
GLib.Object (name: _("External Download Manager - CommandLine"),
- description: _("Download files with a specified command"),
+ description: description_with_command (default_commandline),
version: "0.1" + Midori.VERSION_SUFFIX,
authors: "André Stösel <andre at stoesel.de>",
key: "commandline");
- this.install_string ("commandline", "wget --no-check-certificate --referer={REFERER} --header={COOKIES} {URL}");
+ this.install_string ("commandline", default_commandline);
this.activate.connect (activated);
+ this.activate.connect (update_description);
this.deactivate.connect (deactivated);
this.open_preferences.connect (show_preferences);
}
diff --git a/midori/midori.vapi b/midori/midori.vapi
index 1042d0a..2d5f13b 100644
--- a/midori/midori.vapi
+++ b/midori/midori.vapi
@@ -124,6 +124,7 @@ namespace Midori {
public string key { get; set; }
public signal void activate (Midori.App app);
+ public signal bool is_prepared ();
public signal void deactivate ();
public signal void open_preferences ();
}
More information about the Xfce4-commits
mailing list