CoUninitialize();\r
}\r
}\r
+\r
+#elif defined(__WXGTK__)\r
+\r
+//\r
+// Follow the Desktop Application Autostart Spec:\r
+// http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html\r
+//\r
+\r
+boost::filesystem::path GetAutostartDir()\r
+{\r
+ namespace fs = boost::filesystem;\r
+\r
+ char* pszConfigHome = getenv("XDG_CONFIG_HOME");\r
+ if (pszConfigHome) return fs::path(pszConfigHome) / fs::path("autostart");\r
+ char* pszHome = getenv("HOME");\r
+ if (pszHome) return fs::path(pszHome) / fs::path(".config/autostart");\r
+ return fs::path();\r
+}\r
+\r
+boost::filesystem::path GetAutostartFilePath()\r
+{\r
+ return GetAutostartDir() / boost::filesystem::path("bitcoin.desktop");\r
+}\r
+\r
+bool GetStartOnSystemStartup()\r
+{\r
+ boost::filesystem::ifstream optionFile(GetAutostartFilePath());\r
+ if (!optionFile.good())\r
+ return false;\r
+ // Scan through file for "Hidden=true":\r
+ string line;\r
+ while (!optionFile.eof())\r
+ {\r
+ getline(optionFile, line);\r
+ if (line.find("Hidden") != string::npos &&\r
+ line.find("true") != string::npos)\r
+ return false;\r
+ }\r
+ optionFile.close();\r
+\r
+ return true;\r
+}\r
+\r
+void SetStartOnSystemStartup(bool fAutoStart)\r
+{\r
+ if (!fAutoStart)\r
+ {\r
+ unlink(GetAutostartFilePath().native_file_string().c_str());\r
+ }\r
+ else\r
+ {\r
+ boost::filesystem::create_directories(GetAutostartDir());\r
+\r
+ boost::filesystem::ofstream optionFile(GetAutostartFilePath(), ios_base::out|ios_base::trunc);\r
+ if (!optionFile.good())\r
+ {\r
+ wxMessageBox(_("Cannot write autostart/bitcoin.desktop file"), "Bitcoin");\r
+ return;\r
+ }\r
+ // Write a bitcoin.desktop file to the autostart directory:\r
+ char pszExePath[MAX_PATH+1];\r
+ memset(pszExePath, 0, sizeof(pszExePath));\r
+ readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1);\r
+ optionFile << "[Desktop Entry]\n";\r
+ optionFile << "Type=Application\n";\r
+ optionFile << "Name=Bitcoin\n";\r
+ optionFile << "Exec=" << pszExePath << "\n";\r
+ optionFile << "Terminal=false\n";\r
+ optionFile << "Hidden=false\n";\r
+ optionFile.close();\r
+ }\r
+}\r
#else\r
+\r
+// TODO: OSX startup stuff; see:\r
+// http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPSystemStartup/Articles/CustomLogin.html\r
+\r
bool GetStartOnSystemStartup() { return false; }\r
void SetStartOnSystemStartup(bool fAutoStart) { }\r
+\r
#endif\r
\r
\r