Icons: Add default icons (Use Apostolos E icons).

Minor formatting and use our own icons by Apostolos.
He already created the application icon. These look fine
with flat and dark theme.
This commit is contained in:
Alastair Poole 2020-01-04 12:59:03 +00:00
parent bd588341a8
commit 14344e8bd2
7 changed files with 52 additions and 10 deletions

View File

@ -1,4 +1,4 @@
Alastair Poole <netstar@gmail.com> Alastair Poole <netstar@gmail.com>
Icon: Icons:
Apostolos Bartziokas <barz621@gmail.com> Apostolos Bartziokas <barz621@gmail.com>

BIN
data/images/go-down.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
data/images/go-up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

2
data/images/meson.build Normal file
View File

@ -0,0 +1,2 @@
install_data('go-up.png', 'go-down.png',
install_dir: join_paths(dir_data, 'evisum/images'))

View File

@ -1,2 +1,3 @@
subdir('desktop') subdir('desktop')
subdir('icons') subdir('icons')
subdir('images')

View File

@ -26,6 +26,7 @@ dir_locale = join_paths(dir_prefix, get_option('localedir'))
##### config.h ##### config.h
cfg.set_quoted('PACKAGE_VERSION', meson.project_version()) cfg.set_quoted('PACKAGE_VERSION', meson.project_version())
cfg.set_quoted('PACKAGE_DATA_DIR', join_paths(dir_data, 'evisum'))
configure_file(output: 'config.h', configuration: cfg) configure_file(output: 'config.h', configuration: cfg)
subdir('src') subdir('src')

View File

@ -1,3 +1,4 @@
#include "config.h"
#include "system.h" #include "system.h"
#include "process.h" #include "process.h"
#include "disks.h" #include "disks.h"
@ -12,6 +13,7 @@
static Eina_Lock _lock; static Eina_Lock _lock;
void void
ui_shutdown(Ui *ui) ui_shutdown(Ui *ui)
{ {
@ -55,7 +57,7 @@ _system_stats(void *data, Ecore_Thread *thread)
system_stats_all_get(results); system_stats_all_get(results);
ecore_thread_feedback(thread, results); ecore_thread_feedback(thread, results);
// Let's wait 3/4 of a second before updating. // Let's wait 3/4 of a second before updating.
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
if (ecore_thread_check(thread)) if (ecore_thread_check(thread))
@ -110,6 +112,42 @@ _network_transfer_format(double rate)
return strdup(eina_slstr_printf("%.2f %s", rate, unit)); return strdup(eina_slstr_printf("%.2f %s", rate, unit));
} }
char *
_path_append(const char *path, const char *file)
{
char *concat;
int len;
char separator = '/';
#ifdef WIN32
separator = '\\';
#endif
len = strlen(path) + strlen(file) + 2;
concat = malloc(len * sizeof(char));
snprintf(concat, len, "%s%c%s", path, separator, file);
return concat;
}
const char *
_icon_path_get(const char *name)
{
char *path;
const char *icon_path, *directory = PACKAGE_DATA_DIR "/images";
icon_path = name;
path = _path_append(directory, eina_slstr_printf("%s.png", name));
if (path)
{
if (ecore_file_exists(path))
icon_path = eina_slstr_printf("%s", path);
free(path);
}
return icon_path;
}
static void static void
_tab_misc_update(Ui *ui, results_t *results) _tab_misc_update(Ui *ui, results_t *results)
{ {
@ -132,14 +170,14 @@ _tab_misc_update(Ui *ui, results_t *results)
evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, 0); evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, 0);
evas_object_size_hint_weight_set(frame, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(frame, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
Eina_Strbuf *buf = eina_strbuf_new(); Eina_Strbuf *buf = eina_strbuf_new();
eina_strbuf_append_printf(buf, "Battery %s ", results->power.battery_names[i]); eina_strbuf_append_printf(buf, "Battery %s ", results->power.battery_names[i]);
if (results->power.have_ac && i == 0) if (results->power.have_ac && i == 0)
eina_strbuf_append(buf, "(plugged in)"); eina_strbuf_append(buf, "(plugged in)");
elm_object_text_set(frame, eina_strbuf_string_get(buf)); elm_object_text_set(frame, eina_strbuf_string_get(buf));
eina_strbuf_free(buf); eina_strbuf_free(buf);
evas_object_show(frame); evas_object_show(frame);
progress = elm_progressbar_add(frame); progress = elm_progressbar_add(frame);
@ -152,8 +190,8 @@ _tab_misc_update(Ui *ui, results_t *results)
elm_object_content_set(frame, progress); elm_object_content_set(frame, progress);
elm_box_pack_end(box, frame); elm_box_pack_end(box, frame);
free(results->power.battery_names[i]); free(results->power.battery_names[i]);
free(results->power.batteries[i]); free(results->power.batteries[i]);
} }
if (results->power.batteries) if (results->power.batteries)
@ -848,9 +886,9 @@ _btn_icon_state_set(Evas_Object *button, Eina_Bool reverse)
{ {
Evas_Object *icon = elm_icon_add(button); Evas_Object *icon = elm_icon_add(button);
if (reverse) if (reverse)
elm_icon_standard_set(icon, "go-down"); elm_icon_standard_set(icon, _icon_path_get("go-down"));
else else
elm_icon_standard_set(icon, "go-up"); elm_icon_standard_set(icon, _icon_path_get("go-up"));
elm_object_part_content_set(button, "icon", icon); elm_object_part_content_set(button, "icon", icon);
evas_object_show(icon); evas_object_show(icon);