summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavide Andreoli <dave@gurumeditation.it>2013-04-29 18:26:32 +0000
committerDavide Andreoli <dave@gurumeditation.it>2013-04-29 18:26:32 +0000
commit6809008e4bd6d3660101241d9fe641c0686ffe90 (patch)
tree43d5d2900a584f23c2bad31517a2aa1cc9edf87b
parentcae4d2e37e3e3b9cb57ecbc93f3d73417b317eca (diff)
Places: New option: autoclose_popup
* autoclose_popup: true, will close the popup like connman. False will keep it open like the clock module * factorized _places_run_fm() SVN revision: 84535
-rw-r--r--trunk/E-MODULES-EXTRA/places/src/e_mod_config.c7
-rw-r--r--trunk/E-MODULES-EXTRA/places/src/e_mod_main.c27
-rw-r--r--trunk/E-MODULES-EXTRA/places/src/e_mod_main.h25
-rw-r--r--trunk/E-MODULES-EXTRA/places/src/e_mod_places.c65
4 files changed, 74 insertions, 50 deletions
diff --git a/trunk/E-MODULES-EXTRA/places/src/e_mod_config.c b/trunk/E-MODULES-EXTRA/places/src/e_mod_config.c
index 89fca5af7c..c4cc912bac 100644
--- a/trunk/E-MODULES-EXTRA/places/src/e_mod_config.c
+++ b/trunk/E-MODULES-EXTRA/places/src/e_mod_config.c
@@ -13,6 +13,7 @@ struct _E_Config_Dialog_Data
13 Evas_Object *entry; 13 Evas_Object *entry;
14 int show_menu; 14 int show_menu;
15 int hide_header; 15 int hide_header;
16 int autoclose_popup;
16 int show_home; 17 int show_home;
17 int show_desk; 18 int show_desk;
18 int show_trash; 19 int show_trash;
@@ -86,6 +87,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
86 87
87 cfdata->show_menu = places_conf->show_menu; 88 cfdata->show_menu = places_conf->show_menu;
88 cfdata->hide_header = places_conf->hide_header; 89 cfdata->hide_header = places_conf->hide_header;
90 cfdata->autoclose_popup = places_conf->autoclose_popup;
89 cfdata->show_home = places_conf->show_home; 91 cfdata->show_home = places_conf->show_home;
90 cfdata->show_desk = places_conf->show_desk; 92 cfdata->show_desk = places_conf->show_desk;
91 cfdata->show_trash = places_conf->show_trash; 93 cfdata->show_trash = places_conf->show_trash;
@@ -144,6 +146,10 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
144 &(cfdata->hide_header)); 146 &(cfdata->hide_header));
145 e_widget_framelist_object_append(of, ow); 147 e_widget_framelist_object_append(of, ow);
146 148
149 ow = e_widget_check_add(evas, D_("Auto close the popup"),
150 &(cfdata->autoclose_popup));
151 e_widget_framelist_object_append(of, ow);
152
147 ow = e_widget_check_add(evas, D_("Mount volumes at boot"), 153 ow = e_widget_check_add(evas, D_("Mount volumes at boot"),
148 &(cfdata->boot_mount)); 154 &(cfdata->boot_mount));
149 e_widget_framelist_object_append(of, ow); 155 e_widget_framelist_object_append(of, ow);
@@ -203,6 +209,7 @@ _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
203{ 209{
204 places_conf->show_menu = cfdata->show_menu; 210 places_conf->show_menu = cfdata->show_menu;
205 places_conf->hide_header = cfdata->hide_header; 211 places_conf->hide_header = cfdata->hide_header;
212 places_conf->autoclose_popup = cfdata->autoclose_popup;
206 places_conf->auto_mount = cfdata->auto_mount; 213 places_conf->auto_mount = cfdata->auto_mount;
207 places_conf->boot_mount = cfdata->boot_mount; 214 places_conf->boot_mount = cfdata->boot_mount;
208 places_conf->auto_open = cfdata->auto_open; 215 places_conf->auto_open = cfdata->auto_open;
diff --git a/trunk/E-MODULES-EXTRA/places/src/e_mod_main.c b/trunk/E-MODULES-EXTRA/places/src/e_mod_main.c
index c8aff970d4..8b54a9a28d 100644
--- a/trunk/E-MODULES-EXTRA/places/src/e_mod_main.c
+++ b/trunk/E-MODULES-EXTRA/places/src/e_mod_main.c
@@ -83,6 +83,7 @@ e_modapi_init(E_Module *m)
83 E_CONFIG_LIST(D, T, conf_items, conf_item_edd); 83 E_CONFIG_LIST(D, T, conf_items, conf_item_edd);
84 E_CONFIG_VAL(D, T, show_menu, UCHAR); 84 E_CONFIG_VAL(D, T, show_menu, UCHAR);
85 E_CONFIG_VAL(D, T, hide_header, UCHAR); 85 E_CONFIG_VAL(D, T, hide_header, UCHAR);
86 E_CONFIG_VAL(D, T, autoclose_popup, UCHAR);
86 E_CONFIG_VAL(D, T, show_home, UCHAR); 87 E_CONFIG_VAL(D, T, show_home, UCHAR);
87 E_CONFIG_VAL(D, T, show_desk, UCHAR); 88 E_CONFIG_VAL(D, T, show_desk, UCHAR);
88 E_CONFIG_VAL(D, T, show_trash, UCHAR); 89 E_CONFIG_VAL(D, T, show_trash, UCHAR);
@@ -247,6 +248,19 @@ _gc_shutdown(E_Gadcon_Client *gcc)
247 _places_cb_mouse_down); 248 _places_cb_mouse_down);
248 places_empty_box(inst->o_main); 249 places_empty_box(inst->o_main);
249 evas_object_del(inst->o_main); 250 evas_object_del(inst->o_main);
251 inst->o_main = NULL;
252 }
253
254 if (inst->popup)
255 {
256 e_object_del(E_OBJECT(inst->popup));
257 inst->popup = NULL;
258 }
259
260 if (inst->o_icon)
261 {
262 evas_object_del(inst->o_icon);
263 inst->o_icon = NULL;
250 } 264 }
251 265
252 E_FREE(inst); 266 E_FREE(inst);
@@ -351,6 +365,7 @@ _places_conf_new(void)
351 places_conf->auto_open = 0; 365 places_conf->auto_open = 0;
352 places_conf->show_home = 1; 366 places_conf->show_home = 1;
353 places_conf->hide_header = 0; 367 places_conf->hide_header = 0;
368 places_conf->autoclose_popup = 0;
354 places_conf->show_desk = 1; 369 places_conf->show_desk = 1;
355 places_conf->show_trash = 0; 370 places_conf->show_trash = 0;
356 places_conf->show_root = 0; 371 places_conf->show_root = 0;
@@ -428,9 +443,13 @@ _places_popup_del_cb(Evas_Object *obj)
428 inst = e_object_data_get(E_OBJECT(obj)); 443 inst = e_object_data_get(E_OBJECT(obj));
429 if (!inst) return; 444 if (!inst) return;
430 445
431 places_empty_box(inst->o_main); 446 if (inst->o_main)
432 evas_object_del(inst->o_main); 447 {
433 inst->o_main = NULL; 448 places_empty_box(inst->o_main);
449 evas_object_del(inst->o_main);
450 inst->o_main = NULL;
451 }
452
434 inst->popup = NULL; 453 inst->popup = NULL;
435} 454}
436 455
@@ -445,7 +464,7 @@ _places_popup_new(Instance *inst)
445 464
446 // create the popup 465 // create the popup
447 popup = e_gadcon_popup_new(inst->gcc); 466 popup = e_gadcon_popup_new(inst->gcc);
448 if (0) // TODO make popup_autoclose an option (and close when volume selected?) 467 if (places_conf->autoclose_popup)
449 e_popup_autoclose(popup->win, NULL, NULL); 468 e_popup_autoclose(popup->win, NULL, NULL);
450 e_object_data_set(E_OBJECT(popup), inst); 469 e_object_data_set(E_OBJECT(popup), inst);
451 E_OBJECT_DEL_SET(popup, _places_popup_del_cb); 470 E_OBJECT_DEL_SET(popup, _places_popup_del_cb);
diff --git a/trunk/E-MODULES-EXTRA/places/src/e_mod_main.h b/trunk/E-MODULES-EXTRA/places/src/e_mod_main.h
index 981ef626d0..a5fac161eb 100644
--- a/trunk/E-MODULES-EXTRA/places/src/e_mod_main.h
+++ b/trunk/E-MODULES-EXTRA/places/src/e_mod_main.h
@@ -12,7 +12,7 @@
12 12
13/* Macros used for config file versioning */ 13/* Macros used for config file versioning */
14#define MOD_CONFIG_FILE_EPOCH 0x0001 14#define MOD_CONFIG_FILE_EPOCH 0x0001
15#define MOD_CONFIG_FILE_GENERATION 0x008f 15#define MOD_CONFIG_FILE_GENERATION 0x0090
16#define MOD_CONFIG_FILE_VERSION \ 16#define MOD_CONFIG_FILE_VERSION \
17 ((MOD_CONFIG_FILE_EPOCH << 16) | MOD_CONFIG_FILE_GENERATION) 17 ((MOD_CONFIG_FILE_EPOCH << 16) | MOD_CONFIG_FILE_GENERATION)
18 18
@@ -28,18 +28,19 @@ struct _Config
28 int version; 28 int version;
29 29
30 const char *fm; 30 const char *fm;
31 unsigned char auto_mount; 31 Eina_Bool auto_mount;
32 unsigned char boot_mount; 32 Eina_Bool boot_mount;
33 unsigned char auto_open; 33 Eina_Bool auto_open;
34 unsigned char show_menu; 34 Eina_Bool show_menu;
35 unsigned char hide_header; 35 Eina_Bool hide_header;
36 Eina_Bool autoclose_popup;
36 37
37 unsigned char show_home; 38 Eina_Bool show_home;
38 unsigned char show_desk; 39 Eina_Bool show_desk;
39 unsigned char show_trash; 40 Eina_Bool show_trash;
40 unsigned char show_root; 41 Eina_Bool show_root;
41 unsigned char show_temp; 42 Eina_Bool show_temp;
42 unsigned char show_bookm; 43 Eina_Bool show_bookm;
43}; 44};
44 45
45typedef struct _Config_Item Config_Item; 46typedef struct _Config_Item Config_Item;
diff --git a/trunk/E-MODULES-EXTRA/places/src/e_mod_places.c b/trunk/E-MODULES-EXTRA/places/src/e_mod_places.c
index 93964321fb..94fe556fc3 100644
--- a/trunk/E-MODULES-EXTRA/places/src/e_mod_places.c
+++ b/trunk/E-MODULES-EXTRA/places/src/e_mod_places.c
@@ -19,7 +19,7 @@
19static Eina_Bool _places_poller(void *data); 19static Eina_Bool _places_poller(void *data);
20static const char *_places_human_size_get(unsigned long long size); 20static const char *_places_human_size_get(unsigned long long size);
21static void _places_volume_object_update(Volume *vol, Evas_Object *obj); 21static void _places_volume_object_update(Volume *vol, Evas_Object *obj);
22static void _places_run_fm(void *data, E_Menu *m, E_Menu_Item *mi); 22static void _places_run_fm(const char *directory);
23 23
24/* Edje callbacks */ 24/* Edje callbacks */
25void _places_icon_activated_cb(void *data, Evas_Object *o, const char *emission, const char *source); 25void _places_icon_activated_cb(void *data, Evas_Object *o, const char *emission, const char *source);
@@ -110,8 +110,6 @@ places_volume_add(const char *id, Eina_Bool first_time)
110 v->label = eina_stringshare_add(""); 110 v->label = eina_stringshare_add("");
111 v->mount_point = eina_stringshare_add(""); 111 v->mount_point = eina_stringshare_add("");
112 v->fstype = eina_stringshare_add(""); 112 v->fstype = eina_stringshare_add("");
113 v->to_mount = EINA_FALSE;
114 v->force_open = EINA_FALSE;
115 v->drive_type = eina_stringshare_add(""); 113 v->drive_type = eina_stringshare_add("");
116 v->model = eina_stringshare_add(""); 114 v->model = eina_stringshare_add("");
117 v->serial = eina_stringshare_add(""); 115 v->serial = eina_stringshare_add("");
@@ -227,7 +225,7 @@ places_volume_update(Volume *vol)
227 // the volume has been mounted as requested, open the fm 225 // the volume has been mounted as requested, open the fm
228 if (vol->force_open && vol->mounted && vol->mount_point) 226 if (vol->force_open && vol->mounted && vol->mount_point)
229 { 227 {
230 _places_run_fm((void*)vol->mount_point,NULL, NULL); 228 _places_run_fm(vol->mount_point);
231 vol->force_open = EINA_FALSE; 229 vol->force_open = EINA_FALSE;
232 } 230 }
233} 231}
@@ -612,14 +610,17 @@ _places_run_fm_external(const char *fm, const char *directory)
612} 610}
613 611
614static void 612static void
615_places_run_fm(void *data, E_Menu *m, E_Menu_Item *mi) 613_places_run_fm(const char *directory)
616{ 614{
617 const char *directory = data; 615 // TODO close the popup if any...but I miss inst here :/
618 616 // if (!m && inst->popup && places_conf->autoclose_popup)
617 // {
618 // e_object_del(E_OBJECT(inst->popup));
619 // }
620
619 if (places_conf->fm && places_conf->fm[0]) 621 if (places_conf->fm && places_conf->fm[0])
620 { 622 {
621 _places_run_fm_external(places_conf->fm, directory); 623 _places_run_fm_external(places_conf->fm, directory);
622 return;
623 } 624 }
624 else 625 else
625 { 626 {
@@ -711,7 +712,7 @@ _places_icon_activated_cb(void *data, Evas_Object *o, const char *emission, cons
711 Volume *vol = data; 712 Volume *vol = data;
712 713
713 if (vol->mounted) 714 if (vol->mounted)
714 _places_run_fm((void*)vol->mount_point, NULL, NULL); 715 _places_run_fm((void*)vol->mount_point);
715 else 716 else
716 { 717 {
717 vol->force_open = EINA_TRUE; 718 vol->force_open = EINA_TRUE;
@@ -722,8 +723,7 @@ _places_icon_activated_cb(void *data, Evas_Object *o, const char *emission, cons
722void // work in progress 723void // work in progress
723_places_custom_icon_activated_cb(void *data, Evas_Object *o, const char *emission, const char *source) 724_places_custom_icon_activated_cb(void *data, Evas_Object *o, const char *emission, const char *source)
724{ 725{
725 //data is char *uri 726 _places_run_fm((const char*)data);
726 _places_run_fm(data, NULL, NULL);
727} 727}
728 728
729void 729void
@@ -740,11 +740,17 @@ _places_eject_activated_cb(void *data, Evas_Object *o, const char *emission, con
740void 740void
741_places_header_activated_cb(void *data, Evas_Object *o, const char *emission, const char *source) 741_places_header_activated_cb(void *data, Evas_Object *o, const char *emission, const char *source)
742{ 742{
743 _places_run_fm((char*)e_user_homedir_get(), NULL, NULL); 743 _places_run_fm(e_user_homedir_get());
744} 744}
745 745
746 746
747/* E17 menu augmentation */ 747/* E17 menu augmentation */
748void
749_places_menu_cb(void *data, E_Menu *m, E_Menu_Item *mi)
750{
751 _places_run_fm((const char*) data);
752}
753
748static void 754static void
749_places_bookmarks_parse(E_Menu *em) 755_places_bookmarks_parse(E_Menu *em)
750{ 756{
@@ -770,17 +776,14 @@ _places_bookmarks_parse(E_Menu *em)
770 alias++; 776 alias++;
771 } 777 }
772 uri = efreet_uri_decode(line); 778 uri = efreet_uri_decode(line);
773 if (uri && uri->path) 779 if (uri && uri->path && ecore_file_exists(uri->path))
774 { 780 {
775 if (ecore_file_exists(uri->path)) 781 mi = e_menu_item_new(em);
776 { 782 e_menu_item_label_set(mi, alias ? alias :
777 mi = e_menu_item_new(em); 783 ecore_file_file_get(uri->path));
778 e_menu_item_label_set(mi, alias ? alias : 784 e_util_menu_item_theme_icon_set(mi, "folder");
779 ecore_file_file_get(uri->path)); 785 e_menu_item_callback_set(mi, _places_menu_cb,
780 e_util_menu_item_theme_icon_set(mi, "folder"); 786 strdup(uri->path)); //TODO free somewhere
781 e_menu_item_callback_set(mi, _places_run_fm,
782 strdup(uri->path)); //TODO free somewhere
783 }
784 } 787 }
785 if (uri) efreet_uri_free(uri); 788 if (uri) efreet_uri_free(uri);
786 } 789 }
@@ -789,12 +792,6 @@ _places_bookmarks_parse(E_Menu *em)
789} 792}
790 793
791void 794void
792places_menu_click_cb(void *data, E_Menu *m, E_Menu_Item *mi)
793{
794 _places_icon_activated_cb(data, NULL, NULL, NULL);
795}
796
797void
798places_generate_menu(void *data, E_Menu *em) 795places_generate_menu(void *data, E_Menu *em)
799{ 796{
800 E_Menu_Item *mi; 797 E_Menu_Item *mi;
@@ -806,7 +803,7 @@ places_generate_menu(void *data, E_Menu *em)
806 mi = e_menu_item_new(em); 803 mi = e_menu_item_new(em);
807 e_menu_item_label_set(mi, D_("Home")); 804 e_menu_item_label_set(mi, D_("Home"));
808 e_util_menu_item_theme_icon_set(mi, "user-home"); 805 e_util_menu_item_theme_icon_set(mi, "user-home");
809 e_menu_item_callback_set(mi, _places_run_fm, (char*)e_user_homedir_get()); 806 e_menu_item_callback_set(mi, _places_menu_cb, (char*)e_user_homedir_get());
810 } 807 }
811 808
812 // Desktop 809 // Desktop
@@ -816,7 +813,7 @@ places_generate_menu(void *data, E_Menu *em)
816 e_menu_item_label_set(mi, D_("Desktop")); 813 e_menu_item_label_set(mi, D_("Desktop"));
817 e_util_menu_item_theme_icon_set(mi, "user-desktop"); 814 e_util_menu_item_theme_icon_set(mi, "user-desktop");
818 snprintf(buf, sizeof(buf), "%s/Desktop", (char*)e_user_homedir_get()); 815 snprintf(buf, sizeof(buf), "%s/Desktop", (char*)e_user_homedir_get());
819 e_menu_item_callback_set(mi, _places_run_fm, strdup(buf)); //TODO free somewhere 816 e_menu_item_callback_set(mi, _places_menu_cb, strdup(buf)); //TODO free somewhere
820 } 817 }
821 818
822 // Trash 819 // Trash
@@ -825,7 +822,7 @@ places_generate_menu(void *data, E_Menu *em)
825 mi = e_menu_item_new(em); 822 mi = e_menu_item_new(em);
826 e_menu_item_label_set(mi, D_("Trash")); 823 e_menu_item_label_set(mi, D_("Trash"));
827 e_util_menu_item_theme_icon_set(mi, "user-trash"); 824 e_util_menu_item_theme_icon_set(mi, "user-trash");
828 e_menu_item_callback_set(mi, _places_run_fm, "trash:///"); 825 e_menu_item_callback_set(mi, _places_menu_cb, "trash:///");
829 } 826 }
830 827
831 // File System 828 // File System
@@ -834,7 +831,7 @@ places_generate_menu(void *data, E_Menu *em)
834 mi = e_menu_item_new(em); 831 mi = e_menu_item_new(em);
835 e_menu_item_label_set(mi, D_("Filesystem")); 832 e_menu_item_label_set(mi, D_("Filesystem"));
836 e_util_menu_item_theme_icon_set(mi, "drive-harddisk"); 833 e_util_menu_item_theme_icon_set(mi, "drive-harddisk");
837 e_menu_item_callback_set(mi, _places_run_fm, "/"); 834 e_menu_item_callback_set(mi, _places_menu_cb, "/");
838 } 835 }
839 836
840 // Temp 837 // Temp
@@ -843,7 +840,7 @@ places_generate_menu(void *data, E_Menu *em)
843 mi = e_menu_item_new(em); 840 mi = e_menu_item_new(em);
844 e_menu_item_label_set(mi, D_("Temp")); 841 e_menu_item_label_set(mi, D_("Temp"));
845 e_util_menu_item_theme_icon_set(mi, "user-temp"); 842 e_util_menu_item_theme_icon_set(mi, "user-temp");
846 e_menu_item_callback_set(mi, _places_run_fm, "/tmp"); 843 e_menu_item_callback_set(mi, _places_menu_cb, "/tmp");
847 } 844 }
848 845
849 // Separator 846 // Separator
@@ -873,7 +870,7 @@ places_generate_menu(void *data, E_Menu *em)
873 if (vol->icon) 870 if (vol->icon)
874 e_util_menu_item_theme_icon_set(mi, vol->icon); 871 e_util_menu_item_theme_icon_set(mi, vol->icon);
875 872
876 e_menu_item_callback_set(mi, places_menu_click_cb, vol); 873 e_menu_item_callback_set(mi, _places_menu_cb, vol);
877 volumes_visible = 1; 874 volumes_visible = 1;
878 } 875 }
879 876