formatting

lot of mixed spaces/tabs here made the code unreadable
This commit is contained in:
Mike Blumenkrantz 2017-08-29 15:20:05 -04:00
parent f5e19a7721
commit b5e75eb264
36 changed files with 1270 additions and 1152 deletions

View File

@ -25,7 +25,8 @@ _backlight_gadget_update(Instance *inst)
else
msg.val = inst->val;
if (msg.val < 0.0) msg.val = 0.0;
else if (msg.val > 1.0) msg.val = 1.0;
else if (msg.val > 1.0)
msg.val = 1.0;
edje_object_message_send(elm_layout_edje_get(inst->o_backlight), EDJE_MESSAGE_FLOAT, 0, &msg);
}
@ -312,3 +313,4 @@ backlight_shutdown(void)
}
E_FREE_LIST(handlers, ecore_event_handler_del);
}

View File

@ -26,7 +26,8 @@ struct _Context
E_Menu *menu;
unsigned int notification_id;
struct {
struct
{
E_Action *incr;
E_Action *decr;
E_Action *mute;
@ -399,7 +400,7 @@ _check_changed_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
emix_config_save_state_get();
if (emix_config_save_get()) e_config_save_queue();
/*
*TODO: is it really necessary ? or it will be update
* TODO: is it really necessary ? or it will be update
* with the sink changed hanlder
*/
_mixer_gadget_update();
@ -897,6 +898,7 @@ _sink_input_event(int type, Emix_Sink_Input *input)
pid = _get_ppid(pid);
}
break;
case EMIX_SINK_INPUT_REMOVED_EVENT:
EINA_LIST_FOREACH(_client_sinks, l, sink)
{
@ -908,6 +910,7 @@ _sink_input_event(int type, Emix_Sink_Input *input)
}
}
break;
case EMIX_SINK_INPUT_CHANGED_EVENT:
EINA_LIST_FOREACH(_client_sinks, l, sink)
{
@ -930,12 +933,15 @@ _events_cb(void *data EINA_UNUSED, enum Emix_Event type, void *event_info)
case EMIX_SINK_REMOVED_EVENT:
_sink_event(type, event_info);
break;
case EMIX_DISCONNECTED_EVENT:
_disconnected();
break;
case EMIX_READY_EVENT:
_ready();
break;
case EMIX_SINK_INPUT_ADDED_EVENT:
case EMIX_SINK_INPUT_REMOVED_EVENT:
case EMIX_SINK_INPUT_CHANGED_EVENT:
@ -1083,7 +1089,6 @@ _bd_hook_sink_volume_drag_stop(void *data, Evas_Object *obj, void *event_info EI
elm_check_state_set(check, mute);
}
static void
_bd_hook_sink_mute_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{

View File

@ -141,6 +141,7 @@ _config_update_btn(Evas_Object *button, const int mouse_button)
case 0:
snprintf(lbl, sizeof(lbl), _("Click to set"));
break;
case 1:
if (e_config->mouse_hand == E_MOUSE_HAND_RIGHT)
{
@ -158,10 +159,12 @@ _config_update_btn(Evas_Object *button, const int mouse_button)
icon = "preferences-desktop-mouse-extra";
}
break;
case 2:
snprintf(lbl, sizeof(lbl), _("Middle button"));
icon = "preferences-desktop-mouse-middle";
break;
case 3:
if (e_config->mouse_hand == E_MOUSE_HAND_RIGHT)
{
@ -179,6 +182,7 @@ _config_update_btn(Evas_Object *button, const int mouse_button)
icon = "preferences-desktop-mouse-extra";
}
break;
default:
snprintf(lbl, sizeof(lbl), _("Button %i"), mouse_button);
icon = "preferences-desktop-mouse-extra";

View File

@ -105,3 +105,4 @@ e_modapi_gadget_save(E_Module *m EINA_UNUSED)
e_config_domain_save("module.pager", conf_edd, pager_config);
return 1;
}

View File

@ -178,9 +178,11 @@ _pager_location_get(Instance *inst)
case E_GADGET_SITE_ORIENT_HORIZONTAL:
s = "top";
break;
case E_GADGET_SITE_ORIENT_VERTICAL:
s = "left";
break;
case E_GADGET_SITE_ORIENT_NONE:
s = "left";
break;
@ -193,9 +195,11 @@ _pager_location_get(Instance *inst)
case E_GADGET_SITE_ORIENT_HORIZONTAL:
s = "bottom";
break;
case E_GADGET_SITE_ORIENT_VERTICAL:
s = "left";
break;
case E_GADGET_SITE_ORIENT_NONE:
s = "left";
break;
@ -213,9 +217,11 @@ _pager_location_get(Instance *inst)
case E_GADGET_SITE_ORIENT_HORIZONTAL:
s = "top";
break;
case E_GADGET_SITE_ORIENT_VERTICAL:
s = "right";
break;
case E_GADGET_SITE_ORIENT_NONE:
s = "right";
break;
@ -228,9 +234,11 @@ _pager_location_get(Instance *inst)
case E_GADGET_SITE_ORIENT_HORIZONTAL:
s = "bottom";
break;
case E_GADGET_SITE_ORIENT_VERTICAL:
s = "right";
break;
case E_GADGET_SITE_ORIENT_NONE:
s = "right";
break;
@ -250,9 +258,11 @@ _pager_location_get(Instance *inst)
case E_GADGET_SITE_ORIENT_HORIZONTAL:
s = "bottom";
break;
case E_GADGET_SITE_ORIENT_VERTICAL:
s = "left";
break;
default:
s = "bottom";
break;
@ -316,7 +326,6 @@ _pager_gadget_anchor_change_cb(void *data, Evas_Object *obj, void *event_info EI
}
}
static void
_pager_gadget_created_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
@ -361,13 +370,14 @@ _pager_orient(Instance *inst, E_Gadget_Site_Orient orient)
{
switch (orient)
{
case E_GADGET_SITE_ORIENT_HORIZONTAL:
inst->pager->invert = EINA_FALSE;
break;
case E_GADGET_SITE_ORIENT_VERTICAL:
inst->pager->invert = EINA_TRUE;
break;
default:
inst->pager->invert = EINA_FALSE;
}
@ -445,12 +455,15 @@ _pager_new(Evas *evas, Eina_Bool popup)
case E_POWERSAVE_MODE_HIGH:
p->plain = EINA_TRUE;
break;
case E_POWERSAVE_MODE_EXTREME:
p->plain = EINA_TRUE;
break;
case E_POWERSAVE_MODE_FREEZE:
p->plain = EINA_TRUE;
break;
default:
p->plain = EINA_FALSE;
}
@ -488,13 +501,14 @@ _pager_fill(Pager *p)
orient = e_gadget_site_orient_get(e_gadget_site_get(p->inst->o_pager));
switch (orient)
{
case E_GADGET_SITE_ORIENT_HORIZONTAL:
p->invert = EINA_FALSE;
break;
case E_GADGET_SITE_ORIENT_VERTICAL:
p->invert = EINA_TRUE;
break;
default:
p->invert = EINA_FALSE;
}
@ -1066,7 +1080,7 @@ _button_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
if (_pager_check_modifiers(ev->modifiers)) return;
if (ev->button != 3) return;
if(!pager_config) return;
if (!pager_config) return;
if (cfg_dialog) return;
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
e_gadget_configure(inst->o_pager);
@ -1090,12 +1104,15 @@ _pager_cb_config_gadget_updated(Eina_Bool style_changed)
case E_POWERSAVE_MODE_HIGH:
p->plain = EINA_TRUE;
break;
case E_POWERSAVE_MODE_EXTREME:
p->plain = EINA_TRUE;
break;
case E_POWERSAVE_MODE_FREEZE:
p->plain = EINA_TRUE;
break;
default:
p->plain = EINA_FALSE;
}
@ -1382,8 +1399,8 @@ _pager_window_desk_change(Pager *pager, E_Client *ec)
/* and this pager zone is for this client */
/* see if the window is in this pager at all */
pw = _pager_window_find(pager, ec);
if (pw)
{ /* is it sticky */
if (pw) /* is it sticky */
{
if (ec->sticky)
{
/* if its sticky and in this pager - its already everywhere, so abort
@ -1734,7 +1751,6 @@ _pager_cb_event_client_property(void *data EINA_UNUSED, int type EINA_UNUSED, vo
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_pager_cb_event_zone_desk_count_set(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Zone_Desk_Count_Set *ev)
{
@ -2129,7 +2145,6 @@ _pager_window_cb_drag_finished(E_Drag *drag, int dropped)
else y = 0;
evas_object_move(pw->client->frame, x, y);
if (!(pw->client->lock_user_stacking))
evas_object_raise(pw->client->frame);
evas_object_focus_set(pw->client->frame, 1);

View File

@ -357,7 +357,7 @@ _screensaver_on(void *data)
#if defined(HAVE_EEZE)
Instance *inst = data;
#else
(void) data;
(void)data;
#endif
#if defined(HAVE_EEZE)
@ -417,7 +417,8 @@ _batman_config_updated(Instance *inst)
}
}
static void _warning_popup_dismissed(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
static void
_warning_popup_dismissed(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Instance *inst = data;
@ -425,7 +426,6 @@ static void _warning_popup_dismissed(void *data, Evas_Object *obj EINA_UNUSED, v
E_FREE_FUNC(inst->warning, evas_object_del);
}
static Eina_Bool
_batman_cb_warning_popup_timeout(void *data)
{
@ -613,13 +613,13 @@ sysinfo_batman_remove(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU
#if defined(HAVE_EEZE)
_batman_udev_stop(inst);
#elif defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__)
(void) inst;
(void)inst;
_batman_sysctl_stop();
#elif defined(upower)
(void) inst;
(void)inst;
_batman_upower_stop();
#else
(void) inst;
(void)inst;
_batman_fallback_stop();
#endif
}
@ -707,7 +707,7 @@ _conf_item_get(int *id)
ci = E_NEW(Config_Item, 1);
if (*id != -1)
ci->id = eina_list_count(sysinfo_config->items)+1;
ci->id = eina_list_count(sysinfo_config->items) + 1;
else
ci->id = -1;
@ -755,3 +755,4 @@ batman_create(Evas_Object *parent, int *id, E_Gadget_Site_Orient orient EINA_UNU
return inst->o_main;
}

View File

@ -140,12 +140,15 @@ _suspend_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
case 0:
inst->cfg->batman.suspend_method = SUSPEND;
break;
case 1:
inst->cfg->batman.suspend_method = HIBERNATE;
break;
case 2:
inst->cfg->batman.suspend_method = SHUTDOWN;
break;
default:
inst->cfg->batman.suspend_method = SUSPEND;
}
@ -166,18 +169,23 @@ _poll_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
case 0:
inst->cfg->batman.poll_interval = 4;
break;
case 1:
inst->cfg->batman.poll_interval = 8;
break;
case 2:
inst->cfg->batman.poll_interval = 32;
break;
case 3:
inst->cfg->batman.poll_interval = 64;
break;
case 4:
inst->cfg->batman.poll_interval = 256;
break;
default:
inst->cfg->batman.poll_interval = 32;
}
@ -367,23 +375,28 @@ batman_configure(Instance *inst)
evas_object_smart_callback_add(o, "changed", _poll_changed, bc);
evas_object_show(o);
switch(inst->cfg->batman.poll_interval)
switch (inst->cfg->batman.poll_interval)
{
case 4:
elm_radio_value_set(group, 0);
break;
case 8:
elm_radio_value_set(group, 1);
break;
case 32:
elm_radio_value_set(group, 2);
break;
case 64:
elm_radio_value_set(group, 3);
break;
case 256:
elm_radio_value_set(group, 4);
break;
default:
elm_radio_value_set(group, 2);
}
@ -534,17 +547,20 @@ batman_configure(Instance *inst)
evas_object_smart_callback_add(o, "changed", _suspend_changed, bc);
evas_object_show(o);
switch(inst->cfg->batman.suspend_method)
switch (inst->cfg->batman.suspend_method)
{
case SUSPEND:
elm_radio_value_set(groupy, 0);
break;
case HIBERNATE:
elm_radio_value_set(groupy, 1);
break;
case SHUTDOWN:
elm_radio_value_set(groupy, 2);
break;
default:
elm_radio_value_set(groupy, 0);
}

View File

@ -727,7 +727,6 @@ linux_acpi_cb_acpid_add(void *data EINA_UNUSED,
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
linux_acpi_cb_acpid_del(void *data EINA_UNUSED,
int type EINA_UNUSED,

View File

@ -98,7 +98,7 @@ _batman_sysctl_start(Instance *inst)
sysctlnametomib("hw.acpi.battery.time", bat->mib_time, &len);
bat->mib_units = malloc(sizeof(int) * 4);
if(!bat->mib_units) return 0;
if (!bat->mib_units) return 0;
sysctlnametomib("hw.acpi.battery.units", bat->mib_units, &len);
bat->last_update = ecore_time_get();
@ -175,6 +175,7 @@ _batman_sysctl_battery_update_poll(void *data)
return EINA_TRUE;
}
#endif
static int
@ -324,7 +325,6 @@ _batman_sysctl_battery_update(Instance *inst)
#endif
}
EINA_LIST_FOREACH(batman_device_ac_adapters, l, ac)
{
#if defined(__OpenBSD__) || defined(__NetBSD__)
@ -350,5 +350,3 @@ _batman_sysctl_battery_update(Instance *inst)
return EINA_TRUE;
}

View File

@ -141,7 +141,7 @@ _bat_get_all_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending E
else if (!strcmp(key, "TimeToEmpty"))
{
eldbus_message_iter_arguments_get(variant, "x", &val.i64);
bat->time_left = (int) val.i64;
bat->time_left = (int)val.i64;
if (bat->time_left > 0)
bat->charging = EINA_FALSE;
else
@ -150,27 +150,27 @@ _bat_get_all_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending E
else if (!strcmp(key, "Percentage"))
{
eldbus_message_iter_arguments_get(variant, "d", &val.d);
bat->percent = (int) val.d;
bat->percent = (int)val.d;
}
else if (!strcmp(key, "Energy"))
{
eldbus_message_iter_arguments_get(variant, "d", &val.d);
bat->current_charge = (int) val.d;
bat->current_charge = (int)val.d;
}
else if (!strcmp(key, "EnergyFullDesign"))
{
eldbus_message_iter_arguments_get(variant, "d", &val.d);
bat->design_charge = (int) val.d;
bat->design_charge = (int)val.d;
}
else if (!strcmp(key, "EnergyFull"))
{
eldbus_message_iter_arguments_get(variant, "d", &val.d);
bat->last_full_charge = (int) val.d;
bat->last_full_charge = (int)val.d;
}
else if (!strcmp(key, "TimeToFull"))
{
eldbus_message_iter_arguments_get(variant, "x", &val.i64);
bat->time_full = (int) val.i64;
bat->time_full = (int)val.i64;
}
else if (!strcmp(key, "Technology"))
{
@ -395,3 +395,4 @@ _batman_upower_stop(void)
E_FREE_FUNC(obj, eldbus_object_unref);
E_FREE_FUNC(conn, eldbus_connection_unref);
}

View File

@ -83,6 +83,7 @@ _cpuclock_set_thread_done(void *data EINA_UNUSED, Ecore_Thread *th EINA_UNUSED)
{
return;
}
#endif
void
@ -230,6 +231,7 @@ _cpuclock_event_cb_powersave(void *data, int type, void *event)
eina_stringshare_del(inst->cfg->cpuclock.status->orig_governor);
inst->cfg->cpuclock.status->orig_governor = NULL;
break;
case E_POWERSAVE_MODE_MEDIUM:
case E_POWERSAVE_MODE_HIGH:
if ((inst->cfg->cpuclock.powersave_governor) || (has_conservative))
@ -827,7 +829,7 @@ static void
_cpuclock_cb_frequency_check_main(void *data, Ecore_Thread *th)
{
Thread_Config *thc = data;
for (;;)
for (;; )
{
Cpu_Status *status;
@ -860,9 +862,9 @@ _cpuclock_cb_frequency_check_notify(void *data,
if ((thc->inst->cfg->cpuclock.status) && (status) &&
(
#if defined(__OpenBSD__)
(status->cur_percent != thc->inst->cfg->cpuclock.status->cur_percent ) ||
(status->cur_percent != thc->inst->cfg->cpuclock.status->cur_percent) ||
#endif
(status->cur_frequency != thc->inst->cfg->cpuclock.status->cur_frequency ) ||
(status->cur_frequency != thc->inst->cfg->cpuclock.status->cur_frequency) ||
(status->cur_min_frequency != thc->inst->cfg->cpuclock.status->cur_min_frequency) ||
(status->cur_max_frequency != thc->inst->cfg->cpuclock.status->cur_max_frequency) ||
(status->can_set_frequency != thc->inst->cfg->cpuclock.status->can_set_frequency)))
@ -1002,7 +1004,6 @@ sysinfo_cpuclock_remove(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U
if (inst->cfg->cpuclock.governor)
eina_stringshare_del(inst->cfg->cpuclock.governor);
E_FREE_FUNC(inst->cfg->cpuclock.status, _cpuclock_status_free);
}
static void
@ -1125,7 +1126,7 @@ _conf_item_get(int *id)
ci = E_NEW(Config_Item, 1);
if (*id != -1)
ci->id = eina_list_count(sysinfo_config->items)+1;
ci->id = eina_list_count(sysinfo_config->items) + 1;
else
ci->id = -1;
@ -1166,3 +1167,4 @@ cpuclock_create(Evas_Object *parent, int *id, E_Gadget_Site_Orient orient EINA_U
return inst->o_main;
}

View File

@ -191,18 +191,23 @@ _poll_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
case 0:
inst->cfg->cpuclock.poll_interval = 4;
break;
case 1:
inst->cfg->cpuclock.poll_interval = 8;
break;
case 2:
inst->cfg->cpuclock.poll_interval = 32;
break;
case 3:
inst->cfg->cpuclock.poll_interval = 64;
break;
case 4:
inst->cfg->cpuclock.poll_interval = 256;
break;
default:
inst->cfg->cpuclock.poll_interval = 32;
}
@ -348,23 +353,28 @@ cpuclock_configure(Instance *inst)
evas_object_smart_callback_add(o, "changed", _poll_changed, cc);
evas_object_show(o);
switch(inst->cfg->cpuclock.poll_interval)
switch (inst->cfg->cpuclock.poll_interval)
{
case 4:
elm_radio_value_set(group, 0);
break;
case 8:
elm_radio_value_set(group, 1);
break;
case 32:
elm_radio_value_set(group, 2);
break;
case 64:
elm_radio_value_set(group, 3);
break;
case 256:
elm_radio_value_set(group, 4);
break;
default:
elm_radio_value_set(group, 2);
}

View File

@ -9,7 +9,6 @@
# include <sys/sysctl.h>
#endif
#if defined(__OpenBSD__)
int
_cpuclock_sysctl_frequency(int new_perf)
@ -22,6 +21,7 @@ _cpuclock_sysctl_frequency(int new_perf)
return 0;
}
#elif defined(__FreeBSD__) || defined(__DragonFly__)
int
_cpuclock_sysctl_frequency(int new_perf)
@ -31,4 +31,5 @@ _cpuclock_sysctl_frequency(int new_perf)
return 0;
}
#endif

View File

@ -147,3 +147,4 @@ sys_cpu_pstate(int min, int max, int turbo)
return 1;
}

View File

@ -163,7 +163,7 @@ static void
_cpumonitor_cb_usage_check_main(void *data, Ecore_Thread *th)
{
Thread_Config *thc = data;
for (;;)
for (;; )
{
if (ecore_thread_check(th)) break;
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
@ -474,7 +474,7 @@ _conf_item_get(int *id)
ci = E_NEW(Config_Item, 1);
if (*id != -1)
ci->id = eina_list_count(sysinfo_config->items)+1;
ci->id = eina_list_count(sysinfo_config->items) + 1;
else
ci->id = -1;

View File

@ -15,23 +15,28 @@ _config_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
Instance *inst = data;
int value = elm_radio_value_get(obj);
switch(value)
switch (value)
{
case 0:
inst->cfg->cpumonitor.poll_interval = 4;
break;
case 1:
inst->cfg->cpumonitor.poll_interval = 8;
break;
case 2:
inst->cfg->cpumonitor.poll_interval = 32;
break;
case 3:
inst->cfg->cpumonitor.poll_interval = 64;
break;
case 4:
inst->cfg->cpumonitor.poll_interval = 256;
break;
default:
inst->cfg->cpumonitor.poll_interval = 32;
}
@ -126,23 +131,28 @@ cpumonitor_configure(Instance *inst)
evas_object_smart_callback_add(o, "changed", _config_changed, inst);
evas_object_show(o);
switch(inst->cfg->cpumonitor.poll_interval)
switch (inst->cfg->cpumonitor.poll_interval)
{
case 4:
elm_radio_value_set(group, 0);
break;
case 8:
elm_radio_value_set(group, 1);
break;
case 32:
elm_radio_value_set(group, 2);
break;
case 64:
elm_radio_value_set(group, 3);
break;
case 256:
elm_radio_value_set(group, 4);
break;
default:
elm_radio_value_set(group, 2);
}

View File

@ -22,7 +22,7 @@ _cpumonitor_proc_getcores(void)
}
i++;
}
fclose (f);
fclose(f);
}
return cores;
}
@ -50,7 +50,7 @@ _cpumonitor_proc_getusage(unsigned long *prev_total,
char *line, *tok;
int i = 0;
line = strchr(buf, ' ')+1;
line = strchr(buf, ' ') + 1;
tok = strtok(line, " ");
while (tok)
{
@ -66,7 +66,8 @@ _cpumonitor_proc_getusage(unsigned long *prev_total,
if (total_change != 0)
percent = 100 * (1 - ((float)idle_change / (float)total_change));
if (percent > 100) percent = 100;
else if (percent < 0) percent = 0;
else if (percent < 0)
percent = 0;
*prev_total = total;
*prev_idle = idle;
*prev_percent = percent;
@ -98,7 +99,8 @@ _cpumonitor_proc_getusage(unsigned long *prev_total,
if (total_change != 0)
percent = 100 * (1 - ((float)idle_change / (float)total_change));
if (percent > 100) percent = 100;
else if (percent < 0) percent = 0;
else if (percent < 0)
percent = 0;
core->percent = percent;
core->total = total;
core->idle = idle;

View File

@ -11,7 +11,7 @@
# define CPU_STATES 6
#endif
int
int
_cpumonitor_sysctl_getcores(void)
{
int cores = 0;
@ -25,7 +25,6 @@ _cpumonitor_sysctl_getcores(void)
return cores;
}
void
_cpumonitor_sysctl_getusage(unsigned long *prev_total, unsigned long *prev_idle, int *prev_percent, Eina_List *cores)
{
@ -70,13 +69,13 @@ _cpumonitor_sysctl_getusage(unsigned long *prev_total, unsigned long *prev_idle,
core->total = total;
core->idle = cpu[4];
percent_all += (int) percent;
percent_all += (int)percent;
total_all += total;
idle_all += core->idle;
}
*prev_total = total_all / ncpu;
*prev_idle = idle_all / ncpu;
*prev_percent = (int) (percent_all / ncpu);
*prev_percent = (int)(percent_all / ncpu);
#elif defined(__OpenBSD__)
int ncpu = _cpumonitor_sysctl_getcores();
if (!ncpu) return;
@ -109,7 +108,7 @@ _cpumonitor_sysctl_getusage(unsigned long *prev_total, unsigned long *prev_idle,
*prev_total = total;
*prev_idle = idle; // cpu_times[3];
*prev_percent = (int) percent;
*prev_percent = (int)percent;
}
else if (ncpu > 1)
{
@ -140,7 +139,7 @@ _cpumonitor_sysctl_getusage(unsigned long *prev_total, unsigned long *prev_idle,
core->percent = percent;
percent_all += (int) percent;
percent_all += (int)percent;
total_all += total;
idle_all += core->idle;
}

View File

@ -275,7 +275,7 @@ static void
_memusage_cb_usage_check_main(void *data, Ecore_Thread *th)
{
Thread_Config *thc = data;
for (;;)
for (;; )
{
if (ecore_thread_check(th)) break;
#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
@ -395,7 +395,6 @@ _memusage_removed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_data)
if (inst->o_main != event_data) return;
if (inst->cfg->memusage.popup)
E_FREE_FUNC(inst->cfg->memusage.popup, evas_object_del);
if (inst->cfg->memusage.configure)
@ -502,7 +501,6 @@ sysinfo_memusage_create(Evas_Object *parent, Instance *inst)
_memusage_resize_cb, inst);
evas_object_show(inst->cfg->memusage.o_gadget);
E_LIST_HANDLER_APPEND(inst->cfg->memusage.handlers, E_EVENT_SCREENSAVER_ON, _screensaver_on, inst);
E_LIST_HANDLER_APPEND(inst->cfg->memusage.handlers, E_EVENT_SCREENSAVER_OFF, _screensaver_off, inst);
@ -526,7 +524,7 @@ _conf_item_get(int *id)
ci = E_NEW(Config_Item, 1);
if (*id != -1)
ci->id = eina_list_count(sysinfo_config->items)+1;
ci->id = eina_list_count(sysinfo_config->items) + 1;
else
ci->id = -1;

View File

@ -15,23 +15,28 @@ _config_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
Instance *inst = data;
int value = elm_radio_value_get(obj);
switch(value)
switch (value)
{
case 0:
inst->cfg->memusage.poll_interval = 4;
break;
case 1:
inst->cfg->memusage.poll_interval = 8;
break;
case 2:
inst->cfg->memusage.poll_interval = 32;
break;
case 3:
inst->cfg->memusage.poll_interval = 64;
break;
case 4:
inst->cfg->memusage.poll_interval = 256;
break;
default:
inst->cfg->memusage.poll_interval = 32;
}
@ -126,23 +131,28 @@ memusage_configure(Instance *inst)
evas_object_smart_callback_add(o, "changed", _config_changed, inst);
evas_object_show(o);
switch(inst->cfg->memusage.poll_interval)
switch (inst->cfg->memusage.poll_interval)
{
case 4:
elm_radio_value_set(group, 0);
break;
case 8:
elm_radio_value_set(group, 1);
break;
case 32:
elm_radio_value_set(group, 2);
break;
case 64:
elm_radio_value_set(group, 3);
break;
case 256:
elm_radio_value_set(group, 4);
break;
default:
elm_radio_value_set(group, 2);
}

View File

@ -1,17 +1,19 @@
#include "memusage.h"
unsigned long _line_parse(const char *line)
unsigned long
_line_parse(const char *line)
{
char *p, *tok;
p = strchr(line, ':') + 1;
while(isspace(*p)) p++;
while (isspace(*p))
p++;
tok = strtok(p, " ");
return atol(tok);
}
void _memusage_proc_getusage(unsigned long *mem_total,
void
_memusage_proc_getusage(unsigned long *mem_total,
unsigned long *mem_used,
unsigned long *mem_cached,
unsigned long *mem_buffers,
@ -39,7 +41,7 @@ void _memusage_proc_getusage(unsigned long *mem_total,
f = fopen("/proc/meminfo", "r");
if (!f) return;
while(fgets(line, sizeof(line), f) != NULL)
while (fgets(line, sizeof(line), f) != NULL)
{
if (!strncmp("MemTotal:", line, 9))
{
@ -93,3 +95,4 @@ void _memusage_proc_getusage(unsigned long *mem_total,
*swp_total = tmp_swp_total;
*swp_used = tmp_swp_total - tmp_swp_free;
}

View File

@ -26,14 +26,17 @@ _sysctlfromname(const char *name, void *mib, int depth, size_t *len)
return result;
}
#endif
void _memsize_bytes_to_kb(unsigned long *bytes)
void
_memsize_bytes_to_kb(unsigned long *bytes)
{
*bytes = (unsigned int) *bytes >> 10;
*bytes = (unsigned int)*bytes >> 10;
}
void _memusage_sysctl_getusage(unsigned long *mem_total,
void
_memusage_sysctl_getusage(unsigned long *mem_total,
unsigned long *mem_used,
unsigned long *mem_cached,
unsigned long *mem_buffers,
@ -136,7 +139,7 @@ void _memusage_sysctl_getusage(unsigned long *mem_total,
rnswap = swapctl(SWAP_STATS, swdev, nswap);
if (rnswap == -1) goto swap_out;
for (i = 0; i < nswap; i++)// nswap; i++)
for (i = 0; i < nswap; i++) // nswap; i++)
{
if (swdev[i].se_flags & SWF_ENABLE)
{
@ -162,3 +165,4 @@ swap_out:
_memsize_bytes_to_kb(mem_shared);
#endif
}

View File

@ -137,7 +137,7 @@ static void
_netstatus_cb_usage_check_main(void *data, Ecore_Thread *th)
{
Thread_Config *thc = data;
for (;;)
for (;; )
{
char rin[4096], rout[4096];
@ -406,7 +406,7 @@ _conf_item_get(int *id)
ci = E_NEW(Config_Item, 1);
if (*id != -1)
ci->id = eina_list_count(sysinfo_config->items)+1;
ci->id = eina_list_count(sysinfo_config->items) + 1;
else
ci->id = -1;

View File

@ -18,23 +18,28 @@ _poll_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
Instance *inst = nc->inst;
int value = elm_radio_value_get(obj);
switch(value)
switch (value)
{
case 0:
inst->cfg->netstatus.poll_interval = 4;
break;
case 1:
inst->cfg->netstatus.poll_interval = 8;
break;
case 2:
inst->cfg->netstatus.poll_interval = 32;
break;
case 3:
inst->cfg->netstatus.poll_interval = 64;
break;
case 4:
inst->cfg->netstatus.poll_interval = 256;
break;
default:
inst->cfg->netstatus.poll_interval = 32;
}
@ -244,23 +249,28 @@ netstatus_configure(Instance *inst)
evas_object_smart_callback_add(o, "changed", _poll_changed, nc);
evas_object_show(o);
switch(inst->cfg->netstatus.poll_interval)
switch (inst->cfg->netstatus.poll_interval)
{
case 4:
elm_radio_value_set(group, 0);
break;
case 8:
elm_radio_value_set(group, 1);
break;
case 32:
elm_radio_value_set(group, 2);
break;
case 64:
elm_radio_value_set(group, 3);
break;
case 256:
elm_radio_value_set(group, 4);
break;
default:
elm_radio_value_set(group, 2);
}

View File

@ -16,9 +16,9 @@ _netstatus_proc_getrstatus(Eina_Bool automax,
f = fopen("/proc/net/dev", "r");
if (f)
{
while(fgets(buf, sizeof(buf), f) != NULL)
while (fgets(buf, sizeof(buf), f) != NULL)
{
if (sscanf (buf, "%s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu "
if (sscanf(buf, "%s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu "
"%lu %lu %lu %lu\n", dummys, &in, &dummy, &dummy,
&dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy,
&dummy, &dummy, &dummy, &dummy, &dummy, &dummy) < 17)
@ -42,7 +42,8 @@ _netstatus_proc_getrstatus(Eina_Bool automax,
if (*prev_inmax > 0)
percent = 100 * ((float)*prev_incurrent / (float)*prev_inmax);
if (percent > 100) percent = 100;
else if (percent < 0) percent = 0;
else if (percent < 0)
percent = 0;
*prev_inpercent = percent;
}
}
@ -63,9 +64,9 @@ _netstatus_proc_gettstatus(Eina_Bool automax,
f = fopen("/proc/net/dev", "r");
if (f)
{
while(fgets(buf, sizeof(buf), f) != NULL)
while (fgets(buf, sizeof(buf), f) != NULL)
{
if (sscanf (buf, "%s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu "
if (sscanf(buf, "%s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu "
"%lu %lu %lu %lu\n", dummys, &dummy, &dummy, &dummy,
&dummy, &dummy, &dummy, &dummy, &dummy, &out, &dummy,
&dummy, &dummy, &dummy, &dummy, &dummy, &dummy) < 17)
@ -89,7 +90,8 @@ _netstatus_proc_gettstatus(Eina_Bool automax,
if (*prev_outcurrent > 0)
percent = 100 * ((float)*prev_outcurrent / (float)*prev_outmax);
if (percent > 100) percent = 100;
else if (percent < 0) percent = 0;
else if (percent < 0)
percent = 0;
*prev_outpercent = percent;
}
}

View File

@ -83,11 +83,11 @@ _openbsd_generic_network_status(unsigned long int *in, unsigned long int *out)
struct if_data if_data;
ifreq.ifr_data = (void *)&if_data;
strncpy(ifreq.ifr_name, ifa->ifa_name, IFNAMSIZ-1);
strncpy(ifreq.ifr_name, ifa->ifa_name, IFNAMSIZ - 1);
if (ioctl(sock, SIOCGIFDATA, &ifreq) < 0)
return;
struct if_data * const ifi = &if_data;
struct if_data *const ifi = &if_data;
if (ifi->ifi_type == IFT_ETHER || ifi->ifi_type == IFT_IEEE80211)
{
if (ifi->ifi_ibytes)
@ -103,6 +103,7 @@ _openbsd_generic_network_status(unsigned long int *in, unsigned long int *out)
}
close(sock);
}
#endif
void
@ -137,7 +138,8 @@ _netstatus_sysctl_getrstatus(Eina_Bool automax,
if (*prev_inmax > 0)
percent = 100 * ((float)*prev_incurrent / (float)*prev_inmax);
if (percent > 100) percent = 100;
else if (percent < 0) percent = 0;
else if (percent < 0)
percent = 0;
*prev_inpercent = percent;
}
}
@ -174,7 +176,8 @@ _netstatus_sysctl_gettstatus(Eina_Bool automax,
if (*prev_outcurrent > 0)
percent = 100 * ((float)*prev_outcurrent / (float)*prev_outmax);
if (percent > 100) percent = 100;
else if (percent < 0) percent = 0;
else if (percent < 0)
percent = 0;
*prev_outpercent = percent;
}
}

View File

@ -83,7 +83,7 @@ _conf_item_get(int *id)
ci = E_NEW(Config_Item, 1);
if (*id != -1)
ci->id = eina_list_count(sysinfo_config->items)+1;
ci->id = eina_list_count(sysinfo_config->items) + 1;
else
ci->id = -1;

View File

@ -11,7 +11,8 @@ _thermal_thread_free(Tempthread *tth)
eina_stringshare_del(tth->sensor_name);
eina_stringshare_del(tth->sensor_path);
#if defined(HAVE_EEZE)
EINA_LIST_FREE(tth->tempdevs, s) eina_stringshare_del(s);
EINA_LIST_FREE(tth->tempdevs, s)
eina_stringshare_del(s);
#endif
e_powersave_sleeper_free(tth->sleeper);
E_FREE(tth->extn);
@ -24,7 +25,8 @@ _thermal_face_level_set(Instance *inst, double level)
Edje_Message_Float msg;
if (level < 0.0) level = 0.0;
else if (level > 1.0) level = 1.0;
else if (level > 1.0)
level = 1.0;
msg.val = level;
edje_object_message_send(elm_layout_edje_get(inst->cfg->thermal.o_gadget), EDJE_MESSAGE_FLOAT, 1, &msg);
}
@ -32,7 +34,6 @@ _thermal_face_level_set(Instance *inst, double level)
static void
_thermal_apply(Instance *inst, int temp)
{
if (inst->cfg->thermal.temp == temp) return;
inst->cfg->thermal.temp = temp;
if (temp != -999)
@ -82,6 +83,7 @@ _thermal_udev_poll(void *data)
_thermal_apply(tth->inst, temp);
return EINA_TRUE;
}
#endif
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
@ -91,7 +93,7 @@ _thermal_check_sysctl(void *data, Ecore_Thread *th)
Tempthread *tth = data;
int ptemp = -500, temp;
for (;;)
for (;; )
{
if (ecore_thread_check(th)) break;
temp = thermal_sysctl_get(tth);
@ -101,6 +103,7 @@ _thermal_check_sysctl(void *data, Ecore_Thread *th)
if (ecore_thread_check(th)) break;
}
}
#endif
#if !defined(HAVE_EEZE) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
@ -109,7 +112,7 @@ _thermal_check_fallback(void *data, Ecore_Thread *th)
{
Tempthread *tth = data;
int ptemp = -500, temp;
for (;;)
for (;; )
{
if (ecore_thread_check(th)) break;
temp = thermal_fallback_get(tth);
@ -119,6 +122,7 @@ _thermal_check_fallback(void *data, Ecore_Thread *th)
if (ecore_thread_check(th)) break;
}
}
#endif
#if !defined(HAVE_EEZE)
@ -136,8 +140,8 @@ _thermal_check_done(void *data, Ecore_Thread *th EINA_UNUSED)
{
Tempthread *tth = data;
_thermal_thread_free(tth);
}
#endif
static Evas_Object *
@ -230,6 +234,7 @@ _thermal_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UN
e_gadget_configure(inst->o_main);
}
}
static Eina_Bool
_screensaver_on(void *data)
{
@ -253,7 +258,6 @@ _screensaver_off(void *data)
return ECORE_CALLBACK_RENEW;
}
void
_thermal_config_updated(Instance *inst)
{
@ -451,7 +455,7 @@ _conf_item_get(int *id)
ci = E_NEW(Config_Item, 1);
if (*id != -1)
ci->id = eina_list_count(sysinfo_config->items)+1;
ci->id = eina_list_count(sysinfo_config->items) + 1;
else
ci->id = -1;

View File

@ -36,7 +36,6 @@ _update_low_temperature(void *data, Evas_Object *obj EINA_UNUSED, void *event_in
inst->cfg->thermal.low = value;
e_config_save_queue();
_thermal_config_updated(inst);
}
static void
@ -51,9 +50,11 @@ _units_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
case 0:
inst->cfg->thermal.units = CELSIUS;
break;
case 1:
inst->cfg->thermal.units = FAHRENHEIT;
break;
default:
inst->cfg->thermal.units = CELSIUS;
}
@ -103,18 +104,23 @@ _poll_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
case 0:
inst->cfg->thermal.poll_interval = 4;
break;
case 1:
inst->cfg->thermal.poll_interval = 8;
break;
case 2:
inst->cfg->thermal.poll_interval = 32;
break;
case 3:
inst->cfg->thermal.poll_interval = 64;
break;
case 4:
inst->cfg->thermal.poll_interval = 256;
break;
default:
inst->cfg->thermal.poll_interval = 32;
}
@ -182,14 +188,16 @@ thermal_configure(Instance *inst)
evas_object_smart_callback_add(o, "changed", _units_changed, tc);
evas_object_show(o);
switch(inst->cfg->thermal.units)
switch (inst->cfg->thermal.units)
{
case CELSIUS:
elm_radio_value_set(groupu, 0);
break;
case FAHRENHEIT:
elm_radio_value_set(groupu, 1);
break;
default:
elm_radio_value_set(groupu, 0);
}
@ -258,23 +266,28 @@ thermal_configure(Instance *inst)
evas_object_smart_callback_add(o, "changed", _poll_changed, tc);
evas_object_show(o);
switch(inst->cfg->thermal.poll_interval)
switch (inst->cfg->thermal.poll_interval)
{
case 4:
elm_radio_value_set(group, 0);
break;
case 8:
elm_radio_value_set(group, 1);
break;
case 32:
elm_radio_value_set(group, 2);
break;
case 64:
elm_radio_value_set(group, 3);
break;
case 256:
elm_radio_value_set(group, 4);
break;
default:
elm_radio_value_set(group, 2);
}

View File

@ -193,6 +193,7 @@ init(Tempthread *tth)
{
case SENSOR_TYPE_NONE:
break;
case SENSOR_TYPE_OMNIBOOK:
tth->sensor_path = eina_stringshare_add("/proc/omnibook/temperature");
break;

View File

@ -26,13 +26,13 @@ typedef struct
#if defined(__FreeBSD__) || defined(__DragonFly__)
static const char *sources[] =
{
{
"hw.acpi.thermal.tz0.temperature",
"dev.cpu.0.temperature",
"dev.aibs.0.temp.0",
"dev.lm75.0.temperature",
NULL
};
};
#endif
#if defined(__OpenBSD__)
@ -187,7 +187,7 @@ check(Tempthread *tth)
goto error;
#endif
}
if (ret) return temp;
if (ret) return temp;
return -999;
error:
@ -208,4 +208,5 @@ thermal_sysctl_get(Tempthread *tth)
temp = check(tth);
return temp;
}
#endif

View File

@ -48,3 +48,4 @@ thermal_udev_get(Tempthread *tth)
}
return -999;
}

View File

@ -26,3 +26,4 @@ e_modapi_gadget_save(E_Module *m EINA_UNUSED)
{
return 1;
}