summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Houston <smhouston88@gmail.com>2017-11-28 16:03:11 -0600
committerStephen Houston <smhouston88@gmail.com>2017-11-28 16:03:11 -0600
commit292881981e0129763e77d2d9c9e217e2396245fa (patch)
treeba41753d25f90174eba8e2389e387b74ffc5d182
parentaec1b6516d65930c82ea892c0654b15deacd8bce (diff)
Improve Wizard appearance of gadget and add fileselector for slideshow path.
-rw-r--r--src/bin/ephoto.c27
-rw-r--r--src/bin/ephoto_slideshow.c39
2 files changed, 44 insertions, 22 deletions
diff --git a/src/bin/ephoto.c b/src/bin/ephoto.c
index 8cbf01a..41e06e1 100644
--- a/src/bin/ephoto.c
+++ b/src/bin/ephoto.c
@@ -5,7 +5,8 @@ static void _ephoto_display_usage(void);
5int 5int
6main(int argc, char *argv[]) 6main(int argc, char *argv[])
7{ 7{
8 int gadget = 0, r = 0; 8 int gadget = 0, id_num = 0, r = 0;
9 char buf[4096];
9 10
10 elm_init(argc, (char **)argv); 11 elm_init(argc, (char **)argv);
11 eio_init(); 12 eio_init();
@@ -30,9 +31,29 @@ main(int argc, char *argv[])
30 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); 31 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
31 32
32 if (getenv("E_GADGET_ID")) 33 if (getenv("E_GADGET_ID"))
33 gadget = 1; 34 {
35 gadget = 1;
36 snprintf(buf, sizeof(buf), "%s", getenv("E_GADGET_ID"));
37 id_num = atoi(buf);
38 }
39 if (id_num < 0)
40 {
41 Evas_Object *win, *icon;
34 42
35 if (argc > 2) 43 win = elm_win_add(NULL, "ephoto", ELM_WIN_BASIC);
44 elm_win_title_set(win, "Ephoto");
45 elm_win_alpha_set(win, 1);
46 elm_win_autodel_set(win, 1);
47 evas_object_size_hint_aspect_set(win, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
48
49 icon = elm_image_add(win);
50 elm_image_file_set(icon, PACKAGE_DATA_DIR "/images/ephoto.png", NULL);
51 elm_win_resize_object_add(win, icon);
52 evas_object_show(icon);
53
54 evas_object_show(win);
55 }
56 else if (argc > 2)
36 { 57 {
37 printf("Too Many Arguments!\n"); 58 printf("Too Many Arguments!\n");
38 _ephoto_display_usage(); 59 _ephoto_display_usage();
diff --git a/src/bin/ephoto_slideshow.c b/src/bin/ephoto_slideshow.c
index 7bfe66f..f72735b 100644
--- a/src/bin/ephoto_slideshow.c
+++ b/src/bin/ephoto_slideshow.c
@@ -799,7 +799,7 @@ _gadget_settings_save(void *data, Evas_Object *obj EINA_UNUSED,
799 spinner = evas_object_data_get(popup, "timeout"); 799 spinner = evas_object_data_get(popup, "timeout");
800 800
801 ss->ephoto->config->slideshow_timeout = elm_spinner_value_get(spinner); 801 ss->ephoto->config->slideshow_timeout = elm_spinner_value_get(spinner);
802 path = elm_object_text_get(fentry); 802 path = elm_fileselector_path_get(fentry);
803 if (ecore_file_is_dir(path)) 803 if (ecore_file_is_dir(path))
804 ephoto_directory_set(ss->ephoto, path, NULL, EINA_FALSE, EINA_TRUE); 804 ephoto_directory_set(ss->ephoto, path, NULL, EINA_FALSE, EINA_TRUE);
805 805
@@ -811,7 +811,7 @@ _gadget_settings(void *data, Evas_Object *obj EINA_UNUSED,
811 void *event_info EINA_UNUSED) 811 void *event_info EINA_UNUSED)
812{ 812{
813 Ephoto_Slideshow *ss = data; 813 Ephoto_Slideshow *ss = data;
814 Evas_Object *popup, *but, *table, *fentry, *label, *spinner; 814 Evas_Object *popup, *but, *table, *fentry, *label, *spinner, *rect;
815 char buf[PATH_MAX]; 815 char buf[PATH_MAX];
816 816
817 popup = elm_win_add(ss->ephoto->win, "win", ELM_WIN_BASIC); 817 popup = elm_win_add(ss->ephoto->win, "win", ELM_WIN_BASIC);
@@ -819,26 +819,20 @@ _gadget_settings(void *data, Evas_Object *obj EINA_UNUSED,
819 evas_object_data_set(popup, "slideshow", ss); 819 evas_object_data_set(popup, "slideshow", ss);
820 820
821 table = elm_table_add(popup); 821 table = elm_table_add(popup);
822 elm_table_homogeneous_set(table, EINA_FALSE);
822 EPHOTO_EXPAND(table); 823 EPHOTO_EXPAND(table);
823 EPHOTO_FILL(table); 824 EPHOTO_FILL(table);
824 elm_win_resize_object_add(popup, table); 825 elm_win_resize_object_add(popup, table);
825 evas_object_show(table); 826 evas_object_show(table);
826 827
827 label = elm_label_add(table); 828 fentry = elm_fileselector_add(table);
828 elm_object_text_set(label, _("Directory:")); 829 elm_fileselector_is_save_set(fentry, EINA_FALSE);
829 EPHOTO_FILL(label); 830 elm_fileselector_expandable_set(fentry, EINA_FALSE);
830 elm_table_pack(table, label, 0, 0, 1, 1); 831 elm_fileselector_path_set(fentry, ss->ephoto->config->directory);
831 evas_object_show(label); 832 elm_fileselector_buttons_ok_cancel_set(fentry, EINA_FALSE);
832 833 evas_object_size_hint_weight_set(fentry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
833 fentry = elm_entry_add(table);
834 elm_entry_single_line_set(fentry, EINA_TRUE);
835 elm_entry_editable_set(fentry, EINA_TRUE);
836 elm_entry_scrollable_set(fentry, EINA_TRUE);
837 elm_object_text_set(fentry, ss->ephoto->config->directory);
838 evas_object_size_hint_weight_set(fentry, EVAS_HINT_EXPAND, 0.0);
839 evas_object_size_hint_align_set(fentry, EVAS_HINT_FILL, EVAS_HINT_FILL); 834 evas_object_size_hint_align_set(fentry, EVAS_HINT_FILL, EVAS_HINT_FILL);
840 evas_object_size_hint_min_set(fentry, 300, 75); 835 elm_table_pack(table, fentry, 0, 0, 2, 5);
841 elm_table_pack(table, fentry, 1, 0, 1, 1);
842 evas_object_show(fentry); 836 evas_object_show(fentry);
843 evas_object_data_set(popup, "fentry", fentry); 837 evas_object_data_set(popup, "fentry", fentry);
844 838
@@ -847,7 +841,7 @@ _gadget_settings(void *data, Evas_Object *obj EINA_UNUSED,
847 snprintf(buf, PATH_MAX, "%s:", _("Show Each Slide For")); 841 snprintf(buf, PATH_MAX, "%s:", _("Show Each Slide For"));
848 elm_object_text_set(label, buf); 842 elm_object_text_set(label, buf);
849 EPHOTO_FILL(label); 843 EPHOTO_FILL(label);
850 elm_table_pack(table, label, 0, 1, 1, 1); 844 elm_table_pack(table, label, 0, 5, 1, 1);
851 evas_object_show(label); 845 evas_object_show(label);
852 846
853 spinner = elm_spinner_add(table); 847 spinner = elm_spinner_add(table);
@@ -858,16 +852,23 @@ _gadget_settings(void *data, Evas_Object *obj EINA_UNUSED,
858 elm_spinner_step_set(spinner, 1); 852 elm_spinner_step_set(spinner, 1);
859 elm_spinner_value_set(spinner, ss->ephoto->config->slideshow_timeout); 853 elm_spinner_value_set(spinner, ss->ephoto->config->slideshow_timeout);
860 elm_spinner_min_max_set(spinner, 1, 60); 854 elm_spinner_min_max_set(spinner, 1, 60);
861 elm_table_pack(table, spinner, 1, 1, 1, 1); 855 elm_table_pack(table, spinner, 1, 5, 1, 1);
862 evas_object_show(spinner); 856 evas_object_show(spinner);
863 evas_object_data_set(popup, "timeout", spinner); 857 evas_object_data_set(popup, "timeout", spinner);
864 858
865 but = elm_button_add(table); 859 but = elm_button_add(table);
866 elm_object_text_set(but, _("Okay")); 860 elm_object_text_set(but, _("Okay"));
867 elm_table_pack(table, but, 0, 2, 2, 1); 861 elm_table_pack(table, but, 0, 6, 2, 1);
868 evas_object_smart_callback_add(but, "clicked", _gadget_settings_save, popup); 862 evas_object_smart_callback_add(but, "clicked", _gadget_settings_save, popup);
869 evas_object_show(but); 863 evas_object_show(but);
870 864
865 rect = evas_object_rectangle_add(evas_object_evas_get(table));
866 evas_object_repeat_events_set(rect, EINA_TRUE);
867 evas_object_color_set(rect, 0, 0, 0, 0);
868 evas_object_size_hint_min_set(rect, 300, 300);
869 elm_table_pack(table, rect, 0, 0, 2, 7);
870 evas_object_show(rect);
871
871 evas_object_show(popup); 872 evas_object_show(popup);
872} 873}
873 874