OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 | 66 |
67 instance = s_instance; | 67 instance = s_instance; |
68 } | 68 } |
69 s_criticalSectionLocal.Unlock(); | 69 s_criticalSectionLocal.Unlock(); |
70 | 70 |
71 return instance; | 71 return instance; |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 bool CPluginSettings::HasInstance() | |
76 { | |
77 bool hasInstance = true; | |
78 | |
79 s_criticalSectionLocal.Lock(); | |
80 { | |
81 hasInstance = s_instance != NULL; | |
82 } | |
83 s_criticalSectionLocal.Unlock(); | |
84 | |
85 return hasInstance; | |
86 } | |
87 | |
88 bool CPluginSettings::IsPluginEnabled() const | 75 bool CPluginSettings::IsPluginEnabled() const |
89 { | 76 { |
90 return GetPluginEnabled(); | 77 return GetPluginEnabled(); |
91 } | 78 } |
92 | 79 |
93 std::map<CString, CString> CPluginSettings::GetFilterLanguageTitleList() const | 80 std::map<CString, CString> CPluginSettings::GetFilterLanguageTitleList() const |
94 { | 81 { |
95 std::vector<SubscriptionDescription> subscriptions = CPluginClient::GetInstanc
e()->FetchAvailableSubscriptions(); | 82 std::vector<SubscriptionDescription> subscriptions = CPluginClient::GetInstanc
e()->FetchAvailableSubscriptions(); |
96 | 83 |
97 std::map<CString, CString> filterList; | 84 std::map<CString, CString> filterList; |
98 for (size_t i = 0; i < subscriptions.size(); i ++) | 85 for (size_t i = 0; i < subscriptions.size(); i ++) |
99 { | 86 { |
100 SubscriptionDescription it = subscriptions[i]; | 87 SubscriptionDescription it = subscriptions[i]; |
101 filterList.insert(std::make_pair(CString(it.url.c_str()), CString(it.title.c
_str()))); | 88 filterList.insert(std::make_pair(CString(it.url.c_str()), CString(it.title.c
_str()))); |
102 } | 89 } |
103 return filterList; | 90 return filterList; |
104 } | 91 } |
105 | 92 |
106 void CPluginSettings::TogglePluginEnabled() | 93 void CPluginSettings::TogglePluginEnabled() |
107 { | 94 { |
108 CPluginClient::GetInstance()->TogglePluginEnabled(); | 95 CPluginClient::GetInstance()->TogglePluginEnabled(); |
109 } | 96 } |
110 bool CPluginSettings::GetPluginEnabled() const | 97 bool CPluginSettings::GetPluginEnabled() const |
111 { | 98 { |
112 return CPluginClient::GetInstance()->GetPref(L"enabled", true); | 99 return CPluginClient::GetInstance()->GetPref(L"enabled", true); |
113 } | 100 } |
114 | 101 |
115 | 102 |
116 void CPluginSettings::AddError(const CString& error, const CString& errorCode) | |
117 { | |
118 DEBUG_SETTINGS(L"SettingsTab::AddError error:" + error + " code:" + errorCode) | |
119 } | |
120 | |
121 | |
122 // ============================================================================ | 103 // ============================================================================ |
123 // Whitelist settings | 104 // Whitelist settings |
124 // ============================================================================ | 105 // ============================================================================ |
125 | 106 |
126 void CPluginSettings::ClearWhitelist() | 107 void CPluginSettings::ClearWhitelist() |
127 { | 108 { |
128 s_criticalSectionLocal.Lock(); | 109 s_criticalSectionLocal.Lock(); |
129 { | 110 { |
130 m_whitelistedDomains.clear(); | 111 m_whitelistedDomains.clear(); |
131 } | 112 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 222 |
242 CString CPluginSettings::GetAppLocale() | 223 CString CPluginSettings::GetAppLocale() |
243 { | 224 { |
244 return ToCString(GetBrowserLanguage()); | 225 return ToCString(GetBrowserLanguage()); |
245 } | 226 } |
246 | 227 |
247 CString CPluginSettings::GetDocumentationLink() | 228 CString CPluginSettings::GetDocumentationLink() |
248 { | 229 { |
249 return CString(CPluginClient::GetInstance()->GetDocumentationLink().c_str()); | 230 return CString(CPluginClient::GetInstance()->GetDocumentationLink().c_str()); |
250 } | 231 } |
OLD | NEW |