aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
parenteolian_mono: remove non existing file references for distcheck (diff)
downloadefl-18b6b1248d79627982390dbd3d2b11ce2e7f238e.tar.gz
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 https://phab.enlightenment.org/D5965 Reviewers: cedric, stefan_schmidt Reviewed By: cedric Subscribers: stefan_schmidt, cedric Differential Revision: https://phab.enlightenment.org/D5966
Diffstat (limited to 'src')
-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);
*/
EAPI void efreet_lang_reset(void);
+/**
+ * @brief Disables connecting to efreet cache for this process.
+ * @since 1.21
+ */
+EAPI void efreet_cache_disable(void);
+
+/**
+ * @brief Enables connecting to efreet cache for this process.
+ * @since 1.21
+ */
+EAPI void efreet_cache_enable(void);
+
#undef EAPI
#define EAPI
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);
static void *hash_array_string_add(void *hash, const char *key, void *data);
+static Eina_Bool disable_cache;
+
EAPI int EFREET_EVENT_ICON_CACHE_UPDATE = 0;
EAPI int EFREET_EVENT_DESKTOP_CACHE_UPDATE = 0;
EAPI int EFREET_EVENT_DESKTOP_CACHE_BUILD = 0;
@@ -162,6 +164,8 @@ _cb_server_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
double t;
IPC_HEAD(Del);
ipc = NULL;
+
+ if (disable_cache) return ECORE_CALLBACK_RENEW;
if (reconnect_count > 10)
{
reconnect_timer = NULL;
@@ -188,7 +192,9 @@ _efreet_cache_reset()
int len = 0;
if (ipc) ecore_ipc_server_del(ipc);
- ipc = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, "efreetd", 0, NULL);
+ ipc = NULL;
+ if (!disable_cache)
+ ipc = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, "efreetd", 0, NULL);
if (!ipc) return;
s = efreet_language_get();
@@ -316,8 +322,13 @@ efreet_cache_init(void)
pfx = eina_prefix_new
(NULL, efreet_icon_cache_file, "EFREET", "efreet", "checkme",
PACKAGE_BIN_DIR, PACKAGE_LIB_DIR, PACKAGE_DATA_DIR, PACKAGE_DATA_DIR);
- ipc = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, "efreetd", 0, NULL);
- if (!ipc) _ipc_launch();
+ if (disable_cache)
+ ipc = NULL;
+ else
+ {
+ ipc = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, "efreetd", 0, NULL);
+ if (!ipc) _ipc_launch();
+ }
if (ipc)
{
const char *s;
@@ -337,7 +348,8 @@ efreet_cache_init(void)
{
Efreet_Event_Cache_Update *ev;
- WRN("Can't contact efreetd daemon for desktop/icon etc. changes");
+ if (!disable_cache)
+ WRN("Can't contact efreetd daemon for desktop/icon etc. changes");
ev = NEW(Efreet_Event_Cache_Update, 1);
if (ev)
{
@@ -1340,3 +1352,31 @@ hash_array_string_add(void *hash, const char *key, void *data)
eina_hash_add(hash, key, data);
return hash;
}
+
+EAPI void
+efreet_cache_disable(void)
+{
+ Eina_Bool prev = disable_cache;
+
+ disable_cache = EINA_TRUE;
+
+ if (_efreet_cache_log_dom < 0) return; // not yet initialized
+ if (prev == disable_cache) return; // same value
+ if (ipc)
+ {
+ ecore_ipc_server_del(ipc);
+ ipc = NULL;
+ }
+}
+
+EAPI void
+efreet_cache_enable(void)
+{
+ Eina_Bool prev = disable_cache;
+
+ disable_cache = EINA_FALSE;
+
+ if (_efreet_cache_log_dom < 0) return; // not yet initialized
+ if (prev == disable_cache) return; // same value
+ if (!ipc) _ipc_launch();
+}