summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS2
-rw-r--r--data/images/go-down.pngbin0 -> 1470 bytes
-rw-r--r--data/images/go-up.pngbin0 -> 1580 bytes
-rw-r--r--data/images/meson.build2
-rw-r--r--data/meson.build1
-rw-r--r--meson.build1
-rw-r--r--src/bin/ui.c56
7 files changed, 52 insertions, 10 deletions
diff --git a/AUTHORS b/AUTHORS
index 2f10215..5233598 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,4 +1,4 @@
1Alastair Poole <netstar@gmail.com> 1Alastair Poole <netstar@gmail.com>
2 2
3Icon: 3Icons:
4Apostolos Bartziokas <barz621@gmail.com> 4Apostolos Bartziokas <barz621@gmail.com>
diff --git a/data/images/go-down.png b/data/images/go-down.png
new file mode 100644
index 0000000..93c3644
--- /dev/null
+++ b/data/images/go-down.png
Binary files differ
diff --git a/data/images/go-up.png b/data/images/go-up.png
new file mode 100644
index 0000000..899e596
--- /dev/null
+++ b/data/images/go-up.png
Binary files differ
diff --git a/data/images/meson.build b/data/images/meson.build
new file mode 100644
index 0000000..25530a8
--- /dev/null
+++ b/data/images/meson.build
@@ -0,0 +1,2 @@
1install_data('go-up.png', 'go-down.png',
2 install_dir: join_paths(dir_data, 'evisum/images'))
diff --git a/data/meson.build b/data/meson.build
index 8a19d38..db5bf15 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,2 +1,3 @@
1subdir('desktop') 1subdir('desktop')
2subdir('icons') 2subdir('icons')
3subdir('images')
diff --git a/meson.build b/meson.build
index 5f6143b..05b1862 100644
--- a/meson.build
+++ b/meson.build
@@ -26,6 +26,7 @@ dir_locale = join_paths(dir_prefix, get_option('localedir'))
26##### config.h 26##### config.h
27 27
28cfg.set_quoted('PACKAGE_VERSION', meson.project_version()) 28cfg.set_quoted('PACKAGE_VERSION', meson.project_version())
29cfg.set_quoted('PACKAGE_DATA_DIR', join_paths(dir_data, 'evisum'))
29configure_file(output: 'config.h', configuration: cfg) 30configure_file(output: 'config.h', configuration: cfg)
30 31
31subdir('src') 32subdir('src')
diff --git a/src/bin/ui.c b/src/bin/ui.c
index 24bfa7d..800d0fc 100644
--- a/src/bin/ui.c
+++ b/src/bin/ui.c
@@ -1,3 +1,4 @@
1#include "config.h"
1#include "system.h" 2#include "system.h"
2#include "process.h" 3#include "process.h"
3#include "disks.h" 4#include "disks.h"
@@ -12,6 +13,7 @@
12 13
13static Eina_Lock _lock; 14static Eina_Lock _lock;
14 15
16
15void 17void
16ui_shutdown(Ui *ui) 18ui_shutdown(Ui *ui)
17{ 19{
@@ -55,7 +57,7 @@ _system_stats(void *data, Ecore_Thread *thread)
55 system_stats_all_get(results); 57 system_stats_all_get(results);
56 ecore_thread_feedback(thread, results); 58 ecore_thread_feedback(thread, results);
57 59
58 // Let's wait 3/4 of a second before updating. 60 // Let's wait 3/4 of a second before updating.
59 for (int i = 0; i < 3; i++) 61 for (int i = 0; i < 3; i++)
60 { 62 {
61 if (ecore_thread_check(thread)) 63 if (ecore_thread_check(thread))
@@ -110,6 +112,42 @@ _network_transfer_format(double rate)
110 return strdup(eina_slstr_printf("%.2f %s", rate, unit)); 112 return strdup(eina_slstr_printf("%.2f %s", rate, unit));
111} 113}
112 114
115char *
116_path_append(const char *path, const char *file)
117{
118 char *concat;
119 int len;
120 char separator = '/';
121#ifdef WIN32
122 separator = '\\';
123#endif
124
125 len = strlen(path) + strlen(file) + 2;
126 concat = malloc(len * sizeof(char));
127 snprintf(concat, len, "%s%c%s", path, separator, file);
128
129 return concat;
130}
131
132const char *
133_icon_path_get(const char *name)
134{
135 char *path;
136 const char *icon_path, *directory = PACKAGE_DATA_DIR "/images";
137 icon_path = name;
138
139 path = _path_append(directory, eina_slstr_printf("%s.png", name));
140 if (path)
141 {
142 if (ecore_file_exists(path))
143 icon_path = eina_slstr_printf("%s", path);
144
145 free(path);
146 }
147
148 return icon_path;
149}
150
113static void 151static void
114_tab_misc_update(Ui *ui, results_t *results) 152_tab_misc_update(Ui *ui, results_t *results)
115{ 153{
@@ -132,14 +170,14 @@ _tab_misc_update(Ui *ui, results_t *results)
132 evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, 0); 170 evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, 0);
133 evas_object_size_hint_weight_set(frame, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 171 evas_object_size_hint_weight_set(frame, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
134 172
135 Eina_Strbuf *buf = eina_strbuf_new(); 173 Eina_Strbuf *buf = eina_strbuf_new();
136 eina_strbuf_append_printf(buf, "Battery %s ", results->power.battery_names[i]); 174 eina_strbuf_append_printf(buf, "Battery %s ", results->power.battery_names[i]);
137 if (results->power.have_ac && i == 0) 175 if (results->power.have_ac && i == 0)
138 eina_strbuf_append(buf, "(plugged in)"); 176 eina_strbuf_append(buf, "(plugged in)");
139 177
140 elm_object_text_set(frame, eina_strbuf_string_get(buf)); 178 elm_object_text_set(frame, eina_strbuf_string_get(buf));
141 179
142 eina_strbuf_free(buf); 180 eina_strbuf_free(buf);
143 evas_object_show(frame); 181 evas_object_show(frame);
144 182
145 progress = elm_progressbar_add(frame); 183 progress = elm_progressbar_add(frame);
@@ -152,8 +190,8 @@ _tab_misc_update(Ui *ui, results_t *results)
152 elm_object_content_set(frame, progress); 190 elm_object_content_set(frame, progress);
153 elm_box_pack_end(box, frame); 191 elm_box_pack_end(box, frame);
154 192
155 free(results->power.battery_names[i]); 193 free(results->power.battery_names[i]);
156 free(results->power.batteries[i]); 194 free(results->power.batteries[i]);
157 } 195 }
158 196
159 if (results->power.batteries) 197 if (results->power.batteries)
@@ -848,9 +886,9 @@ _btn_icon_state_set(Evas_Object *button, Eina_Bool reverse)
848{ 886{
849 Evas_Object *icon = elm_icon_add(button); 887 Evas_Object *icon = elm_icon_add(button);
850 if (reverse) 888 if (reverse)
851 elm_icon_standard_set(icon, "go-down"); 889 elm_icon_standard_set(icon, _icon_path_get("go-down"));
852 else 890 else
853 elm_icon_standard_set(icon, "go-up"); 891 elm_icon_standard_set(icon, _icon_path_get("go-up"));
854 892
855 elm_object_part_content_set(button, "icon", icon); 893 elm_object_part_content_set(button, "icon", icon);
856 evas_object_show(icon); 894 evas_object_show(icon);