Do not poll freespace while the screensaver is on
This commit is contained in:
parent
b682a5f902
commit
efe3ca5115
|
@ -33,6 +33,10 @@ static const char *_places_human_size_get(unsigned long long size);
|
||||||
static void _places_volume_object_update(Volume *vol, Evas_Object *obj);
|
static void _places_volume_object_update(Volume *vol, Evas_Object *obj);
|
||||||
static void _places_run_fm_external(const char *fm, const char *directory);
|
static void _places_run_fm_external(const char *fm, const char *directory);
|
||||||
|
|
||||||
|
/* EcoreEvent callbacks */
|
||||||
|
static Eina_Bool _places_screensaver_on_cb(void *data, int type, void *event);
|
||||||
|
static Eina_Bool _places_screensaver_off_cb(void *data, int type, void *event);
|
||||||
|
|
||||||
/* Edje callbacks */
|
/* Edje callbacks */
|
||||||
void _places_icon_activated_cb(void *data, Evas_Object *o, const char *emission, const char *source);
|
void _places_icon_activated_cb(void *data, Evas_Object *o, const char *emission, const char *source);
|
||||||
void _places_custom_icon_activated_cb(void *data, Evas_Object *o, const char *emission, const char *source);
|
void _places_custom_icon_activated_cb(void *data, Evas_Object *o, const char *emission, const char *source);
|
||||||
|
@ -44,6 +48,9 @@ static char theme_file[PATH_MAX];
|
||||||
static Eina_List *volumes = NULL;
|
static Eina_List *volumes = NULL;
|
||||||
static Ecore_Timer *freespace_timer = NULL;
|
static Ecore_Timer *freespace_timer = NULL;
|
||||||
static Ecore_Thread *freespace_thread = NULL;
|
static Ecore_Thread *freespace_thread = NULL;
|
||||||
|
static Ecore_Event_Handler *places_screensaver_on_handler = NULL;
|
||||||
|
static Ecore_Event_Handler *places_screensaver_off_handler = NULL;
|
||||||
|
#define PLACES_FREESPACE_INTERVAL 3.0
|
||||||
|
|
||||||
|
|
||||||
/* Implementation */
|
/* Implementation */
|
||||||
|
@ -66,12 +73,31 @@ places_init(void)
|
||||||
|
|
||||||
snprintf(theme_file, PATH_MAX, "%s/e-module-places.edj",
|
snprintf(theme_file, PATH_MAX, "%s/e-module-places.edj",
|
||||||
places_conf->module->dir);
|
places_conf->module->dir);
|
||||||
freespace_timer = ecore_timer_add(3.0, _places_freespace_timer_cb, NULL);
|
|
||||||
|
places_screensaver_on_handler =
|
||||||
|
ecore_event_handler_add(E_EVENT_SCREENSAVER_ON,
|
||||||
|
_places_screensaver_on_cb, NULL);
|
||||||
|
places_screensaver_off_handler =
|
||||||
|
ecore_event_handler_add(E_EVENT_SCREENSAVER_OFF,
|
||||||
|
_places_screensaver_off_cb, NULL);
|
||||||
|
|
||||||
|
freespace_timer = ecore_timer_add(PLACES_FREESPACE_INTERVAL,
|
||||||
|
_places_freespace_timer_cb, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
places_shutdown(void)
|
places_shutdown(void)
|
||||||
{
|
{
|
||||||
|
if (places_screensaver_on_handler)
|
||||||
|
{
|
||||||
|
ecore_event_handler_del(places_screensaver_on_handler);
|
||||||
|
places_screensaver_on_handler = NULL;
|
||||||
|
}
|
||||||
|
if (places_screensaver_off_handler)
|
||||||
|
{
|
||||||
|
ecore_event_handler_del(places_screensaver_off_handler);
|
||||||
|
places_screensaver_off_handler = NULL;
|
||||||
|
}
|
||||||
if (freespace_timer)
|
if (freespace_timer)
|
||||||
{
|
{
|
||||||
ecore_timer_del(freespace_timer);
|
ecore_timer_del(freespace_timer);
|
||||||
|
@ -615,6 +641,7 @@ _places_freespace_timer_cb(void *data EINA_UNUSED)
|
||||||
Eina_List *l, *tdl = NULL;
|
Eina_List *l, *tdl = NULL;
|
||||||
FreespaceThreadData *td = NULL;
|
FreespaceThreadData *td = NULL;
|
||||||
|
|
||||||
|
// printf("PLACES: TIMER %.1f\n", ecore_time_get());
|
||||||
if (freespace_thread)
|
if (freespace_thread)
|
||||||
{
|
{
|
||||||
// printf("PLACES: *** SOMETHING WRONG *** thread:%p still running...\n", freespace_thread);
|
// printf("PLACES: *** SOMETHING WRONG *** thread:%p still running...\n", freespace_thread);
|
||||||
|
@ -643,6 +670,28 @@ _places_freespace_timer_cb(void *data EINA_UNUSED)
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_places_screensaver_on_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
if (freespace_timer)
|
||||||
|
{
|
||||||
|
ecore_timer_del(freespace_timer);
|
||||||
|
freespace_timer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_places_screensaver_off_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
if (!freespace_timer)
|
||||||
|
freespace_timer = ecore_timer_add(PLACES_FREESPACE_INTERVAL,
|
||||||
|
_places_freespace_timer_cb, NULL);
|
||||||
|
|
||||||
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
_places_human_size_get(unsigned long long size)
|
_places_human_size_get(unsigned long long size)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue