Skip to content

Commit

Permalink
Places multi devices notif fix + some clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
thewaiter committed May 30, 2018
1 parent 279e8e6 commit abd20f1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/modules/places/e_mod_main.c
Expand Up @@ -127,10 +127,11 @@ e_modapi_init(E_Module *m)
"inconvenience.<br>"); "inconvenience.<br>");
} }
} }

/* if we don't have a config yet, or it got erased above, /* if we don't have a config yet, or it got erased above,
* then create a default one */ * then create a default one */
if (!places_conf) _places_conf_new(); if (!places_conf) _places_conf_new();
E_CONFIG_LIMIT(places_conf->alert_p, 0, 100);
E_CONFIG_LIMIT(places_conf->alert_timeout, 0, 300);


places_conf->module = m; places_conf->module = m;
e_gadcon_provider_register(&_gc_class); e_gadcon_provider_register(&_gc_class);
Expand Down
4 changes: 2 additions & 2 deletions src/modules/places/e_mod_main.h
Expand Up @@ -31,8 +31,8 @@ struct _Config
unsigned char show_root; unsigned char show_root;
unsigned char show_temp; unsigned char show_temp;
unsigned char show_bookm; unsigned char show_bookm;
int alert_p; int alert_p;
int alert_timeout; int alert_timeout;
}; };


typedef struct _Config_Item Config_Item; typedef struct _Config_Item Config_Item;
Expand Down
29 changes: 15 additions & 14 deletions src/modules/places/e_mod_places.c
Expand Up @@ -33,7 +33,7 @@ void _places_header_activated_cb(void *data __UNUSED__, Evas_Object *o __UNUSED_
static Ecore_Timer *poller = NULL; static Ecore_Timer *poller = NULL;
static char theme_file[PATH_MAX]; static char theme_file[PATH_MAX];
Eina_List *volumes = NULL; Eina_List *volumes = NULL;
static int perc_backup = 0; static int perc_backup[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};




/* Implementation */ /* Implementation */
Expand Down Expand Up @@ -533,6 +533,7 @@ _places_poller(void *data __UNUSED__)
Eina_List *l; Eina_List *l;
long long new; long long new;
int percent; int percent;
int i=0;
static E_Notification *notification; static E_Notification *notification;
char diskname[200]; char diskname[200];
char diskpercent[200]; char diskpercent[200];
Expand All @@ -550,21 +551,21 @@ _places_poller(void *data __UNUSED__)


#ifdef HAVE_ENOTIFY #ifdef HAVE_ENOTIFY
if ((places_conf->alert_p > 0) && (percent > places_conf->alert_p) if ((places_conf->alert_p > 0) && (percent > places_conf->alert_p)
&& (percent > perc_backup)) && (percent > perc_backup[i]))
{ {
sprintf(diskname,_("Disk %s is full!"), vol->label); //~ sprintf(diskname,_("Disk ""%s"" is full!"), vol->label);
sprintf(diskpercent,_("Disk usage is %d %%!"), percent); sprintf(diskname,_("Places warning!"));

sprintf(diskpercent,_("Disk ''%s'' usage is %d %%!"), vol->label, percent);
notification = e_notification_full_new
( notification = e_notification_full_new
_("Places"),0,"dialog_error", diskname, (_("Places"),0,"dialog_error", diskname,
diskpercent, places_conf->alert_timeout * 1000 diskpercent, places_conf->alert_timeout * 1000);
); e_notification_send(notification, NULL, NULL);
e_notification_send(notification, NULL, NULL); e_notification_unref(notification);
e_notification_unref(notification); notification = NULL;
notification = NULL;
} }
perc_backup = percent; perc_backup[i] = percent;
i++;
#endif #endif


places_volume_update(vol); places_volume_update(vol);
Expand Down

0 comments on commit abd20f1

Please sign in to comment.