Index: libs/libmyth/mythcontext.cpp
===================================================================
--- libs/libmyth/mythcontext.cpp	(revision 15129)
+++ libs/libmyth/mythcontext.cpp	(working copy)
@@ -2530,6 +2530,11 @@
     (void) SaveSettingOnHost(key, newValue, d->m_localhostname);
 }
 
+void MythContext::SaveGlobalSetting(const QString &key, const QString &newValue)
+{
+    (void) SaveSettingOnHost(key, newValue, NULL);
+}
+
 bool MythContext::SaveSettingOnHost(const QString &key,
                                     const QString &newValue,
                                     const QString &host)
Index: libs/libmyth/mythcontext.h
===================================================================
--- libs/libmyth/mythcontext.h	(revision 15129)
+++ libs/libmyth/mythcontext.h	(working copy)
@@ -342,6 +342,7 @@
 
     void SaveSetting(const QString &key, int newValue);
     void SaveSetting(const QString &key, const QString &newValue);
+    void SaveGlobalSetting(const QString &key, const QString &value);
     QString GetSetting(const QString &key, const QString &defaultval = "");
     bool SaveSettingOnHost(const QString &key, const QString &newValue,
                            const QString &host);
Index: programs/mythshutdown/main.cpp
===================================================================
--- programs/mythshutdown/main.cpp	(revision 15129)
+++ programs/mythshutdown/main.cpp	(working copy)
@@ -15,70 +15,16 @@
 #include "tv.h"
 #include "compat.h"
 
-void setGlobalSetting(const QString &key, const QString &value)
-{
-    MSqlQuery query(MSqlQuery::InitCon());
-    if (query.isConnected())
-    {
-        query.prepare("DELETE FROM settings WHERE value = :KEY;");
-        query.bindValue(":KEY", key);
-
-        if (!query.exec() || !query.isActive())
-            MythContext::DBError("Clear setting", query);
-
-        query.prepare("INSERT INTO settings ( value, data ) "
-                "VALUES ( :VALUE, :DATA );");
-        query.bindValue(":VALUE", key);
-        query.bindValue(":DATA", value);
-
-        if (!query.exec() || !query.isActive())
-            MythContext::DBError("Save new global setting", query);
-    }
-    else
-    {
-        VERBOSE(VB_IMPORTANT,
-                QString("Database not open while trying to save setting: %1")
-                        .arg(key));
-    }
-}
-
-QString getGlobalSetting(const QString &key, const QString &defaultval)
-{
-    QString value = defaultval;
-
-    MSqlQuery query(MSqlQuery::InitCon());
-    if (query.isConnected())
-    {
-        query.prepare("SELECT data FROM settings WHERE value = :KEY AND "
-                      "hostname IS NULL;");
-        query.bindValue(":KEY", key);
-        query.exec();
-        if (query.isActive() && query.size() > 0)
-        {
-            query.next();
-            value = QString::fromUtf8(query.value(0).toString());
-        }
-    }
-    else
-    {
-        VERBOSE(VB_IMPORTANT, 
-                QString("Database not open while trying to load setting: %1")
-                        .arg(key));
-    }
-
-    return value;
-}
-
 int lockShutdown()
 {
     VERBOSE(VB_GENERAL, "Mythshutdown: --lock");
 
-    QString value_str = getGlobalSetting("MythShutdownLock", "0");
+    QString value_str = gContext->GetSetting("MythShutdownLock", "0");
     bool isNumber = false;
     ulong value = value_str.toULong(&isNumber);
     if (!isNumber)
         value = 0;
-    setGlobalSetting("MythShutdownLock", QString::number(++value));
+    gContext->SaveGlobalSetting("MythShutdownLock", QString::number(++value));
 
     return 0;
 }
@@ -87,7 +33,7 @@
 {
     VERBOSE(VB_GENERAL, "Mythshutdown: --unlock");
 
-    QString value_str = getGlobalSetting("MythShutdownLock", "0");
+    QString value_str = gContext->GetSetting("MythShutdownLock", "0");
     bool isNumber = false;
     ulong value = value_str.toULong(&isNumber);
     if (!isNumber)
@@ -95,7 +41,7 @@
     // Prevent going negative
     if (value == 0)
         ++value;
-    setGlobalSetting("MythShutdownLock", QString::number(--value));
+    gContext->SaveGlobalSetting("MythShutdownLock", QString::number(--value));
 
     return 0;
 }
@@ -112,7 +58,7 @@
 
 QDateTime getDailyWakeupTime(QString sPeriod)
 {
-    QString sTime = getGlobalSetting(sPeriod, "00:00");
+    QString sTime = gContext->GetSetting(sPeriod, "00:00");
     QTime tTime = QTime::fromString(sTime);
     QDateTime dtDateTime = QDateTime(QDate::currentDate(), tTime);
 
@@ -209,7 +155,7 @@
         res += 8;
     }
 
-    if (getGlobalSetting("MythShutdownLock", "0") != "0")
+    if (gContext->GetSetting("MythShutdownLock", "0") != "0")
     {
         VERBOSE(VB_IMPORTANT, "Shutdown is locked");
         res += 16;
@@ -339,7 +285,7 @@
         return 1;
     }
 
-    setGlobalSetting("MythShutdownNextScheduled", dtWakeupTime.toString(Qt::ISODate));
+    gContext->SaveGlobalSetting("MythShutdownNextScheduled", dtWakeupTime.toString(Qt::ISODate));
 
     return 0;
 }
@@ -500,7 +446,7 @@
 
     // get next scheduled wake up for a recording if any
     QDateTime dtNextRecordingStart = QDateTime();
-    QString s = getGlobalSetting("MythShutdownNextScheduled", "");
+    QString s = gContext->GetSetting("MythShutdownNextScheduled", "");
     if (s != "")
         dtNextRecordingStart = QDateTime::fromString(s, Qt::ISODate);
 
@@ -521,7 +467,7 @@
                                   "schedule deleted"); 
 
             dtNextRecordingStart = QDateTime();
-            setGlobalSetting("MythShutdownNextScheduled", "");
+            gContext->SaveGlobalSetting("MythShutdownNextScheduled", "");
         }
     }
 
@@ -573,7 +519,7 @@
     }
 
     // save the next wakuptime in the db
-    setGlobalSetting("MythShutdownWakeupTime", dtWakeupTime.toString(Qt::ISODate));
+    gContext->SaveGlobalSetting("MythShutdownWakeupTime", dtWakeupTime.toString(Qt::ISODate));
 
     // stop here to debug  
     //return 0;
@@ -681,7 +627,7 @@
 
     int res = 0;
     QDateTime startupTime = QDateTime();
-    QString s = getGlobalSetting("MythshutdownWakeupTime", "");
+    QString s = gContext->GetSetting("MythshutdownWakeupTime", "");
     if (s != "")
         startupTime = QDateTime::fromString(s, Qt::ISODate);
 
