summaryrefslogtreecommitdiff
path: root/src/lib/efreet
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2018-04-27 14:35:13 +0200
committerStefan Schmidt <stefan@osg.samsung.com>2018-04-27 14:35:13 +0200
commit18b6b1248d79627982390dbd3d2b11ce2e7f238e (patch)
tree1b0a340a9b6656dd80d3525b8f7c55dddf9c717e /src/lib/efreet
parent51f54192925925b4d7986bf9fa32fea97fed0665 (diff)
efreet: add method for disabling efreetd connection
Summary: some minimal applications, such as test suites, may want to disable this if they are not in need of any of the functionality that is provided @feature Depends on D5965 Reviewers: cedric, stefan_schmidt Reviewed By: cedric Subscribers: stefan_schmidt, cedric Differential Revision: https://phab.enlightenment.org/D5966
Diffstat (limited to 'src/lib/efreet')
-rw-r--r--src/lib/efreet/Efreet.h12
-rw-r--r--src/lib/efreet/efreet_cache.c48
2 files changed, 56 insertions, 4 deletions
diff --git a/src/lib/efreet/Efreet.h b/src/lib/efreet/Efreet.h
index 921ae52476..77a994f775 100644
--- a/src/lib/efreet/Efreet.h
+++ b/src/lib/efreet/Efreet.h
@@ -149,6 +149,18 @@ EAPI int efreet_shutdown(void);
149 */ 149 */
150EAPI void efreet_lang_reset(void); 150EAPI void efreet_lang_reset(void);
151 151
152/**
153 * @brief Disables connecting to efreet cache for this process.
154 * @since 1.21
155 */
156EAPI void efreet_cache_disable(void);
157
158/**
159 * @brief Enables connecting to efreet cache for this process.
160 * @since 1.21
161 */
162EAPI void efreet_cache_enable(void);
163
152#undef EAPI 164#undef EAPI
153#define EAPI 165#define EAPI
154 166
diff --git a/src/lib/efreet/efreet_cache.c b/src/lib/efreet/efreet_cache.c
index 052e709b07..5801509cb6 100644
--- a/src/lib/efreet/efreet_cache.c
+++ b/src/lib/efreet/efreet_cache.c
@@ -99,6 +99,8 @@ static void icon_cache_update_free(void *data, void *ev);
99 99
100static void *hash_array_string_add(void *hash, const char *key, void *data); 100static void *hash_array_string_add(void *hash, const char *key, void *data);
101 101
102static Eina_Bool disable_cache;
103
102EAPI int EFREET_EVENT_ICON_CACHE_UPDATE = 0; 104EAPI int EFREET_EVENT_ICON_CACHE_UPDATE = 0;
103EAPI int EFREET_EVENT_DESKTOP_CACHE_UPDATE = 0; 105EAPI int EFREET_EVENT_DESKTOP_CACHE_UPDATE = 0;
104EAPI int EFREET_EVENT_DESKTOP_CACHE_BUILD = 0; 106EAPI int EFREET_EVENT_DESKTOP_CACHE_BUILD = 0;
@@ -162,6 +164,8 @@ _cb_server_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
162 double t; 164 double t;
163 IPC_HEAD(Del); 165 IPC_HEAD(Del);
164 ipc = NULL; 166 ipc = NULL;
167
168 if (disable_cache) return ECORE_CALLBACK_RENEW;
165 if (reconnect_count > 10) 169 if (reconnect_count > 10)
166 { 170 {
167 reconnect_timer = NULL; 171 reconnect_timer = NULL;
@@ -188,7 +192,9 @@ _efreet_cache_reset()
188 int len = 0; 192 int len = 0;
189 193
190 if (ipc) ecore_ipc_server_del(ipc); 194 if (ipc) ecore_ipc_server_del(ipc);
191 ipc = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, "efreetd", 0, NULL); 195 ipc = NULL;
196 if (!disable_cache)
197 ipc = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, "efreetd", 0, NULL);
192 if (!ipc) return; 198 if (!ipc) return;
193 199
194 s = efreet_language_get(); 200 s = efreet_language_get();
@@ -316,8 +322,13 @@ efreet_cache_init(void)
316 pfx = eina_prefix_new 322 pfx = eina_prefix_new
317 (NULL, efreet_icon_cache_file, "EFREET", "efreet", "checkme", 323 (NULL, efreet_icon_cache_file, "EFREET", "efreet", "checkme",
318 PACKAGE_BIN_DIR, PACKAGE_LIB_DIR, PACKAGE_DATA_DIR, PACKAGE_DATA_DIR); 324 PACKAGE_BIN_DIR, PACKAGE_LIB_DIR, PACKAGE_DATA_DIR, PACKAGE_DATA_DIR);
319 ipc = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, "efreetd", 0, NULL); 325 if (disable_cache)
320 if (!ipc) _ipc_launch(); 326 ipc = NULL;
327 else
328 {
329 ipc = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, "efreetd", 0, NULL);
330 if (!ipc) _ipc_launch();
331 }
321 if (ipc) 332 if (ipc)
322 { 333 {
323 const char *s; 334 const char *s;
@@ -337,7 +348,8 @@ efreet_cache_init(void)
337 { 348 {
338 Efreet_Event_Cache_Update *ev; 349 Efreet_Event_Cache_Update *ev;
339 350
340 WRN("Can't contact efreetd daemon for desktop/icon etc. changes"); 351 if (!disable_cache)
352 WRN("Can't contact efreetd daemon for desktop/icon etc. changes");
341 ev = NEW(Efreet_Event_Cache_Update, 1); 353 ev = NEW(Efreet_Event_Cache_Update, 1);
342 if (ev) 354 if (ev)
343 { 355 {
@@ -1340,3 +1352,31 @@ hash_array_string_add(void *hash, const char *key, void *data)
1340 eina_hash_add(hash, key, data); 1352 eina_hash_add(hash, key, data);
1341 return hash; 1353 return hash;
1342} 1354}
1355
1356EAPI void
1357efreet_cache_disable(void)
1358{
1359 Eina_Bool prev = disable_cache;
1360
1361 disable_cache = EINA_TRUE;
1362
1363 if (_efreet_cache_log_dom < 0) return; // not yet initialized
1364 if (prev == disable_cache) return; // same value
1365 if (ipc)
1366 {
1367 ecore_ipc_server_del(ipc);
1368 ipc = NULL;
1369 }
1370}
1371
1372EAPI void
1373efreet_cache_enable(void)
1374{
1375 Eina_Bool prev = disable_cache;
1376
1377 disable_cache = EINA_FALSE;
1378
1379 if (_efreet_cache_log_dom < 0) return; // not yet initialized
1380 if (prev == disable_cache) return; // same value
1381 if (!ipc) _ipc_launch();
1382}