diff --git a/.gitignore b/.gitignore
index f24cd99..25845cf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,6 @@ pip-log.txt
#Mr Developer
.mr.developer.cfg
+
+# temporary developer link dir
+temp
\ No newline at end of file
diff --git a/autoshutdown/core.py b/autoshutdown/core.py
index be0ebbf..5bd0043 100644
--- a/autoshutdown/core.py
+++ b/autoshutdown/core.py
@@ -142,6 +142,12 @@ def power_action(self):
self.os_hibernate()
elif self.config["system_state"] == 'suspend':
self.os_suspend()
+ elif self.config["system_state"] == 'close':
+ self.close_app()
+
+ def close_app(self):
+ log.info("[AutoShutDown] Closing Deluge...")
+ component.get('MainWindow').quit(shutdown=True)
def os_suspend(self):
log.info("[AutoShutDown] Suspending...")
diff --git a/autoshutdown/data/config.glade b/autoshutdown/data/config.glade
index b81f5ba..384facb 100644
--- a/autoshutdown/data/config.glade
+++ b/autoshutdown/data/config.glade
@@ -86,6 +86,23 @@
3
+
+
+ Close Deluge
+ True
+ True
+ False
+ 10
+ True
+ True
+ button_shutdown
+
+
+ False
+ False
+ 4
+
+
Only once, then Do Nothing
@@ -99,7 +116,7 @@
False
False
- 4
+ 5
diff --git a/autoshutdown/gtkui.py b/autoshutdown/gtkui.py
index f1d7355..da6dcb1 100644
--- a/autoshutdown/gtkui.py
+++ b/autoshutdown/gtkui.py
@@ -69,6 +69,8 @@ def on_apply_prefs(self):
config["system_state"] = "shutdown"
elif self.glade.get_widget("button_suspend").get_active():
config["system_state"] = "suspend"
+ elif self.glade.get_widget("button_close").get_active():
+ config["system_state"] = "close"
if self.glade.get_widget("once_check").get_active():
config["once"] = True
else:
@@ -89,6 +91,8 @@ def cb_get_config(self, config):
"hibernate" == config["system_state"])
self.glade.get_widget("button_suspend").set_active(
"suspend" == config["system_state"])
+ self.glade.get_widget("button_close").set_active(
+ "close" == config["system_state"])
self.glade.get_widget("once_check").set_active(config["once"])
self.glade.get_widget("button_disable").set_active(
not config["enabled"] or not config["system_state"])
diff --git a/create_dev_link.sh b/create_dev_link.sh
index aba330d..9c17920 100755
--- a/create_dev_link.sh
+++ b/create_dev_link.sh
@@ -1,6 +1,26 @@
#!/bin/bash
-mkdir temp
+
+cd $(dirname "${0}")
+
export PYTHONPATH=./temp
-python setup.py build develop --install-dir ./temp
-cp ./temp/AutoShutdown.egg-link ~/.config/deluge/plugins
-rm -fr ./temp
+
+# Linux, BSD and Mac OSX
+TARGET_DIR="~/.config/deluge/plugins"
+
+# Windows
+if [ ! -z "${APPDATA}" ];
+then
+ TARGET_DIR="${APPDATA}/deluge/plugins"
+fi
+
+if [ ! -d "${PYTHONPATH}" ]; then
+ mkdir ${PYTHONPATH}
+fi
+
+find ${PYTHONPATH} -mindepth 1 -delete
+
+python setup.py build develop --install-dir ${PYTHONPATH}
+
+if [ -d "${TARGET_DIR}" ]; then
+ cp ${PYTHONPATH}/AutoShutdown.egg-link ${TARGET_DIR}
+fi
diff --git a/setup.py b/setup.py
index 5d4d8d1..94d9f59 100644
--- a/setup.py
+++ b/setup.py
@@ -43,12 +43,12 @@
__plugin_name__ = "AutoShutdown"
__author__ = "Calum Lind"
__author_email__ = "calumlind@gmail.com"
-__version__ = "1.5.0"
+__version__ = "1.5.1"
__url__ = "https://github.com/cas--/autoshutdown/"
__license__ = "GPLv3"
-__description__ = "Shutdown your system once torrents are complete"
+__description__ = "Shutdown your system or close Deluge once torrents are complete"
__long_description__ = """
-A plugin to automatically suspend, hibernate or shutdown your system.
+A plugin to automatically suspend, hibernate or shutdown your system (can also close Deluge app).
Works on Linux and Windows but not OS X.
"""