changes:bugs and some stuff...not finished.

Not finished...if you find a bug tell me...just fixed some bad
ones.
This commit is contained in:
Alastair Poole 2020-08-31 00:36:00 +01:00
parent 57e16a9280
commit 551ee1810f
24 changed files with 235 additions and 98 deletions

View File

@ -1,3 +1,8 @@
# Artwork
Beautiful background images of the sky by rasterman.
In the public domain.
# About Evisum (Imagery)
Lichfield Cathedral - West Midlands Constabulary.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 14 KiB

BIN
data/images/effects.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -6,4 +6,6 @@ install_data('go-up.png', 'go-down.png',
'sensor.png', 'mount.png', 'ladyhand.png',
'find.png', 'bug.png', 'exit.png', 'cpu.png',
'memory.png', 'storage.png', 'misc.png',
'sky_01.jpg', 'sky_02.jpg', 'sky_03.jpg',
'sky_04.jpg', 'sky_05.jpg', 'effects.png',
install_dir: join_paths(dir_data, 'evisum/images'))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 15 KiB

BIN
data/images/sky_01.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 KiB

BIN
data/images/sky_02.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 KiB

BIN
data/images/sky_03.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 828 KiB

BIN
data/images/sky_04.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

BIN
data/images/sky_05.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

View File

@ -3,7 +3,7 @@
#include "ui/ui.h"
#define CONFIG_VERSION 0x0002
#define CONFIG_VERSION 0x0003
typedef struct _Evisum_Config
{
@ -12,6 +12,7 @@ typedef struct _Evisum_Config
Eina_Bool sort_reverse;
int width;
int height;
Eina_Bool effects;
} Evisum_Config;
void config_init(void);

View File

@ -99,6 +99,7 @@ int
main(int argc, char **argv)
{
Ui *ui;
Eina_Bool restart = EINA_FALSE;
int i;
for (i = 0; i < argc; i++)
@ -135,9 +136,13 @@ main(int argc, char **argv)
if (ui)
{
ecore_main_loop_begin();
restart = ui->restart;
evisum_ui_del(ui);
}
if (restart)
ecore_exe_run("evisum", NULL);
elm_shutdown();
config_shutdown();
ecore_shutdown();

View File

@ -28,6 +28,7 @@ _config_save(Ui *ui)
_evisum_config->sort_reverse = ui->sort_reverse;
_evisum_config->width = w;
_evisum_config->height = h;
_evisum_config->effects = evisum_ui_effects_enabled_get();
config_save(_evisum_config);
}
@ -42,6 +43,8 @@ _config_load(Ui *ui)
if ((_evisum_config->width > 0) && (_evisum_config->height > 0))
evas_object_resize(ui->win, _evisum_config->width, _evisum_config->height);
evisum_ui_effects_enabled_set(_evisum_config->effects);
}
static int
@ -359,7 +362,8 @@ _item_create(Evas_Object *parent)
evas_object_size_hint_weight_set(table, FILL, FILL);
evas_object_show(table);
_item_column_add(table, "proc_pid", 0);
label = _item_column_add(table, "proc_pid", 0);
evas_object_size_hint_align_set(label, 1.0, EXPAND);
_item_column_add(table, "proc_uid", 1);
_item_column_add(table, "proc_size", 2);
_item_column_add(table, "proc_rss", 3);
@ -573,10 +577,16 @@ _process_list_feedback_cb(void *data, Ecore_Thread *thread EINA_UNUSED,
}
_genlist_ensure_n_items(ui->genlist_procs, eina_list_count(list));
it = elm_genlist_first_item_get(ui->genlist_procs);
list = _list_sort(ui, list);
EINA_LIST_FREE(list, proc)
{
if (!it)
proc_info_free(proc);
else
{
Proc_Info *prev = elm_object_item_data_get(it);
if (prev)
@ -584,8 +594,10 @@ _process_list_feedback_cb(void *data, Ecore_Thread *thread EINA_UNUSED,
elm_object_item_data_set(it, proc);
elm_genlist_item_update(it);
it = elm_genlist_item_next_get(it);
}
}
eina_lock_release(&_lock);
}
@ -631,7 +643,7 @@ _btn_icon_state_update(Evas_Object *button, Eina_Bool reverse)
Evas_Object *icon = elm_icon_add(button);
if (_selected)
evas_object_color_set(_selected, 47, 153, 255, 255);
evas_object_color_set(_selected, 255, 255, 255, 255);
if (reverse)
elm_icon_standard_set(icon, evisum_icon_path_get("go-down"));
@ -639,7 +651,7 @@ _btn_icon_state_update(Evas_Object *button, Eina_Bool reverse)
elm_icon_standard_set(icon, evisum_icon_path_get("go-up"));
_selected = icon;
evas_object_color_set(_selected, 228, 228, 228, 255);
evas_object_color_set(_selected, 255, 255, 255, 255);
elm_object_part_content_set(button, "icon", icon);
evas_object_show(icon);
@ -656,11 +668,11 @@ _btn_icon_state_init(Evas_Object *button, Eina_Bool reverse, Eina_Bool selected)
elm_icon_standard_set(icon, evisum_icon_path_get("go-up"));
if (!selected)
evas_object_color_set(icon, 47, 153, 255, 255);
evas_object_color_set(icon, 255, 255, 255, 255);
else
{
_selected = icon;
evas_object_color_set(icon, 228, 228, 228, 255);
evas_object_color_set(icon, 255, 255, 255, 255);
}
elm_object_part_content_set(button, "icon", icon);
@ -796,8 +808,6 @@ _item_menu_start_cb(void *data, Evas_Object *obj EINA_UNUSED,
{
Ui *ui = data;
if (!ui) return;
kill(ui->selected_pid, SIGCONT);
}
@ -807,8 +817,6 @@ _item_menu_stop_cb(void *data, Evas_Object *obj EINA_UNUSED,
{
Ui *ui = data;
if (!ui) return;
kill(ui->selected_pid, SIGSTOP);
}
@ -818,8 +826,6 @@ _item_menu_kill_cb(void *data, Evas_Object *obj EINA_UNUSED,
{
Ui *ui = data;
if (!ui) return;
kill(ui->selected_pid, SIGKILL);
}
@ -841,7 +847,8 @@ _item_menu_priority_increase_cb(void *data, Evas_Object *obj EINA_UNUSED,
Proc_Info *proc;
ui = data;
if (!ui) return;
_item_menu_cancel_cb(ui, NULL, NULL);
proc = proc_info_by_pid(ui->selected_pid);
if (!proc) return;
@ -860,6 +867,8 @@ _item_menu_priority_decrease_cb(void *data, Evas_Object *obj EINA_UNUSED,
ui = data;
_item_menu_cancel_cb(ui, NULL, NULL);
proc = proc_info_by_pid(ui->selected_pid);
if (!proc) return;
@ -877,7 +886,8 @@ _item_menu_debug_cb(void *data, Evas_Object *obj EINA_UNUSED,
const char *terminal = "xterm";
ui = data;
if (!ui) return;
_item_menu_cancel_cb(ui, NULL, NULL);
proc = proc_info_by_pid(ui->selected_pid);
if (!proc) return;
@ -895,7 +905,9 @@ _item_menu_priority_add(Evas_Object *menu, Elm_Object_Item *menu_it,
Ui *ui)
{
Elm_Object_Item *it;
Proc_Info *proc = proc_info_by_pid(ui->selected_pid);
Proc_Info *proc;
proc = proc_info_by_pid(ui->selected_pid);
if (!proc) return;
it = elm_menu_item_add(menu, menu_it, evisum_icon_path_get("window"),
@ -925,7 +937,8 @@ _item_menu_properties_cb(void *data, Evas_Object *obj EINA_UNUSED,
Proc_Info *proc;
ui = data;
if (!ui) return;
_item_menu_cancel_cb(ui, NULL, NULL);
proc = proc_info_by_pid(ui->selected_pid);
if (!proc) return;
@ -1035,26 +1048,11 @@ _item_pid_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
ui_process_win_add(ui->win, proc->pid, proc->command);
}
static void
_genlist_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Ui *ui;
Evas_Coord w, ow;
ui = data;
evas_object_geometry_get(ui->genlist_procs, NULL, NULL, &ow, NULL);
evas_object_geometry_get(ui->win, NULL, NULL, &w, NULL);
if (ow > w)
elm_genlist_realized_items_update(ui->genlist_procs);
}
static void
_ui_content_system_add(Ui *ui)
{
Evas_Object *parent, *box, *hbox, *frame, *table;
Evas_Object *pb, *button, *plist;
Evas_Object *parent, *box, *box2, *hbox, *frame, *table;
Evas_Object *entry, *pb, *button, *plist;
int i = 0;
parent = ui->content;
@ -1085,6 +1083,7 @@ _ui_content_system_add(Ui *ui)
elm_progressbar_span_size_set(pb, 1.0);
elm_progressbar_unit_format_set(pb, "%1.2f%%");
elm_object_content_set(frame, pb);
elm_object_tooltip_text_set(pb, _("CPU average usage. For a more detailed view, <br>use the CPU option from the menu."));
evas_object_show(pb);
frame = elm_frame_add(hbox);
@ -1098,6 +1097,7 @@ _ui_content_system_add(Ui *ui)
evas_object_size_hint_align_set(pb, FILL, FILL);
evas_object_size_hint_weight_set(pb, EXPAND, EXPAND);
elm_progressbar_span_size_set(pb, 1.0);
elm_object_tooltip_text_set(pb, _("System memory. There is a more detailed view<br>in the application menu."));
evas_object_show(pb);
elm_object_content_set(frame, pb);
@ -1185,11 +1185,39 @@ _ui_content_system_add(Ui *ui)
evas_object_size_hint_weight_set(plist, EXPAND, EXPAND);
evas_object_size_hint_align_set(plist, FILL, FILL);
evas_object_show(plist);
evas_object_event_callback_add(ui->genlist_procs, EVAS_CALLBACK_RESIZE,
_genlist_resize_cb, ui);
elm_box_pack_end(box, table);
elm_box_pack_end(box, plist);
frame = elm_frame_add(parent);
evas_object_size_hint_weight_set(frame, EXPAND, EXPAND);
evas_object_size_hint_align_set(frame, FILL, FILL);
elm_object_text_set(frame, "Processes");
evas_object_show(frame);
box2 = elm_box_add(parent);
evas_object_size_hint_weight_set(box2, EXPAND, EXPAND);
evas_object_size_hint_align_set(box2, FILL, FILL);
evas_object_show(box2);
elm_box_pack_end(box2, table);
elm_box_pack_end(box2, plist);
elm_object_content_set(frame, box2);
hbox = elm_box_add(parent);
evas_object_size_hint_weight_set(hbox, EXPAND, 0);
evas_object_size_hint_align_set(hbox, FILL, FILL);
elm_box_horizontal_set(hbox, EINA_TRUE);
evas_object_show(hbox);
elm_box_pack_end(box2, hbox);
ui->entry_search = entry = elm_entry_add(parent);
evas_object_size_hint_weight_set(entry, EXPAND, 0); //EXPAND);
evas_object_size_hint_align_set(entry, FILL, FILL);
elm_entry_single_line_set(entry, EINA_TRUE);
elm_entry_scrollable_set(entry, EINA_TRUE);
elm_entry_editable_set(entry, EINA_TRUE);
evas_object_show(entry);
elm_box_pack_end(hbox, entry);
elm_box_pack_end(ui->system_activity, frame);
evas_object_smart_callback_add(ui->btn_pid, "clicked",
_btn_pid_clicked_cb, ui);
@ -1258,6 +1286,19 @@ _menu_cpu_activity_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
ui_win_cpu_add(ui);
}
static void
_menu_effects_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Ui *ui = data;
evisum_ui_effects_enabled_set(!evisum_ui_effects_enabled_get());
_config_save(ui);
ui->restart = EINA_TRUE;
ecore_main_loop_quit();
}
static void
_evisum_process_filter(Ui *ui, const char *text)
{
@ -1297,8 +1338,7 @@ _evisum_search_keypress_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
static Evas_Object *
_ui_content_add(Evas_Object *parent, Ui *ui)
{
Evas_Object *table, *box, *entry, *hbox, *frame;
Evas_Object *ic;
Evas_Object *table;
ui->content = table = elm_table_add(parent);
evas_object_size_hint_weight_set(table, EXPAND, EXPAND);
@ -1306,45 +1346,6 @@ _ui_content_add(Evas_Object *parent, Ui *ui)
elm_object_content_set(parent, table);
evas_object_show(table);
frame = elm_frame_add(parent);
evas_object_size_hint_weight_set(frame, EXPAND, 0);
evas_object_size_hint_align_set(frame, FILL, FILL);
elm_object_style_set(frame, "pad_medium");
evas_object_show(frame);
hbox = elm_box_add(parent);
evas_object_size_hint_weight_set(hbox, EXPAND, 0);
evas_object_size_hint_align_set(hbox, FILL, FILL);
elm_box_horizontal_set(hbox, EINA_TRUE);
evas_object_show(hbox);
box = elm_box_add(parent);
evas_object_size_hint_weight_set(box, EXPAND, EXPAND);
evas_object_size_hint_align_set(box, FILL, FILL);
elm_box_horizontal_set(box, EINA_TRUE);
evas_object_show(box);
ui->entry_search = entry = elm_entry_add(parent);
evas_object_size_hint_weight_set(entry, EXPAND, EXPAND);
evas_object_size_hint_align_set(entry, FILL, FILL);
elm_entry_single_line_set(entry, EINA_TRUE);
elm_entry_scrollable_set(entry, EINA_TRUE);
elm_entry_editable_set(entry, EINA_TRUE);
evas_object_show(entry);
ic = elm_icon_add(parent);
elm_icon_standard_set(ic, evisum_icon_path_get("find"));
evas_object_size_hint_min_set(ic, 24, 24);
evas_object_show(ic);
evas_object_color_set(ic, 64, 64, 64, 255);
elm_object_part_content_set(entry, "icon", ic);
elm_box_pack_end(box, entry);
elm_object_content_set(frame, box);
elm_box_pack_end(hbox, frame);
elm_table_pack(ui->content, hbox, 0, 2, 1, 1);
_ui_content_system_add(ui);
return table;
@ -1392,7 +1393,9 @@ _evisum_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Ui *ui = data;
elm_genlist_realized_items_update(ui->genlist_procs);
elm_genlist_clear(ui->genlist_procs);
_process_list_update(ui);
_config_save(ui);
}
@ -1570,6 +1573,9 @@ _menu_setup(Ui *ui)
_menu_disk_activity_clicked_cb, ui);
elm_menu_item_add(menu, menu_it, evisum_icon_path_get("misc"), _("Misc"),
_menu_misc_activity_clicked_cb, ui);
elm_menu_item_separator_add(menu, menu_it);
elm_menu_item_add(menu, menu_it, evisum_icon_path_get("effects"), _("Effects"),
_menu_effects_clicked_cb, ui);
menu_it = elm_menu_item_add(menu, NULL, NULL, _("Help"), NULL, NULL);
elm_menu_item_add(menu, menu_it, "evisum", _("About"), _about_clicked_cb, ui);

View File

@ -89,6 +89,7 @@ typedef struct Ui
Eina_Bool sort_reverse;
Eina_Bool show_self;
Eina_Bool shutdown_now;
Eina_Bool restart;
Eina_Bool zfs_mounted;

View File

@ -164,7 +164,6 @@ _core_times_cb(void *data, Ecore_Thread *thread)
for (int i = 0; !ecore_thread_check(thread); i = 0)
{
cores = system_cpu_usage_get(&ncpu);
EINA_LIST_FOREACH(ui->cpu_list, l, progress)
{
*progress->value = cores[i]->percent;
@ -193,7 +192,7 @@ _win_del_cb(void *data, Evas_Object *obj,
free(progress);
}
ecore_thread_wait(ui->thread_cpu, 1.0);
ecore_thread_wait(ui->thread_cpu, 0.1);
evas_object_del(obj);
ui->win_cpu = NULL;
}
@ -213,6 +212,8 @@ ui_win_cpu_add(Ui *ui)
evas_object_size_hint_weight_set(win, EXPAND, EXPAND);
evas_object_size_hint_align_set(win, FILL, FILL);
evisum_ui_background_random_add(win, evisum_ui_effects_enabled_get());
hbox = elm_box_add(win);
evas_object_size_hint_weight_set(hbox, EXPAND, EXPAND);
evas_object_size_hint_align_set(hbox, FILL, FILL);
@ -258,7 +259,7 @@ ui_win_cpu_add(Ui *ui)
pb = elm_progressbar_add(frame);
evas_object_size_hint_align_set(pb, FILL, FILL);
evas_object_size_hint_weight_set(pb, 0.1, EXPAND);
evas_object_size_hint_weight_set(pb, 0.2, EXPAND);
elm_progressbar_span_size_set(pb, 1.0);
elm_progressbar_unit_format_set(pb, "%1.2f%%");
evas_object_show(pb);
@ -275,7 +276,7 @@ ui_win_cpu_add(Ui *ui)
evas_object_size_hint_align_set(bg, FILL, FILL);
evas_object_size_hint_weight_set(bg, EXPAND, EXPAND);
evas_object_show(bg);
evas_object_size_hint_min_set(bg, 1, 80);
evas_object_size_hint_min_set(bg, 1, 60);
line = evas_object_rectangle_add(evas_object_evas_get(bg));
evas_object_size_hint_align_set(line, FILL, FILL);

View File

@ -177,6 +177,7 @@ ui_win_disk_add(Ui *ui)
_("Storage"));
evas_object_size_hint_weight_set(win, EXPAND, EXPAND);
evas_object_size_hint_align_set(win, FILL, FILL);
evisum_ui_background_random_add(win, evisum_ui_effects_enabled_get());
box = elm_box_add(win);
evas_object_size_hint_weight_set(box, EXPAND, EXPAND);
@ -187,6 +188,7 @@ ui_win_disk_add(Ui *ui)
evas_object_size_hint_weight_set(vbox, EXPAND, 0.0);
evas_object_size_hint_align_set(vbox, FILL, 0.5);
evas_object_show(vbox);
elm_win_resize_object_add(win, vbox);
scroller = elm_scroller_add(win);
evas_object_size_hint_weight_set(scroller, EXPAND, EXPAND);

View File

@ -134,6 +134,7 @@ ui_win_memory_add(Ui *ui)
_("Memory Usage"));
evas_object_size_hint_weight_set(win, EXPAND, EXPAND);
evas_object_size_hint_align_set(win, FILL, FILL);
evisum_ui_background_random_add(win, evisum_ui_effects_enabled_get());
frame = elm_frame_add(win);
evas_object_size_hint_weight_set(frame, EXPAND, EXPAND);

View File

@ -349,6 +349,7 @@ ui_win_misc_add(Ui *ui)
ui->win_misc = win = elm_win_util_dialog_add(ui->win, "evisum", _("Stuff"));
evas_object_size_hint_weight_set(win, EXPAND, EXPAND);
evas_object_size_hint_align_set(win, FILL, FILL);
evisum_ui_background_random_add(win, evisum_ui_effects_enabled_get());
box = elm_box_add(win);
evas_object_size_hint_weight_set(box, EXPAND, EXPAND);

View File

@ -511,6 +511,7 @@ _process_tab_add(Evas_Object *parent, Ui_Process *ui)
Evas_Object *frame, *hbox, *table;
Evas_Object *label, *entry, *button, *border;
int i = 0;
int r, g, b , a;
frame = elm_frame_add(parent);
elm_object_text_set(frame, _("General"));
@ -518,6 +519,12 @@ _process_tab_add(Evas_Object *parent, Ui_Process *ui)
evas_object_size_hint_align_set(frame, FILL, FILL);
evas_object_show(frame);
if (evisum_ui_effects_enabled_get())
{
evas_object_color_get(frame, &r, &g, &b, &a);
evas_object_color_set(frame, r * 0.75, g * 0.75, b * 0.75, a * 0.75);
}
table = elm_table_add(parent);
evas_object_size_hint_weight_set(table, EXPAND, EXPAND);
evas_object_size_hint_align_set(table, FILL, FILL);
@ -632,8 +639,8 @@ _process_tab_add(Evas_Object *parent, Ui_Process *ui)
elm_object_style_set(border, "pad_small");
evas_object_show(border);
button = evisum_ui_button_add(parent, &ui->btn_stop, _("Stop"),
"stop",_btn_stop_clicked_cb, ui);
button = evisum_ui_tab_add(parent, &ui->btn_stop, _("Stop"),
_btn_stop_clicked_cb, ui);
ui->btn_stop = button;
elm_object_content_set(border, button);
elm_box_pack_end(hbox, border);
@ -643,8 +650,8 @@ _process_tab_add(Evas_Object *parent, Ui_Process *ui)
elm_object_style_set(border, "pad_small");
evas_object_show(border);
button = evisum_ui_button_add(parent, &ui->btn_start, _("Start"),
"start", _btn_start_clicked_cb, ui);
button = evisum_ui_tab_add(parent, &ui->btn_start, _("Start"),
_btn_start_clicked_cb, ui);
ui->btn_start = button;
elm_object_content_set(border, button);
elm_box_pack_end(hbox, border);
@ -655,8 +662,8 @@ _process_tab_add(Evas_Object *parent, Ui_Process *ui)
elm_object_style_set(border, "pad_small");
evas_object_show(border);
button = evisum_ui_button_add(parent, &ui->btn_kill, _("Kill"),
"kill", _btn_kill_clicked_cb, ui);
button = evisum_ui_tab_add(parent, &ui->btn_kill, _("Kill"),
_btn_kill_clicked_cb, ui);
ui->btn_kill = button;
elm_object_content_set(border, button);
elm_box_pack_end(hbox, border);
@ -675,7 +682,7 @@ _btn_icon_state_set(Evas_Object *button, Eina_Bool reverse)
elm_icon_standard_set(icon, evisum_icon_path_get("go-up"));
elm_object_part_content_set(button, "icon", icon);
evas_object_color_set(icon, 47, 153, 255, 255);
evas_object_color_set(icon, 255, 255, 255, 255);
evas_object_show(icon);
}
@ -749,12 +756,19 @@ static Evas_Object *
_threads_tab_add(Evas_Object *parent, Ui_Process *ui)
{
Evas_Object *frame, *box, *hbox, *btn, *genlist;
int r, g, b, a;
frame = elm_frame_add(parent);
evas_object_size_hint_weight_set(frame, EXPAND, EXPAND);
evas_object_size_hint_align_set(frame, FILL, FILL);
elm_object_text_set(frame, _("Threads"));
if (evisum_ui_effects_enabled_get())
{
evas_object_color_get(frame, &r, &g, &b, &a);
evas_object_color_set(frame, r * 0.75, g * 0.75, b * 0.75, a * 0.75);
}
box = elm_box_add(parent);
evas_object_size_hint_weight_set(box, EXPAND, EXPAND);
evas_object_size_hint_align_set(box, FILL, FILL);
@ -835,12 +849,19 @@ static Evas_Object *
_info_tab_add(Evas_Object *parent, Ui_Process *ui)
{
Evas_Object *frame, *box, *entry;
int r, g, b, a;
frame = elm_frame_add(parent);
evas_object_size_hint_weight_set(frame, EXPAND, EXPAND);
evas_object_size_hint_align_set(frame, FILL, FILL);
elm_object_text_set(frame, _("Documentation"));
if (evisum_ui_effects_enabled_get())
{
evas_object_color_get(frame, &r, &g, &b, &a);
evas_object_color_set(frame, r * 0.75, g * 0.75, b * 0.75, a * 0.75);
}
box = elm_box_add(parent);
evas_object_size_hint_weight_set(box, EXPAND, EXPAND);
evas_object_size_hint_align_set(box, FILL, FILL);
@ -1055,6 +1076,8 @@ ui_process_win_add(Evas_Object *parent_win, int pid, const char *cmd)
elm_win_icon_object_set(win, ic);
tabs = _tabs_add(win, ui);
evisum_ui_background_random_add(win, evisum_ui_effects_enabled_get());
box = elm_box_add(win);
evas_object_size_hint_weight_set(box, EXPAND, EXPAND);
evas_object_size_hint_align_set(box, FILL, FILL);

View File

@ -3,6 +3,10 @@
#include <Elementary.h>
#include "config.h"
#define ARRAY_SIZE(n) sizeof(n) / sizeof(n[0])
static Eina_Bool _effects_enabled = EINA_FALSE;
Evas_Object *
evisum_ui_tab_add(Evas_Object *parent, Evas_Object **alias, const char *text,
Evas_Smart_Cb clicked_cb, void *data)
@ -354,3 +358,73 @@ evisum_about_window_show(void *data)
evas_object_show(win);
}
const char *
evisum_image_path_get(const char *name)
{
char *path;
const char *icon_path = NULL, *directory = PACKAGE_DATA_DIR "/images";
path = _path_append(directory, eina_slstr_printf("%s.jpg", name));
if (path)
{
if (ecore_file_exists(path))
icon_path = eina_slstr_printf("%s", path);
free(path);
}
return icon_path;
}
Evas_Object *
evisum_ui_background_random_add(Evas_Object *win, Eina_Bool enabled)
{
Evas_Object *bg;
int i;
char *images[] = { "sky_01", "sky_02", "sky_03", "sky_04", "sky_05" };
if (!enabled) return NULL;
srand(time(NULL));
i = rand() % ARRAY_SIZE(images);
bg = elm_bg_add(win);
elm_bg_file_set(bg, evisum_image_path_get(images[i]), NULL);
evas_object_size_hint_align_set(bg, FILL, FILL);
evas_object_size_hint_weight_set(bg, EXPAND, EXPAND);
elm_win_resize_object_add(win, bg);
evas_object_show(bg);
return bg;
}
Evas_Object *
evisum_ui_background_add(Evas_Object *win, Eina_Bool enabled)
{
Evas_Object *bg;
if (!enabled) return NULL;
bg = elm_bg_add(win);
elm_bg_file_set(bg, evisum_image_path_get("sky_01"), NULL);
evas_object_size_hint_align_set(bg, FILL, FILL);
evas_object_size_hint_weight_set(bg, EXPAND, EXPAND);
elm_win_resize_object_add(win, bg);
evas_object_show(bg);
return bg;
}
Eina_Bool
evisum_ui_effects_enabled_get(void)
{
return _effects_enabled;
}
void
evisum_ui_effects_enabled_set(Eina_Bool enabled)
{
_effects_enabled = enabled;
}

View File

@ -6,8 +6,8 @@
#define FILL EVAS_HINT_FILL
#define EXPAND EVAS_HINT_EXPAND
#define TAB_BTN_WIDTH 96
#define TAB_BTN_HEIGHT 32
#define TAB_BTN_WIDTH 84
#define TAB_BTN_HEIGHT 28
#define BTN_WIDTH 80
#define BTN_HEIGHT 24
@ -32,6 +32,21 @@ evisum_size_format(unsigned long long bytes);
const char *
evisum_icon_path_get(const char *name);
const char *
evisum_image_path_get(const char *name);
Evas_Object *
evisum_ui_background_add(Evas_Object *win, Eina_Bool enabled);
Evas_Object *
evisum_ui_background_random_add(Evas_Object *win, Eina_Bool enabled);
void
evisum_ui_effects_enabled_set(Eina_Bool enabled);
Eina_Bool
evisum_ui_effects_enabled_get(void);
int
evisum_ui_textblock_font_size_get(Evas_Object *tb);