summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Poole <netstar@gmail.com>2020-06-29 22:23:56 +0100
committerAlastair Poole <netstar@gmail.com>2020-06-29 22:23:56 +0100
commit7241ad2da0c4a22b2e6181ccbf80ca6f1edd7cea (patch)
treefbbeef447c758174b72e7b26fbd45d8d18ba076c
parent5763b86213a9c73e6da7eeebcfc79ca87b476381 (diff)
ui: menu iconz
-rw-r--r--src/bin/ui/ui.c12
-rw-r--r--src/bin/ui/ui_util.c68
2 files changed, 50 insertions, 30 deletions
diff --git a/src/bin/ui/ui.c b/src/bin/ui/ui.c
index 9e4bc12..c50aebe 100644
--- a/src/bin/ui/ui.c
+++ b/src/bin/ui/ui.c
@@ -1137,7 +1137,7 @@ static Evas_Object *
1137_ui_content_add(Evas_Object *parent, Ui *ui) 1137_ui_content_add(Evas_Object *parent, Ui *ui)
1138{ 1138{
1139 Evas_Object *table, *box, *entry, *hbox, *frame; 1139 Evas_Object *table, *box, *entry, *hbox, *frame;
1140 Evas_Object *border; 1140 Evas_Object *border, *ic;
1141 1141
1142 ui->content = table = elm_table_add(parent); 1142 ui->content = table = elm_table_add(parent);
1143 evas_object_size_hint_weight_set(table, EXPAND, EXPAND); 1143 evas_object_size_hint_weight_set(table, EXPAND, EXPAND);
@@ -1177,6 +1177,12 @@ _ui_content_add(Evas_Object *parent, Ui *ui)
1177 elm_entry_editable_set(entry, EINA_TRUE); 1177 elm_entry_editable_set(entry, EINA_TRUE);
1178 evas_object_show(entry); 1178 evas_object_show(entry);
1179 1179
1180 ic = elm_icon_add(parent);
1181 elm_icon_standard_set(ic, evisum_icon_path_get("find"));
1182 evas_object_size_hint_min_set(ic, 24, 24);
1183 evas_object_show(ic);
1184 elm_object_part_content_set(entry, "icon", ic);
1185
1180 elm_object_content_set(border, entry); 1186 elm_object_content_set(border, entry);
1181 elm_box_pack_end(box, border); 1187 elm_box_pack_end(box, border);
1182 1188
@@ -1383,7 +1389,7 @@ _menu_setup(Ui *ui)
1383 1389
1384 menu = elm_win_main_menu_get(ui->win); 1390 menu = elm_win_main_menu_get(ui->win);
1385 menu_it = elm_menu_item_add(menu, NULL, NULL, _("File"), NULL, NULL); 1391 menu_it = elm_menu_item_add(menu, NULL, NULL, _("File"), NULL, NULL);
1386 elm_menu_item_add(menu, menu_it, NULL, _("Quit"), _quit_cb, NULL); 1392 elm_menu_item_add(menu, menu_it, "exit", _("Quit"), _quit_cb, NULL);
1387 menu_it = elm_menu_item_add(menu, NULL, NULL, _("View"), NULL, NULL); 1393 menu_it = elm_menu_item_add(menu, NULL, NULL, _("View"), NULL, NULL);
1388 elm_menu_item_add(menu, menu_it, NULL, _("CPU"), _menu_cpu_activity_clicked_cb, ui); 1394 elm_menu_item_add(menu, menu_it, NULL, _("CPU"), _menu_cpu_activity_clicked_cb, ui);
1389 elm_menu_item_add(menu, menu_it, NULL, _("Memory"), 1395 elm_menu_item_add(menu, menu_it, NULL, _("Memory"),
@@ -1393,7 +1399,7 @@ _menu_setup(Ui *ui)
1393 elm_menu_item_add(menu, menu_it, NULL, _("Misc"), 1399 elm_menu_item_add(menu, menu_it, NULL, _("Misc"),
1394 _menu_misc_activity_clicked_cb, ui); 1400 _menu_misc_activity_clicked_cb, ui);
1395 menu_it = elm_menu_item_add(menu, NULL, NULL, _("Help"), NULL, NULL); 1401 menu_it = elm_menu_item_add(menu, NULL, NULL, _("Help"), NULL, NULL);
1396 elm_menu_item_add(menu, menu_it, NULL, _("About"), _about_clicked_cb, ui); 1402 elm_menu_item_add(menu, menu_it, "evisum", _("About"), _about_clicked_cb, ui);
1397 1403
1398 evas_object_show(menu); 1404 evas_object_show(menu);
1399} 1405}
diff --git a/src/bin/ui/ui_util.c b/src/bin/ui/ui_util.c
index 1f6b3c0..867f132 100644
--- a/src/bin/ui/ui_util.c
+++ b/src/bin/ui/ui_util.c
@@ -206,15 +206,16 @@ evisum_child_window_show(Evas_Object *parent, Evas_Object *win)
206 evas_object_show(win); 206 evas_object_show(win);
207} 207}
208 208
209static Ecore_Animator *_about_animator = NULL; 209static Ecore_Animator *_animator = NULL;
210 210
211typedef struct { 211typedef struct {
212 int pos; 212 int pos;
213 Evas_Object *label; 213 Evas_Object *label;
214 Evas_Object *version;
214 Evas_Object *bg; 215 Evas_Object *bg;
215} Animation_Data; 216} Animate_Data;
216 217
217static Animation_Data about; 218static Animate_Data about_data;
218 219
219static void 220static void
220_win_del_cb(void *data, Evas_Object *obj, 221_win_del_cb(void *data, Evas_Object *obj,
@@ -225,9 +226,9 @@ _win_del_cb(void *data, Evas_Object *obj,
225 226
226 win = data; 227 win = data;
227 228
228 if (_about_animator) 229 if (_animator)
229 ecore_animator_del(_about_animator); 230 ecore_animator_del(_animator);
230 _about_animator = NULL; 231 _animator = NULL;
231 ui = evas_object_data_get(win, "ui"); 232 ui = evas_object_data_get(win, "ui");
232 if (!ui) return; 233 if (!ui) return;
233 ui->about_visible = EINA_FALSE; 234 ui->about_visible = EINA_FALSE;
@@ -235,17 +236,19 @@ _win_del_cb(void *data, Evas_Object *obj,
235} 236}
236 237
237static Eina_Bool 238static Eina_Bool
238anim(void *data) 239about_anim(void *data)
239{ 240{
240 Animation_Data *pd = data; 241 Animate_Data *ad;
241 Evas_Coord w, h, ow, oh, x; 242 Evas_Coord w, h, ow, oh, x;
242 243
243 evas_object_geometry_get(pd->bg, NULL, NULL, &w, &h); 244 ad = data;
244 evas_object_geometry_get(pd->label, &x, NULL, &ow, &oh);
245 evas_object_move(pd->label, x, pd->pos);
246 245
247 pd->pos++; 246 evas_object_geometry_get(ad->bg, NULL, NULL, &w, &h);
248 if (pd->pos >= h) pd->pos = -oh; 247 evas_object_geometry_get(ad->label, &x, NULL, &ow, &oh);
248 evas_object_move(ad->label, x, ad->pos);
249
250 ad->pos--;
251 if (ad->pos <= -oh) ad->pos = h;
249 252
250 return EINA_TRUE; 253 return EINA_TRUE;
251} 254}
@@ -254,13 +257,13 @@ void
254evisum_about_window_show(void *data) 257evisum_about_window_show(void *data)
255{ 258{
256 Ui *ui; 259 Ui *ui;
257 Evas_Object *win, *bg, *box, *label, *btn; 260 Evas_Object *win, *bg, *box, *version, *label, *btn;
258 const char *copyright = 261 const char *copyright =
259 "<subtitle>Evisum</subtitle><br>"
260 "<br>"
261 "Copyright (c) 2018-2020 Alastair Roy Poole <netstar@gmail.com> "
262 "<br><br>"
263 "<small>" 262 "<small>"
263 "<b>"
264 "Copyright &copy; 2019-2020 Alastair Poole &lt;netstar@gmail.com&gt;<br>"
265 "<br>"
266 "</b>"
264 "Permission to use, copy, modify, and distribute this software <br>" 267 "Permission to use, copy, modify, and distribute this software <br>"
265 "for any purpose with or without fee is hereby granted, provided <br>" 268 "for any purpose with or without fee is hereby granted, provided <br>"
266 "that the above copyright notice and this permission notice appear <br>" 269 "that the above copyright notice and this permission notice appear <br>"
@@ -274,7 +277,8 @@ evisum_about_window_show(void *data)
274 "FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF <br>" 277 "FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF <br>"
275 "CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT <br>" 278 "CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT <br>"
276 "OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS <br>" 279 "OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS <br>"
277 "SOFTWARE.<br>"; 280 "SOFTWARE.<br>"
281 "</small>";
278 282
279 ui = data; 283 ui = data;
280 284
@@ -283,8 +287,7 @@ evisum_about_window_show(void *data)
283 ui->about_visible = EINA_TRUE; 287 ui->about_visible = EINA_TRUE;
284 288
285 win = elm_win_add(ui->win, "evisum", ELM_WIN_DIALOG_BASIC); 289 win = elm_win_add(ui->win, "evisum", ELM_WIN_DIALOG_BASIC);
286 elm_win_title_set(win, eina_slstr_printf(_("About Evisum %s"), 290 elm_win_title_set(win, "About Evisum");
287 PACKAGE_VERSION));
288 evas_object_smart_callback_add(win, "delete,request", _win_del_cb, win); 291 evas_object_smart_callback_add(win, "delete,request", _win_del_cb, win);
289 evas_object_data_set(win, "ui", ui); 292 evas_object_data_set(win, "ui", ui);
290 293
@@ -309,18 +312,29 @@ evisum_about_window_show(void *data)
309 evas_object_color_set(label, 255, 255, 255, 255); 312 evas_object_color_set(label, 255, 255, 255, 255);
310 elm_object_text_set(label, copyright); 313 elm_object_text_set(label, copyright);
311 314
315 version = elm_label_add(win);
316 evas_object_show(version);
317 evas_object_color_set(version, 47, 153, 255, 255);
318 elm_object_text_set(version,
319 eina_slstr_printf("<small>evisum %s</small>",
320 PACKAGE_VERSION));
321
312 btn = elm_button_add(win); 322 btn = elm_button_add(win);
313 evas_object_size_hint_align_set(btn, 0.5, 1.0); 323 evas_object_size_hint_align_set(btn, 0.5, 0.9);
314 evas_object_size_hint_weight_set(btn, EXPAND, EXPAND); 324 evas_object_size_hint_weight_set(btn, EXPAND, EXPAND);
315 elm_object_text_set(btn, _("Close")); 325 evas_object_color_set(btn, 128, 128, 128, 196);
326 elm_object_text_set(btn, _("Okay!"));
327
316 evas_object_show(btn); 328 evas_object_show(btn);
317 evas_object_smart_callback_add(btn, "clicked", _win_del_cb, win); 329 evas_object_smart_callback_add(btn, "clicked", _win_del_cb, win);
318 330
319 memset(&about, 0, sizeof(Animation_Data)); 331 memset(&about_data, 0, sizeof(Animate_Data));
320 about.label = label; 332 about_data.bg = bg;
321 about.bg = bg; 333 about_data.label = label;
322 _about_animator = ecore_animator_add(anim, &about); 334 about_data.version = version;
335 _animator = ecore_animator_add(about_anim, &about_data);
323 336
337 elm_box_pack_end(box, version);
324 elm_box_pack_end(box, label); 338 elm_box_pack_end(box, label);
325 elm_box_pack_end(box, btn); 339 elm_box_pack_end(box, btn);
326 elm_object_content_set(win, box); 340 elm_object_content_set(win, box);