diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 891b86ee5..317add1c9 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -24,109 +24,118 @@ typedef enum _E_Fm2_Action_Type FILE_CHANGE } E_Fm2_Action_Type; -typedef struct _E_Fm2_Smart_Data E_Fm2_Smart_Data; -typedef struct _E_Fm2_Region E_Fm2_Region; -typedef struct _E_Fm2_Finfo E_Fm2_Finfo; -typedef struct _E_Fm2_Action E_Fm2_Action; -typedef struct _E_Fm2_Client E_Fm2_Client; -typedef struct _E_Fm2_Uri E_Fm2_Uri; -typedef struct _E_Fm2_Context_Menu_Data E_Fm2_Context_Menu_Data; +typedef struct _E_Fm2_Smart_Data E_Fm2_Smart_Data; +typedef struct _E_Fm2_Region E_Fm2_Region; +typedef struct _E_Fm2_Finfo E_Fm2_Finfo; +typedef struct _E_Fm2_Action E_Fm2_Action; +typedef struct _E_Fm2_Client E_Fm2_Client; +typedef struct _E_Fm2_Uri E_Fm2_Uri; +typedef struct _E_Fm2_Context_Menu_Data E_Fm2_Context_Menu_Data; struct _E_Fm2_Smart_Data { - int id; - Evas_Coord x, y, w, h, pw, ph; - Evas_Object *obj; - Evas_Object *clip; - Evas_Object *underlay; - Evas_Object *overlay; - Evas_Object *drop; - Evas_Object *drop_in; - Evas_Object *sel_rect; - const char *dev; - const char *path; - const char *realpath; + int id; + Evas_Coord x, y, w, h, pw, ph; + Evas_Object *obj; + Evas_Object *clip; + Evas_Object *underlay; + Evas_Object *overlay; + Evas_Object *drop; + Evas_Object *drop_in; + Evas_Object *sel_rect; + const char *dev; + const char *path; + const char *realpath; - struct { - Evas_Coord w, h; + struct + { + Evas_Coord w, h; } max, pmax; - struct { - Evas_Coord x, y; + struct + { + Evas_Coord x, y; } pos; - struct { - Eina_List *list; - int member_max; + struct + { + Eina_List *list; + int member_max; } regions; - struct { - struct { - E_Fm_Cb func; - void *data; + struct + { + struct + { + E_Fm_Cb func; + void *data; } start, end, replace; E_Fm2_Menu_Flags flags; } icon_menu; - Eina_List *icons; - Eina_List *icons_place; - Eina_List *queue; - Ecore_Timer *scan_timer; - Ecore_Idler *sort_idler; - Ecore_Job *scroll_job; - Ecore_Job *resize_job; - Ecore_Job *refresh_job; - E_Menu *menu; - E_Entry_Dialog *entry_dialog; - E_Dialog *image_dialog; - Eina_Bool iconlist_changed : 1; - Eina_Bool order_file : 1; - Eina_Bool typebuf_visible : 1; - Eina_Bool show_hidden_files : 1; - Eina_Bool listing : 1; - Eina_Bool inherited_dir_props : 1; - signed char view_mode; /* -1 = unset */ - signed short icon_size; /* -1 = unset */ - E_Fm2_View_Flags view_flags; + Eina_List *icons; + Eina_List *icons_place; + Eina_List *queue; + Ecore_Timer *scan_timer; + Ecore_Idler *sort_idler; + Ecore_Job *scroll_job; + Ecore_Job *resize_job; + Ecore_Job *refresh_job; + E_Menu *menu; + E_Entry_Dialog *entry_dialog; + E_Dialog *image_dialog; + Eina_Bool iconlist_changed : 1; + Eina_Bool order_file : 1; + Eina_Bool typebuf_visible : 1; + Eina_Bool show_hidden_files : 1; + Eina_Bool listing : 1; + Eina_Bool inherited_dir_props : 1; + signed char view_mode; /* -1 = unset */ + signed short icon_size; /* -1 = unset */ + E_Fm2_View_Flags view_flags; - E_Fm2_Config *config; - const char *custom_theme; - const char *custom_theme_content; + E_Fm2_Config *config; + const char *custom_theme; + const char *custom_theme_content; - struct { - Evas_Object *obj, *obj2; - Eina_List *last_insert; - Eina_List **list_index; - int iter; + struct + { + Evas_Object *obj, *obj2; + Eina_List *last_insert; + Eina_List **list_index; + int iter; } tmp; - struct { - Eina_List *actions; - Ecore_Idler *idler; - Ecore_Timer *timer; + struct + { + Eina_List *actions; + Ecore_Idler *idler; + Ecore_Timer *timer; Eina_Bool deletions : 1; } live; - struct { - char *buf; - Ecore_Timer *timer; + struct + { + char *buf; + Ecore_Timer *timer; } typebuf; - int busy_count; + int busy_count; - E_Object *eobj; - E_Drop_Handler *drop_handler; - E_Fm2_Icon *drop_icon; - E_Fm2_Mount *mount; - signed char drop_after; + E_Object *eobj; + E_Drop_Handler *drop_handler; + E_Fm2_Icon *drop_icon; + E_Fm2_Mount *mount; + signed char drop_after; Eina_Bool drop_show : 1; Eina_Bool drop_in_show : 1; Eina_Bool drop_all : 1; Eina_Bool drag : 1; Eina_Bool selecting : 1; - struct { + struct + { int ox, oy; int x, y, w, h; } selrect; - E_Fm2_Icon *iop_icon; + E_Fm2_Icon *iop_icon; }; struct _E_Fm2_Region @@ -134,7 +143,7 @@ struct _E_Fm2_Region E_Fm2_Smart_Data *sd; Evas_Coord x, y, w, h; Eina_List *list; - Eina_Bool realized : 1; + Eina_Bool realized : 1; }; struct _E_Fm2_Icon @@ -153,43 +162,44 @@ struct _E_Fm2_Icon E_Fm2_Icon_Info info; - struct { - Evas_Coord x, y; + struct + { + Evas_Coord x, y; Eina_Bool start : 1; Eina_Bool dnd : 1; Eina_Bool src : 1; } drag; - Eina_Bool realized : 1; - Eina_Bool selected : 1; - Eina_Bool last_selected : 1; - Eina_Bool saved_pos : 1; - Eina_Bool odd : 1; - Eina_Bool down_sel : 1; - Eina_Bool removable_state_change : 1; + Eina_Bool realized : 1; + Eina_Bool selected : 1; + Eina_Bool last_selected : 1; + Eina_Bool saved_pos : 1; + Eina_Bool odd : 1; + Eina_Bool down_sel : 1; + Eina_Bool removable_state_change : 1; }; struct _E_Fm2_Finfo { struct stat st; - int broken_link; + int broken_link; const char *lnk; const char *rlnk; }; struct _E_Fm2_Action { - E_Fm2_Action_Type type; - const char *file; - const char *file2; - int flags; - E_Fm2_Finfo finf; + E_Fm2_Action_Type type; + const char *file; + const char *file2; + int flags; + E_Fm2_Finfo finf; }; struct _E_Fm2_Client { Ecore_Ipc_Client *cl; - int req; + int req; }; struct _E_Fm2_Uri @@ -200,224 +210,224 @@ struct _E_Fm2_Uri struct _E_Fm2_Context_Menu_Data { - E_Fm2_Icon *icon; + E_Fm2_Icon *icon; E_Fm2_Mime_Handler *handler; }; -static const char *_e_fm2_dev_path_map(const char *dev, const char *path); -static void _e_fm2_file_add(Evas_Object *obj, const char *file, int unique, const char *file_rel, int after, E_Fm2_Finfo *finf); -static void _e_fm2_file_del(Evas_Object *obj, const char *file); -static void _e_fm2_queue_process(Evas_Object *obj); -static void _e_fm2_queue_free(Evas_Object *obj); -static void _e_fm2_regions_free(Evas_Object *obj); -static void _e_fm2_regions_populate(Evas_Object *obj); -static void _e_fm2_icons_place(Evas_Object *obj); -static void _e_fm2_icons_free(Evas_Object *obj); -static void _e_fm2_regions_eval(Evas_Object *obj); -static void _e_fm2_config_free(E_Fm2_Config *cfg); +static const char * _e_fm2_dev_path_map(const char *dev, const char *path); +static void _e_fm2_file_add(Evas_Object *obj, const char *file, int unique, const char *file_rel, int after, E_Fm2_Finfo *finf); +static void _e_fm2_file_del(Evas_Object *obj, const char *file); +static void _e_fm2_queue_process(Evas_Object *obj); +static void _e_fm2_queue_free(Evas_Object *obj); +static void _e_fm2_regions_free(Evas_Object *obj); +static void _e_fm2_regions_populate(Evas_Object *obj); +static void _e_fm2_icons_place(Evas_Object *obj); +static void _e_fm2_icons_free(Evas_Object *obj); +static void _e_fm2_regions_eval(Evas_Object *obj); +static void _e_fm2_config_free(E_Fm2_Config *cfg); -static void _e_fm2_dir_load_props(E_Fm2_Smart_Data *sd); -static void _e_fm2_dir_save_props(E_Fm2_Smart_Data *sd); +static void _e_fm2_dir_load_props(E_Fm2_Smart_Data *sd); +static void _e_fm2_dir_save_props(E_Fm2_Smart_Data *sd); -static Evas_Object *_e_fm2_file_fm2_find(const char *file); -static E_Fm2_Icon *_e_fm2_icon_find(Evas_Object *obj, const char *file); -static const char *_e_fm2_uri_escape(const char *path); -static Eina_List *_e_fm2_uri_path_list_get(Eina_List *uri_list); -static Eina_List *_e_fm2_uri_icon_list_get(Eina_List *uri); +static Evas_Object * _e_fm2_file_fm2_find(const char *file); +static E_Fm2_Icon * _e_fm2_icon_find(Evas_Object *obj, const char *file); +static const char * _e_fm2_uri_escape(const char *path); +static Eina_List * _e_fm2_uri_path_list_get(Eina_List *uri_list); +static Eina_List * _e_fm2_uri_icon_list_get(Eina_List *uri); -static E_Fm2_Icon *_e_fm2_icon_new(E_Fm2_Smart_Data *sd, const char *file, E_Fm2_Finfo *finf); -static void _e_fm2_icon_unfill(E_Fm2_Icon *ic); -static int _e_fm2_icon_fill(E_Fm2_Icon *ic, E_Fm2_Finfo *finf); -static void _e_fm2_icon_free(E_Fm2_Icon *ic); -static void _e_fm2_icon_realize(E_Fm2_Icon *ic); -static void _e_fm2_icon_unrealize(E_Fm2_Icon *ic); -static Eina_Bool _e_fm2_icon_visible(const E_Fm2_Icon *ic); -static void _e_fm2_icon_label_set(E_Fm2_Icon *ic, Evas_Object *obj); -static Evas_Object *_e_fm2_icon_icon_direct_set(E_Fm2_Icon *ic, Evas_Object *o, Evas_Smart_Cb gen_func, void *data, int force_gen); -static void _e_fm2_icon_icon_set(E_Fm2_Icon *ic); -static void _e_fm2_icon_thumb(const E_Fm2_Icon *ic, Evas_Object *oic, int force); -static void _e_fm2_icon_select(E_Fm2_Icon *ic); -static void _e_fm2_icon_deselect(E_Fm2_Icon *ic); -static int _e_fm2_icon_desktop_load(E_Fm2_Icon *ic); +static E_Fm2_Icon * _e_fm2_icon_new(E_Fm2_Smart_Data *sd, const char *file, E_Fm2_Finfo *finf); +static void _e_fm2_icon_unfill(E_Fm2_Icon *ic); +static int _e_fm2_icon_fill(E_Fm2_Icon *ic, E_Fm2_Finfo *finf); +static void _e_fm2_icon_free(E_Fm2_Icon *ic); +static void _e_fm2_icon_realize(E_Fm2_Icon *ic); +static void _e_fm2_icon_unrealize(E_Fm2_Icon *ic); +static Eina_Bool _e_fm2_icon_visible(const E_Fm2_Icon *ic); +static void _e_fm2_icon_label_set(E_Fm2_Icon *ic, Evas_Object *obj); +static Evas_Object * _e_fm2_icon_icon_direct_set(E_Fm2_Icon *ic, Evas_Object *o, Evas_Smart_Cb gen_func, void *data, int force_gen); +static void _e_fm2_icon_icon_set(E_Fm2_Icon *ic); +static void _e_fm2_icon_thumb(const E_Fm2_Icon *ic, Evas_Object *oic, int force); +static void _e_fm2_icon_select(E_Fm2_Icon *ic); +static void _e_fm2_icon_deselect(E_Fm2_Icon *ic); +static int _e_fm2_icon_desktop_load(E_Fm2_Icon *ic); static E_Fm2_Region *_e_fm2_region_new(E_Fm2_Smart_Data *sd); -static void _e_fm2_region_free(E_Fm2_Region *rg); -static void _e_fm2_region_realize(E_Fm2_Region *rg); -static void _e_fm2_region_unrealize(E_Fm2_Region *rg); -static int _e_fm2_region_visible(E_Fm2_Region *rg); +static void _e_fm2_region_free(E_Fm2_Region *rg); +static void _e_fm2_region_realize(E_Fm2_Region *rg); +static void _e_fm2_region_unrealize(E_Fm2_Region *rg); +static int _e_fm2_region_visible(E_Fm2_Region *rg); -static void _e_fm2_icon_make_visible(E_Fm2_Icon *ic); -static void _e_fm2_icon_desel_any(Evas_Object *obj); -static E_Fm2_Icon *_e_fm2_icon_first_selected_find(Evas_Object *obj); -static E_Fm2_Icon *_e_fm2_icon_next_find(Evas_Object *obj, int next, int match_func(E_Fm2_Icon *ic, void *data), void *data); +static void _e_fm2_icon_make_visible(E_Fm2_Icon *ic); +static void _e_fm2_icon_desel_any(Evas_Object *obj); +static E_Fm2_Icon * _e_fm2_icon_first_selected_find(Evas_Object *obj); +static E_Fm2_Icon * _e_fm2_icon_next_find(Evas_Object *obj, int next, intmatch_func(E_Fm2_Icon * ic, void *data), void *data); -static void _e_fm2_icon_sel_first(Evas_Object *obj); -static void _e_fm2_icon_sel_last(Evas_Object *obj); -static void _e_fm2_icon_sel_any(Evas_Object *obj); -static void _e_fm2_icon_sel_prev(Evas_Object *obj); -static void _e_fm2_icon_sel_next(Evas_Object *obj); -static void _e_fm2_icon_sel_down(Evas_Object *obj); -static void _e_fm2_icon_sel_up(Evas_Object *obj); +static void _e_fm2_icon_sel_first(Evas_Object *obj); +static void _e_fm2_icon_sel_last(Evas_Object *obj); +static void _e_fm2_icon_sel_any(Evas_Object *obj); +static void _e_fm2_icon_sel_prev(Evas_Object *obj); +static void _e_fm2_icon_sel_next(Evas_Object *obj); +static void _e_fm2_icon_sel_down(Evas_Object *obj); +static void _e_fm2_icon_sel_up(Evas_Object *obj); -static void _e_fm2_typebuf_show(Evas_Object *obj); -static void _e_fm2_typebuf_hide(Evas_Object *obj); +static void _e_fm2_typebuf_show(Evas_Object *obj); +static void _e_fm2_typebuf_hide(Evas_Object *obj); //static void _e_fm2_typebuf_history_prev(Evas_Object *obj); //static void _e_fm2_typebuf_history_next(Evas_Object *obj); -static void _e_fm2_typebuf_run(Evas_Object *obj); -static void _e_fm2_typebuf_match(Evas_Object *obj, int next); -static void _e_fm2_typebuf_complete(Evas_Object *obj); -static void _e_fm2_typebuf_char_append(Evas_Object *obj, const char *ch); -static void _e_fm2_typebuf_char_backspace(Evas_Object *obj); +static void _e_fm2_typebuf_run(Evas_Object *obj); +static void _e_fm2_typebuf_match(Evas_Object *obj, int next); +static void _e_fm2_typebuf_complete(Evas_Object *obj); +static void _e_fm2_typebuf_char_append(Evas_Object *obj, const char *ch); +static void _e_fm2_typebuf_char_backspace(Evas_Object *obj); -static void _e_fm2_cb_dnd_enter(void *data, const char *type, void *event); -static void _e_fm2_cb_dnd_move(void *data, const char *type, void *event); -static void _e_fm2_cb_dnd_leave(void *data, const char *type, void *event); -static void _e_fm2_cb_dnd_drop(void *data, const char *type, void *event); -static void _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _e_fm2_cb_icon_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _e_fm2_cb_icon_thumb_dnd_gen(void *data, Evas_Object *obj, void *event_info); -static void _e_fm2_cb_icon_thumb_gen(void *data, Evas_Object *obj, void *event_info); -static void _e_fm2_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _e_fm2_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _e_fm2_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _e_fm2_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _e_fm2_cb_scroll_job(void *data); -static void _e_fm2_cb_resize_job(void *data); -static int _e_fm2_cb_icon_sort(const void *data1, const void *data2); -static Eina_Bool _e_fm2_cb_scan_timer(void *data); -static Eina_Bool _e_fm2_cb_sort_idler(void *data); +static void _e_fm2_cb_dnd_enter(void *data, const char *type, void *event); +static void _e_fm2_cb_dnd_move(void *data, const char *type, void *event); +static void _e_fm2_cb_dnd_leave(void *data, const char *type, void *event); +static void _e_fm2_cb_dnd_drop(void *data, const char *type, void *event); +static void _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_fm2_cb_icon_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_fm2_cb_icon_thumb_dnd_gen(void *data, Evas_Object *obj, void *event_info); +static void _e_fm2_cb_icon_thumb_gen(void *data, Evas_Object *obj, void *event_info); +static void _e_fm2_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_fm2_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_fm2_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_fm2_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_fm2_cb_scroll_job(void *data); +static void _e_fm2_cb_resize_job(void *data); +static int _e_fm2_cb_icon_sort(const void *data1, const void *data2); +static Eina_Bool _e_fm2_cb_scan_timer(void *data); +static Eina_Bool _e_fm2_cb_sort_idler(void *data); -static void _e_fm2_obj_icons_place(E_Fm2_Smart_Data *sd); +static void _e_fm2_obj_icons_place(E_Fm2_Smart_Data *sd); -static void _e_fm2_smart_add(Evas_Object *object); -static void _e_fm2_smart_del(Evas_Object *object); -static void _e_fm2_smart_move(Evas_Object *object, Evas_Coord x, Evas_Coord y); -static void _e_fm2_smart_resize(Evas_Object *object, Evas_Coord w, Evas_Coord h); -static void _e_fm2_smart_show(Evas_Object *object); -static void _e_fm2_smart_hide(Evas_Object *object); -static void _e_fm2_smart_color_set(Evas_Object *obj, int r, int g, int b, int a); -static void _e_fm2_smart_clip_set(Evas_Object *obj, Evas_Object * clip); -static void _e_fm2_smart_clip_unset(Evas_Object *obj); +static void _e_fm2_smart_add(Evas_Object *object); +static void _e_fm2_smart_del(Evas_Object *object); +static void _e_fm2_smart_move(Evas_Object *object, Evas_Coord x, Evas_Coord y); +static void _e_fm2_smart_resize(Evas_Object *object, Evas_Coord w, Evas_Coord h); +static void _e_fm2_smart_show(Evas_Object *object); +static void _e_fm2_smart_hide(Evas_Object *object); +static void _e_fm2_smart_color_set(Evas_Object *obj, int r, int g, int b, int a); +static void _e_fm2_smart_clip_set(Evas_Object *obj, Evas_Object *clip); +static void _e_fm2_smart_clip_unset(Evas_Object *obj); -static void _e_fm2_menu(Evas_Object *obj, unsigned int timestamp); -static void _e_fm2_menu_post_cb(void *data, E_Menu *m); -static void _e_fm2_icon_menu(E_Fm2_Icon *ic, Evas_Object *obj, unsigned int timestamp); -static void _e_fm2_icon_menu_post_cb(void *data, E_Menu *m); -static void _e_fm2_icon_menu_item_cb(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_icon_view_menu_pre(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_toggle_inherit_dir_props(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_view_menu_pre(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_view_menu_grid_icons_cb(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_view_menu_custom_icons_cb(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_view_menu_list_cb(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_view_menu_use_default_cb(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_view_menu_set_background_cb(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_view_menu_set_overlay_cb(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_view_image_sel(E_Fm2_Smart_Data *sd, const char *title, void (*ok_cb) (void *data, E_Dialog *dia), void (*clear_cb) (void *data, E_Dialog *dia)); -static void _e_fm2_view_image_sel_close(void *data, E_Dialog *dia); -static void _e_fm2_refresh(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_toggle_hidden_files(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_toggle_ordering(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_sort(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_new_directory(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_new_directory_delete_cb(void *obj); -static void _e_fm2_new_directory_yes_cb(char *text, void *data); -static void _e_fm2_new_directory_no_cb(void *data); -static void _e_fm2_file_rename(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_file_rename_delete_cb(void *obj); -static void _e_fm2_file_rename_yes_cb(char *text, void *data); -static void _e_fm2_file_rename_no_cb(void *data); -static void _e_fm2_file_application_properties(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__); -static void _e_fm2_file_properties(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_file_properties_delete_cb(void *obj); -static void _e_fm2_file_do_rename(const char *text, E_Fm2_Icon *ic); +static void _e_fm2_menu(Evas_Object *obj, unsigned int timestamp); +static void _e_fm2_menu_post_cb(void *data, E_Menu *m); +static void _e_fm2_icon_menu(E_Fm2_Icon *ic, Evas_Object *obj, unsigned int timestamp); +static void _e_fm2_icon_menu_post_cb(void *data, E_Menu *m); +static void _e_fm2_icon_menu_item_cb(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_icon_view_menu_pre(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_toggle_inherit_dir_props(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_view_menu_pre(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_view_menu_grid_icons_cb(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_view_menu_custom_icons_cb(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_view_menu_list_cb(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_view_menu_use_default_cb(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_view_menu_set_background_cb(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_view_menu_set_overlay_cb(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_view_image_sel(E_Fm2_Smart_Data *sd, const char *title, void (*ok_cb)(void *data, E_Dialog *dia), void (*clear_cb)(void *data, E_Dialog *dia)); +static void _e_fm2_view_image_sel_close(void *data, E_Dialog *dia); +static void _e_fm2_refresh(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_toggle_hidden_files(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_toggle_ordering(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_sort(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_new_directory(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_new_directory_delete_cb(void *obj); +static void _e_fm2_new_directory_yes_cb(char *text, void *data); +static void _e_fm2_new_directory_no_cb(void *data); +static void _e_fm2_file_rename(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_file_rename_delete_cb(void *obj); +static void _e_fm2_file_rename_yes_cb(char *text, void *data); +static void _e_fm2_file_rename_no_cb(void *data); +static void _e_fm2_file_application_properties(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__); +static void _e_fm2_file_properties(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_file_properties_delete_cb(void *obj); +static void _e_fm2_file_do_rename(const char *text, E_Fm2_Icon *ic); -static Evas_Object* _e_fm2_icon_entry_widget_add(E_Fm2_Icon *ic); -static void _e_fm2_icon_entry_widget_del(E_Fm2_Icon *ic); -static void _e_fm2_icon_entry_widget_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _e_fm2_icon_entry_widget_accept(E_Fm2_Icon *ic); +static Evas_Object * _e_fm2_icon_entry_widget_add(E_Fm2_Icon *ic); +static void _e_fm2_icon_entry_widget_del(E_Fm2_Icon *ic); +static void _e_fm2_icon_entry_widget_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_fm2_icon_entry_widget_accept(E_Fm2_Icon *ic); -static E_Dialog* _e_fm_retry_abort_dialog(int pid, const char *str); -static void _e_fm_retry_abort_delete_cb(void *obj); -static void _e_fm_retry_abort_retry_cb(void *data, E_Dialog *dialog); -static void _e_fm_retry_abort_abort_cb(void *data, E_Dialog *dialog); +static E_Dialog * _e_fm_retry_abort_dialog(int pid, const char *str); +static void _e_fm_retry_abort_delete_cb(void *obj); +static void _e_fm_retry_abort_retry_cb(void *data, E_Dialog *dialog); +static void _e_fm_retry_abort_abort_cb(void *data, E_Dialog *dialog); -static E_Dialog* _e_fm_overwrite_dialog(int pid, const char *str); -static void _e_fm_overwrite_delete_cb(void *obj); -static void _e_fm_overwrite_no_cb(void *data, E_Dialog *dialog); -static void _e_fm_overwrite_no_all_cb(void *data, E_Dialog *dialog); -static void _e_fm_overwrite_yes_cb(void *data, E_Dialog *dialog); -static void _e_fm_overwrite_yes_all_cb(void *data, E_Dialog *dialog); +static E_Dialog * _e_fm_overwrite_dialog(int pid, const char *str); +static void _e_fm_overwrite_delete_cb(void *obj); +static void _e_fm_overwrite_no_cb(void *data, E_Dialog *dialog); +static void _e_fm_overwrite_no_all_cb(void *data, E_Dialog *dialog); +static void _e_fm_overwrite_yes_cb(void *data, E_Dialog *dialog); +static void _e_fm_overwrite_yes_all_cb(void *data, E_Dialog *dialog); -static E_Dialog* _e_fm_error_dialog(int pid, const char *str); -static void _e_fm_error_delete_cb(void *obj); -static void _e_fm_error_retry_cb(void *data, E_Dialog *dialog); -static void _e_fm_error_abort_cb(void *data, E_Dialog *dialog); -static void _e_fm_error_ignore_this_cb(void *data, E_Dialog *dialog); -static void _e_fm_error_ignore_all_cb(void *data, E_Dialog *dialog); +static E_Dialog * _e_fm_error_dialog(int pid, const char *str); +static void _e_fm_error_delete_cb(void *obj); +static void _e_fm_error_retry_cb(void *data, E_Dialog *dialog); +static void _e_fm_error_abort_cb(void *data, E_Dialog *dialog); +static void _e_fm_error_ignore_this_cb(void *data, E_Dialog *dialog); +static void _e_fm_error_ignore_all_cb(void *data, E_Dialog *dialog); -static void _e_fm_device_error_dialog(const char *title, const char *msg, const char *pstr); +static void _e_fm_device_error_dialog(const char *title, const char *msg, const char *pstr); -static void _e_fm2_file_delete(Evas_Object *obj); -static void _e_fm2_file_delete_menu(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_file_delete_delete_cb(void *obj); -static void _e_fm2_file_delete_yes_cb(void *data, E_Dialog *dialog); -static void _e_fm2_file_delete_no_cb(void *data, E_Dialog *dialog); -static void _e_fm2_refresh_job_cb(void *data); -static void _e_fm_file_buffer_clear(void); -static void _e_fm2_file_cut(Evas_Object *obj); -static void _e_fm2_file_copy(Evas_Object *obj); -static void _e_fm2_file_paste(Evas_Object *obj); -static void _e_fm2_file_symlink(Evas_Object *obj); -static void _e_fm2_file_cut_menu(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_file_copy_menu(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_file_paste_menu(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_file_symlink_menu(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_file_delete(Evas_Object *obj); +static void _e_fm2_file_delete_menu(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_file_delete_delete_cb(void *obj); +static void _e_fm2_file_delete_yes_cb(void *data, E_Dialog *dialog); +static void _e_fm2_file_delete_no_cb(void *data, E_Dialog *dialog); +static void _e_fm2_refresh_job_cb(void *data); +static void _e_fm_file_buffer_clear(void); +static void _e_fm2_file_cut(Evas_Object *obj); +static void _e_fm2_file_copy(Evas_Object *obj); +static void _e_fm2_file_paste(Evas_Object *obj); +static void _e_fm2_file_symlink(Evas_Object *obj); +static void _e_fm2_file_cut_menu(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_file_copy_menu(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_file_paste_menu(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_file_symlink_menu(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_live_file_add(Evas_Object *obj, const char *file, const char *file_rel, int after, E_Fm2_Finfo *finf); -static void _e_fm2_live_file_del(Evas_Object *obj, const char *file); -static void _e_fm2_live_file_changed(Evas_Object *obj, const char *file, E_Fm2_Finfo *finf); -static void _e_fm2_live_process_begin(Evas_Object *obj); -static void _e_fm2_live_process_end(Evas_Object *obj); -static void _e_fm2_live_process(Evas_Object *obj); -static Eina_Bool _e_fm2_cb_live_idler(void *data); -static Eina_Bool _e_fm2_cb_live_timer(void *data); +static void _e_fm2_live_file_add(Evas_Object *obj, const char *file, const char *file_rel, int after, E_Fm2_Finfo *finf); +static void _e_fm2_live_file_del(Evas_Object *obj, const char *file); +static void _e_fm2_live_file_changed(Evas_Object *obj, const char *file, E_Fm2_Finfo *finf); +static void _e_fm2_live_process_begin(Evas_Object *obj); +static void _e_fm2_live_process_end(Evas_Object *obj); +static void _e_fm2_live_process(Evas_Object *obj); +static Eina_Bool _e_fm2_cb_live_idler(void *data); +static Eina_Bool _e_fm2_cb_live_timer(void *data); -static int _e_fm2_theme_edje_object_set(E_Fm2_Smart_Data *sd, Evas_Object *o, const char *category, const char *group); -static int _e_fm2_theme_edje_icon_object_set(E_Fm2_Smart_Data *sd, Evas_Object *o, const char *category, const char *group); +static int _e_fm2_theme_edje_object_set(E_Fm2_Smart_Data *sd, Evas_Object *o, const char *category, const char *group); +static int _e_fm2_theme_edje_icon_object_set(E_Fm2_Smart_Data *sd, Evas_Object *o, const char *category, const char *group); -static void _e_fm2_mouse_1_handler(E_Fm2_Icon *ic, int up, void *evas_event); +static void _e_fm2_mouse_1_handler(E_Fm2_Icon *ic, int up, void *evas_event); -static void _e_fm2_client_spawn(void); +static void _e_fm2_client_spawn(void); static E_Fm2_Client *_e_fm2_client_get(void); -static int _e_fm2_client_monitor_add(const char *path); -static void _e_fm2_client_monitor_del(int id, const char *path); -static int _e_fm_client_file_del(const char *args, Evas_Object *e_fm); +static int _e_fm2_client_monitor_add(const char *path); +static void _e_fm2_client_monitor_del(int id, const char *path); +static int _e_fm_client_file_del(const char *args, Evas_Object *e_fm); //static int _e_fm2_client_file_trash(const char *path, Evas_Object *e_fm); -static int _e_fm2_client_file_mkdir(const char *path, const char *rel, int rel_to, int x, int y, int res_w, int res_h, Evas_Object *e_fm); -static int _e_fm_client_file_move(const char *args, Evas_Object *e_fm); -static int _e_fm2_client_file_symlink(const char *path, const char *dest, const char *rel, int rel_to, int x, int y, int res_w, int res_h, Evas_Object *e_fm); -static int _e_fm_client_file_copy(const char *args, Evas_Object *e_fm); -static int _e_fm_client_file_symlink(const char *args, Evas_Object *e_fm); +static int _e_fm2_client_file_mkdir(const char *path, const char *rel, int rel_to, int x, int y, int res_w, int res_h, Evas_Object *e_fm); +static int _e_fm_client_file_move(const char *args, Evas_Object *e_fm); +static int _e_fm2_client_file_symlink(const char *path, const char *dest, const char *rel, int rel_to, int x, int y, int res_w, int res_h, Evas_Object *e_fm); +static int _e_fm_client_file_copy(const char *args, Evas_Object *e_fm); +static int _e_fm_client_file_symlink(const char *args, Evas_Object *e_fm); -static void _e_fm2_sel_rect_update(void *data); -static inline void _e_fm2_context_menu_append(Evas_Object *obj, const char *path, Eina_List *l, E_Menu *mn, E_Fm2_Icon *ic); -static int _e_fm2_context_list_sort(const void *data1, const void *data2); +static void _e_fm2_sel_rect_update(void *data); +static inline void _e_fm2_context_menu_append(Evas_Object *obj, const char *path, Eina_List *l, E_Menu *mn, E_Fm2_Icon *ic); +static int _e_fm2_context_list_sort(const void *data1, const void *data2); -static char *_e_fm_string_append_char(char *str, size_t *size, size_t *len, char c); -static char *_e_fm_string_append_quoted(char *str, size_t *size, size_t *len, const char *src); +static char * _e_fm_string_append_char(char *str, size_t *size, size_t *len, char c); +static char * _e_fm_string_append_quoted(char *str, size_t *size, size_t *len, const char *src); -void _e_fm2_path_parent_set(Evas_Object *obj, const char *path); +void _e_fm2_path_parent_set(Evas_Object *obj, const char *path); -static void _e_fm2_volume_mount(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_volume_unmount(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_volume_eject(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_volume_mount(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_volume_unmount(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_fm2_volume_eject(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_fm2_icon_removable_update(E_Fm2_Icon *ic); -static void _e_fm2_volume_icon_update(E_Volume *v); +static void _e_fm2_icon_removable_update(E_Fm2_Icon *ic); +static void _e_fm2_volume_icon_update(E_Volume *v); -static void _e_fm2_operation_abort_internal(E_Fm2_Op_Registry_Entry *ere); +static void _e_fm2_operation_abort_internal(E_Fm2_Op_Registry_Entry *ere); static char *_e_fm2_meta_path = NULL; static Evas_Smart *_e_fm2_smart = NULL; @@ -487,11 +497,11 @@ _e_fm2_ext_is_desktop(const char *ext) #if E_FM2_SIMPLE_STRCASE_FILES if ((ext[0] == 'd') && ((strcmp(ext + 1, "esktop") == 0) || - (strcmp(ext + 1, "irectory") == 0))) + (strcmp(ext + 1, "irectory") == 0))) return 1; else if ((ext[0] == 'D') && - ((strcmp(ext + 1, "ESKTOP") == 0) || - (strcmp(ext + 1, "IRECTORY") == 0))) + ((strcmp(ext + 1, "ESKTOP") == 0) || + (strcmp(ext + 1, "IRECTORY") == 0))) return 1; else return 0; @@ -501,7 +511,7 @@ _e_fm2_ext_is_desktop(const char *ext) ext++; return ((strcasecmp(ext, "esktop") == 0) || - (strcasecmp(ext, "irectory") == 0)); + (strcasecmp(ext, "irectory") == 0)); #endif } @@ -625,26 +635,26 @@ _e_fm2_op_registry_needs_attention(int id, E_Dialog *dlg) static void _e_fm2_op_registry_entry_print(const E_Fm2_Op_Registry_Entry *ere) { - const char *status_strings[] = - { - "UNKNOWN", "IN_PROGRESS", "SUCCESSFUL", "ABORTED", "ERROR" - }; + const char *status_strings[] = + { + "UNKNOWN", "IN_PROGRESS", "SUCCESSFUL", "ABORTED", "ERROR" + }; const char *status; if ((ere->status >= 0) && - (ere->status < sizeof(status_strings)/sizeof(status_strings[0]))) + (ere->status < sizeof(status_strings) / sizeof(status_strings[0]))) status = status_strings[ere->status]; else status = status_strings[0]; printf("id: %8d, op: %2d [%s] finished: %hhu, needs_attention: %hhu\n" - " %3d%% (%"PRIi64"/%"PRIi64"), start_time: %10.0f, eta: %5ds, xwin: %#x\n" - " src=[%s]\n" - " dst=[%s]\n", - ere->id, ere->op, status, ere->finished, ere->needs_attention, - ere->percent, ere->done, ere->total, ere->start_time, ere->eta, - e_fm2_op_registry_entry_xwin_get(ere), - ere->src, ere->dst); + " %3d%% (%" PRIi64 "/%" PRIi64 "), start_time: %10.0f, eta: %5ds, xwin: %#x\n" + " src=[%s]\n" + " dst=[%s]\n", + ere->id, ere->op, status, ere->finished, ere->needs_attention, + ere->percent, ere->done, ere->total, ere->start_time, ere->eta, + e_fm2_op_registry_entry_xwin_get(ere), + ere->src, ere->dst); } static Eina_Bool @@ -685,7 +695,7 @@ static Ecore_Event_Handler *_e_fm2_op_registry_entry_changed_handler = NULL; EAPI int e_fm2_init(void) { - char path[PATH_MAX]; + char path[PATH_MAX]; eina_init(); ecore_init(); @@ -694,30 +704,30 @@ e_fm2_init(void) ecore_file_mkpath(path); _e_fm2_meta_path = strdup(path); - { - static const Evas_Smart_Class sc = - { - "e_fm", - EVAS_SMART_CLASS_VERSION, - _e_fm2_smart_add, /* add */ - _e_fm2_smart_del, /* del */ - _e_fm2_smart_move, /* move */ - _e_fm2_smart_resize, /* resize */ - _e_fm2_smart_show,/* show */ - _e_fm2_smart_hide,/* hide */ - _e_fm2_smart_color_set, /* color_set */ - _e_fm2_smart_clip_set, /* clip_set */ - _e_fm2_smart_clip_unset, /* clip_unset */ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL - }; - _e_fm2_smart = evas_smart_class_new(&sc); - } + { + static const Evas_Smart_Class sc = + { + "e_fm", + EVAS_SMART_CLASS_VERSION, + _e_fm2_smart_add, /* add */ + _e_fm2_smart_del, /* del */ + _e_fm2_smart_move, /* move */ + _e_fm2_smart_resize, /* resize */ + _e_fm2_smart_show, /* show */ + _e_fm2_smart_hide, /* hide */ + _e_fm2_smart_color_set, /* color_set */ + _e_fm2_smart_clip_set, /* clip_set */ + _e_fm2_smart_clip_unset, /* clip_unset */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }; + _e_fm2_smart = evas_smart_class_new(&sc); + } // _e_fm2_client_spawn(); e_fm2_custom_file_init(); e_fm2_op_registry_init(); @@ -738,15 +748,15 @@ e_fm2_init(void) if (!_e_fm2_op_registry_entry_add_handler) _e_fm2_op_registry_entry_add_handler = ecore_event_handler_add(E_EVENT_FM_OP_REGISTRY_ADD, - _e_fm2_op_registry_entry_add_cb, NULL); + _e_fm2_op_registry_entry_add_cb, NULL); if (!_e_fm2_op_registry_entry_del_handler) _e_fm2_op_registry_entry_del_handler = ecore_event_handler_add(E_EVENT_FM_OP_REGISTRY_DEL, - _e_fm2_op_registry_entry_del_cb, NULL); + _e_fm2_op_registry_entry_del_cb, NULL); if (!_e_fm2_op_registry_entry_changed_handler) _e_fm2_op_registry_entry_changed_handler = ecore_event_handler_add(E_EVENT_FM_OP_REGISTRY_CHANGED, - _e_fm2_op_registry_entry_changed_cb, NULL); + _e_fm2_op_registry_entry_changed_cb, NULL); /// DBG return 1; @@ -765,18 +775,18 @@ e_fm2_shutdown(void) /// DBG if (_e_fm2_op_registry_entry_add_handler) { - ecore_event_handler_del(_e_fm2_op_registry_entry_add_handler); - _e_fm2_op_registry_entry_add_handler = NULL; + ecore_event_handler_del(_e_fm2_op_registry_entry_add_handler); + _e_fm2_op_registry_entry_add_handler = NULL; } if (_e_fm2_op_registry_entry_del_handler) { - ecore_event_handler_del(_e_fm2_op_registry_entry_del_handler); - _e_fm2_op_registry_entry_del_handler = NULL; + ecore_event_handler_del(_e_fm2_op_registry_entry_del_handler); + _e_fm2_op_registry_entry_del_handler = NULL; } if (_e_fm2_op_registry_entry_changed_handler) { - ecore_event_handler_del(_e_fm2_op_registry_entry_changed_handler); - _e_fm2_op_registry_entry_changed_handler = NULL; + ecore_event_handler_del(_e_fm2_op_registry_entry_changed_handler); + _e_fm2_op_registry_entry_changed_handler = NULL; } /// DBG @@ -809,18 +819,18 @@ _e_fm2_cb_mount_ok(void *data) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(data); - if (!sd) return; // safety + if (!sd) return; // safety if (strcmp(sd->mount->mount_point, sd->realpath)) { - e_fm2_path_set(sd->obj, "/", sd->mount->mount_point); + e_fm2_path_set(sd->obj, "/", sd->mount->mount_point); } else { - sd->id = _e_fm2_client_monitor_add(sd->mount->mount_point); - sd->listing = EINA_TRUE; - evas_object_smart_callback_call(data, "dir_changed", NULL); - sd->tmp.iter = EINA_FALSE; + sd->id = _e_fm2_client_monitor_add(sd->mount->mount_point); + sd->listing = EINA_TRUE; + evas_object_smart_callback_call(data, "dir_changed", NULL); + sd->tmp.iter = EINA_FALSE; } } @@ -830,15 +840,15 @@ _e_fm2_cb_mount_fail(void *data) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(data); - if (!sd) return; // safety + if (!sd) return; // safety if (sd->mount) { // At this moment E_Fm2_Mount object already deleted in e_fm_device.c - sd->mount = NULL; - if (sd->config->view.open_dirs_in_place) - e_fm2_path_set(data, "favorites", "/"); - else - evas_object_smart_callback_call(data, "dir_deleted", NULL); + sd->mount = NULL; + if (sd->config->view.open_dirs_in_place) + e_fm2_path_set(data, "favorites", "/"); + else + evas_object_smart_callback_call(data, "dir_deleted", NULL); } } @@ -853,9 +863,9 @@ _e_fm2_cb_unmount_ok(void *data) { sd->mount = NULL; if (sd->config->view.open_dirs_in_place) - _e_fm2_path_parent_set(data, sd->realpath); + _e_fm2_path_parent_set(data, sd->realpath); else - evas_object_smart_callback_call(data, "dir_deleted", NULL); + evas_object_smart_callback_call(data, "dir_deleted", NULL); } } @@ -867,7 +877,7 @@ _e_fm2_path_parent_set(Evas_Object *obj, const char *path) p = strrchr(path, '/'); if (!p || (p == path)) - e_fm2_path_set(obj, "/", "/"); + e_fm2_path_set(obj, "/", "/"); else { idx = p - path; @@ -889,40 +899,40 @@ e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path) const char *realpath; sd = evas_object_smart_data_get(obj); - if (!sd || !path) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd || !path) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety /* internal config for now - don't see a pont making this configurable */ sd->regions.member_max = 64; if (!sd->config) { - sd->config = E_NEW(E_Fm2_Config, 1); - if (!sd->config) return; + sd->config = E_NEW(E_Fm2_Config, 1); + if (!sd->config) return; // sd->config->view.mode = E_FM2_VIEW_MODE_ICONS; - sd->config->view.mode = E_FM2_VIEW_MODE_LIST; - sd->config->view.open_dirs_in_place = EINA_TRUE; - sd->config->view.selector = EINA_TRUE; - sd->config->view.single_click = EINA_FALSE; - sd->config->view.single_click_delay = EINA_FALSE; - sd->config->view.no_subdir_jump = EINA_FALSE; - sd->config->icon.icon.w = 28; - sd->config->icon.icon.h = 28; - sd->config->icon.list.w = 24; - sd->config->icon.list.h = 24; - sd->config->icon.fixed.w = EINA_TRUE; - sd->config->icon.fixed.h = EINA_TRUE; - sd->config->icon.extension.show = EINA_FALSE; - sd->config->list.sort.no_case = EINA_TRUE; - sd->config->list.sort.dirs.first = EINA_TRUE; - sd->config->list.sort.dirs.last = EINA_FALSE; - sd->config->selection.single = EINA_FALSE; - sd->config->selection.windows_modifiers = EINA_FALSE; - sd->config->theme.background = NULL; - sd->config->theme.frame = NULL; - sd->config->theme.icons = NULL; - sd->config->theme.fixed = EINA_FALSE; + sd->config->view.mode = E_FM2_VIEW_MODE_LIST; + sd->config->view.open_dirs_in_place = EINA_TRUE; + sd->config->view.selector = EINA_TRUE; + sd->config->view.single_click = EINA_FALSE; + sd->config->view.single_click_delay = EINA_FALSE; + sd->config->view.no_subdir_jump = EINA_FALSE; + sd->config->icon.icon.w = 28; + sd->config->icon.icon.h = 28; + sd->config->icon.list.w = 24; + sd->config->icon.list.h = 24; + sd->config->icon.fixed.w = EINA_TRUE; + sd->config->icon.fixed.h = EINA_TRUE; + sd->config->icon.extension.show = EINA_FALSE; + sd->config->list.sort.no_case = EINA_TRUE; + sd->config->list.sort.dirs.first = EINA_TRUE; + sd->config->list.sort.dirs.last = EINA_FALSE; + sd->config->selection.single = EINA_FALSE; + sd->config->selection.windows_modifiers = EINA_FALSE; + sd->config->theme.background = NULL; + sd->config->theme.frame = NULL; + sd->config->theme.icons = NULL; + sd->config->theme.fixed = EINA_FALSE; } realpath = _e_fm2_dev_path_map(dev, path); @@ -930,28 +940,28 @@ e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path) if (dev && strncmp(dev, "removable:", 10) && !ecore_file_exists(realpath)) { - E_Manager *man; - E_Container *con; - E_Dialog *dialog; - char text[4096 + 256]; + E_Manager *man; + E_Container *con; + E_Dialog *dialog; + char text[4096 + 256]; - man = e_manager_current_get(); - if (!man) return; - con = e_container_current_get(man); - if (!con) return; + man = e_manager_current_get(); + if (!man) return; + con = e_container_current_get(man); + if (!con) return; - dialog = e_dialog_new(con, "E", "_fm_file_unexisting_path_dialog"); - e_dialog_button_add(dialog, _("Close"), NULL, NULL, dialog); - e_dialog_button_focus_num(dialog, 0); - e_dialog_title_set(dialog, _("Nonexistent path")); + dialog = e_dialog_new(con, "E", "_fm_file_unexisting_path_dialog"); + e_dialog_button_add(dialog, _("Close"), NULL, NULL, dialog); + e_dialog_button_focus_num(dialog, 0); + e_dialog_title_set(dialog, _("Nonexistent path")); e_dialog_icon_set(dialog, "dialog-error", 64); - snprintf(text, sizeof(text), _("%s doesn't exist."), realpath); + snprintf(text, sizeof(text), _("%s doesn't exist."), realpath); - e_dialog_text_set(dialog, text); - e_win_centered_set(dialog->win, 1); - e_dialog_show(dialog); - return; + e_dialog_text_set(dialog, text); + e_win_centered_set(dialog->win, 1); + e_dialog_show(dialog); + return; } if (sd->realpath) _e_fm2_client_monitor_del(sd->id, sd->realpath); @@ -971,37 +981,37 @@ e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path) /* If the path change from a mountpoint to something else, we fake-unmount */ if (sd->mount && sd->mount->mount_point && strncmp(sd->mount->mount_point, sd->realpath, - strlen(sd->mount->mount_point))) + strlen(sd->mount->mount_point))) { - e_fm2_device_unmount(sd->mount); - sd->mount = NULL; + e_fm2_device_unmount(sd->mount); + sd->mount = NULL; } /* If the path is of type removable: we add a new mountpoint */ if (sd->dev && !sd->mount && !strncmp(sd->dev, "removable:", 10)) { - E_Volume *v = NULL; + E_Volume *v = NULL; - v = e_fm2_device_volume_find(sd->dev + strlen("removable:")); - if (v) - sd->mount = e_fm2_device_mount(v, - _e_fm2_cb_mount_ok, _e_fm2_cb_mount_fail, - _e_fm2_cb_unmount_ok, NULL, obj); + v = e_fm2_device_volume_find(sd->dev + strlen("removable:")); + if (v) + sd->mount = e_fm2_device_mount(v, + _e_fm2_cb_mount_ok, _e_fm2_cb_mount_fail, + _e_fm2_cb_unmount_ok, NULL, obj); } else if (sd->config->view.open_dirs_in_place == 0) { - E_Fm2_Mount *m; - m = e_fm2_device_mount_find(sd->realpath); - if (m) - sd->mount = e_fm2_device_mount(m->volume, - _e_fm2_cb_mount_ok, _e_fm2_cb_mount_fail, - _e_fm2_cb_unmount_ok, NULL, obj); + E_Fm2_Mount *m; + m = e_fm2_device_mount_find(sd->realpath); + if (m) + sd->mount = e_fm2_device_mount(m->volume, + _e_fm2_cb_mount_ok, _e_fm2_cb_mount_fail, + _e_fm2_cb_unmount_ok, NULL, obj); } if (!sd->mount || sd->mount->mounted) { - sd->id = _e_fm2_client_monitor_add(sd->realpath); - sd->listing = EINA_TRUE; + sd->id = _e_fm2_client_monitor_add(sd->realpath); + sd->listing = EINA_TRUE; } /* Clean up typebuf. */ @@ -1017,9 +1027,9 @@ e_fm2_underlay_show(Evas_Object *obj) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety evas_object_show(sd->underlay); } @@ -1029,9 +1039,9 @@ e_fm2_underlay_hide(Evas_Object *obj) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety evas_object_hide(sd->underlay); } @@ -1041,9 +1051,9 @@ e_fm2_all_unsel(Evas_Object *obj) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety _e_fm2_icon_desel_any(obj); } @@ -1053,9 +1063,9 @@ e_fm2_all_sel(Evas_Object *obj) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety _e_fm2_icon_sel_any(obj); } @@ -1065,18 +1075,18 @@ e_fm2_custom_theme_set(Evas_Object *obj, const char *path) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety eina_stringshare_replace(&sd->custom_theme, path); _e_fm2_theme_edje_object_set(sd, sd->drop, "base/theme/fileman", - "list/drop_between"); + "list/drop_between"); _e_fm2_theme_edje_object_set(sd, sd->drop_in, "base/theme/fileman", - "list/drop_in"); + "list/drop_in"); _e_fm2_theme_edje_object_set(sd, sd->overlay, "base/theme/fileman", - "overlay"); + "overlay"); _e_fm2_theme_edje_object_set(sd, sd->sel_rect, "base/theme/fileman", - "rubberband"); + "rubberband"); } EAPI void @@ -1085,16 +1095,16 @@ e_fm2_custom_theme_content_set(Evas_Object *obj, const char *content) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety eina_stringshare_replace(&sd->custom_theme_content, content); _e_fm2_theme_edje_object_set(sd, sd->drop, "base/theme/fileman", - "list/drop_between"); + "list/drop_between"); _e_fm2_theme_edje_object_set(sd, sd->drop_in, "base/theme/fileman", - "list/drop_in"); + "list/drop_in"); _e_fm2_theme_edje_object_set(sd, sd->overlay, "base/theme/fileman", - "overlay"); + "overlay"); } EAPI void @@ -1105,9 +1115,9 @@ e_fm2_path_get(Evas_Object *obj, const char **dev, const char **path) if (dev) *dev = NULL; if (path) *path = NULL; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety if (dev) *dev = sd->dev; if (path) *path = sd->path; } @@ -1125,8 +1135,8 @@ _e_fm2_dir_load_props_from_parent(const char *path) cf = e_fm2_custom_file_get(parent); if ((cf) && (cf->dir) && (cf->dir->prop.in_use)) { - free(parent); - return cf; + free(parent); + return cf; } cf = _e_fm2_dir_load_props_from_parent(parent); @@ -1144,44 +1154,44 @@ _e_fm2_dir_load_props(E_Fm2_Smart_Data *sd) cf = e_fm2_custom_file_get(sd->realpath); if ((cf) && (cf->dir)) { - Evas_Coord x, y; + Evas_Coord x, y; - if (sd->max.w - sd->w > 0) - x = (sd->max.w - sd->w) * cf->dir->pos.x; - else - x = 0; + if (sd->max.w - sd->w > 0) + x = (sd->max.w - sd->w) * cf->dir->pos.x; + else + x = 0; - if (sd->max.h - sd->h > 0) - y = (sd->max.h - sd->h) * cf->dir->pos.y; - else - y = 0; + if (sd->max.h - sd->h > 0) + y = (sd->max.h - sd->h) * cf->dir->pos.y; + else + y = 0; - e_fm2_pan_set(sd->obj, x, y); + e_fm2_pan_set(sd->obj, x, y); - if (cf->dir->prop.in_use) - { - sd->view_mode = cf->dir->prop.view_mode; - sd->icon_size = cf->dir->prop.icon_size; - sd->order_file = !!cf->dir->prop.order_file; - sd->show_hidden_files = !!cf->dir->prop.show_hidden_files; - sd->inherited_dir_props = EINA_FALSE; - return; - } + if (cf->dir->prop.in_use) + { + sd->view_mode = cf->dir->prop.view_mode; + sd->icon_size = cf->dir->prop.icon_size; + sd->order_file = !!cf->dir->prop.order_file; + sd->show_hidden_files = !!cf->dir->prop.show_hidden_files; + sd->inherited_dir_props = EINA_FALSE; + return; + } } else { - sd->pos.x = EINA_FALSE; - sd->pos.y = EINA_FALSE; + sd->pos.x = EINA_FALSE; + sd->pos.y = EINA_FALSE; } if (!(sd->view_flags & E_FM2_VIEW_INHERIT_DIR_CUSTOM)) { - sd->view_mode = -1; - sd->icon_size = -1; - sd->order_file = EINA_FALSE; - sd->show_hidden_files = EINA_FALSE; - sd->inherited_dir_props = EINA_FALSE; - return; + sd->view_mode = -1; + sd->icon_size = -1; + sd->order_file = EINA_FALSE; + sd->show_hidden_files = EINA_FALSE; + sd->inherited_dir_props = EINA_FALSE; + return; } sd->inherited_dir_props = EINA_TRUE; @@ -1189,17 +1199,17 @@ _e_fm2_dir_load_props(E_Fm2_Smart_Data *sd) cf = _e_fm2_dir_load_props_from_parent(sd->realpath); if ((cf) && (cf->dir) && (cf->dir->prop.in_use)) { - sd->view_mode = cf->dir->prop.view_mode; - sd->icon_size = cf->dir->prop.icon_size; - sd->order_file = !!cf->dir->prop.order_file; - sd->show_hidden_files = !!cf->dir->prop.show_hidden_files; + sd->view_mode = cf->dir->prop.view_mode; + sd->icon_size = cf->dir->prop.icon_size; + sd->order_file = !!cf->dir->prop.order_file; + sd->show_hidden_files = !!cf->dir->prop.show_hidden_files; } else { - sd->view_mode = -1; - sd->icon_size = -1; - sd->order_file = EINA_FALSE; - sd->show_hidden_files = EINA_FALSE; + sd->view_mode = -1; + sd->icon_size = -1; + sd->order_file = EINA_FALSE; + sd->show_hidden_files = EINA_FALSE; } } @@ -1214,16 +1224,16 @@ _e_fm2_dir_save_props(E_Fm2_Smart_Data *sd) cf = e_fm2_custom_file_get(sd->realpath); if (!cf) { - cf = &cf0; - memset(cf, 0, sizeof(*cf)); - cf->dir = &dir0; + cf = &cf0; + memset(cf, 0, sizeof(*cf)); + cf->dir = &dir0; } else if (!cf->dir) { - E_Fm2_Custom_File *cf2 = cf; - cf = &cf0; - memcpy(cf, cf2, sizeof(*cf2)); - cf->dir = &dir0; + E_Fm2_Custom_File *cf2 = cf; + cf = &cf0; + memcpy(cf, cf2, sizeof(*cf2)); + cf->dir = &dir0; } if (sd->max.w - sd->w > 0) @@ -1252,9 +1262,9 @@ e_fm2_refresh(Evas_Object *obj) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety _e_fm2_dir_save_props(sd); @@ -1266,10 +1276,10 @@ e_fm2_refresh(Evas_Object *obj) if (sd->realpath) { - sd->listing = EINA_FALSE; - _e_fm2_client_monitor_del(sd->id, sd->realpath); - sd->id = _e_fm2_client_monitor_add(sd->realpath); - sd->listing = EINA_TRUE; + sd->listing = EINA_FALSE; + _e_fm2_client_monitor_del(sd->id, sd->realpath); + sd->id = _e_fm2_client_monitor_add(sd->realpath); + sd->listing = EINA_TRUE; } sd->tmp.iter = EINA_FALSE; @@ -1281,9 +1291,9 @@ e_fm2_has_parent_get(Evas_Object *obj) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return 0; // safety - if (!evas_object_type_get(obj)) return 0; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return 0; // safety + if (!sd) return 0; // safety + if (!evas_object_type_get(obj)) return 0; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return 0; // safety if (!sd->path) return 0; if ((sd->path[0] == 0) || (!strcmp(sd->path, "/"))) return 0; return 1; @@ -1295,9 +1305,9 @@ e_fm2_real_path_get(Evas_Object *obj) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return NULL; // safety - if (!evas_object_type_get(obj)) return NULL; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return NULL; // safety + if (!sd) return NULL; // safety + if (!evas_object_type_get(obj)) return NULL; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return NULL; // safety return sd->realpath; } @@ -1308,9 +1318,9 @@ e_fm2_parent_go(Evas_Object *obj) char *p, *path; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety if (!sd->path) return; path = strdup(sd->path); if (!path) return; @@ -1329,9 +1339,9 @@ e_fm2_config_set(Evas_Object *obj, E_Fm2_Config *cfg) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety if (sd->config) _e_fm2_config_free(sd->config); sd->config = NULL; if (!cfg) return; @@ -1350,9 +1360,9 @@ e_fm2_config_get(Evas_Object *obj) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return NULL; // safety - if (!evas_object_type_get(obj)) return NULL; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return NULL; // safety + if (!sd) return NULL; // safety + if (!evas_object_type_get(obj)) return NULL; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return NULL; // safety return sd->config; } @@ -1364,13 +1374,13 @@ e_fm2_selected_list_get(Evas_Object *obj) E_Fm2_Icon *ic; sd = evas_object_smart_data_get(obj); - if (!sd) return NULL; // safety - if (!evas_object_type_get(obj)) return NULL; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return NULL; // safety + if (!sd) return NULL; // safety + if (!evas_object_type_get(obj)) return NULL; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return NULL; // safety EINA_LIST_FOREACH(sd->icons, l, ic) { - if (ic->selected) - list = eina_list_append(list, &(ic->info)); + if (ic->selected) + list = eina_list_append(list, &(ic->info)); } return list; } @@ -1383,12 +1393,12 @@ e_fm2_all_list_get(Evas_Object *obj) E_Fm2_Icon *ic; sd = evas_object_smart_data_get(obj); - if (!sd) return NULL; // safety - if (!evas_object_type_get(obj)) return NULL; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return NULL; // safety + if (!sd) return NULL; // safety + if (!evas_object_type_get(obj)) return NULL; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return NULL; // safety EINA_LIST_FOREACH(sd->icons, l, ic) { - list = eina_list_append(list, &(ic->info)); + list = eina_list_append(list, &(ic->info)); } return list; } @@ -1401,22 +1411,22 @@ e_fm2_select_set(Evas_Object *obj, const char *file, int select) E_Fm2_Icon *ic; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety EINA_LIST_FOREACH(sd->icons, l, ic) { - if ((file) && (!strcmp(ic->info.file, file))) - { - if (select) _e_fm2_icon_select(ic); - else _e_fm2_icon_deselect(ic); - } - else - { - if (ic->sd->config->selection.single) - _e_fm2_icon_deselect(ic); - ic->last_selected = EINA_FALSE; - } + if ((file) && (!strcmp(ic->info.file, file))) + { + if (select) _e_fm2_icon_select(ic); + else _e_fm2_icon_deselect(ic); + } + else + { + if (ic->sd->config->selection.single) + _e_fm2_icon_deselect(ic); + ic->last_selected = EINA_FALSE; + } } } @@ -1428,16 +1438,16 @@ e_fm2_file_show(Evas_Object *obj, const char *file) E_Fm2_Icon *ic; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety EINA_LIST_FOREACH(sd->icons, l, ic) { - if (!strcmp(ic->info.file, file)) - { - _e_fm2_icon_make_visible(ic); - return; - } + if (!strcmp(ic->info.file, file)) + { + _e_fm2_icon_make_visible(ic); + return; + } } } @@ -1447,9 +1457,9 @@ e_fm2_icon_menu_replace_callback_set(Evas_Object *obj, E_Fm_Cb func, void *data) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety sd->icon_menu.replace.func = func; sd->icon_menu.replace.data = data; } @@ -1460,9 +1470,9 @@ e_fm2_icon_menu_start_extend_callback_set(Evas_Object *obj, E_Fm_Cb func, void * E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety sd->icon_menu.start.func = func; sd->icon_menu.start.data = data; } @@ -1473,9 +1483,9 @@ e_fm2_icon_menu_end_extend_callback_set(Evas_Object *obj, E_Fm_Cb func, void *da E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety sd->icon_menu.end.func = func; sd->icon_menu.end.data = data; } @@ -1486,9 +1496,9 @@ e_fm2_icon_menu_flags_set(Evas_Object *obj, E_Fm2_Menu_Flags flags) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety sd->icon_menu.flags = flags; } @@ -1498,9 +1508,9 @@ e_fm2_icon_menu_flags_get(Evas_Object *obj) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return 0; // safety - if (!evas_object_type_get(obj)) return 0; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return 0; // safety + if (!sd) return 0; // safety + if (!evas_object_type_get(obj)) return 0; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return 0; // safety return sd->icon_menu.flags; } @@ -1508,9 +1518,9 @@ EAPI void e_fm2_view_flags_set(Evas_Object *obj, E_Fm2_View_Flags flags) { E_Fm2_Smart_Data *sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety sd->view_flags = flags; } @@ -1518,9 +1528,9 @@ EAPI E_Fm2_View_Flags e_fm2_view_flags_get(Evas_Object *obj) { E_Fm2_Smart_Data *sd = evas_object_smart_data_get(obj); - if (!sd) return 0; // safety - if (!evas_object_type_get(obj)) return 0; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return 0; // safety + if (!sd) return 0; // safety + if (!evas_object_type_get(obj)) return 0; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return 0; // safety return sd->view_flags; } @@ -1531,19 +1541,19 @@ e_fm2_window_object_set(Evas_Object *obj, E_Object *eobj) const char *drop[] = { "enlightenment/desktop", "enlightenment/border", "text/uri-list" }; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety sd->eobj = eobj; if (sd->drop_handler) e_drop_handler_del(sd->drop_handler); sd->drop_handler = e_drop_handler_add(sd->eobj, - sd, - _e_fm2_cb_dnd_enter, - _e_fm2_cb_dnd_move, - _e_fm2_cb_dnd_leave, - _e_fm2_cb_dnd_drop, - drop, 3, - sd->x, sd->y, sd->w, sd->h); + sd, + _e_fm2_cb_dnd_enter, + _e_fm2_cb_dnd_move, + _e_fm2_cb_dnd_leave, + _e_fm2_cb_dnd_drop, + drop, 3, + sd->x, sd->y, sd->w, sd->h); e_drop_handler_responsive_set(sd->drop_handler); } @@ -1557,9 +1567,9 @@ e_fm2_icons_update(Evas_Object *obj) int bufused, buffree; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety bufused = eina_strlcpy(buf, sd->realpath, sizeof(buf)); if (bufused >= sizeof(buf) - 2) @@ -1567,8 +1577,8 @@ e_fm2_icons_update(Evas_Object *obj) if ((bufused > 0) && (buf[bufused - 1] != '/')) { - buf[bufused] = '/'; - bufused++; + buf[bufused] = '/'; + bufused++; } pfile = buf + bufused; @@ -1576,33 +1586,33 @@ e_fm2_icons_update(Evas_Object *obj) EINA_LIST_FOREACH(sd->icons, l, ic) { - E_Fm2_Custom_File *cf; + E_Fm2_Custom_File *cf; - eina_stringshare_del(ic->info.icon); - ic->info.icon = NULL; - ic->info.icon_type = EINA_FALSE; + eina_stringshare_del(ic->info.icon); + ic->info.icon = NULL; + ic->info.icon_type = EINA_FALSE; - if (_e_fm2_file_is_desktop(ic->info.file)) - _e_fm2_icon_desktop_load(ic); + if (_e_fm2_file_is_desktop(ic->info.file)) + _e_fm2_icon_desktop_load(ic); - if (eina_strlcpy(pfile, ic->info.file, buffree) >= buffree) - continue; + if (eina_strlcpy(pfile, ic->info.file, buffree) >= buffree) + continue; - cf = e_fm2_custom_file_get(buf); - if (cf) - { - if (cf->icon.valid) - { - eina_stringshare_replace(&ic->info.icon, cf->icon.icon); - ic->info.icon_type = cf->icon.type; - } - } + cf = e_fm2_custom_file_get(buf); + if (cf) + { + if (cf->icon.valid) + { + eina_stringshare_replace(&ic->info.icon, cf->icon.icon); + ic->info.icon_type = cf->icon.type; + } + } - if (ic->realized) - { - _e_fm2_icon_unrealize(ic); - _e_fm2_icon_realize(ic); - } + if (ic->realized) + { + _e_fm2_icon_unrealize(ic); + _e_fm2_icon_realize(ic); + } } e_fm2_custom_file_flush(); } @@ -1613,9 +1623,9 @@ e_fm2_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety if (x > (sd->max.w - sd->w)) x = sd->max.w - sd->w; if (x < 0) x = 0; if (y > (sd->max.h - sd->h)) y = sd->max.h - sd->h; @@ -1633,9 +1643,9 @@ e_fm2_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety if (x) *x = sd->pos.x; if (y) *y = sd->pos.y; } @@ -1647,9 +1657,9 @@ e_fm2_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) Evas_Coord mx, my; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety mx = sd->max.w - sd->w; if (mx < 0) mx = 0; my = sd->max.h - sd->h; @@ -1664,9 +1674,9 @@ e_fm2_pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety if (w) *w = sd->max.w; if (h) *h = sd->max.h; } @@ -1680,17 +1690,17 @@ e_fm2_all_icons_update(void) _e_fm2_list_walking++; EINA_LIST_FOREACH(_e_fm2_list, l, o) { - if ((_e_fm2_list_walking > 0) && - (eina_list_data_find(_e_fm2_list_remove, o))) continue; - e_fm2_icons_update(o); + if ((_e_fm2_list_walking > 0) && + (eina_list_data_find(_e_fm2_list_remove, o))) continue; + e_fm2_icons_update(o); } _e_fm2_list_walking--; if (_e_fm2_list_walking == 0) { - EINA_LIST_FREE(_e_fm2_list_remove, o) - { - _e_fm2_list = eina_list_remove(_e_fm2_list, o); - } + EINA_LIST_FREE(_e_fm2_list_remove, o) + { + _e_fm2_list = eina_list_remove(_e_fm2_list, o); + } } } @@ -1706,38 +1716,38 @@ _e_fm2_path_join(char *buf, int buflen, const char *base, const char *component) return base; else if (component[0] == '.') { - if (component[1] == '/') - { - component += 2; + if (component[1] == '/') + { + component += 2; - if (!base) - return component; + if (!base) + return component; - if (snprintf(buf, buflen, "%s/%s", base, component) < buflen) - return buf; - else - return NULL; - } - else if ((component[1] == '.') && (component[2] == '/')) - { - const char *p; - int len; + if (snprintf(buf, buflen, "%s/%s", base, component) < buflen) + return buf; + else + return NULL; + } + else if ((component[1] == '.') && (component[2] == '/')) + { + const char *p; + int len; - component += 3; + component += 3; - if (!base) - return component; + if (!base) + return component; - p = strrchr(base, '/'); - if (!p) - return component; + p = strrchr(base, '/'); + if (!p) + return component; - len = p - base; - if (snprintf(buf, buflen, "%.*s/%s", len, base, component) < buflen) - return buf; - else - return NULL; - } + len = p - base; + if (snprintf(buf, buflen, "%.*s/%s", len, base, component) < buflen) + return buf; + else + return NULL; + } } if (snprintf(buf, buflen, "%s/%s", base, component) < buflen) @@ -1762,8 +1772,8 @@ _e_fm2_icon_explicit_edje_get(Evas *evas, const E_Fm2_Icon *ic __UNUSED__, const if (!edje_object_file_set(o, iconpath, "icon")) { - evas_object_del(o); - return NULL; + evas_object_del(o); + return NULL; } if (type_ret) *type_ret = "CUSTOM"; @@ -1787,8 +1797,8 @@ _e_fm2_icon_explicit_theme_icon_get(Evas *evas, const E_Fm2_Icon *ic __UNUSED__, if (!e_util_icon_theme_set(o, name)) { - evas_object_del(o); - return NULL; + evas_object_del(o); + return NULL; } if (type_ret) *type_ret = "THEME_ICON"; @@ -1813,8 +1823,8 @@ _e_fm2_icon_explicit_theme_get(Evas *evas, const E_Fm2_Icon *ic, const char *nam if (!_e_fm2_theme_edje_icon_object_set(ic->sd, o, "base/theme/fileman", name)) { - evas_object_del(o); - return NULL; + evas_object_del(o); + return NULL; } if (type_ret) *type_ret = "THEME"; @@ -1838,22 +1848,22 @@ _e_fm2_icon_explicit_get(Evas *evas, const E_Fm2_Icon *ic, const char *icon, con iconpath = _e_fm2_path_join(buf, sizeof(buf), ic->sd->realpath, icon); if (!iconpath) { - fprintf(stderr, "ERROR: could not create icon \"%s\".\n", icon); - return NULL; + fprintf(stderr, "ERROR: could not create icon \"%s\".\n", icon); + return NULL; } if (_e_fm2_file_is_edje(iconpath)) return _e_fm2_icon_explicit_edje_get(evas, ic, iconpath, type_ret); else { - Evas_Object *o = e_icon_add(evas); - if (!o) - return NULL; + Evas_Object *o = e_icon_add(evas); + if (!o) + return NULL; - e_icon_file_set(o, iconpath); - e_icon_fill_inside_set(o, 1); - if (type_ret) *type_ret = "CUSTOM"; - return o; + e_icon_file_set(o, iconpath); + e_icon_fill_inside_set(o, 1); + if (type_ret) *type_ret = "CUSTOM"; + return o; } return NULL; @@ -1902,12 +1912,12 @@ _e_fm2_icon_thumb_edje_get(Evas *evas, const E_Fm2_Icon *ic, Evas_Smart_Cb cb, v char buf[PATH_MAX]; const char **itr, *group; const char *known_groups[] = { - NULL, - "icon", - "e/desktop/background", - "e/init/splash", - /* XXX TODO: add more? example 'screenshot', 'preview' */ - NULL + NULL, + "icon", + "e/desktop/background", + "e/init/splash", + /* XXX TODO: add more? example 'screenshot', 'preview' */ + NULL }; if (!_e_fm2_icon_realpath(ic, buf, sizeof(buf))) @@ -1927,11 +1937,11 @@ _e_fm2_icon_thumb_edje_get(Evas *evas, const E_Fm2_Icon *ic, Evas_Smart_Cb cb, v group = *itr; else { - Eina_List *l = edje_file_collection_list(buf); - if (!l) - return NULL; - group = eina_list_data_get(l); - edje_file_collection_list_free(l); + Eina_List *l = edje_file_collection_list(buf); + if (!l) + return NULL; + group = eina_list_data_get(l); + edje_file_collection_list_free(l); } return _e_fm2_icon_thumb_get(evas, ic, group, cb, data, force_gen, type_ret); @@ -2014,7 +2024,7 @@ _e_fm2_icon_mime_fdo_get(Evas *evas, const E_Fm2_Icon *ic, const char **type_ret if (icon) { Evas_Object *o; - o = _e_fm2_icon_explicit_get(evas, ic, icon, type_ret); + o = _e_fm2_icon_explicit_get(evas, ic, icon, type_ret); free(icon); return o; } @@ -2033,14 +2043,14 @@ _e_fm2_icon_mime_theme_get(Evas *evas, const E_Fm2_Icon *ic, const char **type_r file = e_theme_edje_file_get("base/theme/icons", buf); if (file && file[0]) { - Evas_Object *obj = edje_object_add(evas); - if (!obj) return NULL; - if (!edje_object_file_set(obj, file, buf)) - { - evas_object_del(obj); - return NULL; - } - return obj; + Evas_Object *obj = edje_object_add(evas); + if (!obj) return NULL; + if (!edje_object_file_set(obj, file, buf)) + { + evas_object_del(obj); + return NULL; + } + return obj; } return NULL; @@ -2058,9 +2068,9 @@ _e_fm2_icon_mime_get(Evas *evas, const E_Fm2_Icon *ic, Evas_Smart_Cb gen_func, v /* create thumbnails for edje files */ if (_e_fm2_file_is_edje(ic->info.file)) { - o = _e_fm2_icon_thumb_edje_get - (evas, ic, gen_func, data, force_gen, type_ret); - if (o) return o; + o = _e_fm2_icon_thumb_edje_get + (evas, ic, gen_func, data, force_gen, type_ret); + if (o) return o; } /* disabled until everyone has edje in mime.types: @@ -2073,17 +2083,17 @@ _e_fm2_icon_mime_get(Evas *evas, const E_Fm2_Icon *ic, Evas_Smart_Cb gen_func, v icon = _e_fm2_icon_mime_type_special_match(ic); if (icon) { - if (icon == _e_fm2_icon_desktop_str) - return _e_fm2_icon_desktop_get(evas, ic, type_ret); - else if (icon == _e_fm2_icon_thumb_str) - { - return _e_fm2_icon_thumb_get - (evas, ic, NULL, gen_func, data, force_gen, type_ret); - } - else if (strncmp(icon, "e/icons/fileman/", 16) == 0) - return _e_fm2_icon_explicit_theme_get(evas, ic, icon + 16, type_ret); - else - return _e_fm2_icon_explicit_get(evas, ic, icon, type_ret); + if (icon == _e_fm2_icon_desktop_str) + return _e_fm2_icon_desktop_get(evas, ic, type_ret); + else if (icon == _e_fm2_icon_thumb_str) + { + return _e_fm2_icon_thumb_get + (evas, ic, NULL, gen_func, data, force_gen, type_ret); + } + else if (strncmp(icon, "e/icons/fileman/", 16) == 0) + return _e_fm2_icon_explicit_theme_get(evas, ic, icon + 16, type_ret); + else + return _e_fm2_icon_explicit_get(evas, ic, icon, type_ret); } if (e_config->icon_theme_overrides) @@ -2101,16 +2111,16 @@ _e_fm2_icon_mime_get(Evas *evas, const E_Fm2_Icon *ic, Evas_Smart_Cb gen_func, v if (o) return o; return NULL; - + /* XXX REMOVE/DEPRECATED below here */ /* icon = e_fm_mime_icon_get(ic->info.mime); * if (!icon) return NULL; - * + * * if (icon == _e_fm2_icon_desktop_str) * return _e_fm2_icon_desktop_get(evas, ic, type_ret); * else if (icon == _e_fm2_icon_thumb_str) * return _e_fm2_icon_thumb_get(evas, ic, NULL, - * gen_func, data, force_gen, type_ret); + * gen_func, data, force_gen, type_ret); * else if (strncmp(icon, "e/icons/fileman/", 16) == 0) * return _e_fm2_icon_explicit_theme_get(evas, ic, icon + 16, type_ret); * else @@ -2144,15 +2154,15 @@ _e_fm2_icon_imc_get(Evas *evas, const E_Fm2_Icon *ic, const char **type_ret) if (!imc->e_im_setup_exec) { - e_intl_input_method_config_free(imc); - return NULL; + e_intl_input_method_config_free(imc); + return NULL; } desktop = efreet_util_desktop_exec_find(imc->e_im_setup_exec); if (desktop) { - o = _e_fm2_icon_desktop_get_internal(evas, ic, desktop, type_ret); - efreet_desktop_free(desktop); + o = _e_fm2_icon_desktop_get_internal(evas, ic, desktop, type_ret); + efreet_desktop_free(desktop); } e_intl_input_method_config_free(imc); @@ -2175,7 +2185,7 @@ _e_fm2_icon_discover_get(Evas *evas, const E_Fm2_Icon *ic, Evas_Smart_Cb gen_fun p++; if (_e_fm2_ext_is_edje(p)) return _e_fm2_icon_thumb_edje_get(evas, ic, gen_func, - data, force_gen, type_ret); + data, force_gen, type_ret); else if (_e_fm2_ext_is_desktop(p)) return _e_fm2_icon_desktop_get(evas, ic, type_ret); else if (_e_fm2_ext_is_imc(p)) @@ -2197,61 +2207,61 @@ _e_fm2_icon_discover_get(Evas *evas, const E_Fm2_Icon *ic, Evas_Smart_Cb gen_fun */ EAPI Evas_Object * e_fm2_icon_get(Evas *evas, E_Fm2_Icon *ic, - Evas_Smart_Cb gen_func, - void *data, int force_gen, const char **type_ret) + Evas_Smart_Cb gen_func, + void *data, int force_gen, const char **type_ret) { if (ic->info.icon) { - Evas_Object *o; + Evas_Object *o; - if ((ic->info.icon[0] == '/') || - ((ic->info.icon[0] == '.') && - ((ic->info.icon[1] == '/') || - ((ic->info.icon[1] == '.') && (ic->info.icon[2] == '/'))))) - { - o = _e_fm2_icon_explicit_get(evas, ic, ic->info.icon, type_ret); - if (o) return o; - } + if ((ic->info.icon[0] == '/') || + ((ic->info.icon[0] == '.') && + ((ic->info.icon[1] == '/') || + ((ic->info.icon[1] == '.') && (ic->info.icon[2] == '/'))))) + { + o = _e_fm2_icon_explicit_get(evas, ic, ic->info.icon, type_ret); + if (o) return o; + } - if (ic->info.mime) - { - o = _e_fm2_icon_mime_get(evas, ic, gen_func, data, - force_gen, type_ret); - if (o) return o; - } + if (ic->info.mime) + { + o = _e_fm2_icon_mime_get(evas, ic, gen_func, data, + force_gen, type_ret); + if (o) return o; + } - o = _e_fm2_icon_explicit_theme_icon_get(evas, ic, ic->info.icon, type_ret); - if (!o) goto fallback; + o = _e_fm2_icon_explicit_theme_icon_get(evas, ic, ic->info.icon, type_ret); + if (!o) goto fallback; - return o; + return o; } if (ic->info.icon_type == 1) { - Evas_Object *o; + Evas_Object *o; - o = _e_fm2_icon_thumb_get(evas, ic, NULL, - gen_func, data, force_gen, type_ret); - if (o) return o; + o = _e_fm2_icon_thumb_get(evas, ic, NULL, + gen_func, data, force_gen, type_ret); + if (o) return o; } if (ic->info.mime) { Evas_Object *o; - o = _e_fm2_icon_mime_get(evas, ic, gen_func, data, force_gen, type_ret); - if (o) return o; + o = _e_fm2_icon_mime_get(evas, ic, gen_func, data, force_gen, type_ret); + if (o) return o; } else if (ic->info.file) { - Evas_Object *o; + Evas_Object *o; - o = _e_fm2_icon_discover_get(evas, ic, gen_func, data, - force_gen, type_ret); - if (o) return o; + o = _e_fm2_icon_discover_get(evas, ic, gen_func, data, + force_gen, type_ret); + if (o) return o; } - fallback: +fallback: return _e_fm2_icon_explicit_theme_get(evas, ic, "text/plain", type_ret); } @@ -2270,11 +2280,11 @@ e_fm2_icon_geometry_get(E_Fm2_Icon *ic, int *x, int *y, int *w, int *h) if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0; if (ic) { - evas_object_geometry_get(ic->obj, &xx, &yy, &ww, &hh); - if (x) *x = xx; - if (y) *y = yy; - if (w) *w = ww; - if (h) *h = hh; + evas_object_geometry_get(ic->obj, &xx, &yy, &ww, &hh); + if (x) *x = xx; + if (y) *y = yy; + if (w) *w = ww; + if (h) *h = hh; } } @@ -2302,16 +2312,16 @@ _e_fm2_client_get(void) /* if we don't have a slave - spane one */ if (!_e_fm2_client_list) { - _e_fm2_client_spawn(); - return NULL; + _e_fm2_client_spawn(); + return NULL; } EINA_LIST_FOREACH(_e_fm2_client_list, l, cl) { - if (cl->req < min_req) - { - min_req = cl->req; - cl_chosen = cl; - } + if (cl->req < min_req) + { + min_req = cl->req; + cl_chosen = cl; + } } return cl_chosen; } @@ -2320,9 +2330,9 @@ typedef struct _E_Fm2_Message E_Fm2_Message; struct _E_Fm2_Message { - int major, minor, ref, ref_to, response; + int major, minor, ref, ref_to, response; void *data; - int size; + int size; }; static Eina_List *_e_fm2_messages = NULL; @@ -2341,15 +2351,15 @@ _e_fm2_client_message_queue(int major, int minor, int ref, int ref_to, int respo msg->response = response; if (data) { - msg->size = size; - msg->data = malloc(size); - if (msg->data) - memcpy(msg->data, data, size); - else - { - free(msg); - return; - } + msg->size = size; + msg->data = malloc(size); + if (msg->data) + memcpy(msg->data, data, size); + else + { + free(msg); + return; + } } _e_fm2_messages = eina_list_append(_e_fm2_messages, msg); } @@ -2359,8 +2369,8 @@ _e_fm2_client_message_flush(E_Fm2_Client *cl, E_Fm2_Message *msg) { _e_fm2_messages = eina_list_remove(_e_fm2_messages, msg); ecore_ipc_client_send(cl->cl, msg->major, msg->minor, - msg->ref, msg->ref_to, msg->response, - msg->data, msg->size); + msg->ref, msg->ref_to, msg->response, + msg->data, msg->size); cl->req++; free(msg->data); free(msg); @@ -2371,11 +2381,11 @@ _e_fm2_client_messages_flush(void) { while (_e_fm2_messages) { - E_Fm2_Client *cl; + E_Fm2_Client *cl; - cl = _e_fm2_client_get(); - if (!cl) break; - _e_fm2_client_message_flush(cl, eina_list_data_get(_e_fm2_messages)); + cl = _e_fm2_client_get(); + if (!cl) break; + _e_fm2_client_message_flush(cl, eina_list_data_get(_e_fm2_messages)); } } @@ -2385,20 +2395,20 @@ _e_fm_client_send_new(int minor, void *data, int size) static int id = 0; E_Fm2_Client *cl; - id ++; + id++; cl = _e_fm2_client_get(); if (!cl) { - _e_fm2_client_message_queue(E_IPC_DOMAIN_FM, minor, - id, 0, 0, - data, size); + _e_fm2_client_message_queue(E_IPC_DOMAIN_FM, minor, + id, 0, 0, + data, size); } else { - ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, minor, - id, 0, 0, - data, size); - cl->req++; + ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, minor, + id, 0, 0, + data, size); + cl->req++; } return id; @@ -2412,16 +2422,16 @@ _e_fm_client_send(int minor, int id, void *data, int size) cl = _e_fm2_client_get(); if (!cl) { - _e_fm2_client_message_queue(E_IPC_DOMAIN_FM, minor, - id, 0, 0, - data, size); + _e_fm2_client_message_queue(E_IPC_DOMAIN_FM, minor, + id, 0, 0, + data, size); } else { - ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, minor, - id, 0, 0, - data, size); - cl->req++; + ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, minor, + id, 0, 0, + data, size); + cl->req++; } return id; @@ -2455,6 +2465,7 @@ _e_fm2_client_file_trash(const char *path, Evas_Object *e_fm) e_fm2_op_registry_entry_add(id, e_fm, E_FM_OP_TRASH, _e_fm2_operation_abort_internal); return id; } + #endif static int @@ -2507,21 +2518,21 @@ _e_fm2_client_file_symlink(const char *path, const char *dest, const char *rel, if ((x != -9999) && (y != -9999)) { - E_Fm2_Custom_File *cf, cf0; + E_Fm2_Custom_File *cf, cf0; - cf = e_fm2_custom_file_get(dest); - if (!cf) - { - memset(&cf0, 0, sizeof(E_Fm2_Custom_File)); - cf = &cf0; - } - cf->geom.x = x; - cf->geom.y = y; - cf->geom.res_w = res_w; - cf->geom.res_h = res_h; - cf->geom.valid = 1; - e_fm2_custom_file_set(dest, cf); - e_fm2_custom_file_flush(); + cf = e_fm2_custom_file_get(dest); + if (!cf) + { + memset(&cf0, 0, sizeof(E_Fm2_Custom_File)); + cf = &cf0; + } + cf->geom.x = x; + cf->geom.y = y; + cf->geom.res_w = res_w; + cf->geom.res_h = res_h; + cf->geom.valid = 1; + e_fm2_custom_file_set(dest, cf); + e_fm2_custom_file_flush(); } id = _e_fm_client_send_new(E_FM_OP_SYMLINK, (void *)d, l); @@ -2621,28 +2632,28 @@ _e_fm2_client_monitor_list_end(Evas_Object *obj) sd->busy_count--; if (sd->busy_count == 0) { - edje_object_signal_emit(sd->overlay, "e,state,busy,stop", "e"); - e_fm2_custom_file_flush(); + edje_object_signal_emit(sd->overlay, "e,state,busy,stop", "e"); + e_fm2_custom_file_flush(); } if (sd->tmp.obj) { - evas_object_del(sd->tmp.obj); - sd->tmp.obj = NULL; + evas_object_del(sd->tmp.obj); + sd->tmp.obj = NULL; } if (sd->tmp.obj2) { - evas_object_del(sd->tmp.obj2); - sd->tmp.obj2 = NULL; + evas_object_del(sd->tmp.obj2); + sd->tmp.obj2 = NULL; } if (sd->scan_timer) { - ecore_timer_del(sd->scan_timer); - sd->scan_timer = NULL; + ecore_timer_del(sd->scan_timer); + sd->scan_timer = NULL; } if (sd->sort_idler) { - ecore_idler_del(sd->sort_idler); - sd->sort_idler = NULL; + ecore_idler_del(sd->sort_idler); + sd->sort_idler = NULL; } E_FREE(sd->tmp.list_index); _e_fm2_queue_free(obj); @@ -2661,28 +2672,28 @@ _e_fm2_file_force_update(const char *path) if (!dir) return; EINA_LIST_FOREACH(_e_fm2_list, l, o) { - if ((_e_fm2_list_walking > 0) && - (eina_list_data_find(_e_fm2_list_remove, o))) continue; - if (!strcmp(e_fm2_real_path_get(o), dir)) - { - E_Fm2_Icon *ic; + if ((_e_fm2_list_walking > 0) && + (eina_list_data_find(_e_fm2_list_remove, o))) continue; + if (!strcmp(e_fm2_real_path_get(o), dir)) + { + E_Fm2_Icon *ic; - ic = _e_fm2_icon_find(o, ecore_file_file_get(path)); - if (ic) - { - E_Fm2_Finfo finf; + ic = _e_fm2_icon_find(o, ecore_file_file_get(path)); + if (ic) + { + E_Fm2_Finfo finf; - memset(&finf, 0, sizeof(E_Fm2_Finfo)); - memcpy(&(finf.st), &(ic->info.statinfo), - sizeof(struct stat)); - finf.broken_link = ic->info.broken_link; - finf.lnk = ic->info.link; - finf.rlnk = ic->info.real_link; - ic->removable_state_change = EINA_TRUE; - _e_fm2_live_file_changed(o, ecore_file_file_get(path), - &finf); - } - } + memset(&finf, 0, sizeof(E_Fm2_Finfo)); + memcpy(&(finf.st), &(ic->info.statinfo), + sizeof(struct stat)); + finf.broken_link = ic->info.broken_link; + finf.lnk = ic->info.link; + finf.rlnk = ic->info.real_link; + ic->removable_state_change = EINA_TRUE; + _e_fm2_live_file_changed(o, ecore_file_file_get(path), + &finf); + } + } } free(dir); } @@ -2694,280 +2705,285 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e) Eina_List *l, *dels = NULL; E_Fm2_Client *cl; - if (e->major != 6/*E_IPC_DOMAIN_FM*/) return; + if (e->major != 6 /*E_IPC_DOMAIN_FM*/) return; EINA_LIST_FOREACH(_e_fm2_client_list, l, cl) { - if (cl->cl == e->client) break; + if (cl->cl == e->client) break; } if (!l) { - cl = E_NEW(E_Fm2_Client, 1); - cl->cl = e->client; - _e_fm2_client_list = eina_list_prepend(_e_fm2_client_list, cl); - /* FIXME: new client - send queued msgs */ - _e_fm2_client_spawning = 0; - _e_fm2_client_messages_flush(); + cl = E_NEW(E_Fm2_Client, 1); + cl->cl = e->client; + _e_fm2_client_list = eina_list_prepend(_e_fm2_client_list, cl); + /* FIXME: new client - send queued msgs */ + _e_fm2_client_spawning = 0; + _e_fm2_client_messages_flush(); } _e_fm2_list_walking++; EINA_LIST_FOREACH(_e_fm2_list, l, obj) { - unsigned char *p; - char *evdir; - const char *dir, *path, *lnk, *rlnk, *file; - struct stat st; - int broken_link; - E_Fm2_Smart_Data *sd; + unsigned char *p; + char *evdir; + const char *dir, *path, *lnk, *rlnk, *file; + struct stat st; + int broken_link; + E_Fm2_Smart_Data *sd; - if ((_e_fm2_list_walking > 0) && - (eina_list_data_find(_e_fm2_list_remove, obj))) continue; - dir = e_fm2_real_path_get(obj); - sd = evas_object_smart_data_get(obj); - switch (e->minor) - { - case E_FM_OP_HELLO:/*hello*/ + if ((_e_fm2_list_walking > 0) && + (eina_list_data_find(_e_fm2_list_remove, obj))) continue; + dir = e_fm2_real_path_get(obj); + sd = evas_object_smart_data_get(obj); + switch (e->minor) + { + case E_FM_OP_HELLO: /*hello*/ // printf("E_FM_OP_HELLO\n"); - break; - case E_FM_OP_OK:/*req ok*/ + break; + + case E_FM_OP_OK: /*req ok*/ // printf("E_FM_OP_OK\n"); - cl->req--; - break; - case E_FM_OP_FILE_ADD:/*file add*/ + cl->req--; + break; + + case E_FM_OP_FILE_ADD: /*file add*/ // printf("E_FM_OP_FILE_ADD\n"); - case E_FM_OP_FILE_CHANGE:/*file change*/ + case E_FM_OP_FILE_CHANGE: /*file change*/ // printf("E_FM_OP_FILE_CHANGE\n"); - { - E_Fm2_Finfo finf; + { + E_Fm2_Finfo finf; - p = e->data; - /* NOTE: i am NOT converting this data to portable arch/os independent - * format. i am ASSUMING e_fm_main and e are local and built together - * and thus this will work. if this ever changes this here needs to - * change */ - memcpy(&st, p, sizeof(struct stat)); - p += sizeof(struct stat); + p = e->data; + /* NOTE: i am NOT converting this data to portable arch/os independent + * format. i am ASSUMING e_fm_main and e are local and built together + * and thus this will work. if this ever changes this here needs to + * change */ + memcpy(&st, p, sizeof(struct stat)); + p += sizeof(struct stat); - broken_link = p[0]; - p += 1; + broken_link = p[0]; + p += 1; - path = (char *)p; - p += strlen(path) + 1; + path = (char *)p; + p += strlen(path) + 1; - lnk = (char *)p; - p += strlen(lnk) + 1; + lnk = (char *)p; + p += strlen(lnk) + 1; - rlnk = (char *)p; + rlnk = (char *)p; - memcpy(&(finf.st), &st, sizeof(struct stat)); - finf.broken_link = broken_link; - finf.lnk = lnk; - finf.rlnk = rlnk; + memcpy(&(finf.st), &st, sizeof(struct stat)); + finf.broken_link = broken_link; + finf.lnk = lnk; + finf.rlnk = rlnk; - evdir = ecore_file_dir_get(path); - if ((evdir) && (sd->id == e->ref_to) && - ((!strcmp(evdir, "") || (!strcmp(dir, evdir))))) - { + evdir = ecore_file_dir_get(path); + if ((evdir) && (sd->id == e->ref_to) && + ((!strcmp(evdir, "") || (!strcmp(dir, evdir))))) + { // printf(" ch/add response = %i\n", e->response); - if (e->response == 0)/*live changes*/ - { - if (e->minor == E_FM_OP_FILE_ADD)/*file add*/ - { - _e_fm2_live_file_add - (obj, ecore_file_file_get(path), - NULL, 0, &finf); - } - else if (e->minor == E_FM_OP_FILE_CHANGE)/*file change*/ - { - _e_fm2_live_file_changed - (obj, (char *)ecore_file_file_get(path), - &finf); - } - } - else/*file add - listing*/ - { - if (e->minor == E_FM_OP_FILE_ADD)/*file add*/ - { - if (!sd->scan_timer) - { - sd->scan_timer = - ecore_timer_add(0.5, - _e_fm2_cb_scan_timer, - sd->obj); - sd->busy_count++; - if (sd->busy_count == 1) - edje_object_signal_emit(sd->overlay, "e,state,busy,start", "e"); - } - if (path[0] != 0) - { - file = ecore_file_file_get(path); - if ((!strcmp(file, ".order"))) - sd->order_file = EINA_TRUE; - else - { - if (!((file[0] == '.') && - (!sd->show_hidden_files))) - _e_fm2_file_add(obj, file, - sd->order_file, - NULL, 0, &finf); - } - } - if (e->response == 2)/* end of scan */ - { - sd->listing = EINA_FALSE; - if (sd->scan_timer) - { - ecore_timer_del(sd->scan_timer); - sd->scan_timer = - ecore_timer_add(0.0001, - _e_fm2_cb_scan_timer, - sd->obj); - } - else - { - _e_fm2_client_monitor_list_end(obj); - } - } - } - } - } - else - { + if (e->response == 0) /*live changes*/ + { + if (e->minor == E_FM_OP_FILE_ADD) /*file add*/ + { + _e_fm2_live_file_add + (obj, ecore_file_file_get(path), + NULL, 0, &finf); + } + else if (e->minor == E_FM_OP_FILE_CHANGE) /*file change*/ + { + _e_fm2_live_file_changed + (obj, (char *)ecore_file_file_get(path), + &finf); + } + } + else /*file add - listing*/ + { + if (e->minor == E_FM_OP_FILE_ADD) /*file add*/ + { + if (!sd->scan_timer) + { + sd->scan_timer = + ecore_timer_add(0.5, + _e_fm2_cb_scan_timer, + sd->obj); + sd->busy_count++; + if (sd->busy_count == 1) + edje_object_signal_emit(sd->overlay, "e,state,busy,start", "e"); + } + if (path[0] != 0) + { + file = ecore_file_file_get(path); + if ((!strcmp(file, ".order"))) + sd->order_file = EINA_TRUE; + else + { + if (!((file[0] == '.') && + (!sd->show_hidden_files))) + _e_fm2_file_add(obj, file, + sd->order_file, + NULL, 0, &finf); + } + } + if (e->response == 2) /* end of scan */ + { + sd->listing = EINA_FALSE; + if (sd->scan_timer) + { + ecore_timer_del(sd->scan_timer); + sd->scan_timer = + ecore_timer_add(0.0001, + _e_fm2_cb_scan_timer, + sd->obj); + } + else + { + _e_fm2_client_monitor_list_end(obj); + } + } + } + } + } + else + { // printf(" ...\n"); - if ((sd->id == e->ref_to) && (path[0] == 0)) - { + if ((sd->id == e->ref_to) && (path[0] == 0)) + { // printf(" end response = %i\n", e->response); - if (e->response == 2)/* end of scan */ - { - sd->listing = EINA_FALSE; - if (sd->scan_timer) - { - ecore_timer_del(sd->scan_timer); - sd->scan_timer = - ecore_timer_add(0.0001, - _e_fm2_cb_scan_timer, - sd->obj); - } - else - { - _e_fm2_client_monitor_list_end(obj); - } - } - } - } - if (evdir) free(evdir); - } - break; - case E_FM_OP_FILE_DEL:/*file del*/ + if (e->response == 2) /* end of scan */ + { + sd->listing = EINA_FALSE; + if (sd->scan_timer) + { + ecore_timer_del(sd->scan_timer); + sd->scan_timer = + ecore_timer_add(0.0001, + _e_fm2_cb_scan_timer, + sd->obj); + } + else + { + _e_fm2_client_monitor_list_end(obj); + } + } + } + } + if (evdir) free(evdir); + } + break; + + case E_FM_OP_FILE_DEL: /*file del*/ // printf("E_FM_OP_FILE_DEL\n"); - path = e->data; - evdir = ecore_file_dir_get(path); - if ((sd->id == e->ref_to) && (!strcmp(dir, evdir))) - { - _e_fm2_live_file_del - (obj, ecore_file_file_get(path)); - } - free(evdir); - break; - case E_FM_OP_MONITOR_END:/*mon dir del*/ + path = e->data; + evdir = ecore_file_dir_get(path); + if ((sd->id == e->ref_to) && (!strcmp(dir, evdir))) + { + _e_fm2_live_file_del + (obj, ecore_file_file_get(path)); + } + free(evdir); + break; + + case E_FM_OP_MONITOR_END: /*mon dir del*/ // printf("E_FM_OP_MONITOR_END\n"); - path = e->data; - if ((sd->id == e->ref_to) && (!strcmp(dir, path))) - { - dels = eina_list_append(dels, obj); - } - break; - default: - break; - } + path = e->data; + if ((sd->id == e->ref_to) && (!strcmp(dir, path))) + { + dels = eina_list_append(dels, obj); + } + break; + + default: + break; + } } EINA_LIST_FREE(dels, obj) { - E_Fm2_Smart_Data *sd; + E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if ((_e_fm2_list_walking > 0) && - (eina_list_data_find(_e_fm2_list_remove, obj))) continue; - if (sd->config->view.open_dirs_in_place) + if ((_e_fm2_list_walking > 0) && + (eina_list_data_find(_e_fm2_list_remove, obj))) continue; + if (sd->config->view.open_dirs_in_place) _e_fm2_path_parent_set(obj, sd->realpath); - else - evas_object_smart_callback_call(obj, "dir_deleted", NULL); + else + evas_object_smart_callback_call(obj, "dir_deleted", NULL); } _e_fm2_list_walking--; if (_e_fm2_list_walking == 0) { - EINA_LIST_FREE(_e_fm2_list_remove, obj) - { - _e_fm2_list = eina_list_remove(_e_fm2_list, obj); - } + EINA_LIST_FREE(_e_fm2_list_remove, obj) + { + _e_fm2_list = eina_list_remove(_e_fm2_list, obj); + } } switch (e->minor) { - case E_FM_OP_MONITOR_SYNC:/*mon list sync*/ - ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, E_FM_OP_MONITOR_SYNC, - 0, 0, e->response, - NULL, 0); - break; + case E_FM_OP_MONITOR_SYNC: /*mon list sync*/ + ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, E_FM_OP_MONITOR_SYNC, + 0, 0, e->response, + NULL, 0); + break; - case E_FM_OP_STORAGE_ADD:/*storage add*/ - if ((e->data) && (e->size > 0)) - { - E_Storage *s; + case E_FM_OP_STORAGE_ADD: /*storage add*/ + if ((e->data) && (e->size > 0)) + { + E_Storage *s; - s = _e_fm_shared_codec_storage_decode(e->data, e->size); - if (s) e_fm2_device_storage_add(s); - } - break; + s = _e_fm_shared_codec_storage_decode(e->data, e->size); + if (s) e_fm2_device_storage_add(s); + } + break; - case E_FM_OP_STORAGE_DEL:/*storage del*/ - if ((e->data) && (e->size > 0)) - { - char *udi; - E_Storage *s; + case E_FM_OP_STORAGE_DEL: /*storage del*/ + if ((e->data) && (e->size > 0)) + { + char *udi; + E_Storage *s; - udi = e->data; - s = e_fm2_device_storage_find(udi); - if (s) e_fm2_device_storage_del(s); - } - break; + udi = e->data; + s = e_fm2_device_storage_find(udi); + if (s) e_fm2_device_storage_del(s); + } + break; - case E_FM_OP_VOLUME_ADD:/*volume add*/ - if ((e->data) && (e->size > 0)) - { - E_Volume *v; - - v = _e_fm_shared_codec_volume_decode(e->data, e->size); - if (v) - { - e_fm2_device_volume_add(v); - if (e_config->device_auto_mount && !v->mounted && !v->first_time) - _e_fm2_client_mount(v->udi, v->mount_point); - v->first_time = 0; - } - } - break; - - case E_FM_OP_VOLUME_DEL:/*volume del*/ - if ((e->data) && (e->size > 0)) - { - char *udi; + case E_FM_OP_VOLUME_ADD: /*volume add*/ + if ((e->data) && (e->size > 0)) + { E_Volume *v; - udi = e->data; - v = e_fm2_device_volume_find(udi); - if (v) e_fm2_device_volume_del(v); - } - break; + v = _e_fm_shared_codec_volume_decode(e->data, e->size); + if (v) + { + e_fm2_device_volume_add(v); + if (e_config->device_auto_mount && !v->mounted && !v->first_time) + _e_fm2_client_mount(v->udi, v->mount_point); + v->first_time = 0; + } + } + break; - case E_FM_OP_MOUNT_DONE:/*mount done*/ - if ((e->data) && (e->size > 1)) - { - E_Volume *v; - char *udi, *mountpoint; + case E_FM_OP_VOLUME_DEL: /*volume del*/ + if ((e->data) && (e->size > 0)) + { + char *udi; + E_Volume *v; - udi = e->data; - mountpoint = udi + strlen(udi) + 1; - v = e_fm2_device_volume_find(udi); - if (v) + udi = e->data; + v = e_fm2_device_volume_find(udi); + if (v) e_fm2_device_volume_del(v); + } + break; + + case E_FM_OP_MOUNT_DONE: /*mount done*/ + if ((e->data) && (e->size > 1)) + { + E_Volume *v; + char *udi, *mountpoint; + + udi = e->data; + mountpoint = udi + strlen(udi) + 1; + v = e_fm2_device_volume_find(udi); + if (v) { e_fm2_device_mount_add(v, mountpoint); _e_fm2_volume_icon_update(v); @@ -2975,36 +2991,36 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e) { E_Action *a; Eina_List *m; - + a = e_action_find("fileman"); m = e_manager_list(); if (a && a->func.go && m && eina_list_data_get(m)) a->func.go(E_OBJECT(eina_list_data_get(m)), mountpoint); } } - } - break; + } + break; - case E_FM_OP_UNMOUNT_DONE:/*unmount done*/ - if ((e->data) && (e->size > 1)) - { - E_Volume *v; - char *udi; + case E_FM_OP_UNMOUNT_DONE: /*unmount done*/ + if ((e->data) && (e->size > 1)) + { + E_Volume *v; + char *udi; - udi = e->data; - v = e_fm2_device_volume_find(udi); - if (v) + udi = e->data; + v = e_fm2_device_volume_find(udi); + if (v) { e_fm2_device_mount_del(v); _e_fm2_volume_icon_update(v); } - } - break; + } + break; case E_FM_OP_EJECT_DONE: break; - - case E_FM_OP_MOUNT_ERROR:/*mount error*/ + + case E_FM_OP_MOUNT_ERROR: /*mount error*/ if (e->data && (e->size > 1)) { E_Volume *v; @@ -3012,15 +3028,15 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e) udi = e->data; v = e_fm2_device_volume_find(udi); - if (v) + if (v) { _e_fm_device_error_dialog(_("Mount Error"), _("Can't mount device"), e->data); e_fm2_device_mount_fail(v); } } break; - - case E_FM_OP_UNMOUNT_ERROR:/*unmount error*/ + + case E_FM_OP_UNMOUNT_ERROR: /*unmount error*/ if (e->data && (e->size > 1)) { E_Volume *v; @@ -3035,7 +3051,7 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e) } } break; - + case E_FM_OP_EJECT_ERROR: if (e->data && (e->size > 1)) { @@ -3045,88 +3061,88 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e) udi = e->data; v = e_fm2_device_volume_find(udi); if (v) - _e_fm_device_error_dialog(_("Eject Error"), _("Can't eject device"), e->data); + _e_fm_device_error_dialog(_("Eject Error"), _("Can't eject device"), e->data); } break; - - case E_FM_OP_ERROR:/*error*/ - { - E_Dialog *dlg; - printf("%s:%s(%d) Error from slave #%d: %s\n", __FILE__, __FUNCTION__, __LINE__, e->ref, (char *)e->data); - dlg = _e_fm_error_dialog(e->ref, e->data); - _e_fm2_op_registry_error(e->ref, dlg); - } - break; - case E_FM_OP_ERROR_RETRY_ABORT:/*error*/ - { - E_Dialog *dlg; - printf("%s:%s(%d) Error from slave #%d: %s\n", __FILE__, __FUNCTION__, __LINE__, e->ref, (char *)e->data); - dlg = _e_fm_retry_abort_dialog(e->ref, (char *)e->data); - _e_fm2_op_registry_error(e->ref, dlg); - } - break; + case E_FM_OP_ERROR: /*error*/ + { + E_Dialog *dlg; + printf("%s:%s(%d) Error from slave #%d: %s\n", __FILE__, __FUNCTION__, __LINE__, e->ref, (char *)e->data); + dlg = _e_fm_error_dialog(e->ref, e->data); + _e_fm2_op_registry_error(e->ref, dlg); + } + break; - case E_FM_OP_OVERWRITE:/*overwrite*/ - { - E_Dialog *dlg; - printf("%s:%s(%d) Overwrite from slave #%d: %s\n", __FILE__, __FUNCTION__, __LINE__, e->ref, (char *)e->data); - dlg = _e_fm_overwrite_dialog(e->ref, (char *)e->data); - _e_fm2_op_registry_needs_attention(e->ref, dlg); - } - break; + case E_FM_OP_ERROR_RETRY_ABORT: /*error*/ + { + E_Dialog *dlg; + printf("%s:%s(%d) Error from slave #%d: %s\n", __FILE__, __FUNCTION__, __LINE__, e->ref, (char *)e->data); + dlg = _e_fm_retry_abort_dialog(e->ref, (char *)e->data); + _e_fm2_op_registry_error(e->ref, dlg); + } + break; - case E_FM_OP_PROGRESS:/*progress*/ - { - int percent, seconds; - off_t done, total; - char *src = NULL; - char *dst = NULL; - char *p = e->data; + case E_FM_OP_OVERWRITE: /*overwrite*/ + { + E_Dialog *dlg; + printf("%s:%s(%d) Overwrite from slave #%d: %s\n", __FILE__, __FUNCTION__, __LINE__, e->ref, (char *)e->data); + dlg = _e_fm_overwrite_dialog(e->ref, (char *)e->data); + _e_fm2_op_registry_needs_attention(e->ref, dlg); + } + break; - if (!e->data) return; + case E_FM_OP_PROGRESS: /*progress*/ + { + int percent, seconds; + off_t done, total; + char *src = NULL; + char *dst = NULL; + char *p = e->data; + + if (!e->data) return; #define UP(value, type) (value) = *(type *)p; p += sizeof(type) - UP(percent, int); - UP(seconds, int); - UP(done, off_t); - UP(total, off_t); + UP(percent, int); + UP(seconds, int); + UP(done, off_t); + UP(total, off_t); #undef UP - src = p; - dst = p + strlen(src) + 1; - // printf("%s:%s(%d) Progress from slave #%d:\n\t%d%% done,\n\t%d seconds left,\n\t%zd done,\n\t%zd total,\n\tsrc = %s,\n\tdst = %s.\n", __FILE__, __FUNCTION__, __LINE__, e->ref, percent, seconds, done, total, src, dst); + src = p; + dst = p + strlen(src) + 1; + // printf("%s:%s(%d) Progress from slave #%d:\n\t%d%% done,\n\t%d seconds left,\n\t%zd done,\n\t%zd total,\n\tsrc = %s,\n\tdst = %s.\n", __FILE__, __FUNCTION__, __LINE__, e->ref, percent, seconds, done, total, src, dst); - E_Fm2_Op_Registry_Entry *ere = e_fm2_op_registry_entry_get(e->ref); - if (!ere) return; - ere->percent = percent; - ere->done = done; - ere->total = total; - ere->eta = seconds; - e_fm2_op_registry_entry_files_set(ere, src, dst); - if (ere->percent == 100) - { - ere->status = E_FM2_OP_STATUS_SUCCESSFUL; - ere->finished = 1; - } - e_fm2_op_registry_entry_changed(ere); - } - break; + E_Fm2_Op_Registry_Entry *ere = e_fm2_op_registry_entry_get(e->ref); + if (!ere) return; + ere->percent = percent; + ere->done = done; + ere->total = total; + ere->eta = seconds; + e_fm2_op_registry_entry_files_set(ere, src, dst); + if (ere->percent == 100) + { + ere->status = E_FM2_OP_STATUS_SUCCESSFUL; + ere->finished = 1; + } + e_fm2_op_registry_entry_changed(ere); + } + break; - case E_FM_OP_QUIT:/*finished*/ - { - E_Fm2_Op_Registry_Entry *ere = e_fm2_op_registry_entry_get(e->ref); - if (ere) - { - ere->finished = 1; - ere->eta = 0; - e_fm2_op_registry_entry_changed(ere); - } - e_fm2_op_registry_entry_del(e->ref); - } - break; + case E_FM_OP_QUIT: /*finished*/ + { + E_Fm2_Op_Registry_Entry *ere = e_fm2_op_registry_entry_get(e->ref); + if (ere) + { + ere->finished = 1; + ere->eta = 0; + e_fm2_op_registry_entry_changed(ere); + } + e_fm2_op_registry_entry_del(e->ref); + } + break; - default: - break; + default: + break; } } @@ -3138,12 +3154,12 @@ e_fm2_client_del(Ecore_Ipc_Event_Client_Del *e) EINA_LIST_FOREACH(_e_fm2_client_list, l, cl) { - if (cl->cl == e->client) - { - _e_fm2_client_list = eina_list_remove_list(_e_fm2_client_list, l); - free(cl); - break; - } + if (cl->cl == e->client) + { + _e_fm2_client_list = eina_list_remove_list(_e_fm2_client_list, l); + free(cl); + break; + } } } @@ -3161,86 +3177,87 @@ _e_fm2_dev_path_map(const char *dev, const char *path) * maybe for home directory and root fs and other simple thngs */ /* FIXME: also add other virtualized dirs like "backgrounds", "themes", * "favorites" */ -#define CMP(x) ((dev) && (e_util_glob_case_match(dev, x))) -#define PRT(args...) snprintf(buf, sizeof(buf), ##args) +#define CMP(x) ((dev) && (e_util_glob_case_match(dev, x))) +#define PRT(args ...) snprintf(buf, sizeof(buf), ##args) if (dev) { - if (dev[0] == '/') - { - if (dev[1] == '\0') - { - if (eina_strlcpy(buf, path, sizeof(buf)) >= sizeof(buf)) - return NULL; - } - else - { - if (PRT("%s/%s", dev, path) >= sizeof(buf)) - return NULL; - } - } - else if ((dev[0] == '~') && (dev[1] == '/') && (dev[2] == '\0')) - { - s = (char *)e_user_homedir_get(); - if (PRT("%s/%s", s, path) >= sizeof(buf)) - return NULL; - } - else if (strcmp(dev, "favorites") == 0) - { - /* this is a virtual device - it's where your favorites list is - * stored - a dir with - .desktop files or symlinks (in fact anything - * you like - */ - if (e_user_dir_concat_static(buf, "fileman/favorites") >= sizeof(buf)) - return NULL; - } - else if (strcmp(dev, "desktop") == 0) - { - /* this is a virtual device - it's where your favorites list is - * stored - a dir with - .desktop files or symlinks (in fact anything - * you like - */ - if (strcmp(path, "/") == 0) - { - if (e_user_homedir_concat(buf, sizeof(buf), _("Desktop")) >= sizeof(buf)) - return NULL; - } - else - { - if (e_user_homedir_snprintf(buf, sizeof(buf), "%s-%s", _("Desktop"), path) >= sizeof(buf)) - return NULL; - } - ecore_file_mkpath(buf); - } - else if (strcmp(dev, "temp") == 0) - PRT("/tmp"); - /* FIXME: replace all this removable, dvd and like with hal */ - else if (strncmp(dev, "removable:", sizeof("removable:") - 1) == 0) - { - E_Volume *v; + if (dev[0] == '/') + { + if (dev[1] == '\0') + { + if (eina_strlcpy(buf, path, sizeof(buf)) >= sizeof(buf)) + return NULL; + } + else + { + if (PRT("%s/%s", dev, path) >= sizeof(buf)) + return NULL; + } + } + else if ((dev[0] == '~') && (dev[1] == '/') && (dev[2] == '\0')) + { + s = (char *)e_user_homedir_get(); + if (PRT("%s/%s", s, path) >= sizeof(buf)) + return NULL; + } + else if (strcmp(dev, "favorites") == 0) + { + /* this is a virtual device - it's where your favorites list is + * stored - a dir with + .desktop files or symlinks (in fact anything + * you like + */ + if (e_user_dir_concat_static(buf, "fileman/favorites") >= sizeof(buf)) + return NULL; + } + else if (strcmp(dev, "desktop") == 0) + { + /* this is a virtual device - it's where your favorites list is + * stored - a dir with + .desktop files or symlinks (in fact anything + * you like + */ + if (strcmp(path, "/") == 0) + { + if (e_user_homedir_concat(buf, sizeof(buf), _("Desktop")) >= sizeof(buf)) + return NULL; + } + else + { + if (e_user_homedir_snprintf(buf, sizeof(buf), "%s-%s", _("Desktop"), path) >= sizeof(buf)) + return NULL; + } + ecore_file_mkpath(buf); + } + else if (strcmp(dev, "temp") == 0) + PRT("/tmp"); + /* FIXME: replace all this removable, dvd and like with hal */ + else if (strncmp(dev, "removable:", sizeof("removable:") - 1) == 0) + { + E_Volume *v; - v = e_fm2_device_volume_find(dev + strlen("removable:")); - if (v) - { - if (!v->mount_point) - v->mount_point = e_fm2_device_volume_mountpoint_get(v);; - if (PRT("%s/%s", v->mount_point, path) >= sizeof(buf)) - return NULL; - } - } -/* else if (CMP("dvd") || CMP("dvd-*")) */ -/* { */ -/* /\* FIXME: find dvd mountpoint optionally for dvd no. X *\/ */ -/* /\* maybe make part of the device mappings config? *\/ */ -/* } */ -/* else if (CMP("cd") || CMP("cd-*") || CMP("cdrom") || CMP("cdrom-*") || */ -/* CMP("dvd") || CMP("dvd-*")) */ -/* { */ -/* /\* FIXME: find cdrom or dvd mountpoint optionally for cd/dvd no. X *\/ */ -/* /\* maybe make part of the device mappings config? *\/ */ -/* } */ + v = e_fm2_device_volume_find(dev + strlen("removable:")); + if (v) + { + if (!v->mount_point) + v->mount_point = e_fm2_device_volume_mountpoint_get(v); + ; + if (PRT("%s/%s", v->mount_point, path) >= sizeof(buf)) + return NULL; + } + } +/* else if (CMP("dvd") || CMP("dvd-*")) */ +/* { */ +/* /\* FIXME: find dvd mountpoint optionally for dvd no. X *\/ */ +/* /\* maybe make part of the device mappings config? *\/ */ +/* } */ +/* else if (CMP("cd") || CMP("cd-*") || CMP("cdrom") || CMP("cdrom-*") || */ +/* CMP("dvd") || CMP("dvd-*")) */ +/* { */ +/* /\* FIXME: find cdrom or dvd mountpoint optionally for cd/dvd no. X *\/ */ +/* /\* maybe make part of the device mappings config? *\/ */ +/* } */ } /* FIXME: add code to find USB devices (multi-card readers or single, * usb thumb drives, other usb storage devices (usb hd's etc.) @@ -3251,32 +3268,32 @@ _e_fm2_dev_path_map(const char *dev, const char *path) if (buf[0] == '\0') { - if (eina_strlcpy(buf, path, sizeof(buf)) >= sizeof(buf)) - return NULL; + if (eina_strlcpy(buf, path, sizeof(buf)) >= sizeof(buf)) + return NULL; } /* strip out excess multiple slashes */ s = buf; while (*s) { - if ((s[0] == '/') && (s[1] == '/')) - { - ss = s; - do - { - ss[0] = ss[1]; - ss++; - } - while (*ss); - } - s++; + if ((s[0] == '/') && (s[1] == '/')) + { + ss = s; + do + { + ss[0] = ss[1]; + ss++; + } + while (*ss); + } + s++; } /* strip out slashes at the end - unless its just "/" */ len = s - buf; while ((len > 1) && (buf[len - 1] == '/')) { - buf[len - 1] = 0; - len--; + buf[len - 1] = 0; + len--; } return eina_stringshare_add(buf); } @@ -3293,65 +3310,65 @@ _e_fm2_file_add(Evas_Object *obj, const char *file, int unique, const char *file /* if we only want unique icon names - if it's there - ignore */ if (unique) { - EINA_LIST_FOREACH(sd->icons, l, ic) - { - if (!strcmp(ic->info.file, file)) - { - sd->tmp.last_insert = NULL; - return; - } - } - EINA_LIST_FOREACH(sd->queue, l, ic) - { - if (!strcmp(ic->info.file, file)) - { - sd->tmp.last_insert = NULL; - return; - } - } + EINA_LIST_FOREACH(sd->icons, l, ic) + { + if (!strcmp(ic->info.file, file)) + { + sd->tmp.last_insert = NULL; + return; + } + } + EINA_LIST_FOREACH(sd->queue, l, ic) + { + if (!strcmp(ic->info.file, file)) + { + sd->tmp.last_insert = NULL; + return; + } + } } /* create icon obj and append to unsorted list */ ic = _e_fm2_icon_new(sd, file, finf); if (ic) { - if (!file_rel) - { - /* respekt da ordah! */ - if (sd->order_file) - sd->queue = eina_list_append(sd->queue, ic); - else - { - /* insertion sort it here to spread the sort load into idle time */ - EINA_LIST_FOREACH(sd->queue, l, ic2) - { - if (_e_fm2_cb_icon_sort(ic, ic2) < 0) - { - sd->queue = eina_list_prepend_relative_list(sd->queue, ic, l); - break; - } - } - if (!l) sd->queue = eina_list_append(sd->queue, ic); - } - } - else - { - EINA_LIST_FOREACH(sd->icons, l, ic2) - { - if (!strcmp(ic2->info.file, file_rel)) - { - if (after) - sd->icons = eina_list_append_relative(sd->icons, ic, ic2); - else - sd->icons = eina_list_prepend_relative(sd->icons, ic, ic2); - break; - } - } - if (!l) - sd->icons = eina_list_append(sd->icons, ic); - sd->icons_place = eina_list_append(sd->icons_place, ic); - } - sd->tmp.last_insert = NULL; - sd->iconlist_changed = EINA_TRUE; + if (!file_rel) + { + /* respekt da ordah! */ + if (sd->order_file) + sd->queue = eina_list_append(sd->queue, ic); + else + { + /* insertion sort it here to spread the sort load into idle time */ + EINA_LIST_FOREACH(sd->queue, l, ic2) + { + if (_e_fm2_cb_icon_sort(ic, ic2) < 0) + { + sd->queue = eina_list_prepend_relative_list(sd->queue, ic, l); + break; + } + } + if (!l) sd->queue = eina_list_append(sd->queue, ic); + } + } + else + { + EINA_LIST_FOREACH(sd->icons, l, ic2) + { + if (!strcmp(ic2->info.file, file_rel)) + { + if (after) + sd->icons = eina_list_append_relative(sd->icons, ic, ic2); + else + sd->icons = eina_list_prepend_relative(sd->icons, ic, ic2); + break; + } + } + if (!l) + sd->icons = eina_list_append(sd->icons, ic); + sd->icons_place = eina_list_append(sd->icons_place, ic); + } + sd->tmp.last_insert = NULL; + sd->iconlist_changed = EINA_TRUE; } } @@ -3366,18 +3383,18 @@ _e_fm2_file_del(Evas_Object *obj, const char *file) if (!sd) return; EINA_LIST_FOREACH(sd->icons, l, ic) { - if (!strcmp(ic->info.file, file)) - { - sd->icons = eina_list_remove_list(sd->icons, l); - sd->icons_place = eina_list_remove(sd->icons_place, ic); - if (ic->region) - { - ic->region->list = eina_list_remove(ic->region->list, ic); - ic->region = NULL; - } - _e_fm2_icon_free(ic); - return; - } + if (!strcmp(ic->info.file, file)) + { + sd->icons = eina_list_remove_list(sd->icons, l); + sd->icons_place = eina_list_remove(sd->icons_place, ic); + if (ic->region) + { + ic->region->list = eina_list_remove(ic->region->list, ic); + ic->region = NULL; + } + _e_fm2_icon_free(ic); + return; + } } } @@ -3412,8 +3429,8 @@ _e_fm2_buffer_fill(Evas_Object *obj) if ((bufused > 0) && (buf[bufused - 1] != '/')) { - buf[bufused] = '/'; - bufused++; + buf[bufused] = '/'; + bufused++; } pfile = buf + bufused; @@ -3421,9 +3438,9 @@ _e_fm2_buffer_fill(Evas_Object *obj) EINA_LIST_FREE(sel, ici) { - if (!ici) continue; - if (eina_strlcpy(pfile, ici->file, buffree) >= buffree) continue; - _e_fm_file_buffer = eina_list_append(_e_fm_file_buffer, _e_fm2_uri_escape(buf)); + if (!ici) continue; + if (eina_strlcpy(pfile, ici->file, buffree) >= buffree) continue; + _e_fm_file_buffer = eina_list_append(_e_fm_file_buffer, _e_fm2_uri_escape(buf)); } return EINA_TRUE; @@ -3460,24 +3477,24 @@ _e_fm2_file_paste(Evas_Object *obj) paths = _e_fm2_uri_path_list_get(_e_fm_file_buffer); EINA_LIST_FREE(paths, filepath) { - /* Get file's full path. */ - if (!filepath) - continue; + /* Get file's full path. */ + if (!filepath) + continue; - /* Check if file is protected. */ - if (e_filereg_file_protected(filepath)) - { - eina_stringshare_del(filepath); - continue; - } + /* Check if file is protected. */ + if (e_filereg_file_protected(filepath)) + { + eina_stringshare_del(filepath); + continue; + } - /* Put filepath into a string of args. - * If there are more files, put an additional space. - */ - args = _e_fm_string_append_quoted(args, &size, &length, filepath); - args = _e_fm_string_append_char(args, &size, &length, ' '); + /* Put filepath into a string of args. + * If there are more files, put an additional space. + */ + args = _e_fm_string_append_quoted(args, &size, &length, filepath); + args = _e_fm_string_append_char(args, &size, &length, ' '); - eina_stringshare_del(filepath); + eina_stringshare_del(filepath); } /* Add destination to the arguments. */ @@ -3486,11 +3503,11 @@ _e_fm2_file_paste(Evas_Object *obj) /* Roll the operation! */ if (_e_fm_file_buffer_copying) { - _e_fm_client_file_copy(args, sd->obj); + _e_fm_client_file_copy(args, sd->obj); } else { - _e_fm_client_file_move(args, sd->obj); + _e_fm_client_file_move(args, sd->obj); } free(args); @@ -3513,24 +3530,24 @@ _e_fm2_file_symlink(Evas_Object *obj) paths = _e_fm2_uri_path_list_get(_e_fm_file_buffer); EINA_LIST_FREE(paths, filepath) { - /* Get file's full path. */ - if (!filepath) - continue; + /* Get file's full path. */ + if (!filepath) + continue; - /* Check if file is protected. */ - if (e_filereg_file_protected(filepath)) - { - eina_stringshare_del(filepath); - continue; - } + /* Check if file is protected. */ + if (e_filereg_file_protected(filepath)) + { + eina_stringshare_del(filepath); + continue; + } - /* Put filepath into a string of args. - * If there are more files, put an additional space. - */ - args = _e_fm_string_append_quoted(args, &size, &length, filepath); - args = _e_fm_string_append_char(args, &size, &length, ' '); + /* Put filepath into a string of args. + * If there are more files, put an additional space. + */ + args = _e_fm_string_append_quoted(args, &size, &length, filepath); + args = _e_fm_string_append_char(args, &size, &length, ' '); - eina_stringshare_del(filepath); + eina_stringshare_del(filepath); } /* Add destination to the arguments. */ @@ -3589,93 +3606,93 @@ _e_fm2_queue_process(Evas_Object *obj) if (!sd) return; if (!sd->queue) { - if (sd->resize_job) ecore_job_del(sd->resize_job); - sd->resize_job = ecore_job_add(_e_fm2_cb_resize_job, obj); - evas_object_smart_callback_call(sd->obj, "changed", NULL); - sd->tmp.last_insert = NULL; - return; + if (sd->resize_job) ecore_job_del(sd->resize_job); + sd->resize_job = ecore_job_add(_e_fm2_cb_resize_job, obj); + evas_object_smart_callback_call(sd->obj, "changed", NULL); + sd->tmp.last_insert = NULL; + return; } // double tt = ecore_time_get(); // int queued = eina_list_count(sd->queue); - /* take unsorted and insert into the icon list - reprocess regions */ +/* take unsorted and insert into the icon list - reprocess regions */ t = ecore_time_get(); if (!sd->tmp.last_insert) { #if 1 - n = eina_list_count(sd->icons); - E_FREE(sd->tmp.list_index); - if (n > 0) - sd->tmp.list_index = malloc(n * sizeof(Eina_List *)); - if (sd->tmp.list_index) - { - ll = sd->tmp.list_index; - for (l = sd->icons; l; l = eina_list_next(l)) - { - *ll = l; - ll++; - } - /* binary search first queue */ - ic = eina_list_data_get(sd->queue); - p0 = 0; p1 = n; - i = (p0 + p1) / 2; - ll = sd->tmp.list_index; - do - { - ic2 = eina_list_data_get(ll[i]); - v = _e_fm2_cb_icon_sort(ic, ic2); - if (v < 0) /* ic should go before ic2 */ - p1 = i; - else /* ic should go at or after ic2 */ - p0 = i; - i = (p0 + p1) / 2; - l = ll[i]; - } - while ((p1 - p0) > 1); - } - else + n = eina_list_count(sd->icons); + E_FREE(sd->tmp.list_index); + if (n > 0) + sd->tmp.list_index = malloc(n * sizeof(Eina_List *)); + if (sd->tmp.list_index) + { + ll = sd->tmp.list_index; + for (l = sd->icons; l; l = eina_list_next(l)) + { + *ll = l; + ll++; + } + /* binary search first queue */ + ic = eina_list_data_get(sd->queue); + p0 = 0; p1 = n; + i = (p0 + p1) / 2; + ll = sd->tmp.list_index; + do + { + ic2 = eina_list_data_get(ll[i]); + v = _e_fm2_cb_icon_sort(ic, ic2); + if (v < 0) /* ic should go before ic2 */ + p1 = i; + else /* ic should go at or after ic2 */ + p0 = i; + i = (p0 + p1) / 2; + l = ll[i]; + } + while ((p1 - p0) > 1); + } + else #endif - l = sd->icons; + l = sd->icons; } else l = sd->tmp.last_insert; EINA_LIST_FREE(sd->queue, ic) { - /* insertion sort - better than qsort for the way we are doing - * things - incrimentally scan and sort as we go as we now know - * that the queue files are in order, we speed up insertions to - * a worst case of O(n) where n is the # of files in the list - * so far - */ - if (sd->order_file) - { - l = NULL; - } - else - { - EINA_LIST_FOREACH(l, l, ic2) - { - if (_e_fm2_cb_icon_sort(ic, ic2) < 0) - { - if (l == sd->icons) - sd->icons = eina_list_prepend(sd->icons, ic); - else - sd->icons = eina_list_prepend_relative_list(sd->icons, - ic, l); - sd->tmp.last_insert = l; - break; - } - } - } - if (!l) - { - sd->icons = eina_list_append(sd->icons, ic); - sd->tmp.last_insert = eina_list_last(sd->icons); - } - sd->icons_place = eina_list_append(sd->icons_place, ic); - added++; - /* if we spent more than 1/20th of a second inserting - give up - * for now */ - if ((ecore_time_get() - t) > 0.05) break; + /* insertion sort - better than qsort for the way we are doing + * things - incrimentally scan and sort as we go as we now know + * that the queue files are in order, we speed up insertions to + * a worst case of O(n) where n is the # of files in the list + * so far + */ + if (sd->order_file) + { + l = NULL; + } + else + { + EINA_LIST_FOREACH(l, l, ic2) + { + if (_e_fm2_cb_icon_sort(ic, ic2) < 0) + { + if (l == sd->icons) + sd->icons = eina_list_prepend(sd->icons, ic); + else + sd->icons = eina_list_prepend_relative_list(sd->icons, + ic, l); + sd->tmp.last_insert = l; + break; + } + } + } + if (!l) + { + sd->icons = eina_list_append(sd->icons, ic); + sd->tmp.last_insert = eina_list_last(sd->icons); + } + sd->icons_place = eina_list_append(sd->icons_place, ic); + added++; + /* if we spent more than 1/20th of a second inserting - give up + * for now */ + if ((ecore_time_get() - t) > 0.05) break; } // printf("FM: SORT %1.3f (%i files) (%i queued, %i added) [%i iter]\n", // ecore_time_get() - tt, eina_list_count(sd->icons), queued, @@ -3730,49 +3747,49 @@ _e_fm2_regions_populate(Evas_Object *obj) edje_freeze(); EINA_LIST_FOREACH(sd->icons, l, ic) { - if (!rg) - { - rg = _e_fm2_region_new(sd); - sd->regions.list = eina_list_append(sd->regions.list, rg); - } - ic->region = rg; - rg->list = eina_list_append(rg->list, ic); - if (rg->w == 0) - { - rg->x = ic->x; - rg->y = ic->y; - rg->w = ic->w; - rg->h = ic->h; - } - else - { - if (ic->x < rg->x) - { - rg->w += rg->x - ic->x; - rg->x = ic->x; - } - if ((ic->x + ic->w) > (rg->x + rg->w)) - { - rg->w += (ic->x + ic->w) - (rg->x + rg->w); - } - if (ic->y < rg->y) - { - rg->h += rg->y - ic->y; - rg->y = ic->y; - } - if ((ic->y + ic->h) > (rg->y + rg->h)) - { - rg->h += (ic->y + ic->h) - (rg->y + rg->h); - } - } - if (eina_list_count(rg->list) > sd->regions.member_max) - rg = NULL; + if (!rg) + { + rg = _e_fm2_region_new(sd); + sd->regions.list = eina_list_append(sd->regions.list, rg); + } + ic->region = rg; + rg->list = eina_list_append(rg->list, ic); + if (rg->w == 0) + { + rg->x = ic->x; + rg->y = ic->y; + rg->w = ic->w; + rg->h = ic->h; + } + else + { + if (ic->x < rg->x) + { + rg->w += rg->x - ic->x; + rg->x = ic->x; + } + if ((ic->x + ic->w) > (rg->x + rg->w)) + { + rg->w += (ic->x + ic->w) - (rg->x + rg->w); + } + if (ic->y < rg->y) + { + rg->h += rg->y - ic->y; + rg->y = ic->y; + } + if ((ic->y + ic->h) > (rg->y + rg->h)) + { + rg->h += (ic->y + ic->h) - (rg->y + rg->h); + } + } + if (eina_list_count(rg->list) > sd->regions.member_max) + rg = NULL; } _e_fm2_regions_eval(obj); EINA_LIST_FOREACH(sd->icons, l, ic) { - if ((!ic->region->realized) && (ic->realized)) - _e_fm2_icon_unrealize(ic); + if ((!ic->region->realized) && (ic->realized)) + _e_fm2_icon_unrealize(ic); } _e_fm2_obj_icons_place(sd); edje_thaw(); @@ -3790,18 +3807,18 @@ _e_fm2_icons_place_icons(E_Fm2_Smart_Data *sd) rh = 0; EINA_LIST_FOREACH(sd->icons, l, ic) { - if ((x > 0) && ((x + ic->w) > sd->w)) - { - x = 0; - y += rh; - rh = 0; - } - ic->x = x; - ic->y = y; - x += ic->w; - if (ic->h > rh) rh = ic->h; - if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w; - if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h; + if ((x > 0) && ((x + ic->w) > sd->w)) + { + x = 0; + y += rh; + rh = 0; + } + ic->x = x; + ic->y = y; + x += ic->w; + if (ic->h > rh) rh = ic->h; + if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w; + if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h; } } @@ -3816,26 +3833,26 @@ _e_fm2_icons_place_grid_icons(E_Fm2_Smart_Data *sd) gw = 0; gh = 0; EINA_LIST_FOREACH(sd->icons, l, ic) { - if (ic->w > gw) gw = ic->w; - if (ic->h > gh) gh = ic->h; + if (ic->w > gw) gw = ic->w; + if (ic->h > gh) gh = ic->h; } if (gw > 0) cols = sd->w / gw; if (cols < 1) cols = 1; x = 0; y = 0; col = 0; EINA_LIST_FOREACH(sd->icons, l, ic) { - ic->x = x + ((gw - ic->w) / 2); - ic->y = y + (gh - ic->h); - x += gw; - col++; - if (col >= cols) - { - col = 0; - x = 0; - y += gh; - } - if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w; - if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h; + ic->x = x + ((gw - ic->w) / 2); + ic->y = y + (gh - ic->h); + x += gw; + col++; + if (col >= cols) + { + col = 0; + x = 0; + y += gh; + } + if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w; + if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h; } } @@ -3848,12 +3865,12 @@ _e_fm2_icons_icon_overlaps(E_Fm2_Icon *ic) /* this is really slow... when we have a lot of icons */ EINA_LIST_FOREACH(ic->sd->icons, l, ic2) { - if ((ic2 != ic) && (ic2->saved_pos)) - { - if (E_INTERSECTS(ic2->x, ic2->y, ic2->w, ic2->h, - ic->x, ic->y, ic->w, ic->h)) - return 1; - } + if ((ic2 != ic) && (ic2->saved_pos)) + { + if (E_INTERSECTS(ic2->x, ic2->y, ic2->w, ic2->h, + ic->x, ic->y, ic->w, ic->h)) + return 1; + } } return 0; } @@ -3874,14 +3891,20 @@ _e_fm2_icon_place_relative(E_Fm2_Icon *ic, E_Fm2_Icon *icr, int xrel, int yrel, ic->y = icr->y; if (xrel > 0) ic->x += icr->w; - else if (xrel < 0) ic->x -= ic->w; - else if (xa == 1) ic->x += (icr->w - ic->w) / 2; - else if (xa == 2) ic->x += icr->w - ic->w; + else if (xrel < 0) + ic->x -= ic->w; + else if (xa == 1) + ic->x += (icr->w - ic->w) / 2; + else if (xa == 2) + ic->x += icr->w - ic->w; if (yrel > 0) ic->y += icr->h; - else if (yrel < 0) ic->y -= ic->h; - else if (ya == 1) ic->y += (icr->h - ic->h) / 2; - else if (ya == 2) ic->y += icr->h - ic->h; + else if (yrel < 0) + ic->y -= ic->h; + else if (ya == 1) + ic->y += (icr->h - ic->h) / 2; + else if (ya == 2) + ic->y += icr->h - ic->h; } static void @@ -3896,58 +3919,58 @@ _e_fm2_icons_place_icon(E_Fm2_Icon *ic) /* ### BLAH ### */ // if (!_e_fm2_icons_icon_overlaps(ic)) return; /* - _e_fm2_icon_place_relative(ic, ic2, 1, 0, 0, 2); - if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return; - _e_fm2_icon_place_relative(ic, ic2, 0, -1, 0, 0); - if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return; - _e_fm2_icon_place_relative(ic, ic2, 0, -1, 1, 0); - if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return; - _e_fm2_icon_place_relative(ic, ic2, 1, 0, 0, 0); - if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return; - _e_fm2_icon_place_relative(ic, ic2, 1, 0, 0, 1); - if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return; - _e_fm2_icon_place_relative(ic, ic2, 0, 1, 0, 0); - if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return; - _e_fm2_icon_place_relative(ic, ic2, 0, 1, 1, 0); - if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return; + _e_fm2_icon_place_relative(ic, ic2, 1, 0, 0, 2); + if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return; + _e_fm2_icon_place_relative(ic, ic2, 0, -1, 0, 0); + if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return; + _e_fm2_icon_place_relative(ic, ic2, 0, -1, 1, 0); + if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return; + _e_fm2_icon_place_relative(ic, ic2, 1, 0, 0, 0); + if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return; + _e_fm2_icon_place_relative(ic, ic2, 1, 0, 0, 1); + if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return; + _e_fm2_icon_place_relative(ic, ic2, 0, 1, 0, 0); + if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return; + _e_fm2_icon_place_relative(ic, ic2, 0, 1, 1, 0); + if (_e_fm2_icons_icon_row_ok(ic) && !_e_fm2_icons_icon_overlaps(ic)) return; */ EINA_LIST_FOREACH(ic->sd->icons, l, ic2) { - if ((ic2 != ic) && (ic2->saved_pos)) - { - // ###_ - _e_fm2_icon_place_relative(ic, ic2, 1, 0, 0, 2); - if (_e_fm2_icons_icon_row_ok(ic) && - !_e_fm2_icons_icon_overlaps(ic)) goto done; - // _### - _e_fm2_icon_place_relative(ic, ic2, -1, 0, 0, 2); - if (_e_fm2_icons_icon_row_ok(ic) && - !_e_fm2_icons_icon_overlaps(ic)) goto done; - } + if ((ic2 != ic) && (ic2->saved_pos)) + { + // ###_ + _e_fm2_icon_place_relative(ic, ic2, 1, 0, 0, 2); + if (_e_fm2_icons_icon_row_ok(ic) && + !_e_fm2_icons_icon_overlaps(ic)) goto done; + // _### + _e_fm2_icon_place_relative(ic, ic2, -1, 0, 0, 2); + if (_e_fm2_icons_icon_row_ok(ic) && + !_e_fm2_icons_icon_overlaps(ic)) goto done; + } } EINA_LIST_FOREACH(ic->sd->icons, l, ic2) { - if ((ic2 != ic) && (ic2->saved_pos)) - { - // ### - // | - _e_fm2_icon_place_relative(ic, ic2, 0, 1, 1, 0); - if (_e_fm2_icons_icon_row_ok(ic) && - !_e_fm2_icons_icon_overlaps(ic)) goto done; - // | - // ### - _e_fm2_icon_place_relative(ic, ic2, 0, -1, 1, 0); - if (_e_fm2_icons_icon_row_ok(ic) && - !_e_fm2_icons_icon_overlaps(ic)) goto done; - } if ((ic2 != ic) && (ic2->saved_pos)) - { + { + // ### + // | + _e_fm2_icon_place_relative(ic, ic2, 0, 1, 1, 0); + if (_e_fm2_icons_icon_row_ok(ic) && + !_e_fm2_icons_icon_overlaps(ic)) goto done; + // | + // ### + _e_fm2_icon_place_relative(ic, ic2, 0, -1, 1, 0); + if (_e_fm2_icons_icon_row_ok(ic) && + !_e_fm2_icons_icon_overlaps(ic)) goto done; + } + if ((ic2 != ic) && (ic2->saved_pos)) + { // TODO: if uncomment this, change EINA_LIST_FOREACH to EINA_LIST_FOREACH_SAFE! // ic->sd->icons_place = eina_list_remove_list(ic->sd->icons_place, pl); - } + } } - done: +done: return; } @@ -3959,14 +3982,14 @@ _e_fm2_icons_place_custom_icons(E_Fm2_Smart_Data *sd) EINA_LIST_FOREACH(sd->icons, l, ic) { - if (!ic->saved_pos) - { - /* FIXME: place using smart place fn */ - _e_fm2_icons_place_icon(ic); - } + if (!ic->saved_pos) + { + /* FIXME: place using smart place fn */ + _e_fm2_icons_place_icon(ic); + } - if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w; - if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h; + if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w; + if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h; } } @@ -3974,38 +3997,38 @@ static void _e_fm2_icons_place_custom_grid_icons(E_Fm2_Smart_Data *sd) { /* FIXME: not going to implement this at this stage */ - Eina_List *l; - E_Fm2_Icon *ic; + Eina_List *l; + E_Fm2_Icon *ic; - EINA_LIST_FOREACH(sd->icons, l, ic) - { - if (!ic->saved_pos) - { - /* FIXME: place using grid fn */ - } + EINA_LIST_FOREACH(sd->icons, l, ic) + { + if (!ic->saved_pos) + { + /* FIXME: place using grid fn */ + } - if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w; - if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h; - } + if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w; + if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h; + } } static void _e_fm2_icons_place_custom_smart_grid_icons(E_Fm2_Smart_Data *sd) { /* FIXME: not going to implement this at this stage */ - Eina_List *l; - E_Fm2_Icon *ic; + Eina_List *l; + E_Fm2_Icon *ic; - EINA_LIST_FOREACH(sd->icons, l, ic) - { - if (!ic->saved_pos) - { - /* FIXME: place using smart grid fn */ - } + EINA_LIST_FOREACH(sd->icons, l, ic) + { + if (!ic->saved_pos) + { + /* FIXME: place using smart grid fn */ + } - if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w; - if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h; - } + if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w; + if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h; + } } static void @@ -4019,21 +4042,21 @@ _e_fm2_icons_place_list(E_Fm2_Smart_Data *sd) i = x = y = 0; EINA_LIST_FOREACH(sd->icons, l, ic) { - ic->x = x; - ic->y = y; - if (sd->w > ic->min_w) - ic->w = sd->w; - else - ic->w = ic->min_w; - y += ic->h; - ic->odd = (i & 0x01); - if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w; - if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h; - i++; + ic->x = x; + ic->y = y; + if (sd->w > ic->min_w) + ic->w = sd->w; + else + ic->w = ic->min_w; + y += ic->h; + ic->odd = (i & 0x01); + if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w; + if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h; + i++; } EINA_LIST_FOREACH(sd->icons, l, ic) { - ic->w = sd->max.w; + ic->w = sd->max.w; } } @@ -4050,27 +4073,33 @@ _e_fm2_icons_place(Evas_Object *obj) switch (_e_fm2_view_mode_get(sd)) { case E_FM2_VIEW_MODE_ICONS: - _e_fm2_icons_place_icons(sd); - break; + _e_fm2_icons_place_icons(sd); + break; + case E_FM2_VIEW_MODE_GRID_ICONS: - _e_fm2_icons_place_grid_icons(sd); - break; + _e_fm2_icons_place_grid_icons(sd); + break; + case E_FM2_VIEW_MODE_CUSTOM_ICONS: - _e_fm2_icons_place_custom_icons(sd); - break; + _e_fm2_icons_place_custom_icons(sd); + break; + case E_FM2_VIEW_MODE_CUSTOM_GRID_ICONS: - /* FIXME: not going to implement this at this stage */ - _e_fm2_icons_place_custom_grid_icons(sd); - break; + /* FIXME: not going to implement this at this stage */ + _e_fm2_icons_place_custom_grid_icons(sd); + break; + case E_FM2_VIEW_MODE_CUSTOM_SMART_GRID_ICONS: - /* FIXME: not going to implement this at this stage */ - _e_fm2_icons_place_custom_smart_grid_icons(sd); - break; + /* FIXME: not going to implement this at this stage */ + _e_fm2_icons_place_custom_smart_grid_icons(sd); + break; + case E_FM2_VIEW_MODE_LIST: - _e_fm2_icons_place_list(sd); - break; + _e_fm2_icons_place_list(sd); + break; + default: - break; + break; } /* tell our parent scrollview - if any, that we have changed */ evas_object_smart_callback_call(sd->obj, "changed", NULL); @@ -4105,10 +4134,10 @@ _e_fm2_regions_eval(Evas_Object *obj) edje_freeze(); EINA_LIST_FOREACH(sd->regions.list, l, rg) { - if (_e_fm2_region_visible(rg)) - _e_fm2_region_realize(rg); - else - _e_fm2_region_unrealize(rg); + if (_e_fm2_region_visible(rg)) + _e_fm2_region_realize(rg); + else + _e_fm2_region_unrealize(rg); } edje_thaw(); evas_event_thaw(evas_object_evas_get(obj)); @@ -4135,13 +4164,13 @@ _e_fm2_file_fm2_find(const char *file) if (!dir) return NULL; EINA_LIST_FOREACH(_e_fm2_list, l, obj) { - if ((_e_fm2_list_walking > 0) && - (eina_list_data_find(_e_fm2_list_remove, obj))) continue; - if (!strcmp(e_fm2_real_path_get(obj), dir)) - { - free(dir); - return obj; - } + if ((_e_fm2_list_walking > 0) && + (eina_list_data_find(_e_fm2_list_remove, obj))) continue; + if (!strcmp(e_fm2_real_path_get(obj), dir)) + { + free(dir); + return obj; + } } free(dir); return NULL; @@ -4158,7 +4187,7 @@ _e_fm2_icon_find(Evas_Object *obj, const char *file) if (!sd) return NULL; EINA_LIST_FOREACH(sd->icons, l, ic) { - if (!strcmp(ic->info.file, file)) return ic; + if (!strcmp(ic->info.file, file)) return ic; } return NULL; } @@ -4179,13 +4208,13 @@ _e_fm2_uri_escape(const char *path) /* Most app doesn't handle the hostname in the uri so it's put to NULL */ for (i = 7, p = path; *p != '\0'; p++, i++) { - if (isalnum(*p) || strchr("/$-_.+!*'()", *p)) - dest[i] = *p; - else - { - snprintf(&(dest[i]), 4, "%%%02X", (unsigned char)*p); - i += 2; - } + if (isalnum(*p) || strchr("/$-_.+!*'()", *p)) + dest[i] = *p; + else + { + snprintf(&(dest[i]), 4, "%%%02X", (unsigned char)*p); + i += 2; + } } return eina_stringshare_add(dest); @@ -4222,23 +4251,23 @@ _e_fm2_uri_parse(const char *val) p = val + 7; if (*p != '/') { - for (i = 0; *p != '/' && *p != '\0' && i < _POSIX_HOST_NAME_MAX; p++, i++) - hostname[i] = *p; + for (i = 0; *p != '/' && *p != '\0' && i < _POSIX_HOST_NAME_MAX; p++, i++) + hostname[i] = *p; } hostname[i] = '\0'; /* See http://www.faqs.org/rfcs/rfc1738.html for the escaped chars */ for (i = 0; *p != '\0' && i < PATH_MAX; i++, p++) { - if (*p == '%') - { - path[i] = *(++p); - path[i+1] = *(++p); - path[i] = (char)strtol(&(path[i]), NULL, 16); - path[i+1] = '\0'; - } - else - path[i] = *p; + if (*p == '%') + { + path[i] = *(++p); + path[i + 1] = *(++p); + path[i] = (char)strtol(&(path[i]), NULL, 16); + path[i + 1] = '\0'; + } + else + path[i] = *p; } uri = E_NEW(E_Fm2_Uri, 1); @@ -4263,19 +4292,19 @@ _e_fm2_uri_path_list_get(Eina_List *uri_list) EINA_LIST_FOREACH(uri_list, l, uri_str) { - if (!(uri = _e_fm2_uri_parse(uri_str))) - continue; + if (!(uri = _e_fm2_uri_parse(uri_str))) + continue; - if (!uri->hostname || !strcmp(uri->hostname, "localhost") - || !strcmp(uri->hostname, current_hostname)) - { - path_list = eina_list_append(path_list, uri->path); - } - else - eina_stringshare_del(uri->path); + if (!uri->hostname || !strcmp(uri->hostname, "localhost") + || !strcmp(uri->hostname, current_hostname)) + { + path_list = eina_list_append(path_list, uri->path); + } + else + eina_stringshare_del(uri->path); - if (uri->hostname) eina_stringshare_del(uri->hostname); - E_FREE(uri); + if (uri->hostname) eina_stringshare_del(uri->hostname); + E_FREE(uri); } return path_list; @@ -4290,17 +4319,17 @@ _e_fm2_uri_icon_list_get(Eina_List *uri) EINA_LIST_FOREACH(uri, l, path) { - Evas_Object *fm; - E_Fm2_Icon *ic; + Evas_Object *fm; + E_Fm2_Icon *ic; - ic = NULL; - fm = _e_fm2_file_fm2_find(path); - if (fm) - { - const char *file = ecore_file_file_get(path); - ic = _e_fm2_icon_find(fm, file); - } - icons = eina_list_append(icons, ic); + ic = NULL; + fm = _e_fm2_file_fm2_find(path); + if (fm) + { + const char *file = ecore_file_file_get(path); + ic = _e_fm2_icon_find(fm, file); + } + icons = eina_list_append(icons, ic); } return icons; } @@ -4320,9 +4349,9 @@ _e_fm2_icon_new(E_Fm2_Smart_Data *sd, const char *file, E_Fm2_Finfo *finf) ic->sd = sd; if (!_e_fm2_icon_fill(ic, finf)) { - eina_stringshare_del(ic->info.file); - free(ic); - return NULL; + eina_stringshare_del(ic->info.file); + free(ic); + return NULL; } return ic; } @@ -4358,9 +4387,9 @@ _e_fm2_icon_geom_adjust(E_Fm2_Icon *ic, int saved_x, int saved_y, int saved_w __ int qx, qy, rx, ry, x, y; if (!((_e_fm2_view_mode_get(ic->sd) == E_FM2_VIEW_MODE_CUSTOM_ICONS) && - (ic->sd->config->view.fit_custom_pos) && - (saved_res_w > 0) && - (saved_res_h > 0))) + (ic->sd->config->view.fit_custom_pos) && + (saved_res_w > 0) && + (saved_res_h > 0))) return; if (saved_res_w >= 3) qx = saved_x / (saved_res_w / 3); else qx = 0; @@ -4389,76 +4418,76 @@ _e_fm2_icon_fill(E_Fm2_Icon *ic, E_Fm2_Finfo *finf) cf = e_fm2_custom_file_get(buf); if (finf) { - memcpy(&(ic->info.statinfo), &(finf->st), sizeof(struct stat)); - if ((finf->lnk) && (finf->lnk[0])) - ic->info.link = eina_stringshare_add(finf->lnk); - else - ic->info.link = NULL; - if ((finf->rlnk) && (finf->rlnk[0])) - ic->info.real_link = eina_stringshare_add(finf->rlnk); - else - ic->info.real_link = NULL; - ic->info.broken_link = finf->broken_link; + memcpy(&(ic->info.statinfo), &(finf->st), sizeof(struct stat)); + if ((finf->lnk) && (finf->lnk[0])) + ic->info.link = eina_stringshare_add(finf->lnk); + else + ic->info.link = NULL; + if ((finf->rlnk) && (finf->rlnk[0])) + ic->info.real_link = eina_stringshare_add(finf->rlnk); + else + ic->info.real_link = NULL; + ic->info.broken_link = finf->broken_link; } else { - printf("FIXME: remove old non finf icon fill code\n"); - /* FIXME: this should go away... get this from the fm slave proc above */ - lnk = ecore_file_readlink(buf); - if (stat(buf, &(ic->info.statinfo)) == -1) - { - if (lnk) - ic->info.broken_link = EINA_TRUE; - else - { - return 0; - } - } - if (lnk) - { - if (lnk[0] == '/') - { - ic->info.link = eina_stringshare_add(lnk); - ic->info.real_link = eina_stringshare_add(lnk); - } - else - { - char *rp; + printf("FIXME: remove old non finf icon fill code\n"); + /* FIXME: this should go away... get this from the fm slave proc above */ + lnk = ecore_file_readlink(buf); + if (stat(buf, &(ic->info.statinfo)) == -1) + { + if (lnk) + ic->info.broken_link = EINA_TRUE; + else + { + return 0; + } + } + if (lnk) + { + if (lnk[0] == '/') + { + ic->info.link = eina_stringshare_add(lnk); + ic->info.real_link = eina_stringshare_add(lnk); + } + else + { + char *rp; - snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, lnk); - rp = ecore_file_realpath(buf); - if (rp) - { - ic->info.link = eina_stringshare_add(rp); - free(rp); - } - ic->info.real_link = eina_stringshare_add(lnk); - } - free(lnk); - } - /* FIXME: end go away chunk */ + snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, lnk); + rp = ecore_file_realpath(buf); + if (rp) + { + ic->info.link = eina_stringshare_add(rp); + free(rp); + } + ic->info.real_link = eina_stringshare_add(lnk); + } + free(lnk); + } + /* FIXME: end go away chunk */ } if (S_ISDIR(ic->info.statinfo.st_mode)) { - ic->info.mime = eina_stringshare_ref(_e_fm2_mime_inode_directory); + ic->info.mime = eina_stringshare_ref(_e_fm2_mime_inode_directory); } else if (ic->info.real_link) { - mime = efreet_mime_type_get(ic->info.real_link); - if (!mime) - /* XXX REMOVE/DEPRECATE ME LATER */ - mime = e_fm_mime_filename_get(ic->info.file); - if (mime) ic->info.mime = eina_stringshare_add(mime); + mime = efreet_mime_type_get(ic->info.real_link); + if (!mime) + /* XXX REMOVE/DEPRECATE ME LATER */ + mime = e_fm_mime_filename_get(ic->info.file); + if (mime) ic->info.mime = eina_stringshare_add(mime); } if (!ic->info.mime) { - mime = efreet_mime_type_get(buf); - if (!mime) - /* XXX REMOVE/DEPRECATE ME LATER */ - mime = e_fm_mime_filename_get(ic->info.file); - if (mime) ic->info.mime = eina_stringshare_add(mime); + mime = efreet_mime_type_get(buf); + if (!mime) + /* XXX REMOVE/DEPRECATE ME LATER */ + mime = e_fm_mime_filename_get(ic->info.file); + if (mime) ic->info.mime = eina_stringshare_add(mime); } if (_e_fm2_file_is_desktop(ic->info.file)) @@ -4466,23 +4495,23 @@ _e_fm2_icon_fill(E_Fm2_Icon *ic, E_Fm2_Finfo *finf) if (cf) { - if (cf->icon.valid) - { - if (cf->icon.icon) - { - eina_stringshare_replace(&ic->info.icon, cf->icon.icon); - } - ic->info.icon_type = cf->icon.type; - } - if (cf->geom.valid) - { - ic->saved_pos = EINA_TRUE; - ic->x = cf->geom.x; - ic->y = cf->geom.y; - if (cf->geom.w > 0) ic->w = cf->geom.w; - if (cf->geom.h > 0) ic->h = cf->geom.h; - _e_fm2_icon_geom_adjust(ic, cf->geom.x, cf->geom.y, cf->geom.w, cf->geom.h, cf->geom.res_w, cf->geom.res_h); - } + if (cf->icon.valid) + { + if (cf->icon.icon) + { + eina_stringshare_replace(&ic->info.icon, cf->icon.icon); + } + ic->info.icon_type = cf->icon.type; + } + if (cf->geom.valid) + { + ic->saved_pos = EINA_TRUE; + ic->x = cf->geom.x; + ic->y = cf->geom.y; + if (cf->geom.w > 0) ic->w = cf->geom.w; + if (cf->geom.h > 0) ic->h = cf->geom.h; + _e_fm2_icon_geom_adjust(ic, cf->geom.x, cf->geom.y, cf->geom.w, cf->geom.h, cf->geom.res_w, cf->geom.res_h); + } } evas_event_freeze(evas_object_evas_get(ic->sd->obj)); @@ -4495,88 +4524,90 @@ _e_fm2_icon_fill(E_Fm2_Icon *ic, E_Fm2_Finfo *finf) case E_FM2_VIEW_MODE_CUSTOM_ICONS: case E_FM2_VIEW_MODE_CUSTOM_GRID_ICONS: case E_FM2_VIEW_MODE_CUSTOM_SMART_GRID_ICONS: - /* FIXME: need to define icon edjes. here goes: - * - * fileman/icon/fixed - * fileman/icon/variable - * fileman/list/fixed - * fileman/list/variable - * fileman/list_odd/fixed - * fileman/list_odd/variable - * - */ - if ((!ic->sd->config->icon.fixed.w) || (!ic->sd->config->icon.fixed.h)) - { - obj = ic->sd->tmp.obj; - if (!obj) - { - obj = edje_object_add(evas_object_evas_get(ic->sd->obj)); - if ((ic->sd->config->icon.fixed.w) && (ic->sd->config->icon.fixed.h)) - _e_fm2_theme_edje_object_set(ic->sd, obj, - "base/theme/fileman", - "icon/fixed"); - else - _e_fm2_theme_edje_object_set(ic->sd, obj, - "base/theme/fileman", - "icon/variable"); + /* FIXME: need to define icon edjes. here goes: + * + * fileman/icon/fixed + * fileman/icon/variable + * fileman/list/fixed + * fileman/list/variable + * fileman/list_odd/fixed + * fileman/list_odd/variable + * + */ + if ((!ic->sd->config->icon.fixed.w) || (!ic->sd->config->icon.fixed.h)) + { + obj = ic->sd->tmp.obj; + if (!obj) + { + obj = edje_object_add(evas_object_evas_get(ic->sd->obj)); + if ((ic->sd->config->icon.fixed.w) && (ic->sd->config->icon.fixed.h)) + _e_fm2_theme_edje_object_set(ic->sd, obj, + "base/theme/fileman", + "icon/fixed"); + else + _e_fm2_theme_edje_object_set(ic->sd, obj, + "base/theme/fileman", + "icon/variable"); ic->sd->tmp.obj = obj; - } - _e_fm2_icon_label_set(ic, obj); - obj2 = ic->sd->tmp.obj2; - if (!obj2) - { - obj2 = evas_object_rectangle_add(evas_object_evas_get(ic->sd->obj)); - ic->sd->tmp.obj2 = obj2; - } - /* FIXME: if icons are allowed to have their own size - use it */ - edje_extern_object_min_size_set(obj2, _e_fm2_icon_w_get(ic->sd), _e_fm2_icon_h_get(ic->sd)); - edje_extern_object_max_size_set(obj2, _e_fm2_icon_w_get(ic->sd), _e_fm2_icon_h_get(ic->sd)); - edje_object_part_swallow(obj, "e.swallow.icon", obj2); - edje_object_size_min_calc(obj, &mw, &mh); - } - ic->w = mw; - ic->h = mh; - if (ic->sd->config->icon.fixed.w) ic->w = _e_fm2_icon_w_get(ic->sd); - if (ic->sd->config->icon.fixed.h) ic->h = _e_fm2_icon_h_get(ic->sd); - ic->min_w = mw; - ic->min_h = mh; - break; + } + _e_fm2_icon_label_set(ic, obj); + obj2 = ic->sd->tmp.obj2; + if (!obj2) + { + obj2 = evas_object_rectangle_add(evas_object_evas_get(ic->sd->obj)); + ic->sd->tmp.obj2 = obj2; + } + /* FIXME: if icons are allowed to have their own size - use it */ + edje_extern_object_min_size_set(obj2, _e_fm2_icon_w_get(ic->sd), _e_fm2_icon_h_get(ic->sd)); + edje_extern_object_max_size_set(obj2, _e_fm2_icon_w_get(ic->sd), _e_fm2_icon_h_get(ic->sd)); + edje_object_part_swallow(obj, "e.swallow.icon", obj2); + edje_object_size_min_calc(obj, &mw, &mh); + } + ic->w = mw; + ic->h = mh; + if (ic->sd->config->icon.fixed.w) ic->w = _e_fm2_icon_w_get(ic->sd); + if (ic->sd->config->icon.fixed.h) ic->h = _e_fm2_icon_h_get(ic->sd); + ic->min_w = mw; + ic->min_h = mh; + break; + case E_FM2_VIEW_MODE_LIST: - { - obj = ic->sd->tmp.obj; - if (!obj) - { - obj = edje_object_add(evas_object_evas_get(ic->sd->obj)); + { + obj = ic->sd->tmp.obj; + if (!obj) + { + obj = edje_object_add(evas_object_evas_get(ic->sd->obj)); // vairable sized list items are pretty usless - ignore. // if (ic->sd->config->icon.fixed.w) - _e_fm2_theme_edje_object_set(ic->sd, obj, - "base/theme/fileman", - "list/fixed"); + _e_fm2_theme_edje_object_set(ic->sd, obj, + "base/theme/fileman", + "list/fixed"); // else // _e_fm2_theme_edje_object_set(ic->sd, obj, "base/theme/fileman", // "list/variable"); - ic->sd->tmp.obj = obj; - } - _e_fm2_icon_label_set(ic, obj); - obj2 = ic->sd->tmp.obj2; - if (!obj2) - { - obj2 = evas_object_rectangle_add(evas_object_evas_get(ic->sd->obj)); - ic->sd->tmp.obj2 = obj2; - } - edje_extern_object_min_size_set(obj2, ic->sd->config->icon.list.w, ic->sd->config->icon.list.h); - edje_extern_object_max_size_set(obj2, ic->sd->config->icon.list.w, ic->sd->config->icon.list.h); - edje_object_part_swallow(obj, "e.swallow.icon", obj2); - edje_object_size_min_calc(obj, &mw, &mh); - } - if (mw < ic->sd->w) ic->w = ic->sd->w; - else ic->w = mw; - ic->h = mh; - ic->min_w = mw; - ic->min_h = mh; - break; + ic->sd->tmp.obj = obj; + } + _e_fm2_icon_label_set(ic, obj); + obj2 = ic->sd->tmp.obj2; + if (!obj2) + { + obj2 = evas_object_rectangle_add(evas_object_evas_get(ic->sd->obj)); + ic->sd->tmp.obj2 = obj2; + } + edje_extern_object_min_size_set(obj2, ic->sd->config->icon.list.w, ic->sd->config->icon.list.h); + edje_extern_object_max_size_set(obj2, ic->sd->config->icon.list.w, ic->sd->config->icon.list.h); + edje_object_part_swallow(obj, "e.swallow.icon", obj2); + edje_object_size_min_calc(obj, &mw, &mh); + } + if (mw < ic->sd->w) ic->w = ic->sd->w; + else ic->w = mw; + ic->h = mh; + ic->min_w = mw; + ic->min_h = mh; + break; + default: - break; + break; } edje_thaw(); evas_event_thaw(evas_object_evas_get(ic->sd->obj)); @@ -4587,45 +4618,45 @@ static void _e_fm2_icon_free(E_Fm2_Icon *ic) { /* free icon, object data etc. etc. */ - if (ic->sd->drop_icon == ic) - { - /* FIXME: call hide call */ - ic->sd->drop_icon = NULL; - } - _e_fm2_icon_unrealize(ic); - if (ic->menu) - { - e_menu_post_deactivate_callback_set(ic->menu, NULL, NULL); - e_object_del(E_OBJECT(ic->menu)); - ic->menu = NULL; - } - if (ic->dialog) - { - e_object_del(E_OBJECT(ic->dialog)); - ic->dialog = NULL; - } - if (ic->entry_dialog) - { - e_object_del(E_OBJECT(ic->entry_dialog)); - ic->entry_dialog = NULL; - } - if (ic->entry_widget) - _e_fm2_icon_entry_widget_del(ic); - if (ic->prop_dialog) - { - e_object_del(E_OBJECT(ic->prop_dialog)); - ic->prop_dialog = NULL; - } - eina_stringshare_del(ic->info.file); - eina_stringshare_del(ic->info.mime); - eina_stringshare_del(ic->info.label); - eina_stringshare_del(ic->info.comment); - eina_stringshare_del(ic->info.generic); - eina_stringshare_del(ic->info.icon); - eina_stringshare_del(ic->info.link); - eina_stringshare_del(ic->info.real_link); - eina_stringshare_del(ic->info.category); - free(ic); + if (ic->sd->drop_icon == ic) + { + /* FIXME: call hide call */ + ic->sd->drop_icon = NULL; + } + _e_fm2_icon_unrealize(ic); + if (ic->menu) + { + e_menu_post_deactivate_callback_set(ic->menu, NULL, NULL); + e_object_del(E_OBJECT(ic->menu)); + ic->menu = NULL; + } + if (ic->dialog) + { + e_object_del(E_OBJECT(ic->dialog)); + ic->dialog = NULL; + } + if (ic->entry_dialog) + { + e_object_del(E_OBJECT(ic->entry_dialog)); + ic->entry_dialog = NULL; + } + if (ic->entry_widget) + _e_fm2_icon_entry_widget_del(ic); + if (ic->prop_dialog) + { + e_object_del(E_OBJECT(ic->prop_dialog)); + ic->prop_dialog = NULL; + } + eina_stringshare_del(ic->info.file); + eina_stringshare_del(ic->info.mime); + eina_stringshare_del(ic->info.label); + eina_stringshare_del(ic->info.comment); + eina_stringshare_del(ic->info.generic); + eina_stringshare_del(ic->info.icon); + eina_stringshare_del(ic->info.link); + eina_stringshare_del(ic->info.real_link); + eina_stringshare_del(ic->info.category); + free(ic); } static void @@ -4641,26 +4672,26 @@ _e_fm2_icon_realize(E_Fm2_Icon *ic) evas_object_stack_below(ic->obj, ic->sd->drop); if (_e_fm2_view_mode_get(ic->sd) == E_FM2_VIEW_MODE_LIST) { - const char *stacking; + const char *stacking; // if (ic->sd->config->icon.fixed.w) // { - if (ic->odd) - _e_fm2_theme_edje_object_set(ic->sd, ic->obj, - "base/theme/widgets", - "list_odd/fixed"); - else - _e_fm2_theme_edje_object_set(ic->sd, ic->obj, - "base/theme/widgets", - "list/fixed"); - stacking = edje_object_data_get(ic->obj, "stacking"); - if (stacking) - { - if (!strcmp(stacking, "below")) - evas_object_stack_above(ic->obj, ic->sd->underlay); - else if (!strcmp(stacking, "above")) - evas_object_stack_below(ic->obj, ic->sd->drop); - } + if (ic->odd) + _e_fm2_theme_edje_object_set(ic->sd, ic->obj, + "base/theme/widgets", + "list_odd/fixed"); + else + _e_fm2_theme_edje_object_set(ic->sd, ic->obj, + "base/theme/widgets", + "list/fixed"); + stacking = edje_object_data_get(ic->obj, "stacking"); + if (stacking) + { + if (!strcmp(stacking, "below")) + evas_object_stack_above(ic->obj, ic->sd->underlay); + else if (!strcmp(stacking, "above")) + evas_object_stack_below(ic->obj, ic->sd->drop); + } // } // else @@ -4676,19 +4707,19 @@ _e_fm2_icon_realize(E_Fm2_Icon *ic) else { if (ic->sd->config->icon.fixed.w) - _e_fm2_theme_edje_object_set(ic->sd, ic->obj, - "base/theme/fileman", - "icon/fixed"); - else - _e_fm2_theme_edje_object_set(ic->sd, ic->obj, - "base/theme/fileman", - "icon/variable"); + _e_fm2_theme_edje_object_set(ic->sd, ic->obj, + "base/theme/fileman", + "icon/fixed"); + else + _e_fm2_theme_edje_object_set(ic->sd, ic->obj, + "base/theme/fileman", + "icon/variable"); } _e_fm2_icon_label_set(ic, ic->obj); evas_object_clip_set(ic->obj, ic->sd->clip); evas_object_move(ic->obj, - ic->sd->x + ic->x - ic->sd->pos.x, - ic->sd->y + ic->y - ic->sd->pos.y); + ic->sd->x + ic->x - ic->sd->pos.x, + ic->sd->y + ic->y - ic->sd->pos.y); evas_object_resize(ic->obj, ic->w, ic->h); evas_object_event_callback_add(ic->obj, EVAS_CALLBACK_MOUSE_DOWN, _e_fm2_cb_icon_mouse_down, ic); @@ -4703,20 +4734,20 @@ _e_fm2_icon_realize(E_Fm2_Icon *ic) if (ic->selected) { - const char *selectraise; + const char *selectraise; - /* FIXME: need new signal to INSTANTLY activate - no anim */ - /* FIXME: while listing dirs need to use icons in-place and not - * unrealize and re-realize */ - edje_object_signal_emit(ic->obj, "e,state,selected", "e"); - edje_object_signal_emit(ic->obj_icon, "e,state,selected", "e"); - selectraise = edje_object_data_get(ic->obj, "selectraise"); + /* FIXME: need new signal to INSTANTLY activate - no anim */ + /* FIXME: while listing dirs need to use icons in-place and not + * unrealize and re-realize */ + edje_object_signal_emit(ic->obj, "e,state,selected", "e"); + edje_object_signal_emit(ic->obj_icon, "e,state,selected", "e"); + selectraise = edje_object_data_get(ic->obj, "selectraise"); if ((selectraise) && (!strcmp(selectraise, "on"))) - evas_object_stack_below(ic->obj, ic->sd->drop); + evas_object_stack_below(ic->obj, ic->sd->drop); } if (ic->info.removable) - _e_fm2_icon_removable_update(ic); + _e_fm2_icon_removable_update(ic); } static void @@ -4735,14 +4766,14 @@ static Eina_Bool _e_fm2_icon_visible(const E_Fm2_Icon *ic) { /* return if the icon is visible */ - if ( - ((ic->x - ic->sd->pos.x) < (ic->sd->w + OVERCLIP)) && - ((ic->x + ic->w - ic->sd->pos.x) > (-OVERCLIP)) && - ((ic->y - ic->sd->pos.y) < (ic->sd->h + OVERCLIP)) && - ((ic->y + ic->h - ic->sd->pos.y) > (-OVERCLIP)) - ) - return 1; - return 0; + if ( + ((ic->x - ic->sd->pos.x) < (ic->sd->w + OVERCLIP)) && + ((ic->x + ic->w - ic->sd->pos.x) > (-OVERCLIP)) && + ((ic->y - ic->sd->pos.y) < (ic->sd->h + OVERCLIP)) && + ((ic->y + ic->h - ic->sd->pos.y) > (-OVERCLIP)) + ) + return 1; + return 0; } static void @@ -4753,31 +4784,31 @@ _e_fm2_icon_label_set(E_Fm2_Icon *ic, Evas_Object *obj) if (ic->info.label) { - edje_object_part_text_set(obj, "e.text.label", ic->info.label); - return; + edje_object_part_text_set(obj, "e.text.label", ic->info.label); + return; } if ((ic->sd->config->icon.extension.show) || (S_ISDIR(ic->info.statinfo.st_mode))) edje_object_part_text_set(obj, "e.text.label", ic->info.file); else { - /* remove extension. handle double extensions like .tar.gz too - * also be fuzzy - up to 4 chars of extn is ok - eg .html but 5 or - * more is considered part of the name - */ - eina_strlcpy(buf, ic->info.file, sizeof(buf)); + /* remove extension. handle double extensions like .tar.gz too + * also be fuzzy - up to 4 chars of extn is ok - eg .html but 5 or + * more is considered part of the name + */ + eina_strlcpy(buf, ic->info.file, sizeof(buf)); - len = strlen(buf); - p = strrchr(buf, '.'); - if ((p) && ((len - (p - buf)) < 6)) - { - *p = 0; + len = strlen(buf); + p = strrchr(buf, '.'); + if ((p) && ((len - (p - buf)) < 6)) + { + *p = 0; - len = strlen(buf); - p = strrchr(buf, '.'); - if ((p) && ((len - (p - buf)) < 6)) *p = 0; - } - edje_object_part_text_set(obj, "e.text.label", buf); + len = strlen(buf); + p = strrchr(buf, '.'); + if ((p) && ((len - (p - buf)) < 6)) *p = 0; + } + edje_object_part_text_set(obj, "e.text.label", buf); } } @@ -4787,10 +4818,10 @@ _e_fm2_icon_icon_direct_set(E_Fm2_Icon *ic, Evas_Object *o, Evas_Smart_Cb gen_fu Evas_Object *oic; oic = e_fm2_icon_get(evas_object_evas_get(o), ic, - gen_func, data, force_gen, NULL); + gen_func, data, force_gen, NULL); if (oic) { - edje_object_part_swallow(o, "e.swallow.icon", oic); + edje_object_part_swallow(o, "e.swallow.icon", oic); evas_object_show(oic); } return oic; @@ -4801,8 +4832,8 @@ _e_fm2_icon_icon_set(E_Fm2_Icon *ic) { if (!ic->realized) return; ic->obj_icon = _e_fm2_icon_icon_direct_set(ic, ic->obj, - _e_fm2_cb_icon_thumb_gen, - ic, 0); + _e_fm2_cb_icon_thumb_gen, + ic, 0); } static void @@ -4810,9 +4841,9 @@ _e_fm2_icon_thumb(const E_Fm2_Icon *ic, Evas_Object *oic, int force) { if ((force) || ((_e_fm2_icon_visible(ic)) && - (!ic->sd->queue) && - (!ic->sd->sort_idler) && - (!ic->sd->listing))) + (!ic->sd->queue) && + (!ic->sd->sort_idler) && + (!ic->sd->listing))) e_thumb_icon_begin(oic); } @@ -4824,17 +4855,17 @@ _e_fm2_icon_select(E_Fm2_Icon *ic) ic->last_selected = EINA_TRUE; if (ic->realized) { - const char *selectraise; + const char *selectraise; if (ic->sd->iop_icon) _e_fm2_icon_entry_widget_accept(ic->sd->iop_icon); - edje_object_signal_emit(ic->obj, "e,state,selected", "e"); - edje_object_signal_emit(ic->obj_icon, "e,state,selected", "e"); - evas_object_stack_below(ic->obj, ic->sd->drop); - selectraise = edje_object_data_get(ic->obj, "selectraise"); + edje_object_signal_emit(ic->obj, "e,state,selected", "e"); + edje_object_signal_emit(ic->obj_icon, "e,state,selected", "e"); + evas_object_stack_below(ic->obj, ic->sd->drop); + selectraise = edje_object_data_get(ic->obj, "selectraise"); if ((selectraise) && (!strcmp(selectraise, "on"))) - evas_object_stack_below(ic->obj, ic->sd->drop); + evas_object_stack_below(ic->obj, ic->sd->drop); } } @@ -4846,20 +4877,20 @@ _e_fm2_icon_deselect(E_Fm2_Icon *ic) ic->last_selected = EINA_FALSE; if (ic->realized) { - const char *stacking, *selectraise; + const char *stacking, *selectraise; - if (ic->entry_widget) + if (ic->entry_widget) _e_fm2_icon_entry_widget_accept(ic); - edje_object_signal_emit(ic->obj, "e,state,unselected", "e"); - edje_object_signal_emit(ic->obj_icon, "e,state,unselected", "e"); + edje_object_signal_emit(ic->obj, "e,state,unselected", "e"); + edje_object_signal_emit(ic->obj_icon, "e,state,unselected", "e"); stacking = edje_object_data_get(ic->obj, "stacking"); - selectraise = edje_object_data_get(ic->obj, "selectraise"); - if ((selectraise) && (!strcmp(selectraise, "on"))) - { - if ((stacking) && (!strcmp(stacking, "below"))) - evas_object_stack_above(ic->obj, ic->sd->underlay); - } + selectraise = edje_object_data_get(ic->obj, "selectraise"); + if ((selectraise) && (!strcmp(selectraise, "on"))) + { + if ((stacking) && (!strcmp(stacking, "below"))) + evas_object_stack_above(ic->obj, ic->sd->underlay); + } } } @@ -4898,45 +4929,45 @@ _e_fm2_icon_desktop_load(E_Fm2_Icon *ic) ic->info.removable = EINA_FALSE; ic->info.removable_full = EINA_FALSE; - ic->info.label = eina_stringshare_add(desktop->name); + ic->info.label = eina_stringshare_add(desktop->name); ic->info.generic = eina_stringshare_add(desktop->generic_name); ic->info.comment = eina_stringshare_add(desktop->comment); - ic->info.icon = eina_stringshare_add(desktop->icon); + ic->info.icon = eina_stringshare_add(desktop->icon); if (desktop->url) ic->info.link = _e_fm2_icon_desktop_url_eval(desktop->url); if (desktop->x) { - const char *type; + const char *type; - type = eina_hash_find(desktop->x, "X-Enlightenment-Type"); - if (type) - { - if (!strcmp(type, "Mount")) ic->info.mount = EINA_TRUE; - else if (!strcmp(type, "Removable")) - { - ic->info.removable = EINA_TRUE; - if ((!e_fm2_device_storage_find(ic->info.link)) && - (!e_fm2_device_volume_find(ic->info.link))) - { - _e_fm2_live_file_del(ic->sd->obj, ic->info.file); - efreet_desktop_free(desktop); - goto error; - } - } - type = eina_hash_find(desktop->x, "X-Enlightenment-Removable-State"); - if (type) - { - if (!strcmp(type, "Full")) - ic->info.removable_full = EINA_TRUE; - } - } + type = eina_hash_find(desktop->x, "X-Enlightenment-Type"); + if (type) + { + if (!strcmp(type, "Mount")) ic->info.mount = EINA_TRUE; + else if (!strcmp(type, "Removable")) + { + ic->info.removable = EINA_TRUE; + if ((!e_fm2_device_storage_find(ic->info.link)) && + (!e_fm2_device_volume_find(ic->info.link))) + { + _e_fm2_live_file_del(ic->sd->obj, ic->info.file); + efreet_desktop_free(desktop); + goto error; + } + } + type = eina_hash_find(desktop->x, "X-Enlightenment-Removable-State"); + if (type) + { + if (!strcmp(type, "Full")) + ic->info.removable_full = EINA_TRUE; + } + } } /* FIXME: get category */ ic->info.category = NULL; efreet_desktop_free(desktop); return 1; - error: +error: eina_stringshare_del(ic->info.label); eina_stringshare_del(ic->info.comment); eina_stringshare_del(ic->info.generic); @@ -4971,7 +5002,7 @@ _e_fm2_region_free(E_Fm2_Region *rg) E_Fm2_Icon *ic; EINA_LIST_FREE(rg->list, ic) - ic->region = NULL; + ic->region = NULL; free(rg); } @@ -4988,8 +5019,8 @@ _e_fm2_region_realize(E_Fm2_Region *rg) EINA_LIST_FOREACH(rg->list, l, ic) _e_fm2_icon_realize(ic); EINA_LIST_FOREACH(rg->list, l, ic) { - if (ic->selected) - evas_object_stack_below(ic->obj, ic->sd->drop); + if (ic->selected) + evas_object_stack_below(ic->obj, ic->sd->drop); } edje_thaw(); } @@ -5012,14 +5043,14 @@ static int _e_fm2_region_visible(E_Fm2_Region *rg) { /* return if the icon is visible */ - if ( - ((rg->x - rg->sd->pos.x) < (rg->sd->w + OVERCLIP)) && - ((rg->x + rg->w - rg->sd->pos.x) > (-OVERCLIP)) && - ((rg->y - rg->sd->pos.y) < (rg->sd->h + OVERCLIP)) && - ((rg->y + rg->h - rg->sd->pos.y) > (-OVERCLIP)) - ) - return 1; - return 0; + if ( + ((rg->x - rg->sd->pos.x) < (rg->sd->w + OVERCLIP)) && + ((rg->x + rg->w - rg->sd->pos.x) > (-OVERCLIP)) && + ((rg->y - rg->sd->pos.y) < (rg->sd->h + OVERCLIP)) && + ((rg->y + rg->h - rg->sd->pos.y) > (-OVERCLIP)) + ) + return 1; + return 0; } static void @@ -5027,38 +5058,38 @@ _e_fm2_icon_make_visible(E_Fm2_Icon *ic) { if (_e_fm2_view_mode_get(ic->sd) == E_FM2_VIEW_MODE_LIST) { - if ( - ((ic->y - ic->sd->pos.y) >= 0) && - ((ic->y + ic->h - ic->sd->pos.y) <= (ic->sd->h)) - ) - return; - if ((ic->y - ic->sd->pos.y) < 0) - e_fm2_pan_set(ic->sd->obj, ic->sd->pos.x, ic->y); - else - e_fm2_pan_set(ic->sd->obj, ic->sd->pos.x, ic->y - ic->sd->h + ic->h); + if ( + ((ic->y - ic->sd->pos.y) >= 0) && + ((ic->y + ic->h - ic->sd->pos.y) <= (ic->sd->h)) + ) + return; + if ((ic->y - ic->sd->pos.y) < 0) + e_fm2_pan_set(ic->sd->obj, ic->sd->pos.x, ic->y); + else + e_fm2_pan_set(ic->sd->obj, ic->sd->pos.x, ic->y - ic->sd->h + ic->h); } else { - Evas_Coord x, y; + Evas_Coord x, y; - if ( - ((ic->y - ic->sd->pos.y) >= 0) && - ((ic->y + ic->h - ic->sd->pos.y) <= (ic->sd->h)) && - ((ic->x - ic->sd->pos.x) >= 0) && - ((ic->x + ic->w - ic->sd->pos.x) <= (ic->sd->w)) - ) - return; - x = ic->sd->pos.x; - if ((ic->x - ic->sd->pos.x) < 0) - x = ic->x; - else if ((ic->x + ic->w - ic->sd->pos.x) > (ic->sd->w)) - x = ic->x + ic->w - ic->sd->w; - y = ic->sd->pos.y; - if ((ic->y - ic->sd->pos.y) < 0) - y = ic->y; - else if ((ic->y + ic->h - ic->sd->pos.y) > (ic->sd->h)) - y = ic->y + ic->h - ic->sd->h; - e_fm2_pan_set(ic->sd->obj, x, y); + if ( + ((ic->y - ic->sd->pos.y) >= 0) && + ((ic->y + ic->h - ic->sd->pos.y) <= (ic->sd->h)) && + ((ic->x - ic->sd->pos.x) >= 0) && + ((ic->x + ic->w - ic->sd->pos.x) <= (ic->sd->w)) + ) + return; + x = ic->sd->pos.x; + if ((ic->x - ic->sd->pos.x) < 0) + x = ic->x; + else if ((ic->x + ic->w - ic->sd->pos.x) > (ic->sd->w)) + x = ic->x + ic->w - ic->sd->w; + y = ic->sd->pos.y; + if ((ic->y - ic->sd->pos.y) < 0) + y = ic->y; + else if ((ic->y + ic->h - ic->sd->pos.y) > (ic->sd->h)) + y = ic->y + ic->h - ic->sd->h; + e_fm2_pan_set(ic->sd->obj, x, y); } evas_object_smart_callback_call(ic->sd->obj, "pan_changed", NULL); } @@ -5074,7 +5105,7 @@ _e_fm2_icon_desel_any(Evas_Object *obj) if (!sd) return; EINA_LIST_FOREACH(sd->icons, l, ic) { - if (ic->selected) _e_fm2_icon_deselect(ic); + if (ic->selected) _e_fm2_icon_deselect(ic); } } @@ -5089,7 +5120,7 @@ _e_fm2_icon_first_selected_find(Evas_Object *obj) if (!sd) return NULL; EINA_LIST_FOREACH(sd->icons, l, ic) { - if (ic->selected) return ic; + if (ic->selected) return ic; } return NULL; } @@ -5164,105 +5195,105 @@ _e_fm2_icon_next_find(Evas_Object *obj, int next, int match_func(E_Fm2_Icon *ic, /* find selected item / current position */ EINA_LIST_FOREACH(sd->icons, l, ic) { - if (ic->selected) - { - if (!custom && !match_func) - { - ic_next = ic; - } - else - { - x = ic->x; - y = ic->y; - } - break; - } + if (ic->selected) + { + if (!custom && !match_func) + { + ic_next = ic; + } + else + { + x = ic->x; + y = ic->y; + } + break; + } } if (next && (custom || match_func)) { - /* find next item in custom grid, or list/grid when match - func is given */ - if (next == 1) - { - EINA_LIST_FOREACH(sd->icons, l, ic) - { - if ((ic->x > x) && - (custom ? (ic->y >= y) : (ic->y == y)) && - (!match_func || match_func(ic, data))) - { - dist = 2 * (ic->y - y) + (ic->x - x); - if (dist < min) - { - min = dist; - ic_next = ic; - } - } - } - /* no next item was found in row go down and begin */ - if (!ic_next) - { - EINA_LIST_FOREACH(sd->icons, l, ic) - { - if ((ic->y > y) && (!match_func || match_func(ic, data))) - { - dist = 2 * (abs(ic->y - y)) + ic->x; - if (dist < min) - { - min = dist; - ic_next = ic; - } - } - } - } - } - /* find previous item */ - else if (next == -1) - { - EINA_LIST_FOREACH(sd->icons, l, ic) - { - if ((ic->x < x) && - (custom ? (ic->y <= y) : (ic->y == y)) && - (!match_func || match_func(ic, data))) - { - dist = 2 * (y - ic->y) + (x - ic->x); - if (dist < min) - { - min = dist; - ic_next = ic; - } - } - } - /* no prev item was found in row go to end and up */ - if (!ic_next) - { - EINA_LIST_FOREACH(sd->icons, l, ic) - { - if ((ic->y < y) && (!match_func || match_func(ic, data))) - { - dist = 2 * (abs(ic->y - y)) - ic->x; - if (dist < min) - { - min = dist; - ic_next = ic; - } - } - } - } - } + /* find next item in custom grid, or list/grid when match + func is given */ + if (next == 1) + { + EINA_LIST_FOREACH(sd->icons, l, ic) + { + if ((ic->x > x) && + (custom ? (ic->y >= y) : (ic->y == y)) && + (!match_func || match_func(ic, data))) + { + dist = 2 * (ic->y - y) + (ic->x - x); + if (dist < min) + { + min = dist; + ic_next = ic; + } + } + } + /* no next item was found in row go down and begin */ + if (!ic_next) + { + EINA_LIST_FOREACH(sd->icons, l, ic) + { + if ((ic->y > y) && (!match_func || match_func(ic, data))) + { + dist = 2 * (abs(ic->y - y)) + ic->x; + if (dist < min) + { + min = dist; + ic_next = ic; + } + } + } + } + } + /* find previous item */ + else if (next == -1) + { + EINA_LIST_FOREACH(sd->icons, l, ic) + { + if ((ic->x < x) && + (custom ? (ic->y <= y) : (ic->y == y)) && + (!match_func || match_func(ic, data))) + { + dist = 2 * (y - ic->y) + (x - ic->x); + if (dist < min) + { + min = dist; + ic_next = ic; + } + } + } + /* no prev item was found in row go to end and up */ + if (!ic_next) + { + EINA_LIST_FOREACH(sd->icons, l, ic) + { + if ((ic->y < y) && (!match_func || match_func(ic, data))) + { + dist = 2 * (abs(ic->y - y)) - ic->x; + if (dist < min) + { + min = dist; + ic_next = ic; + } + } + } + } + } } /* not custom, items are arranged in list order */ else if (ic_next) { - if (next == 1) - { - if (!eina_list_next(l)) return NULL; - ic_next = eina_list_data_get(eina_list_next(l)); - } - if (next == -1) - { - if (!eina_list_prev(l)) return NULL; - ic_next = eina_list_data_get(eina_list_prev(l)); - } + if (next == 1) + { + if (!eina_list_next(l)) return NULL; + ic_next = eina_list_data_get(eina_list_next(l)); + } + if (next == -1) + { + if (!eina_list_prev(l)) return NULL; + ic_next = eina_list_data_get(eina_list_prev(l)); + } } return ic_next; @@ -5277,9 +5308,9 @@ _e_fm2_icon_sel_prev(Evas_Object *obj) if (!ic_prev) { - /* FIXME this is not the bottomright item for custom grid */ - _e_fm2_icon_sel_last(obj); - return; + /* FIXME this is not the bottomright item for custom grid */ + _e_fm2_icon_sel_last(obj); + return; } _e_fm2_icon_desel_any(obj); _e_fm2_icon_select(ic_prev); @@ -5295,9 +5326,9 @@ _e_fm2_icon_sel_next(Evas_Object *obj) ic_next = _e_fm2_icon_next_find(obj, 1, NULL, NULL); if (!ic_next) { - /* FIXME this is not the topleft item for custom grid */ - _e_fm2_icon_sel_first(obj); - return; + /* FIXME this is not the topleft item for custom grid */ + _e_fm2_icon_sel_first(obj); + return; } _e_fm2_icon_desel_any(obj); _e_fm2_icon_select(ic_next); @@ -5330,48 +5361,48 @@ _e_fm2_icon_sel_down(Evas_Object *obj) EINA_LIST_FOREACH(sd->icons, l, ic) { - if (!found) - { - if (ic->selected) - { - found = 1; - x = ic->x; - y = ic->y; - if (custom) break; - } - } - else if (ic->y > y) - { - dist = (abs(ic->x - x)) + (ic->y - y) * 2; - if (dist < min) - { - min = dist; - ic_down = ic; - } - else break; - } + if (!found) + { + if (ic->selected) + { + found = 1; + x = ic->x; + y = ic->y; + if (custom) break; + } + } + else if (ic->y > y) + { + dist = (abs(ic->x - x)) + (ic->y - y) * 2; + if (dist < min) + { + min = dist; + ic_down = ic; + } + else break; + } } if (custom) { - EINA_LIST_FOREACH(sd->icons, l, ic) - { - if (ic->y > y) - { - dist = (abs(ic->x - x)) + (ic->y - y) * 2; - if (dist < min) - { - min = dist; - ic_down = ic; - } - } - } + EINA_LIST_FOREACH(sd->icons, l, ic) + { + if (ic->y > y) + { + dist = (abs(ic->x - x)) + (ic->y - y) * 2; + if (dist < min) + { + min = dist; + ic_down = ic; + } + } + } } if (!ic_down) { - if (!custom) _e_fm2_icon_sel_next(obj); - return; + if (!custom) _e_fm2_icon_sel_next(obj); + return; } _e_fm2_icon_desel_any(obj); _e_fm2_icon_select(ic_down); @@ -5379,7 +5410,6 @@ _e_fm2_icon_sel_down(Evas_Object *obj) _e_fm2_icon_make_visible(ic_down); } - static void _e_fm2_icon_sel_up(Evas_Object *obj) { @@ -5404,49 +5434,49 @@ _e_fm2_icon_sel_up(Evas_Object *obj) ic_up = NULL; EINA_LIST_REVERSE_FOREACH(sd->icons, l, ic) - { - if (!found) - { - if (ic->selected) - { - found = 1; - x = ic->x; - y = ic->y; - if (custom) break; - } - } - else if (ic->y < y) - { - dist = (abs(ic->x - x)) + (y - ic->y) * 2; - if (dist < min) - { - min = dist; - ic_up = ic; - } - else break; - } - } + { + if (!found) + { + if (ic->selected) + { + found = 1; + x = ic->x; + y = ic->y; + if (custom) break; + } + } + else if (ic->y < y) + { + dist = (abs(ic->x - x)) + (y - ic->y) * 2; + if (dist < min) + { + min = dist; + ic_up = ic; + } + else break; + } + } if (custom && found) { - EINA_LIST_FOREACH(sd->icons, l, ic) - { - if (!ic->selected && ic->y < y) - { - dist = (abs(ic->x - x)) + (y - ic->y) * 2; - if (dist < min) - { - min = dist; - ic_up = ic; - } - } - } + EINA_LIST_FOREACH(sd->icons, l, ic) + { + if (!ic->selected && ic->y < y) + { + dist = (abs(ic->x - x)) + (y - ic->y) * 2; + if (dist < min) + { + min = dist; + ic_up = ic; + } + } + } } if (!ic_up) { - if (!custom) _e_fm2_icon_sel_prev(obj); - return; + if (!custom) _e_fm2_icon_sel_prev(obj); + return; } _e_fm2_icon_desel_any(obj); _e_fm2_icon_select(ic_up); @@ -5454,7 +5484,6 @@ _e_fm2_icon_sel_up(Evas_Object *obj) _e_fm2_icon_make_visible(ic_up); } - /* FIXME: prototype */ static void _e_fm2_typebuf_show(Evas_Object *obj) @@ -5502,6 +5531,7 @@ _e_fm2_typebuf_history_next(Evas_Object *obj) if (!sd) return; /* FIXME: do */ } + #endif static int @@ -5510,8 +5540,8 @@ _e_fm2_inplace_open(const E_Fm2_Icon *ic) char buf[PATH_MAX]; if (!((S_ISDIR(ic->info.statinfo.st_mode)) && - (ic->sd->config->view.open_dirs_in_place) && - (!ic->sd->config->view.no_subdir_jump))) + (ic->sd->config->view.open_dirs_in_place) && + (!ic->sd->config->view.no_subdir_jump))) return 0; if (!_e_fm2_icon_path(ic, buf, sizeof(buf))) @@ -5530,19 +5560,19 @@ _e_fm2_typebuf_run(Evas_Object *obj) ic = _e_fm2_icon_first_selected_find(obj); if (ic) { - if (_e_fm2_inplace_open(ic) == 0) - evas_object_smart_callback_call(ic->sd->obj, "selected", NULL); + if (_e_fm2_inplace_open(ic) == 0) + evas_object_smart_callback_call(ic->sd->obj, "selected", NULL); } } static int -_e_fm2_typebuf_match_func(E_Fm2_Icon *ic, void* data) +_e_fm2_typebuf_match_func(E_Fm2_Icon *ic, void *data) { char *tb = data; return (((ic->info.label) && - (e_util_glob_case_match(ic->info.label, tb))) || - ((ic->info.file) && - (e_util_glob_case_match(ic->info.file, tb)))); + (e_util_glob_case_match(ic->info.label, tb))) || + ((ic->info.file) && + (e_util_glob_case_match(ic->info.file, tb)))); } static Eina_Bool @@ -5586,33 +5616,33 @@ _e_fm2_typebuf_match(Evas_Object *obj, int next) if (!next) { - EINA_LIST_FOREACH(sd->icons, l, ic) - { - if (_e_fm2_typebuf_match_func(ic, tb)) - { - ic_match = ic; - break; - } - } + EINA_LIST_FOREACH(sd->icons, l, ic) + { + if (_e_fm2_typebuf_match_func(ic, tb)) + { + ic_match = ic; + break; + } + } } else { - ic_match = _e_fm2_icon_next_find(obj, next, &_e_fm2_typebuf_match_func, tb); + ic_match = _e_fm2_icon_next_find(obj, next, &_e_fm2_typebuf_match_func, tb); } if (ic_match) { - _e_fm2_icon_desel_any(obj); - _e_fm2_icon_select(ic_match); - evas_object_smart_callback_call(obj, "selection_change", NULL); - _e_fm2_icon_make_visible(ic_match); + _e_fm2_icon_desel_any(obj); + _e_fm2_icon_select(ic_match); + evas_object_smart_callback_call(obj, "selection_change", NULL); + _e_fm2_icon_make_visible(ic_match); } free(tb); if (sd->typebuf.timer) { - ecore_timer_del(sd->typebuf.timer); + ecore_timer_del(sd->typebuf.timer); } sd->typebuf.timer = ecore_timer_add(5.0, _e_fm_typebuf_timer_cb, obj); @@ -5661,8 +5691,8 @@ _e_fm2_typebuf_char_backspace(Evas_Object *obj) len = strlen(sd->typebuf.buf); if (len == 0) { - _e_fm2_typebuf_hide(obj); - return; + _e_fm2_typebuf_hide(obj); + return; } p = evas_string_char_prev_get(sd->typebuf.buf, len, &dec); if (p >= 0) sd->typebuf.buf[p] = EINA_FALSE; @@ -5687,24 +5717,24 @@ _e_fm2_dnd_drop_configure(Evas_Object *obj) if (!sd->drop_icon) return; if (sd->drop_after == -1) { - evas_object_move(sd->drop_in, - sd->x + sd->drop_icon->x - sd->pos.x, - sd->y + sd->drop_icon->y - sd->pos.y); - evas_object_resize(sd->drop_in, sd->drop_icon->w, sd->drop_icon->h); + evas_object_move(sd->drop_in, + sd->x + sd->drop_icon->x - sd->pos.x, + sd->y + sd->drop_icon->y - sd->pos.y); + evas_object_resize(sd->drop_in, sd->drop_icon->w, sd->drop_icon->h); } else if (sd->drop_after) { - evas_object_move(sd->drop, - sd->x + sd->drop_icon->x - sd->pos.x, - sd->y + sd->drop_icon->y - sd->pos.y + sd->drop_icon->h - 1); - evas_object_resize(sd->drop, sd->drop_icon->w, 2); + evas_object_move(sd->drop, + sd->x + sd->drop_icon->x - sd->pos.x, + sd->y + sd->drop_icon->y - sd->pos.y + sd->drop_icon->h - 1); + evas_object_resize(sd->drop, sd->drop_icon->w, 2); } else { - evas_object_move(sd->drop, - sd->x + sd->drop_icon->x - sd->pos.x, - sd->y + sd->drop_icon->y - sd->pos.y - 1); - evas_object_resize(sd->drop, sd->drop_icon->w, 2); + evas_object_move(sd->drop, + sd->x + sd->drop_icon->x - sd->pos.x, + sd->y + sd->drop_icon->y - sd->pos.y - 1); + evas_object_resize(sd->drop, sd->drop_icon->w, 2); } } @@ -5718,18 +5748,18 @@ _e_fm2_dnd_drop_all_show(Evas_Object *obj) if (!sd) return; if (sd->drop_show) { - edje_object_signal_emit(sd->drop, "e,state,unselected", "e"); - sd->drop_show = EINA_FALSE; + edje_object_signal_emit(sd->drop, "e,state,unselected", "e"); + sd->drop_show = EINA_FALSE; } if (sd->drop_in_show) { - edje_object_signal_emit(sd->drop_in, "e,state,unselected", "e"); - sd->drop_in_show = EINA_FALSE; + edje_object_signal_emit(sd->drop_in, "e,state,unselected", "e"); + sd->drop_in_show = EINA_FALSE; } if (!sd->drop_all) { - edje_object_signal_emit(sd->overlay, "e,state,drop,start", "e"); - sd->drop_all = EINA_TRUE; + edje_object_signal_emit(sd->overlay, "e,state,drop,start", "e"); + sd->drop_all = EINA_TRUE; } sd->drop_icon = NULL; sd->drop_after = EINA_FALSE; @@ -5745,8 +5775,8 @@ _e_fm2_dnd_drop_all_hide(Evas_Object *obj) if (!sd) return; if (sd->drop_all) { - edje_object_signal_emit(sd->overlay, "e,state,drop,stop", "e"); - sd->drop_all = EINA_FALSE; + edje_object_signal_emit(sd->overlay, "e,state,drop,stop", "e"); + sd->drop_all = EINA_FALSE; } } @@ -5767,20 +5797,20 @@ _e_fm2_dnd_drop_show(E_Fm2_Icon *ic, int after) ic->sd->drop_after = after; if (emit) { - if (ic->sd->drop_after != -1) - { - edje_object_signal_emit(ic->sd->drop_in, "e,state,unselected", "e"); - edje_object_signal_emit(ic->sd->drop, "e,state,selected", "e"); - ic->sd->drop_in_show = EINA_FALSE; - ic->sd->drop_show = EINA_TRUE; - } - else - { - edje_object_signal_emit(ic->sd->drop, "e,state,unselected", "e"); - edje_object_signal_emit(ic->sd->drop_in, "e,state,selected", "e"); - ic->sd->drop_in_show = EINA_TRUE; - ic->sd->drop_show = EINA_FALSE; - } + if (ic->sd->drop_after != -1) + { + edje_object_signal_emit(ic->sd->drop_in, "e,state,unselected", "e"); + edje_object_signal_emit(ic->sd->drop, "e,state,selected", "e"); + ic->sd->drop_in_show = EINA_FALSE; + ic->sd->drop_show = EINA_TRUE; + } + else + { + edje_object_signal_emit(ic->sd->drop, "e,state,unselected", "e"); + edje_object_signal_emit(ic->sd->drop_in, "e,state,selected", "e"); + ic->sd->drop_in_show = EINA_TRUE; + ic->sd->drop_show = EINA_FALSE; + } } _e_fm2_dnd_drop_all_hide(ic->sd->obj); _e_fm2_dnd_drop_configure(ic->sd->obj); @@ -5796,13 +5826,13 @@ _e_fm2_dnd_drop_hide(Evas_Object *obj) if (!sd) return; if (sd->drop_show) { - edje_object_signal_emit(sd->drop, "e,state,unselected", "e"); - sd->drop_show = EINA_FALSE; + edje_object_signal_emit(sd->drop, "e,state,unselected", "e"); + sd->drop_show = EINA_FALSE; } if (sd->drop_in_show) { - edje_object_signal_emit(sd->drop_in, "e,state,unselected", "e"); - sd->drop_in_show = EINA_FALSE; + edje_object_signal_emit(sd->drop_in, "e,state,unselected", "e"); + sd->drop_in_show = EINA_FALSE; } sd->drop_icon = NULL; sd->drop_after = EINA_FALSE; @@ -5822,10 +5852,10 @@ _e_fm2_dnd_finish(Evas_Object *obj, int refresh) sd->drag = EINA_FALSE; EINA_LIST_FOREACH(sd->icons, l, ic) { - ic->drag.dnd = EINA_FALSE; - ic->drag.src = EINA_FALSE; - if (ic->obj) evas_object_show(ic->obj); - if (ic->obj_icon) evas_object_show(ic->obj_icon); + ic->drag.dnd = EINA_FALSE; + ic->drag.src = EINA_FALSE; + if (ic->obj) evas_object_show(ic->obj); + if (ic->obj_icon) evas_object_show(ic->obj_icon); } if (refresh) e_fm2_refresh(obj); } @@ -5854,91 +5884,91 @@ _e_fm2_cb_dnd_move(void *data, const char *type, void *event) e_drop_handler_action_set(ev->action); EINA_LIST_FOREACH(sd->icons, l, ic) { - if (E_INSIDE(ev->x, ev->y, ic->x - ic->sd->pos.x, ic->y - ic->sd->pos.y, ic->w, ic->h)) - { - if (ic->drag.dnd) continue; - /* if list view */ - if (_e_fm2_view_mode_get(ic->sd) == E_FM2_VIEW_MODE_LIST) - { - /* if there is a .order file - we can re-order files */ - if (ic->sd->order_file) - { - /* if dir: */ - if ((S_ISDIR(ic->info.statinfo.st_mode)) && - (!ic->sd->config->view.no_subdir_drop)) - { - /* if bottom 25% or top 25% then insert between prev or next */ - /* if in middle 50% then put in dir */ - if (ev->y <= (ic->y - ic->sd->pos.y + (ic->h / 4))) - { - _e_fm2_dnd_drop_show(ic, 0); - } - else if (ev->y > (ic->y - ic->sd->pos.y + ((ic->h * 3) / 4))) - { - _e_fm2_dnd_drop_show(ic, 1); - } - else - { - _e_fm2_dnd_drop_show(ic, -1); - } - } - else - { - /* if top 50% or bottom 50% then insert between prev or next */ - if (ev->y <= (ic->y - ic->sd->pos.y + (ic->h / 2))) - _e_fm2_dnd_drop_show(ic, 0); - else - _e_fm2_dnd_drop_show(ic, 1); - } - } - /* if we are over subdirs or files */ - else - { - /* - * if it's over a dir - hilight as it will be dropped info - * FIXME: should there be a separate highlighting function for files? - * */ - if (!(S_ISDIR(ic->info.statinfo.st_mode)) || - (!ic->sd->config->view.no_subdir_drop)) - _e_fm2_dnd_drop_show(ic, -1); - } - } - else - { - /* if it's over a dir - hilight as it will be dropped in */ - if (!(S_ISDIR(ic->info.statinfo.st_mode)) || - (!ic->sd->config->view.no_subdir_drop)) - _e_fm2_dnd_drop_show(ic, -1); - } - return; - } + if (E_INSIDE(ev->x, ev->y, ic->x - ic->sd->pos.x, ic->y - ic->sd->pos.y, ic->w, ic->h)) + { + if (ic->drag.dnd) continue; + /* if list view */ + if (_e_fm2_view_mode_get(ic->sd) == E_FM2_VIEW_MODE_LIST) + { + /* if there is a .order file - we can re-order files */ + if (ic->sd->order_file) + { + /* if dir: */ + if ((S_ISDIR(ic->info.statinfo.st_mode)) && + (!ic->sd->config->view.no_subdir_drop)) + { + /* if bottom 25% or top 25% then insert between prev or next */ + /* if in middle 50% then put in dir */ + if (ev->y <= (ic->y - ic->sd->pos.y + (ic->h / 4))) + { + _e_fm2_dnd_drop_show(ic, 0); + } + else if (ev->y > (ic->y - ic->sd->pos.y + ((ic->h * 3) / 4))) + { + _e_fm2_dnd_drop_show(ic, 1); + } + else + { + _e_fm2_dnd_drop_show(ic, -1); + } + } + else + { + /* if top 50% or bottom 50% then insert between prev or next */ + if (ev->y <= (ic->y - ic->sd->pos.y + (ic->h / 2))) + _e_fm2_dnd_drop_show(ic, 0); + else + _e_fm2_dnd_drop_show(ic, 1); + } + } + /* if we are over subdirs or files */ + else + { + /* + * if it's over a dir - hilight as it will be dropped info + * FIXME: should there be a separate highlighting function for files? + * */ + if (!(S_ISDIR(ic->info.statinfo.st_mode)) || + (!ic->sd->config->view.no_subdir_drop)) + _e_fm2_dnd_drop_show(ic, -1); + } + } + else + { + /* if it's over a dir - hilight as it will be dropped in */ + if (!(S_ISDIR(ic->info.statinfo.st_mode)) || + (!ic->sd->config->view.no_subdir_drop)) + _e_fm2_dnd_drop_show(ic, -1); + } + return; + } } /* FIXME: not over icon - is it within the fm view? if so drop there */ if (E_INSIDE(ev->x, ev->y, 0, 0, sd->w, sd->h)) { - /* if listview - it is now after last file */ - if (_e_fm2_view_mode_get(sd) == E_FM2_VIEW_MODE_LIST) - { - /* if there is a .order file - we can re-order files */ - if (sd->order_file) - { - ic = eina_list_data_get(eina_list_last(sd->icons)); - if (ic) - { - if (!ic->drag.dnd) - _e_fm2_dnd_drop_show(ic, 1); - else - _e_fm2_dnd_drop_all_show(sd->obj); - } - else - _e_fm2_dnd_drop_all_show(sd->obj); - } - else - _e_fm2_dnd_drop_all_show(sd->obj); - } - else - _e_fm2_dnd_drop_all_show(sd->obj); - return; + /* if listview - it is now after last file */ + if (_e_fm2_view_mode_get(sd) == E_FM2_VIEW_MODE_LIST) + { + /* if there is a .order file - we can re-order files */ + if (sd->order_file) + { + ic = eina_list_data_get(eina_list_last(sd->icons)); + if (ic) + { + if (!ic->drag.dnd) + _e_fm2_dnd_drop_show(ic, 1); + else + _e_fm2_dnd_drop_all_show(sd->obj); + } + else + _e_fm2_dnd_drop_all_show(sd->obj); + } + else + _e_fm2_dnd_drop_all_show(sd->obj); + } + else + _e_fm2_dnd_drop_all_show(sd->obj); + return; } /* outside fm view */ _e_fm2_dnd_drop_hide(sd->obj); @@ -5987,8 +6017,8 @@ _e_fm_icon_save_position(const char *file, Evas_Coord x, Evas_Coord y, Evas_Coor cf = e_fm2_custom_file_get(file); if (!cf) { - memset(&new, 0, sizeof(E_Fm2_Custom_File)); - cf = &new; + memset(&new, 0, sizeof(E_Fm2_Custom_File)); + cf = &new; } cf->geom.x = x; @@ -6061,8 +6091,8 @@ _e_fm_drop_menu(char *args, Evas_Object *e_fm) d = malloc(sizeof(*d)); if (!d) { - e_object_del(E_OBJECT(menu)); - return; + e_object_del(E_OBJECT(menu)); + return; } d->e_fm = e_fm; @@ -6080,9 +6110,9 @@ _e_fm_drop_menu(char *args, Evas_Object *e_fm) e_menu_item_label_set(item, _("Move")); e_menu_item_callback_set(item, _e_fm_drop_menu_move_cb, d); e_menu_item_icon_edje_set(item, - e_theme_edje_file_get("base/theme/fileman", - "e/fileman/default/button/move"), - "e/fileman/default/button/move"); + e_theme_edje_file_get("base/theme/fileman", + "e/fileman/default/button/move"), + "e/fileman/default/button/move"); item = e_menu_item_new(menu); e_menu_item_label_set(item, _("Link")); @@ -6096,9 +6126,9 @@ _e_fm_drop_menu(char *args, Evas_Object *e_fm) e_menu_item_label_set(item, _("Abort")); e_menu_item_callback_set(item, _e_fm_drop_menu_abort_cb, d); e_menu_item_icon_edje_set(item, - e_theme_edje_file_get("base/theme/fileman", - "e/fileman/default/button/abort"), - "e/fileman/default/button/abort"); + e_theme_edje_file_get("base/theme/fileman", + "e/fileman/default/button/abort"), + "e/fileman/default/button/abort"); man = e_manager_current_get(); if (!man) goto error; @@ -6109,7 +6139,7 @@ _e_fm_drop_menu(char *args, Evas_Object *e_fm) if (!zone) goto error; e_menu_activate_mouse(menu, zone, x, y, 1, 1, E_MENU_POP_DIRECTION_DOWN, 0); - error: +error: e_object_del(E_OBJECT(menu)); } @@ -6140,12 +6170,12 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event) ox = 0; oy = 0; EINA_LIST_FOREACH(isel, l, ic) { - if (ic && ic->drag.src) - { - ox = ic->x; - oy = ic->y; - break; - } + if (ic && ic->drag.src) + { + ox = ic->x; + oy = ic->y; + break; + } } /* note - logic. @@ -6157,146 +6187,146 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event) */ if (sd->drop_all) /* drop arbitrarily into the dir */ { - /* move file into this fm dir */ - for (ll = fsel, il = isel; ll && il; ll = eina_list_next(ll), il = eina_list_next(il)) - { - ic = eina_list_data_get(il); - fp = eina_list_data_get(ll); - if (!fp) continue; + /* move file into this fm dir */ + for (ll = fsel, il = isel; ll && il; ll = eina_list_next(ll), il = eina_list_next(il)) + { + ic = eina_list_data_get(il); + fp = eina_list_data_get(ll); + if (!fp) continue; - if ((ic) && (_e_fm2_view_mode_get(sd) == E_FM2_VIEW_MODE_CUSTOM_ICONS)) - { - /* dnd doesn't tell me all the co-ords of the icons being dragged so i can't place them accurately. - * need to fix this. ev->data probably needs to become more compelx than a list of url's - */ - x = ev->x + (ic->x - ox) - ic->drag.x + sd->pos.x; - y = ev->y + (ic->y - oy) - ic->drag.y + sd->pos.y; + if ((ic) && (_e_fm2_view_mode_get(sd) == E_FM2_VIEW_MODE_CUSTOM_ICONS)) + { + /* dnd doesn't tell me all the co-ords of the icons being dragged so i can't place them accurately. + * need to fix this. ev->data probably needs to become more compelx than a list of url's + */ + x = ev->x + (ic->x - ox) - ic->drag.x + sd->pos.x; + y = ev->y + (ic->y - oy) - ic->drag.y + sd->pos.y; - if (x < 0) x = 0; - if (y < 0) y = 0; + if (x < 0) x = 0; + if (y < 0) y = 0; - if (sd->config->view.fit_custom_pos) - { - if ((x + ic->w) > sd->w) x = (sd->w - ic->w); - if ((y + ic->h) > sd->h) y = (sd->h - ic->h); - } + if (sd->config->view.fit_custom_pos) + { + if ((x + ic->w) > sd->w) x = (sd->w - ic->w); + if ((y + ic->h) > sd->h) y = (sd->h - ic->h); + } - if (ic->sd == sd) - { - ic->x = x; - ic->y = y; - ic->saved_pos = EINA_TRUE; - adjust_icons = 1; - } + if (ic->sd == sd) + { + ic->x = x; + ic->y = y; + ic->saved_pos = EINA_TRUE; + adjust_icons = 1; + } - snprintf(buf, sizeof(buf), "%s/%s", - sd->realpath, ecore_file_file_get(fp)); - _e_fm_icon_save_position(buf, x, y, sd->w, sd->h); - } + snprintf(buf, sizeof(buf), "%s/%s", + sd->realpath, ecore_file_file_get(fp)); + _e_fm_icon_save_position(buf, x, y, sd->w, sd->h); + } - args = _e_fm_string_append_quoted(args, &size, &length, fp); - args = _e_fm_string_append_char(args, &size, &length, ' '); + args = _e_fm_string_append_quoted(args, &size, &length, fp); + args = _e_fm_string_append_char(args, &size, &length, ' '); - eina_stringshare_del(fp); - } - if (adjust_icons) - { - sd->max.w = EINA_FALSE; - sd->max.h = EINA_FALSE; - EINA_LIST_FOREACH(sd->icons, l, ic) - { - if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w; - if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h; - } - _e_fm2_obj_icons_place(sd); - evas_object_smart_callback_call(sd->obj, "changed", NULL); - } + eina_stringshare_del(fp); + } + if (adjust_icons) + { + sd->max.w = EINA_FALSE; + sd->max.h = EINA_FALSE; + EINA_LIST_FOREACH(sd->icons, l, ic) + { + if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w; + if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h; + } + _e_fm2_obj_icons_place(sd); + evas_object_smart_callback_call(sd->obj, "changed", NULL); + } - args = _e_fm_string_append_quoted(args, &size, &length, sd->realpath); + args = _e_fm_string_append_quoted(args, &size, &length, sd->realpath); } else if (sd->drop_icon) /* into or before/after an icon */ { - if (sd->drop_after == -1) /* put into subdir/file in icon */ - { - /* move file into dir that this icon is for */ - for (ll = fsel, il = isel; ll && il; ll = eina_list_next(ll), il = eina_list_next(il)) - { - fp = eina_list_data_get(ll); - if (!fp) continue; + if (sd->drop_after == -1) /* put into subdir/file in icon */ + { + /* move file into dir that this icon is for */ + for (ll = fsel, il = isel; ll && il; ll = eina_list_next(ll), il = eina_list_next(il)) + { + fp = eina_list_data_get(ll); + if (!fp) continue; - args = _e_fm_string_append_quoted(args, &size, &length, fp); - args = _e_fm_string_append_char(args, &size, &length, ' '); + args = _e_fm_string_append_quoted(args, &size, &length, fp); + args = _e_fm_string_append_char(args, &size, &length, ' '); - eina_stringshare_del(fp); - } + eina_stringshare_del(fp); + } - if (S_ISDIR(sd->drop_icon->info.statinfo.st_mode)) - snprintf(dirpath, sizeof(dirpath), "%s/%s", sd->realpath, sd->drop_icon->info.file); - else - snprintf(dirpath, sizeof(dirpath), "%s", sd->realpath); + if (S_ISDIR(sd->drop_icon->info.statinfo.st_mode)) + snprintf(dirpath, sizeof(dirpath), "%s/%s", sd->realpath, sd->drop_icon->info.file); + else + snprintf(dirpath, sizeof(dirpath), "%s", sd->realpath); - args = _e_fm_string_append_quoted(args, &size, &length, dirpath); - } - else - { - if (_e_fm2_view_mode_get(sd) == E_FM2_VIEW_MODE_LIST && sd->order_file) /* list */ - { - for (ll = fsel, il = isel; ll && il; ll = eina_list_next(ll), il = eina_list_next(il)) - { - fp = eina_list_data_get(ll); - if (!fp) continue; - snprintf(buf, sizeof(buf), "%s/%s", - sd->realpath, ecore_file_file_get(fp)); - if (sd->config->view.link_drop) - { - _e_fm2_client_file_symlink(buf, fp, sd->drop_icon->info.file, sd->drop_after, -9999, -9999, sd->h, sd->h, sd->obj); - } - else - { - args = _e_fm_string_append_quoted(args, &size, &length, fp); - args = _e_fm_string_append_char(args, &size, &length, ' '); - } + args = _e_fm_string_append_quoted(args, &size, &length, dirpath); + } + else + { + if (_e_fm2_view_mode_get(sd) == E_FM2_VIEW_MODE_LIST && sd->order_file) /* list */ + { + for (ll = fsel, il = isel; ll && il; ll = eina_list_next(ll), il = eina_list_next(il)) + { + fp = eina_list_data_get(ll); + if (!fp) continue; + snprintf(buf, sizeof(buf), "%s/%s", + sd->realpath, ecore_file_file_get(fp)); + if (sd->config->view.link_drop) + { + _e_fm2_client_file_symlink(buf, fp, sd->drop_icon->info.file, sd->drop_after, -9999, -9999, sd->h, sd->h, sd->obj); + } + else + { + args = _e_fm_string_append_quoted(args, &size, &length, fp); + args = _e_fm_string_append_char(args, &size, &length, ' '); + } - _e_fm_file_reorder(ecore_file_file_get(fp), sd->realpath, sd->drop_icon->info.file, sd->drop_after); + _e_fm_file_reorder(ecore_file_file_get(fp), sd->realpath, sd->drop_icon->info.file, sd->drop_after); - eina_stringshare_del(fp); - } + eina_stringshare_del(fp); + } - args = _e_fm_string_append_quoted(args, &size, &length, sd->realpath); - } - else - { - for (ll = fsel, il = isel; ll && il; ll = eina_list_next(ll), il = eina_list_next(il)) - { - fp = eina_list_data_get(ll); - if (!fp) continue; + args = _e_fm_string_append_quoted(args, &size, &length, sd->realpath); + } + else + { + for (ll = fsel, il = isel; ll && il; ll = eina_list_next(ll), il = eina_list_next(il)) + { + fp = eina_list_data_get(ll); + if (!fp) continue; - args = _e_fm_string_append_quoted(args, &size, &length, fp); - args = _e_fm_string_append_char(args, &size, &length, ' '); + args = _e_fm_string_append_quoted(args, &size, &length, fp); + args = _e_fm_string_append_char(args, &size, &length, ' '); - eina_stringshare_del(fp); - } - args = _e_fm_string_append_quoted(args, &size, &length, sd->realpath); - } - } + eina_stringshare_del(fp); + } + args = _e_fm_string_append_quoted(args, &size, &length, sd->realpath); + } + } } if (args) { - if (e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_COPY) - { - _e_fm_client_file_copy(args, sd->obj); - free(args); - } - else if (e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_MOVE) - { - _e_fm_client_file_move(args, sd->obj); - free(args); - } - else if (e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_ASK) - { - _e_fm_drop_menu(args, sd->obj); - } + if (e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_COPY) + { + _e_fm_client_file_copy(args, sd->obj); + free(args); + } + else if (e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_MOVE) + { + _e_fm_client_file_move(args, sd->obj); + free(args); + } + else if (e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_ASK) + { + _e_fm_drop_menu(args, sd->obj); + } } _e_fm2_dnd_drop_hide(sd->obj); @@ -6305,17 +6335,17 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event) Evas_Object *obj; EINA_LIST_FOREACH(_e_fm2_list, l, obj) { - if ((_e_fm2_list_walking > 0) && - (eina_list_data_find(_e_fm2_list_remove, obj))) continue; - _e_fm2_dnd_finish(obj, 0); + if ((_e_fm2_list_walking > 0) && + (eina_list_data_find(_e_fm2_list_remove, obj))) continue; + _e_fm2_dnd_finish(obj, 0); } _e_fm2_list_walking--; if (_e_fm2_list_walking == 0) { - EINA_LIST_FREE(_e_fm2_list_remove, obj) - { - _e_fm2_list = eina_list_remove(_e_fm2_list, obj); - } + EINA_LIST_FREE(_e_fm2_list_remove, obj) + { + _e_fm2_list = eina_list_remove(_e_fm2_list, obj); + } } eina_list_free(fsel); eina_list_free(isel); @@ -6333,12 +6363,12 @@ _e_fm2_mouse_1_handler(E_Fm2_Icon *ic, int up, void *evas_event) if (!evas_event) return; - if (!up) + if (!up) { ed = evas_event; modifiers = ed->modifiers; - } - else + } + else { eu = evas_event; modifiers = eu->modifiers; @@ -6346,115 +6376,114 @@ _e_fm2_mouse_1_handler(E_Fm2_Icon *ic, int up, void *evas_event) if (ic->sd->config->selection.windows_modifiers) { - if (evas_key_modifier_is_set(modifiers, "Shift")) - range_sel = 1; - else if (evas_key_modifier_is_set(modifiers, "Control")) - multi_sel = 1; + if (evas_key_modifier_is_set(modifiers, "Shift")) + range_sel = 1; + else if (evas_key_modifier_is_set(modifiers, "Control")) + multi_sel = 1; } else { - if (evas_key_modifier_is_set(modifiers, "Control")) - range_sel = 1; - else if (evas_key_modifier_is_set(modifiers, "Shift")) - multi_sel = 1; + if (evas_key_modifier_is_set(modifiers, "Control")) + range_sel = 1; + else if (evas_key_modifier_is_set(modifiers, "Shift")) + multi_sel = 1; } if (ic->sd->config->selection.single) { - multi_sel = 0; - range_sel = 0; + multi_sel = 0; + range_sel = 0; } if (range_sel) { - const Eina_List *l; - E_Fm2_Icon *ic2; - Eina_Bool seen = 0; - /* find last selected - if any, and select all icons between */ - EINA_LIST_FOREACH(ic->sd->icons, l, ic2) - { - if (ic2 == ic) seen = 1; - if (ic2->last_selected) - { - ic2->last_selected = 0; - if (seen) - { - EINA_LIST_REVERSE_FOREACH(l, l, ic2) - { - if (ic == ic2) break; - if (!ic2->selected) sel_change = 1; - _e_fm2_icon_select(ic2); - ic2->last_selected = 0; - } - } - else - { - EINA_LIST_FOREACH(l, l, ic2) - { - if (ic == ic2) break; - if (!ic2->selected) sel_change = 1; - _e_fm2_icon_select(ic2); - ic2->last_selected = 0; - } - } - break; - } - } + const Eina_List *l; + E_Fm2_Icon *ic2; + Eina_Bool seen = 0; + /* find last selected - if any, and select all icons between */ + EINA_LIST_FOREACH(ic->sd->icons, l, ic2) + { + if (ic2 == ic) seen = 1; + if (ic2->last_selected) + { + ic2->last_selected = 0; + if (seen) + { + EINA_LIST_REVERSE_FOREACH(l, l, ic2) + { + if (ic == ic2) break; + if (!ic2->selected) sel_change = 1; + _e_fm2_icon_select(ic2); + ic2->last_selected = 0; + } + } + else + { + EINA_LIST_FOREACH(l, l, ic2) + { + if (ic == ic2) break; + if (!ic2->selected) sel_change = 1; + _e_fm2_icon_select(ic2); + ic2->last_selected = 0; + } + } + break; + } + } } else if ((!multi_sel) && ((up) || ((!up) && (!ic->selected)))) { - const Eina_List *l; - E_Fm2_Icon *ic2; - /* desel others */ - EINA_LIST_FOREACH(ic->sd->icons, l, ic2) - { - if (ic2 != ic) - { - if (ic2->selected) - { - _e_fm2_icon_deselect(ic2); - sel_change = 1; - } - } - } + const Eina_List *l; + E_Fm2_Icon *ic2; + /* desel others */ + EINA_LIST_FOREACH(ic->sd->icons, l, ic2) + { + if (ic2 != ic) + { + if (ic2->selected) + { + _e_fm2_icon_deselect(ic2); + sel_change = 1; + } + } + } } else { - if (!up) - { - const Eina_List *l; - E_Fm2_Icon *ic2; - EINA_LIST_FOREACH(ic->sd->icons, l, ic2) + if (!up) + { + const Eina_List *l; + E_Fm2_Icon *ic2; + EINA_LIST_FOREACH(ic->sd->icons, l, ic2) ic2->last_selected = 0; - } + } } if ((multi_sel) && (ic->selected)) { - if ((up) && (!ic->drag.dnd) && (!ic->down_sel)) - { - sel_change = 1; - _e_fm2_icon_deselect(ic); - } + if ((up) && (!ic->drag.dnd) && (!ic->down_sel)) + { + sel_change = 1; + _e_fm2_icon_deselect(ic); + } } else { - if (!up) - { - if (!ic->selected) sel_change = EINA_TRUE; - _e_fm2_icon_select(ic); - ic->down_sel = EINA_TRUE; - ic->last_selected = EINA_TRUE; - } - + if (!up) + { + if (!ic->selected) sel_change = EINA_TRUE; + _e_fm2_icon_select(ic); + ic->down_sel = EINA_TRUE; + ic->last_selected = EINA_TRUE; + } } if (sel_change) evas_object_smart_callback_call(ic->sd->obj, "selection_change", NULL); if ((!(S_ISDIR(ic->info.statinfo.st_mode)) || - (ic->sd->config->view.no_subdir_jump)) && + (ic->sd->config->view.no_subdir_jump)) && (ic->sd->config->view.single_click)) { - if (ed && ic->sd->config->view.single_click_delay) + if (ed && ic->sd->config->view.single_click_delay) down_timestamp = ed->timestamp; - if (eu && (eu->timestamp - down_timestamp) > ic->sd->config->view.single_click_delay) + if (eu && (eu->timestamp - down_timestamp) > ic->sd->config->view.single_click_delay) { int icon_pos_x = ic->x + ic->sd->x - ic->sd->pos.x; int icon_pos_y = ic->y + ic->sd->y - ic->sd->pos.y; @@ -6476,39 +6505,39 @@ _e_fm2_cb_icon_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU ev = event_info; if (ic->entry_widget) - return; + return; if ((ev->button == 1) && (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)) { - /* if its a directory && open dirs in-place is set then change the dir - * to be the dir + file */ - if (_e_fm2_inplace_open(ic) == 0) - evas_object_smart_callback_call(ic->sd->obj, "selected", NULL); - /* if its in file selector mode then signal that a selection has - * taken place and dont do anything more */ + /* if its a directory && open dirs in-place is set then change the dir + * to be the dir + file */ + if (_e_fm2_inplace_open(ic) == 0) + evas_object_smart_callback_call(ic->sd->obj, "selected", NULL); + /* if its in file selector mode then signal that a selection has + * taken place and dont do anything more */ - /* do the below per selected file */ - /* if its a directory and open dirs in-place is not set, then - * signal owner that a new dir should be opened */ - /* if its a normal file - do what the mime type says to do with - * that file type */ + /* do the below per selected file */ + /* if its a directory and open dirs in-place is not set, then + * signal owner that a new dir should be opened */ + /* if its a normal file - do what the mime type says to do with + * that file type */ } else if (ev->button == 1) { - if ((ic->sd->eobj)) - { - ic->drag.x = ev->output.x - ic->x - ic->sd->x + ic->sd->pos.x; - ic->drag.y = ev->output.y - ic->y - ic->sd->y + ic->sd->pos.y; - ic->drag.start = EINA_TRUE; - ic->drag.dnd = EINA_FALSE; - ic->drag.src = EINA_TRUE; - } - _e_fm2_mouse_1_handler(ic, 0, ev); + if ((ic->sd->eobj)) + { + ic->drag.x = ev->output.x - ic->x - ic->sd->x + ic->sd->pos.x; + ic->drag.y = ev->output.y - ic->y - ic->sd->y + ic->sd->pos.y; + ic->drag.start = EINA_TRUE; + ic->drag.dnd = EINA_FALSE; + ic->drag.src = EINA_TRUE; + } + _e_fm2_mouse_1_handler(ic, 0, ev); } else if (ev->button == 3) { - if (!ic->selected) _e_fm2_mouse_1_handler(ic, 0, ev); - _e_fm2_icon_menu(ic, ic->sd->obj, ev->timestamp); + if (!ic->selected) _e_fm2_mouse_1_handler(ic, 0, ev); + _e_fm2_icon_menu(ic, ic->sd->obj, ev->timestamp); } } @@ -6525,18 +6554,18 @@ _e_fm2_cb_icon_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSE if ((ev->button == 1) && (!ic->drag.dnd)) { - if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)) - _e_fm2_mouse_1_handler(ic, 1, ev); + if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)) + _e_fm2_mouse_1_handler(ic, 1, ev); ic->drag.start = EINA_FALSE; - ic->drag.dnd = EINA_FALSE; - ic->drag.src = EINA_FALSE; + ic->drag.dnd = EINA_FALSE; + ic->drag.src = EINA_FALSE; ic->down_sel = EINA_FALSE; - if ((ic->sd->config->view.single_click) && - (ic->sd->config->view.single_click_delay == 0) && - (!evas_key_modifier_is_set(ev->modifiers, "Control")) && - (!evas_key_modifier_is_set(ev->modifiers, "Shift")) && - (_e_fm2_inplace_open(ic) == 0)) + if ((ic->sd->config->view.single_click) && + (ic->sd->config->view.single_click_delay == 0) && + (!evas_key_modifier_is_set(ev->modifiers, "Control")) && + (!evas_key_modifier_is_set(ev->modifiers, "Shift")) && + (_e_fm2_inplace_open(ic) == 0)) evas_object_smart_callback_call(ic->sd->obj, "selected", NULL); } } @@ -6553,33 +6582,33 @@ _e_fm2_cb_drag_finished(E_Drag *drag, int dropped __UNUSED__) memset(buf, 0, sizeof(buf)); for (p = drag->data, i = 0; p && *p != '\0'; p++, i++) { - if (*p == '\r') - { - p++; - i = -1; - uri = _e_fm2_uri_parse(buf); - memset(buf, 0, sizeof(buf)); - if (!uri) continue; + if (*p == '\r') + { + p++; + i = -1; + uri = _e_fm2_uri_parse(buf); + memset(buf, 0, sizeof(buf)); + if (!uri) continue; - fm = _e_fm2_file_fm2_find(uri->path); - if (fm) - { - const char *file; - E_Fm2_Icon *ic; + fm = _e_fm2_file_fm2_find(uri->path); + if (fm) + { + const char *file; + E_Fm2_Icon *ic; - file = ecore_file_file_get(uri->path); - ic = _e_fm2_icon_find(fm, file); - ic->drag.dnd = EINA_FALSE; - if (ic->obj) evas_object_show(ic->obj); - if (ic->obj_icon) evas_object_show(ic->obj_icon); - } + file = ecore_file_file_get(uri->path); + ic = _e_fm2_icon_find(fm, file); + ic->drag.dnd = EINA_FALSE; + if (ic->obj) evas_object_show(ic->obj); + if (ic->obj_icon) evas_object_show(ic->obj_icon); + } - if (uri->hostname) eina_stringshare_del(uri->hostname); - eina_stringshare_del(uri->path); - E_FREE(uri); - } - else - buf[i] = *p; + if (uri->hostname) eina_stringshare_del(uri->hostname); + eina_stringshare_del(uri->path); + E_FREE(uri); + } + else + buf[i] = *p; } free(drag->data); } @@ -6589,18 +6618,18 @@ _e_fm_drag_key_down_cb(E_Drag *drag, Ecore_Event_Key *e) { if (!strncmp(e->keyname, "Alt", 3)) { - ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_ASK); - edje_object_signal_emit(drag->object, "e,state,ask", "e"); + ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_ASK); + edje_object_signal_emit(drag->object, "e,state,ask", "e"); } else if (!strncmp(e->keyname, "Shift", 5)) { - ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_MOVE); - edje_object_signal_emit(drag->object, "e,state,move", "e"); + ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_MOVE); + edje_object_signal_emit(drag->object, "e,state,move", "e"); } else if (!strncmp(e->keyname, "Control", 7)) { - ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_COPY); - edje_object_signal_emit(drag->object, "e,state,copy", "e"); + ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_COPY); + edje_object_signal_emit(drag->object, "e,state,copy", "e"); } } @@ -6609,14 +6638,14 @@ _e_fm_drag_key_up_cb(E_Drag *drag, Ecore_Event_Key *e) { /* Default action would be move. ;) */ - if (!strncmp(e->keyname, "Alt", 3)) - ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_MOVE); - else if (!strncmp(e->keyname, "Shift", 5)) - ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_MOVE); - else if (!strncmp(e->keyname, "Control", 7)) - ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_MOVE); + if (!strncmp(e->keyname, "Alt", 3)) + ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_MOVE); + else if (!strncmp(e->keyname, "Shift", 5)) + ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_MOVE); + else if (!strncmp(e->keyname, "Control", 7)) + ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_MOVE); - edje_object_signal_emit(drag->object, "e,state,move", "e"); + edje_object_signal_emit(drag->object, "e,state,move", "e"); } static void @@ -6634,148 +6663,153 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; if ((ic->drag.start) && (ic->sd->eobj)) { - int dx, dy; + int dx, dy; - dx = ev->cur.output.x - (ic->drag.x + ic->x + ic->sd->x - ic->sd->pos.x); - dy = ev->cur.output.y - (ic->drag.y + ic->y + ic->sd->y - ic->sd->pos.y); - if (((dx * dx) + (dy * dy)) > - (e_config->drag_resist * e_config->drag_resist)) - { - E_Drag *d; - Evas_Object *o, *o2; - Evas_Coord x, y, w, h; - const char *drag_types[] = { "text/uri-list" }, *realpath; - char buf[PATH_MAX + 8], *p, *sel = NULL; - E_Container *con = NULL; - Eina_List *sl; - int sel_length = 0, p_offset, p_length; + dx = ev->cur.output.x - (ic->drag.x + ic->x + ic->sd->x - ic->sd->pos.x); + dy = ev->cur.output.y - (ic->drag.y + ic->y + ic->sd->y - ic->sd->pos.y); + if (((dx * dx) + (dy * dy)) > + (e_config->drag_resist * e_config->drag_resist)) + { + E_Drag *d; + Evas_Object *o, *o2; + Evas_Coord x, y, w, h; + const char *drag_types[] = { "text/uri-list" }, *realpath; + char buf[PATH_MAX + 8], *p, *sel = NULL; + E_Container *con = NULL; + Eina_List *sl; + int sel_length = 0, p_offset, p_length; - switch (ic->sd->eobj->type) - { - case E_GADCON_TYPE: - con = ((E_Gadcon *)(ic->sd->eobj))->zone->container; - break; - case E_WIN_TYPE: - con = ((E_Win *)(ic->sd->eobj))->container; - break; - case E_ZONE_TYPE: - con = ((E_Zone *)(ic->sd->eobj))->container; - break; - case E_BORDER_TYPE: - con = ((E_Border *)(ic->sd->eobj))->zone->container; - break; - case E_POPUP_TYPE: - con = ((E_Popup *)(ic->sd->eobj))->zone->container; - break; - /* FIXME: add more types as needed */ - default: - break; - } - if (!con) return; - ic->sd->drag = EINA_TRUE; - ic->drag.dnd = EINA_TRUE; - if (ic->obj) evas_object_hide(ic->obj); - if (ic->obj_icon) evas_object_hide(ic->obj_icon); - ic->drag.start = EINA_FALSE; - evas_object_geometry_get(ic->obj, &x, &y, &w, &h); - realpath = e_fm2_real_path_get(ic->sd->obj); - p_offset = eina_strlcpy(buf, realpath, sizeof(buf)); - if ((p_offset < 1) || (p_offset >= sizeof(buf) - 2)) return; - if (buf[p_offset - 1] != '/') - { - buf[p_offset] = '/'; - p_offset++; - } - p = buf + p_offset; - p_length = sizeof(buf) - p_offset - 1; + switch (ic->sd->eobj->type) + { + case E_GADCON_TYPE: + con = ((E_Gadcon *)(ic->sd->eobj))->zone->container; + break; - sl = e_fm2_selected_list_get(ic->sd->obj); - EINA_LIST_FREE(sl, ici) - { - char *tmp; - const char *s; - int s_len; + case E_WIN_TYPE: + con = ((E_Win *)(ic->sd->eobj))->container; + break; - if (eina_strlcpy(p, ici->file, p_length) >= p_length) continue; - s = _e_fm2_uri_escape(buf); - if (!s) continue; - s_len = strlen(s); - tmp = realloc(sel, sel_length + s_len + 2 + 1); - if (!tmp) - { - free(sel); - sel = NULL; - break; - } - sel = tmp; - memcpy(sel + sel_length, s, s_len); - memcpy(sel + sel_length + s_len, "\r\n", 2); - sel_length += s_len + 2; - eina_stringshare_del(s); + case E_ZONE_TYPE: + con = ((E_Zone *)(ic->sd->eobj))->container; + break; - ici->ic->drag.dnd = EINA_TRUE; - if (ici->ic->obj) evas_object_hide(ici->ic->obj); - if (ici->ic->obj_icon) evas_object_hide(ici->ic->obj_icon); - } - if (!sel) return; - sel[sel_length] = '\0'; + case E_BORDER_TYPE: + con = ((E_Border *)(ic->sd->eobj))->zone->container; + break; - d = e_drag_new(con, x, y, drag_types, 1, - sel, sel_length, NULL, _e_fm2_cb_drag_finished); - o = edje_object_add(e_drag_evas_get(d)); - if (_e_fm2_view_mode_get(ic->sd) == E_FM2_VIEW_MODE_LIST) - { - if (ic->sd->config->icon.fixed.w) - { - if (ic->odd) - _e_fm2_theme_edje_object_set(ic->sd, o, - "base/theme/widgets", - "list_odd/fixed"); - else - _e_fm2_theme_edje_object_set(ic->sd, o, - "base/theme/widgets", - "list/fixed"); - } - else - { - if (ic->odd) - _e_fm2_theme_edje_object_set(ic->sd, o, - "base/theme/widgets", - "list_odd/variable"); - else - _e_fm2_theme_edje_object_set(ic->sd, o, - "base/theme/widgets", - "list/variable"); - } - } - else - { - if (ic->sd->config->icon.fixed.w) - _e_fm2_theme_edje_object_set(ic->sd, o, - "base/theme/fileman", - "icon/fixed"); - else - _e_fm2_theme_edje_object_set(ic->sd, o, - "base/theme/fileman", - "icon/variable"); - } - _e_fm2_icon_label_set(ic, o); - o2 = _e_fm2_icon_icon_direct_set(ic, o, - _e_fm2_cb_icon_thumb_dnd_gen, o, - 1); - edje_object_signal_emit(o, "e,state,selected", "e"); - edje_object_signal_emit(o2, "e,state,selected", "e"); - e_drag_object_set(d, o); - edje_object_signal_emit(o, "e,state,move", "e"); - e_drag_resize(d, w, h); + case E_POPUP_TYPE: + con = ((E_Popup *)(ic->sd->eobj))->zone->container; + break; - e_drag_key_down_cb_set(d, _e_fm_drag_key_down_cb); - e_drag_key_up_cb_set(d, _e_fm_drag_key_up_cb); + /* FIXME: add more types as needed */ + default: + break; + } + if (!con) return; + ic->sd->drag = EINA_TRUE; + ic->drag.dnd = EINA_TRUE; + if (ic->obj) evas_object_hide(ic->obj); + if (ic->obj_icon) evas_object_hide(ic->obj_icon); + ic->drag.start = EINA_FALSE; + evas_object_geometry_get(ic->obj, &x, &y, &w, &h); + realpath = e_fm2_real_path_get(ic->sd->obj); + p_offset = eina_strlcpy(buf, realpath, sizeof(buf)); + if ((p_offset < 1) || (p_offset >= sizeof(buf) - 2)) return; + if (buf[p_offset - 1] != '/') + { + buf[p_offset] = '/'; + p_offset++; + } + p = buf + p_offset; + p_length = sizeof(buf) - p_offset - 1; - e_drag_xdnd_start(d, - ic->drag.x + ic->x + ic->sd->x - ic->sd->pos.x, - ic->drag.y + ic->y + ic->sd->y - ic->sd->pos.y); - } + sl = e_fm2_selected_list_get(ic->sd->obj); + EINA_LIST_FREE(sl, ici) + { + char *tmp; + const char *s; + int s_len; + + if (eina_strlcpy(p, ici->file, p_length) >= p_length) continue; + s = _e_fm2_uri_escape(buf); + if (!s) continue; + s_len = strlen(s); + tmp = realloc(sel, sel_length + s_len + 2 + 1); + if (!tmp) + { + free(sel); + sel = NULL; + break; + } + sel = tmp; + memcpy(sel + sel_length, s, s_len); + memcpy(sel + sel_length + s_len, "\r\n", 2); + sel_length += s_len + 2; + eina_stringshare_del(s); + + ici->ic->drag.dnd = EINA_TRUE; + if (ici->ic->obj) evas_object_hide(ici->ic->obj); + if (ici->ic->obj_icon) evas_object_hide(ici->ic->obj_icon); + } + if (!sel) return; + sel[sel_length] = '\0'; + + d = e_drag_new(con, x, y, drag_types, 1, + sel, sel_length, NULL, _e_fm2_cb_drag_finished); + o = edje_object_add(e_drag_evas_get(d)); + if (_e_fm2_view_mode_get(ic->sd) == E_FM2_VIEW_MODE_LIST) + { + if (ic->sd->config->icon.fixed.w) + { + if (ic->odd) + _e_fm2_theme_edje_object_set(ic->sd, o, + "base/theme/widgets", + "list_odd/fixed"); + else + _e_fm2_theme_edje_object_set(ic->sd, o, + "base/theme/widgets", + "list/fixed"); + } + else + { + if (ic->odd) + _e_fm2_theme_edje_object_set(ic->sd, o, + "base/theme/widgets", + "list_odd/variable"); + else + _e_fm2_theme_edje_object_set(ic->sd, o, + "base/theme/widgets", + "list/variable"); + } + } + else + { + if (ic->sd->config->icon.fixed.w) + _e_fm2_theme_edje_object_set(ic->sd, o, + "base/theme/fileman", + "icon/fixed"); + else + _e_fm2_theme_edje_object_set(ic->sd, o, + "base/theme/fileman", + "icon/variable"); + } + _e_fm2_icon_label_set(ic, o); + o2 = _e_fm2_icon_icon_direct_set(ic, o, + _e_fm2_cb_icon_thumb_dnd_gen, o, + 1); + edje_object_signal_emit(o, "e,state,selected", "e"); + edje_object_signal_emit(o2, "e,state,selected", "e"); + e_drag_object_set(d, o); + edje_object_signal_emit(o, "e,state,move", "e"); + e_drag_resize(d, w, h); + + e_drag_key_down_cb_set(d, _e_fm_drag_key_down_cb); + e_drag_key_up_cb_set(d, _e_fm_drag_key_up_cb); + + e_drag_xdnd_start(d, + ic->drag.x + ic->x + ic->sd->x - ic->sd->pos.x, + ic->drag.y + ic->y + ic->sd->y - ic->sd->pos.y); + } } } @@ -6790,9 +6824,9 @@ _e_fm2_cb_icon_thumb_dnd_gen(void *data, Evas_Object *obj, void *event_info __UN e_icon_size_get(obj, &w, &h); have_alpha = e_icon_alpha_get(obj); // if (_e_fm2_view_mode_get(ic->sd) == E_FM2_VIEW_MODE_LIST) - { - edje_extern_object_aspect_set(obj, EDJE_ASPECT_CONTROL_BOTH, w, h); - } + { + edje_extern_object_aspect_set(obj, EDJE_ASPECT_CONTROL_BOTH, w, h); + } edje_object_part_swallow(o, "e.swallow.icon", obj); if (have_alpha) edje_object_signal_emit(o, "e,action,thumb,gen,alpha", "e"); @@ -6808,21 +6842,21 @@ _e_fm2_cb_icon_thumb_gen(void *data, Evas_Object *obj, void *event_info __UNUSED ic = data; if (ic->realized) { - Evas_Coord w = 0, h = 0; - int have_alpha; + Evas_Coord w = 0, h = 0; + int have_alpha; - e_icon_size_get(obj, &w, &h); - have_alpha = e_icon_alpha_get(obj); + e_icon_size_get(obj, &w, &h); + have_alpha = e_icon_alpha_get(obj); // if (_e_fm2_view_mode_get(ic->sd) == E_FM2_VIEW_MODE_LIST) - { - edje_extern_object_aspect_set(obj, - EDJE_ASPECT_CONTROL_BOTH, w, h); - } - edje_object_part_swallow(ic->obj, "e.swallow.icon", obj); - if (have_alpha) - edje_object_signal_emit(ic->obj, "e,action,thumb,gen,alpha", "e"); - else - edje_object_signal_emit(ic->obj, "e,action,thumb,gen", "e"); + { + edje_extern_object_aspect_set(obj, + EDJE_ASPECT_CONTROL_BOTH, w, h); + } + edje_object_part_swallow(ic->obj, "e.swallow.icon", obj); + if (have_alpha) + edje_object_signal_emit(ic->obj, "e,action,thumb,gen,alpha", "e"); + else + edje_object_signal_emit(ic->obj, "e,action,thumb,gen", "e"); } } @@ -6840,164 +6874,163 @@ _e_fm2_cb_key_down(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event if (evas_key_modifier_is_set(ev->modifiers, "Control")) { - if (!strcmp(ev->key, "x")) - { - _e_fm2_file_cut(obj); - return; - } - else if (!strcmp(ev->key, "c")) - { - _e_fm2_file_copy(obj); - return; - } - else if (!strcmp(ev->key, "v")) - { - _e_fm2_file_paste(obj); - return; - } + if (!strcmp(ev->key, "x")) + { + _e_fm2_file_cut(obj); + return; + } + else if (!strcmp(ev->key, "c")) + { + _e_fm2_file_copy(obj); + return; + } + else if (!strcmp(ev->key, "v")) + { + _e_fm2_file_paste(obj); + return; + } } if (!strcmp(ev->key, "Left")) { - /* FIXME: icon mode, typebuf extras */ - /* list mode: scroll left n pix - * icon mode: prev icon - * typebuf mode: cursor left - */ - _e_fm2_icon_sel_prev(obj); + /* FIXME: icon mode, typebuf extras */ + /* list mode: scroll left n pix + * icon mode: prev icon + * typebuf mode: cursor left + */ + _e_fm2_icon_sel_prev(obj); } else if (!strcmp(ev->key, "Right")) { - /* FIXME: icon mode, typebuf extras */ - /* list mode: scroll right n pix - * icon mode: next icon - * typebuf mode: cursor right - */ - _e_fm2_icon_sel_next(obj); + /* FIXME: icon mode, typebuf extras */ + /* list mode: scroll right n pix + * icon mode: next icon + * typebuf mode: cursor right + */ + _e_fm2_icon_sel_next(obj); } else if (!strcmp(ev->key, "Up")) { - if (sd->typebuf_visible) - /* FIXME: icon mode, typebuf extras */ - /* is there a way to use this atm? */ - // _e_fm2_typebuf_history_prev(obj); - _e_fm2_typebuf_match(obj, -1); - else if (_e_fm2_view_mode_get(sd) == E_FM2_VIEW_MODE_LIST) - _e_fm2_icon_sel_prev(obj); - else - _e_fm2_icon_sel_up(obj); + if (sd->typebuf_visible) + /* FIXME: icon mode, typebuf extras */ + /* is there a way to use this atm? */ + // _e_fm2_typebuf_history_prev(obj); + _e_fm2_typebuf_match(obj, -1); + else if (_e_fm2_view_mode_get(sd) == E_FM2_VIEW_MODE_LIST) + _e_fm2_icon_sel_prev(obj); + else + _e_fm2_icon_sel_up(obj); } else if (!strcmp(ev->key, "Down")) { - if (sd->typebuf_visible) - /* FIXME: icon mode, typebuf extras */ - /* is there a way to use this? */ - //_e_fm2_typebuf_history_next(obj); - _e_fm2_typebuf_match(obj, 1); - else if (_e_fm2_view_mode_get(sd) == E_FM2_VIEW_MODE_LIST) - _e_fm2_icon_sel_next(obj); - else - _e_fm2_icon_sel_down(obj); + if (sd->typebuf_visible) + /* FIXME: icon mode, typebuf extras */ + /* is there a way to use this? */ + //_e_fm2_typebuf_history_next(obj); + _e_fm2_typebuf_match(obj, 1); + else if (_e_fm2_view_mode_get(sd) == E_FM2_VIEW_MODE_LIST) + _e_fm2_icon_sel_next(obj); + else + _e_fm2_icon_sel_down(obj); } else if (!strcmp(ev->key, "Home")) { - /* FIXME: typebuf extras */ - /* go to first icon - * typebuf mode: cursor to start - */ - _e_fm2_icon_sel_first(obj); + /* FIXME: typebuf extras */ + /* go to first icon + * typebuf mode: cursor to start + */ + _e_fm2_icon_sel_first(obj); } else if (!strcmp(ev->key, "End")) { - /* FIXME: typebuf extras */ - /* go to last icon - * typebuf mode: cursor to end - */ - _e_fm2_icon_sel_last(obj); + /* FIXME: typebuf extras */ + /* go to last icon + * typebuf mode: cursor to end + */ + _e_fm2_icon_sel_last(obj); } else if (!strcmp(ev->key, "Prior")) { - /* up h * n pixels */ - e_fm2_pan_set(obj, sd->pos.x, sd->pos.y - sd->h); - evas_object_smart_callback_call(sd->obj, "pan_changed", NULL); + /* up h * n pixels */ + e_fm2_pan_set(obj, sd->pos.x, sd->pos.y - sd->h); + evas_object_smart_callback_call(sd->obj, "pan_changed", NULL); } else if (!strcmp(ev->keyname, "Next")) { - /* down h * n pixels */ - e_fm2_pan_set(obj, sd->pos.x, sd->pos.y + sd->h); - evas_object_smart_callback_call(sd->obj, "pan_changed", NULL); + /* down h * n pixels */ + e_fm2_pan_set(obj, sd->pos.x, sd->pos.y + sd->h); + evas_object_smart_callback_call(sd->obj, "pan_changed", NULL); } else if (!strcmp(ev->key, "Escape")) { - /* typebuf mode: end typebuf mode */ - if (sd->typebuf_visible) - _e_fm2_typebuf_hide(obj); - else - { - ic = _e_fm2_icon_first_selected_find(obj); - if (ic) - _e_fm2_icon_desel_any(obj); - else - { - if (e_fm2_has_parent_get(obj)) - e_fm2_parent_go(obj); - } - } + /* typebuf mode: end typebuf mode */ + if (sd->typebuf_visible) + _e_fm2_typebuf_hide(obj); + else + { + ic = _e_fm2_icon_first_selected_find(obj); + if (ic) + _e_fm2_icon_desel_any(obj); + else + { + if (e_fm2_has_parent_get(obj)) + e_fm2_parent_go(obj); + } + } } else if (!strcmp(ev->key, "Return")) { - /* if selected - select callback. - * typebuf mode: if nothing selected - run cmd - */ - if (sd->typebuf_visible) - _e_fm2_typebuf_run(obj); - else - { - ic = _e_fm2_icon_first_selected_find(obj); - if (ic) - { - if (_e_fm2_inplace_open(ic) == 0) - evas_object_smart_callback_call(ic->sd->obj, "selected", NULL); - } - } + /* if selected - select callback. + * typebuf mode: if nothing selected - run cmd + */ + if (sd->typebuf_visible) + _e_fm2_typebuf_run(obj); + else + { + ic = _e_fm2_icon_first_selected_find(obj); + if (ic) + { + if (_e_fm2_inplace_open(ic) == 0) + evas_object_smart_callback_call(ic->sd->obj, "selected", NULL); + } + } } else if (!strcmp(ev->key, "Insert")) { - /* dunno what to do with this yet */ + /* dunno what to do with this yet */ } else if (!strcmp(ev->key, "Tab")) { - /* typebuf mode: tab complete */ - if (sd->typebuf_visible) - _e_fm2_typebuf_complete(obj); + /* typebuf mode: tab complete */ + if (sd->typebuf_visible) + _e_fm2_typebuf_complete(obj); } else if (!strcmp(ev->key, "BackSpace")) { - /* typebuf mode: backspace */ - if (sd->typebuf_visible) - _e_fm2_typebuf_char_backspace(obj); - else - { - if (e_fm2_has_parent_get(obj)) - e_fm2_parent_go(obj); - } + /* typebuf mode: backspace */ + if (sd->typebuf_visible) + _e_fm2_typebuf_char_backspace(obj); + else + { + if (e_fm2_has_parent_get(obj)) + e_fm2_parent_go(obj); + } } else if (!strcmp(ev->key, "Delete")) { - /* FIXME: typebuf extras */ - if (sd->typebuf_visible) - { /* typebuf mode: delete */ } - else - _e_fm2_file_delete(obj); + /* FIXME: typebuf extras */ + if (sd->typebuf_visible) + { /* typebuf mode: delete */ }else + _e_fm2_file_delete(obj); } else if (!evas_key_modifier_is_set(ev->modifiers, "Control") && - !evas_key_modifier_is_set(ev->modifiers, "Alt")) + !evas_key_modifier_is_set(ev->modifiers, "Alt")) { - if (ev->string) - { - if (!sd->typebuf_visible) _e_fm2_typebuf_show(obj); - _e_fm2_typebuf_char_append(obj, ev->string); - } + if (ev->string) + { + if (!sd->typebuf_visible) _e_fm2_typebuf_show(obj); + _e_fm2_typebuf_char_append(obj, ev->string); + } } } @@ -7011,56 +7044,56 @@ _e_fm2_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__ ev = event_info; if (ev->button == 1) { - Eina_List *l; - int multi_sel = 0, range_sel = 0, sel_change = 0; + Eina_List *l; + int multi_sel = 0, range_sel = 0, sel_change = 0; - if (sd->config->selection.windows_modifiers) - { - if (evas_key_modifier_is_set(ev->modifiers, "Shift")) - range_sel = 1; - else if (evas_key_modifier_is_set(ev->modifiers, "Control")) - multi_sel = 1; - } - else - { - if (evas_key_modifier_is_set(ev->modifiers, "Control")) - range_sel = 1; - else if (evas_key_modifier_is_set(ev->modifiers, "Shift")) - multi_sel = 1; - } - if (sd->config->selection.single) - { - multi_sel = 0; - range_sel = 0; - } - if ((!multi_sel) && (!range_sel)) - { - E_Fm2_Icon *ic; - EINA_LIST_FOREACH(sd->icons, l, ic) - { - if (ic->selected) - { - _e_fm2_icon_deselect(ic); - sel_change = 1; - } - } - } - if (sel_change) - evas_object_smart_callback_call(sd->obj, "selection_change", NULL); + if (sd->config->selection.windows_modifiers) + { + if (evas_key_modifier_is_set(ev->modifiers, "Shift")) + range_sel = 1; + else if (evas_key_modifier_is_set(ev->modifiers, "Control")) + multi_sel = 1; + } + else + { + if (evas_key_modifier_is_set(ev->modifiers, "Control")) + range_sel = 1; + else if (evas_key_modifier_is_set(ev->modifiers, "Shift")) + multi_sel = 1; + } + if (sd->config->selection.single) + { + multi_sel = 0; + range_sel = 0; + } + if ((!multi_sel) && (!range_sel)) + { + E_Fm2_Icon *ic; + EINA_LIST_FOREACH(sd->icons, l, ic) + { + if (ic->selected) + { + _e_fm2_icon_deselect(ic); + sel_change = 1; + } + } + } + if (sel_change) + evas_object_smart_callback_call(sd->obj, "selection_change", NULL); - if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)) - { - if (!sd->config->selection.single) - { - sd->selrect.ox = ev->canvas.x; - sd->selrect.oy = ev->canvas.y; - sd->selecting = EINA_TRUE; - } - } + if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)) + { + if (!sd->config->selection.single) + { + sd->selrect.ox = ev->canvas.x; + sd->selrect.oy = ev->canvas.y; + sd->selecting = EINA_TRUE; + } + } } else if (ev->button == 3) { - _e_fm2_menu(sd->obj, ev->timestamp); + _e_fm2_menu(sd->obj, ev->timestamp); } } @@ -7089,36 +7122,36 @@ _e_fm2_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__ ev = event_info; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) { - if (sd->selecting) - { - sd->selecting = EINA_FALSE; - sd->selrect.ox = EINA_FALSE; - sd->selrect.oy = EINA_FALSE; - evas_object_hide(sd->sel_rect); - } - return; + if (sd->selecting) + { + sd->selecting = EINA_FALSE; + sd->selrect.ox = EINA_FALSE; + sd->selrect.oy = EINA_FALSE; + evas_object_hide(sd->sel_rect); + } + return; } if (!sd->selecting) return; if (ev->cur.canvas.x < sd->selrect.ox) { - sd->selrect.x = ev->cur.canvas.x; - sd->selrect.w = (sd->selrect.ox - sd->selrect.x); + sd->selrect.x = ev->cur.canvas.x; + sd->selrect.w = (sd->selrect.ox - sd->selrect.x); } else { - sd->selrect.x = MIN(sd->selrect.ox, ev->cur.canvas.x); - sd->selrect.w = abs(sd->selrect.x - ev->cur.canvas.x); + sd->selrect.x = MIN(sd->selrect.ox, ev->cur.canvas.x); + sd->selrect.w = abs(sd->selrect.x - ev->cur.canvas.x); } if (ev->cur.canvas.y < sd->selrect.oy) { - sd->selrect.y = ev->cur.canvas.y; - sd->selrect.h = (sd->selrect.oy - sd->selrect.y); + sd->selrect.y = ev->cur.canvas.y; + sd->selrect.h = (sd->selrect.oy - sd->selrect.y); } else { - sd->selrect.y = MIN(sd->selrect.oy, ev->cur.canvas.y); - sd->selrect.h = abs(sd->selrect.y - ev->cur.canvas.y); + sd->selrect.y = MIN(sd->selrect.oy, ev->cur.canvas.y); + sd->selrect.h = abs(sd->selrect.y - ev->cur.canvas.y); } _e_fm2_sel_rect_update(sd); @@ -7141,36 +7174,36 @@ _e_fm2_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__ ny = y + h - sd->h; e_fm2_pan_set(sd->obj, nx, ny); evas_object_smart_callback_call(sd->obj, "pan_changed", NULL); -*/ + */ E_Fm2_Icon *ic; EINA_LIST_FOREACH(sd->icons, l, ic) { - int ix, iy, iw, ih; - int ix_t, iy_t, iw_t, ih_t; + int ix, iy, iw, ih; + int ix_t, iy_t, iw_t, ih_t; - if (!ic) continue; - evas_object_geometry_get(ic->obj_icon, &ix, &iy, &iw, &ih); - evas_object_geometry_get(edje_object_part_object_get(ic->obj, - "e.text.label"), - &ix_t, &iy_t, &iw_t, &ih_t); - if (E_INTERSECTS(x, y, w, h, ix, iy, iw, ih) || - E_INTERSECTS(x, y, w, h, ix_t, iy_t, iw_t, ih_t)) - { - if (!ic->selected) - { - _e_fm2_icon_select(ic); - sel_change = 1; - } - } - else - { - if (ic->selected) - { - _e_fm2_icon_deselect(ic); - sel_change = 1; - } - } + if (!ic) continue; + evas_object_geometry_get(ic->obj_icon, &ix, &iy, &iw, &ih); + evas_object_geometry_get(edje_object_part_object_get(ic->obj, + "e.text.label"), + &ix_t, &iy_t, &iw_t, &ih_t); + if (E_INTERSECTS(x, y, w, h, ix, iy, iw, ih) || + E_INTERSECTS(x, y, w, h, ix_t, iy_t, iw_t, ih_t)) + { + if (!ic->selected) + { + _e_fm2_icon_select(ic); + sel_change = 1; + } + } + else + { + if (ic->selected) + { + _e_fm2_icon_deselect(ic); + sel_change = 1; + } + } } if (sel_change) evas_object_smart_callback_call(sd->obj, "selection_change", NULL); @@ -7218,60 +7251,66 @@ _e_fm2_cb_resize_job(void *data) switch (_e_fm2_view_mode_get(sd)) { case E_FM2_VIEW_MODE_ICONS: - _e_fm2_regions_free(sd->obj); - _e_fm2_icons_place(sd->obj); - _e_fm2_regions_populate(sd->obj); - break; - case E_FM2_VIEW_MODE_GRID_ICONS: - _e_fm2_regions_free(sd->obj); - _e_fm2_icons_place(sd->obj); - _e_fm2_regions_populate(sd->obj); - break; - case E_FM2_VIEW_MODE_CUSTOM_ICONS: - if (sd->config->view.fit_custom_pos) - { - E_Fm2_Icon *ic; - EINA_LIST_FOREACH(sd->icons, l, ic) - { - ic->region = NULL; - _e_fm2_icon_geom_adjust(ic, ic->x, ic->y, ic->w, ic->h, sd->pw, sd->ph); - } - } _e_fm2_regions_free(sd->obj); -// _e_fm2_regions_eval(sd->obj); - _e_fm2_icons_place(sd->obj); - _e_fm2_regions_populate(sd->obj); - break; - case E_FM2_VIEW_MODE_CUSTOM_GRID_ICONS: - /* FIXME: not going to implement this at this stage */ - _e_fm2_regions_free(sd->obj); -// _e_fm2_regions_eval(sd->obj); - _e_fm2_icons_place(sd->obj); - _e_fm2_regions_populate(sd->obj); - break; - case E_FM2_VIEW_MODE_CUSTOM_SMART_GRID_ICONS: - /* FIXME: not going to implement this at this stage */ - _e_fm2_regions_free(sd->obj); -// _e_fm2_regions_eval(sd->obj); - _e_fm2_icons_place(sd->obj); - _e_fm2_regions_populate(sd->obj); - break; - case E_FM2_VIEW_MODE_LIST: - if (sd->iconlist_changed) - { - E_Fm2_Icon *ic; - EINA_LIST_FOREACH(sd->icons, l, ic) - { - ic->region = NULL; -// _e_fm2_icon_unrealize(ic); - } - } - _e_fm2_regions_free(sd->obj); - _e_fm2_icons_place(sd->obj); + _e_fm2_icons_place(sd->obj); _e_fm2_regions_populate(sd->obj); - break; + break; + + case E_FM2_VIEW_MODE_GRID_ICONS: + _e_fm2_regions_free(sd->obj); + _e_fm2_icons_place(sd->obj); + _e_fm2_regions_populate(sd->obj); + break; + + case E_FM2_VIEW_MODE_CUSTOM_ICONS: + if (sd->config->view.fit_custom_pos) + { + E_Fm2_Icon *ic; + EINA_LIST_FOREACH(sd->icons, l, ic) + { + ic->region = NULL; + _e_fm2_icon_geom_adjust(ic, ic->x, ic->y, ic->w, ic->h, sd->pw, sd->ph); + } + } + _e_fm2_regions_free(sd->obj); +// _e_fm2_regions_eval(sd->obj); + _e_fm2_icons_place(sd->obj); + _e_fm2_regions_populate(sd->obj); + break; + + case E_FM2_VIEW_MODE_CUSTOM_GRID_ICONS: + /* FIXME: not going to implement this at this stage */ + _e_fm2_regions_free(sd->obj); +// _e_fm2_regions_eval(sd->obj); + _e_fm2_icons_place(sd->obj); + _e_fm2_regions_populate(sd->obj); + break; + + case E_FM2_VIEW_MODE_CUSTOM_SMART_GRID_ICONS: + /* FIXME: not going to implement this at this stage */ + _e_fm2_regions_free(sd->obj); +// _e_fm2_regions_eval(sd->obj); + _e_fm2_icons_place(sd->obj); + _e_fm2_regions_populate(sd->obj); + break; + + case E_FM2_VIEW_MODE_LIST: + if (sd->iconlist_changed) + { + E_Fm2_Icon *ic; + EINA_LIST_FOREACH(sd->icons, l, ic) + { + ic->region = NULL; +// _e_fm2_icon_unrealize(ic); + } + } + _e_fm2_regions_free(sd->obj); + _e_fm2_icons_place(sd->obj); + _e_fm2_regions_populate(sd->obj); + break; + default: - break; + break; } edje_thaw(); evas_event_thaw(evas_object_evas_get(sd->obj)); @@ -7281,13 +7320,13 @@ _e_fm2_cb_resize_job(void *data) if ((sd->max.w > 0) && (sd->max.h > 0) && (sd->w > 0) && (sd->h > 0)) { - E_Fm2_Custom_File *cf = e_fm2_custom_file_get(sd->realpath); - if ((cf) && (cf->dir)) - { - sd->pos.x = cf->dir->pos.x * (sd->max.w - sd->w); - sd->pos.y = cf->dir->pos.y * (sd->max.h - sd->h); - evas_object_smart_callback_call(sd->obj, "pan_changed", NULL); - } + E_Fm2_Custom_File *cf = e_fm2_custom_file_get(sd->realpath); + if ((cf) && (cf->dir)) + { + sd->pos.x = cf->dir->pos.x * (sd->max.w - sd->w); + sd->pos.y = cf->dir->pos.y * (sd->max.h - sd->h); + evas_object_smart_callback_call(sd->obj, "pan_changed", NULL); + } } } @@ -7305,48 +7344,48 @@ _e_fm2_cb_icon_sort(const void *data1, const void *data2) if (ic2->info.label) l2 = (char *)ic2->info.label; if (ic1->sd->config->list.sort.dirs.first) { - if ((S_ISDIR(ic1->info.statinfo.st_mode)) != - (S_ISDIR(ic2->info.statinfo.st_mode))) - { - if (S_ISDIR(ic1->info.statinfo.st_mode)) return -1; - else return 1; - } + if ((S_ISDIR(ic1->info.statinfo.st_mode)) != + (S_ISDIR(ic2->info.statinfo.st_mode))) + { + if (S_ISDIR(ic1->info.statinfo.st_mode)) return -1; + else return 1; + } } else if (ic1->sd->config->list.sort.dirs.last) { - if ((S_ISDIR(ic1->info.statinfo.st_mode)) != - (S_ISDIR(ic2->info.statinfo.st_mode))) - { - if (S_ISDIR(ic1->info.statinfo.st_mode)) return 1; - else return -1; - } + if ((S_ISDIR(ic1->info.statinfo.st_mode)) != + (S_ISDIR(ic2->info.statinfo.st_mode))) + { + if (S_ISDIR(ic1->info.statinfo.st_mode)) return 1; + else return -1; + } } if (ic1->sd->config->list.sort.no_case) { - char buf1[4096], buf2[4096], *p; + char buf1[4096], buf2[4096], *p; /* if (ic1->sd->config->list.sort.category) - { + { * FIXME: implement category sorting - } - else -*/ { - eina_strlcpy(buf1, l1, sizeof(buf1)); - eina_strlcpy(buf2, l2, sizeof(buf2)); - } - p = buf1; - while (*p) - { - *p = tolower(*p); - p++; - } - p = buf2; - while (*p) - { - *p = tolower(*p); - p++; - } - return strcmp(buf1, buf2); + } + else + */ { + eina_strlcpy(buf1, l1, sizeof(buf1)); + eina_strlcpy(buf2, l2, sizeof(buf2)); + } + p = buf1; + while (*p) + { + *p = tolower(*p); + p++; + } + p = buf2; + while (*p) + { + *p = tolower(*p); + p++; + } + return strcmp(buf1, buf2); } return strcmp(l1, l2); } @@ -7362,15 +7401,15 @@ _e_fm2_cb_scan_timer(void *data) sd->scan_timer = NULL; if (!sd->listing) { - _e_fm2_client_monitor_list_end(data); - return ECORE_CALLBACK_CANCEL; + _e_fm2_client_monitor_list_end(data); + return ECORE_CALLBACK_CANCEL; } if (sd->busy_count > 0) sd->scan_timer = ecore_timer_add(0.2, _e_fm2_cb_scan_timer, sd->obj); else { - if (!sd->sort_idler) - sd->sort_idler = ecore_idler_add(_e_fm2_cb_sort_idler, data); + if (!sd->sort_idler) + sd->sort_idler = ecore_idler_add(_e_fm2_cb_sort_idler, data); } return ECORE_CALLBACK_CANCEL; } @@ -7385,9 +7424,9 @@ _e_fm2_cb_sort_idler(void *data) _e_fm2_queue_process(data); if (!sd->listing) { - sd->sort_idler = NULL; + sd->sort_idler = NULL; _e_fm2_client_monitor_list_end(data); - return ECORE_CALLBACK_CANCEL; + return ECORE_CALLBACK_CANCEL; } return ECORE_CALLBACK_RENEW; } @@ -7403,27 +7442,27 @@ _e_fm2_obj_icons_place(E_Fm2_Smart_Data *sd) edje_freeze(); EINA_LIST_FOREACH(sd->regions.list, l, rg) { - if (rg->realized) - { - const Eina_List *ll; - E_Fm2_Icon *ic; + if (rg->realized) + { + const Eina_List *ll; + E_Fm2_Icon *ic; - EINA_LIST_FOREACH(rg->list, ll, ic) - { - if (ic->realized) - { - if (!_e_fm2_icon_visible(ic)) - { - e_thumb_icon_end(ic->obj_icon); - } - evas_object_move(ic->obj, - sd->x + ic->x - sd->pos.x, - sd->y + ic->y - sd->pos.y); - evas_object_resize(ic->obj, ic->w, ic->h); - _e_fm2_icon_thumb(ic, ic->obj_icon, 0); - } - } - } + EINA_LIST_FOREACH(rg->list, ll, ic) + { + if (ic->realized) + { + if (!_e_fm2_icon_visible(ic)) + { + e_thumb_icon_end(ic->obj_icon); + } + evas_object_move(ic->obj, + sd->x + ic->x - sd->pos.x, + sd->y + ic->y - sd->pos.y); + evas_object_resize(ic->obj, ic->w, ic->h); + _e_fm2_icon_thumb(ic, ic->obj_icon, 0); + } + } + } } edje_thaw(); evas_event_thaw(evas_object_evas_get(sd->obj)); @@ -7461,31 +7500,31 @@ _e_fm2_smart_add(Evas_Object *obj) sd->drop = edje_object_add(evas_object_evas_get(obj)); evas_object_clip_set(sd->drop, sd->clip); _e_fm2_theme_edje_object_set(sd, sd->drop, - "base/theme/fileman", - "list/drop_between"); + "base/theme/fileman", + "list/drop_between"); evas_object_smart_member_add(sd->drop, obj); evas_object_show(sd->drop); sd->drop_in = edje_object_add(evas_object_evas_get(obj)); evas_object_clip_set(sd->drop_in, sd->clip); _e_fm2_theme_edje_object_set(sd, sd->drop_in, - "base/theme/fileman", - "list/drop_in"); + "base/theme/fileman", + "list/drop_in"); evas_object_smart_member_add(sd->drop_in, obj); evas_object_show(sd->drop_in); sd->overlay = edje_object_add(evas_object_evas_get(obj)); evas_object_clip_set(sd->overlay, sd->clip); _e_fm2_theme_edje_object_set(sd, sd->overlay, - "base/theme/fileman", - "overlay"); + "base/theme/fileman", + "overlay"); evas_object_smart_member_add(sd->overlay, obj); evas_object_show(sd->overlay); sd->sel_rect = edje_object_add(evas_object_evas_get(obj)); evas_object_clip_set(sd->sel_rect, sd->clip); _e_fm2_theme_edje_object_set(sd, sd->sel_rect, "base/theme/fileman", - "rubberband"); + "rubberband"); evas_object_smart_member_add(sd->sel_rect, obj); evas_object_smart_data_set(obj, sd); @@ -7510,14 +7549,14 @@ _e_fm2_smart_del(Evas_Object *obj) _e_fm2_icons_free(obj); if (sd->menu) { - e_menu_post_deactivate_callback_set(sd->menu, NULL, NULL); - e_object_del(E_OBJECT(sd->menu)); - sd->menu = NULL; + e_menu_post_deactivate_callback_set(sd->menu, NULL, NULL); + e_object_del(E_OBJECT(sd->menu)); + sd->menu = NULL; } if (sd->entry_dialog) { - e_object_del(E_OBJECT(sd->entry_dialog)); - sd->entry_dialog = NULL; + e_object_del(E_OBJECT(sd->entry_dialog)); + sd->entry_dialog = NULL; } if (sd->image_dialog) { @@ -7536,8 +7575,8 @@ _e_fm2_smart_del(Evas_Object *obj) sd->dev = sd->path = sd->realpath = NULL; if (sd->mount) { - e_fm2_device_unmount(sd->mount); - sd->mount = NULL; + e_fm2_device_unmount(sd->mount); + sd->mount = NULL; } if (sd->config) _e_fm2_config_free(sd->config); @@ -7598,29 +7637,29 @@ _e_fm2_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) if ((_e_fm2_view_mode_get(sd) == E_FM2_VIEW_MODE_LIST) || (_e_fm2_view_mode_get(sd) == E_FM2_VIEW_MODE_GRID_ICONS)) { - if (wch) - { - if (sd->resize_job) ecore_job_del(sd->resize_job); - sd->resize_job = ecore_job_add(_e_fm2_cb_resize_job, obj); - } - else - { - if (sd->scroll_job) ecore_job_del(sd->scroll_job); - sd->scroll_job = ecore_job_add(_e_fm2_cb_scroll_job, obj); - } + if (wch) + { + if (sd->resize_job) ecore_job_del(sd->resize_job); + sd->resize_job = ecore_job_add(_e_fm2_cb_resize_job, obj); + } + else + { + if (sd->scroll_job) ecore_job_del(sd->scroll_job); + sd->scroll_job = ecore_job_add(_e_fm2_cb_scroll_job, obj); + } } else if (_e_fm2_view_mode_get(sd) == E_FM2_VIEW_MODE_CUSTOM_ICONS) { - if (sd->config->view.fit_custom_pos) - { - if (sd->resize_job) ecore_job_del(sd->resize_job); - sd->resize_job = ecore_job_add(_e_fm2_cb_resize_job, obj); - } - else - { - if (sd->scroll_job) ecore_job_del(sd->scroll_job); - sd->scroll_job = ecore_job_add(_e_fm2_cb_scroll_job, obj); - } + if (sd->config->view.fit_custom_pos) + { + if (sd->resize_job) ecore_job_del(sd->resize_job); + sd->resize_job = ecore_job_add(_e_fm2_cb_resize_job, obj); + } + else + { + if (sd->scroll_job) ecore_job_del(sd->scroll_job); + sd->scroll_job = ecore_job_add(_e_fm2_cb_scroll_job, obj); + } } if (sd->drop_handler) e_drop_handler_geometry_set(sd->drop_handler, sd->x, sd->y, sd->w, sd->h); @@ -7698,131 +7737,131 @@ _e_fm2_menu(Evas_Object *obj, unsigned int timestamp) sd->icon_menu.replace.func(sd->icon_menu.replace.data, sd->obj, mn, NULL); else { - if (sd->icon_menu.start.func) - { - sd->icon_menu.start.func(sd->icon_menu.start.data, sd->obj, mn, NULL); - mi = e_menu_item_new(mn); - e_menu_item_separator_set(mi, 1); - } - if ((!(sd->icon_menu.flags & E_FM2_MENU_NO_INHERIT_PARENT)) && - (sd->view_flags & E_FM2_VIEW_INHERIT_DIR_CUSTOM)) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Inherit parent settings")); - e_util_menu_item_theme_icon_set(mi, "view-inherit"); - e_menu_item_check_set(mi, 1); - e_menu_item_toggle_set(mi, sd->inherited_dir_props); - e_menu_item_callback_set(mi, _e_fm2_toggle_inherit_dir_props, sd); - } - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_VIEW_MENU)) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("View Mode")); - e_util_menu_item_theme_icon_set(mi, "preferences-look"); - e_menu_item_submenu_pre_callback_set(mi, _e_fm2_view_menu_pre, sd); - } - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_REFRESH)) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Refresh View")); - e_util_menu_item_theme_icon_set(mi, "view-refresh"); - e_menu_item_callback_set(mi, _e_fm2_refresh, sd); - } + if (sd->icon_menu.start.func) + { + sd->icon_menu.start.func(sd->icon_menu.start.data, sd->obj, mn, NULL); + mi = e_menu_item_new(mn); + e_menu_item_separator_set(mi, 1); + } + if ((!(sd->icon_menu.flags & E_FM2_MENU_NO_INHERIT_PARENT)) && + (sd->view_flags & E_FM2_VIEW_INHERIT_DIR_CUSTOM)) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Inherit parent settings")); + e_util_menu_item_theme_icon_set(mi, "view-inherit"); + e_menu_item_check_set(mi, 1); + e_menu_item_toggle_set(mi, sd->inherited_dir_props); + e_menu_item_callback_set(mi, _e_fm2_toggle_inherit_dir_props, sd); + } + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_VIEW_MENU)) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("View Mode")); + e_util_menu_item_theme_icon_set(mi, "preferences-look"); + e_menu_item_submenu_pre_callback_set(mi, _e_fm2_view_menu_pre, sd); + } + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_REFRESH)) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Refresh View")); + e_util_menu_item_theme_icon_set(mi, "view-refresh"); + e_menu_item_callback_set(mi, _e_fm2_refresh, sd); + } - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_SHOW_HIDDEN)) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Show Hidden Files")); - e_util_menu_item_theme_icon_set(mi,"view-refresh"); - e_menu_item_check_set(mi, 1); - e_menu_item_toggle_set(mi, sd->show_hidden_files); - e_menu_item_callback_set(mi, _e_fm2_toggle_hidden_files, sd); - } + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_SHOW_HIDDEN)) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Show Hidden Files")); + e_util_menu_item_theme_icon_set(mi,"view-refresh"); + e_menu_item_check_set(mi, 1); + e_menu_item_toggle_set(mi, sd->show_hidden_files); + e_menu_item_callback_set(mi, _e_fm2_toggle_hidden_files, sd); + } - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_REMEMBER_ORDERING)) - { - if (!sd->config->view.always_order) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Remember Ordering")); - e_util_menu_item_theme_icon_set(mi, "view-order"); - e_menu_item_check_set(mi, 1); - e_menu_item_toggle_set(mi, sd->order_file); - e_menu_item_callback_set(mi, _e_fm2_toggle_ordering, sd); - } - if ((sd->order_file) || (sd->config->view.always_order)) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Sort Now")); - e_util_menu_item_theme_icon_set(mi, "view-sort"); - e_menu_item_callback_set(mi, _e_fm2_sort, sd); - } - } + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_REMEMBER_ORDERING)) + { + if (!sd->config->view.always_order) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Remember Ordering")); + e_util_menu_item_theme_icon_set(mi, "view-order"); + e_menu_item_check_set(mi, 1); + e_menu_item_toggle_set(mi, sd->order_file); + e_menu_item_callback_set(mi, _e_fm2_toggle_ordering, sd); + } + if ((sd->order_file) || (sd->config->view.always_order)) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Sort Now")); + e_util_menu_item_theme_icon_set(mi, "view-sort"); + e_menu_item_callback_set(mi, _e_fm2_sort, sd); + } + } - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_NEW_DIRECTORY)) - { - mi = e_menu_item_new(mn); - e_menu_item_separator_set(mi, 1); + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_NEW_DIRECTORY)) + { + mi = e_menu_item_new(mn); + e_menu_item_separator_set(mi, 1); - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("New Directory")); - e_util_menu_item_theme_icon_set(mi, "folder-new"); - e_menu_item_callback_set(mi, _e_fm2_new_directory, sd); - } + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("New Directory")); + e_util_menu_item_theme_icon_set(mi, "folder-new"); + e_menu_item_callback_set(mi, _e_fm2_new_directory, sd); + } - if (((!(sd->icon_menu.flags & E_FM2_MENU_NO_PASTE)) || - (!(sd->icon_menu.flags & E_FM2_MENU_NO_SYMLINK))) && - (eina_list_count(_e_fm_file_buffer) > 0) && - ecore_file_can_write(sd->realpath)) - { - mi = e_menu_item_new(mn); - e_menu_item_separator_set(mi, 1); + if (((!(sd->icon_menu.flags & E_FM2_MENU_NO_PASTE)) || + (!(sd->icon_menu.flags & E_FM2_MENU_NO_SYMLINK))) && + (eina_list_count(_e_fm_file_buffer) > 0) && + ecore_file_can_write(sd->realpath)) + { + mi = e_menu_item_new(mn); + e_menu_item_separator_set(mi, 1); - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_PASTE)) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Paste")); - e_util_menu_item_theme_icon_set(mi, "edit-paste"); - e_menu_item_callback_set(mi, _e_fm2_file_paste_menu, sd); - } + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_PASTE)) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Paste")); + e_util_menu_item_theme_icon_set(mi, "edit-paste"); + e_menu_item_callback_set(mi, _e_fm2_file_paste_menu, sd); + } - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_SYMLINK)) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Link")); - e_util_menu_item_theme_icon_set(mi, "emblem-symbolic-link"); - e_menu_item_callback_set(mi, _e_fm2_file_symlink_menu, sd); - } - } + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_SYMLINK)) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Link")); + e_util_menu_item_theme_icon_set(mi, "emblem-symbolic-link"); + e_menu_item_callback_set(mi, _e_fm2_file_symlink_menu, sd); + } + } - if (sd->icon_menu.end.func) - sd->icon_menu.end.func(sd->icon_menu.end.data, sd->obj, mn, NULL); + if (sd->icon_menu.end.func) + sd->icon_menu.end.func(sd->icon_menu.end.data, sd->obj, mn, NULL); } man = e_manager_current_get(); if (!man) { - e_object_del(E_OBJECT(mn)); - return; + e_object_del(E_OBJECT(mn)); + return; } con = e_container_current_get(man); if (!con) { - e_object_del(E_OBJECT(mn)); - return; + e_object_del(E_OBJECT(mn)); + return; } ecore_x_pointer_xy_get(con->win, &x, &y); zone = e_util_zone_current_get(man); if (!zone) { - e_object_del(E_OBJECT(mn)); - return; + e_object_del(E_OBJECT(mn)); + return; } sd->menu = mn; e_menu_post_deactivate_callback_set(mn, _e_fm2_menu_post_cb, sd); e_menu_activate_mouse(mn, zone, - x, y, 1, 1, - E_MENU_POP_DIRECTION_DOWN, timestamp); + x, y, 1, 1, + E_MENU_POP_DIRECTION_DOWN, timestamp); } static void @@ -7857,201 +7896,202 @@ _e_fm2_icon_menu(E_Fm2_Icon *ic, Evas_Object *obj, unsigned int timestamp) sd->icon_menu.replace.func(sd->icon_menu.replace.data, sd->obj, mn, NULL); else { - if (sd->icon_menu.start.func) - { - sd->icon_menu.start.func(sd->icon_menu.start.data, sd->obj, mn, NULL); - mi = e_menu_item_new(mn); - e_menu_item_separator_set(mi, 1); - } + if (sd->icon_menu.start.func) + { + sd->icon_menu.start.func(sd->icon_menu.start.data, sd->obj, mn, NULL); + mi = e_menu_item_new(mn); + e_menu_item_separator_set(mi, 1); + } - if ((!(sd->icon_menu.flags & E_FM2_MENU_NO_INHERIT_PARENT)) && - (sd->view_flags & E_FM2_VIEW_INHERIT_DIR_CUSTOM)) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Inherit parent settings")); - e_util_menu_item_theme_icon_set(mi, "view-inherit"); - e_menu_item_check_set(mi, 1); - e_menu_item_toggle_set(mi, sd->inherited_dir_props); - e_menu_item_callback_set(mi, _e_fm2_toggle_inherit_dir_props, sd); - } - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_VIEW_MENU)) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("View Mode")); - e_util_menu_item_theme_icon_set(mi, "preferences-look"); - e_menu_item_submenu_pre_callback_set(mi, _e_fm2_icon_view_menu_pre, sd); - } - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_REFRESH)) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Refresh View")); - e_util_menu_item_theme_icon_set(mi, "view-refresh"); - e_menu_item_callback_set(mi, _e_fm2_refresh, sd); - } + if ((!(sd->icon_menu.flags & E_FM2_MENU_NO_INHERIT_PARENT)) && + (sd->view_flags & E_FM2_VIEW_INHERIT_DIR_CUSTOM)) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Inherit parent settings")); + e_util_menu_item_theme_icon_set(mi, "view-inherit"); + e_menu_item_check_set(mi, 1); + e_menu_item_toggle_set(mi, sd->inherited_dir_props); + e_menu_item_callback_set(mi, _e_fm2_toggle_inherit_dir_props, sd); + } + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_VIEW_MENU)) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("View Mode")); + e_util_menu_item_theme_icon_set(mi, "preferences-look"); + e_menu_item_submenu_pre_callback_set(mi, _e_fm2_icon_view_menu_pre, sd); + } + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_REFRESH)) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Refresh View")); + e_util_menu_item_theme_icon_set(mi, "view-refresh"); + e_menu_item_callback_set(mi, _e_fm2_refresh, sd); + } - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_SHOW_HIDDEN)) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Show Hidden Files")); - e_util_menu_item_theme_icon_set(mi, "view-hidden-files"); - e_menu_item_check_set(mi, 1); - e_menu_item_toggle_set(mi, sd->show_hidden_files); - e_menu_item_callback_set(mi, _e_fm2_toggle_hidden_files, sd); - } + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_SHOW_HIDDEN)) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Show Hidden Files")); + e_util_menu_item_theme_icon_set(mi, "view-hidden-files"); + e_menu_item_check_set(mi, 1); + e_menu_item_toggle_set(mi, sd->show_hidden_files); + e_menu_item_callback_set(mi, _e_fm2_toggle_hidden_files, sd); + } - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_REMEMBER_ORDERING)) - { - if (!sd->config->view.always_order) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Remember Ordering")); - e_util_menu_item_theme_icon_set(mi, "view-order"); - e_menu_item_check_set(mi, 1); - e_menu_item_toggle_set(mi, sd->order_file); - e_menu_item_callback_set(mi, _e_fm2_toggle_ordering, sd); - } - if ((sd->order_file) || (sd->config->view.always_order)) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Sort Now")); - e_util_menu_item_theme_icon_set(mi, "view-sort"); - e_menu_item_callback_set(mi, _e_fm2_sort, sd); - } - } + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_REMEMBER_ORDERING)) + { + if (!sd->config->view.always_order) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Remember Ordering")); + e_util_menu_item_theme_icon_set(mi, "view-order"); + e_menu_item_check_set(mi, 1); + e_menu_item_toggle_set(mi, sd->order_file); + e_menu_item_callback_set(mi, _e_fm2_toggle_ordering, sd); + } + if ((sd->order_file) || (sd->config->view.always_order)) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Sort Now")); + e_util_menu_item_theme_icon_set(mi, "view-sort"); + e_menu_item_callback_set(mi, _e_fm2_sort, sd); + } + } - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_NEW_DIRECTORY)) - { - /* FIXME: stat the dir itself - move to e_fm_main */ - if (ecore_file_can_write(sd->realpath)) - { - mi = e_menu_item_new(mn); - e_menu_item_separator_set(mi, 1); + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_NEW_DIRECTORY)) + { + /* FIXME: stat the dir itself - move to e_fm_main */ + if (ecore_file_can_write(sd->realpath)) + { + mi = e_menu_item_new(mn); + e_menu_item_separator_set(mi, 1); - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("New Directory")); - e_util_menu_item_theme_icon_set(mi, "folder-new"); - e_menu_item_callback_set(mi, _e_fm2_new_directory, sd); - } - } - if (!ic->info.removable) { - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_CUT)) - { - if (ecore_file_can_write(sd->realpath)) - { - mi = e_menu_item_new(mn); - e_menu_item_separator_set(mi, 1); + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("New Directory")); + e_util_menu_item_theme_icon_set(mi, "folder-new"); + e_menu_item_callback_set(mi, _e_fm2_new_directory, sd); + } + } + if (!ic->info.removable) + { + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_CUT)) + { + if (ecore_file_can_write(sd->realpath)) + { + mi = e_menu_item_new(mn); + e_menu_item_separator_set(mi, 1); - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Cut")); - e_util_menu_item_theme_icon_set(mi, "edit-cut"); - e_menu_item_callback_set(mi, _e_fm2_file_cut_menu, sd); - } - } - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_COPY)) - { - if (!ecore_file_can_write(sd->realpath)) - { - mi = e_menu_item_new(mn); - e_menu_item_separator_set(mi, 1); - } + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Cut")); + e_util_menu_item_theme_icon_set(mi, "edit-cut"); + e_menu_item_callback_set(mi, _e_fm2_file_cut_menu, sd); + } + } + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_COPY)) + { + if (!ecore_file_can_write(sd->realpath)) + { + mi = e_menu_item_new(mn); + e_menu_item_separator_set(mi, 1); + } - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Copy")); - e_util_menu_item_theme_icon_set(mi, "edit-copy"); - e_menu_item_callback_set(mi, _e_fm2_file_copy_menu, sd); - } + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Copy")); + e_util_menu_item_theme_icon_set(mi, "edit-copy"); + e_menu_item_callback_set(mi, _e_fm2_file_copy_menu, sd); + } - if (((!(sd->icon_menu.flags & E_FM2_MENU_NO_PASTE)) || - (!(sd->icon_menu.flags & E_FM2_MENU_NO_SYMLINK))) && - (eina_list_count(_e_fm_file_buffer) > 0) && - ecore_file_can_write(sd->realpath)) - { - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_PASTE)) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Paste")); - e_util_menu_item_theme_icon_set(mi, "edit-paste"); - e_menu_item_callback_set(mi, _e_fm2_file_paste_menu, sd); - } + if (((!(sd->icon_menu.flags & E_FM2_MENU_NO_PASTE)) || + (!(sd->icon_menu.flags & E_FM2_MENU_NO_SYMLINK))) && + (eina_list_count(_e_fm_file_buffer) > 0) && + ecore_file_can_write(sd->realpath)) + { + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_PASTE)) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Paste")); + e_util_menu_item_theme_icon_set(mi, "edit-paste"); + e_menu_item_callback_set(mi, _e_fm2_file_paste_menu, sd); + } - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_SYMLINK)) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Link")); - e_util_menu_item_theme_icon_set(mi, "emblem-symbolic-link"); - e_menu_item_callback_set(mi, _e_fm2_file_symlink_menu, sd); - } - } - } - - can_w2 = 1; - if (ic->sd->order_file) - { - snprintf(buf, sizeof(buf), "%s/.order", sd->realpath); - /* FIXME: stat the .order itself - move to e_fm_main */ + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_SYMLINK)) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Link")); + e_util_menu_item_theme_icon_set(mi, "emblem-symbolic-link"); + e_menu_item_callback_set(mi, _e_fm2_file_symlink_menu, sd); + } + } + } + + can_w2 = 1; + if (ic->sd->order_file) + { + snprintf(buf, sizeof(buf), "%s/.order", sd->realpath); + /* FIXME: stat the .order itself - move to e_fm_main */ // can_w2 = ecore_file_can_write(buf); - } - if (ic->info.link) - { - can_w = 1; + } + if (ic->info.link) + { + can_w = 1; /* struct stat st; - if (_e_fm2_icon_realpath(ic, buf, sizeof(buf)) && - (lstat(buf, &st) == 0)) - { - if (st.st_uid == getuid()) - { - if (st.st_mode & S_IWUSR) can_w = 1; - } - else if (st.st_gid == getgid()) - { - if (st.st_mode & S_IWGRP) can_w = 1; - } - else - { - if (st.st_mode & S_IWOTH) can_w = 1; - } - } -*/ } - else - can_w = 1; + if (_e_fm2_icon_realpath(ic, buf, sizeof(buf)) && + (lstat(buf, &st) == 0)) + { + if (st.st_uid == getuid()) + { + if (st.st_mode & S_IWUSR) can_w = 1; + } + else if (st.st_gid == getgid()) + { + if (st.st_mode & S_IWGRP) can_w = 1; + } + else + { + if (st.st_mode & S_IWOTH) can_w = 1; + } + } + */ } + else + can_w = 1; - sel = e_fm2_selected_list_get(ic->sd->obj); - if ((!sel) || eina_list_count(sel) == 1) - { - _e_fm2_icon_realpath(ic, buf, sizeof(buf)); - protect = e_filereg_file_protected(buf); - } - else - protect = 0; - eina_list_free(sel); + sel = e_fm2_selected_list_get(ic->sd->obj); + if ((!sel) || eina_list_count(sel) == 1) + { + _e_fm2_icon_realpath(ic, buf, sizeof(buf)); + protect = e_filereg_file_protected(buf); + } + else + protect = 0; + eina_list_free(sel); - if ((can_w) && (can_w2) && !(protect) && !ic->info.removable) - { - mi = e_menu_item_new(mn); - e_menu_item_separator_set(mi, 1); + if ((can_w) && (can_w2) && !(protect) && !ic->info.removable) + { + mi = e_menu_item_new(mn); + e_menu_item_separator_set(mi, 1); - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_DELETE)) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Delete")); - e_util_menu_item_theme_icon_set(mi, "edit-delete"); - e_menu_item_callback_set(mi, _e_fm2_file_delete_menu, ic); - } + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_DELETE)) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Delete")); + e_util_menu_item_theme_icon_set(mi, "edit-delete"); + e_menu_item_callback_set(mi, _e_fm2_file_delete_menu, ic); + } - if (!(sd->icon_menu.flags & E_FM2_MENU_NO_RENAME)) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Rename")); - e_util_menu_item_theme_icon_set(mi, "edit-rename"); - e_menu_item_callback_set(mi, _e_fm2_file_rename, ic); - } - } + if (!(sd->icon_menu.flags & E_FM2_MENU_NO_RENAME)) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Rename")); + e_util_menu_item_theme_icon_set(mi, "edit-rename"); + e_menu_item_callback_set(mi, _e_fm2_file_rename, ic); + } + } + + if (ic->info.removable) + { + E_Volume *v; - if (ic->info.removable) - { - E_Volume *v; - v = e_fm2_device_volume_find(ic->info.link); if (v) { @@ -8069,7 +8109,7 @@ _e_fm2_icon_menu(E_Fm2_Icon *ic, Evas_Object *obj, unsigned int timestamp) e_menu_item_label_set(mi, _("Mount")); e_menu_item_callback_set(mi, _e_fm2_volume_mount, v); } - + mi = e_menu_item_new(mn); e_menu_item_label_set(mi, _("Eject")); e_util_menu_item_theme_icon_set(mi, "media-eject"); @@ -8078,74 +8118,74 @@ _e_fm2_icon_menu(E_Fm2_Icon *ic, Evas_Object *obj, unsigned int timestamp) mi = e_menu_item_new(mn); e_menu_item_separator_set(mi, 1); } - } + } - if (!strcmp(ic->info.mime, "application/x-desktop")) - { - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Application Properties")); - e_util_menu_item_theme_icon_set(mi, "configure"); - e_menu_item_callback_set(mi, _e_fm2_file_application_properties, ic); - } - - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("File Properties")); - e_util_menu_item_theme_icon_set(mi, "document-properties"); - e_menu_item_callback_set(mi, _e_fm2_file_properties, ic); + if (!strcmp(ic->info.mime, "application/x-desktop")) + { + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Application Properties")); + e_util_menu_item_theme_icon_set(mi, "configure"); + e_menu_item_callback_set(mi, _e_fm2_file_application_properties, ic); + } - if (ic->info.mime) - { - /* see if we have any mime handlers registered for this file */ - l = e_fm2_mime_handler_mime_handlers_get(ic->info.mime); - if (l) - { - _e_fm2_icon_realpath(ic, buf, sizeof(buf)); - _e_fm2_context_menu_append(obj, buf, l, mn, ic); - } - } + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("File Properties")); + e_util_menu_item_theme_icon_set(mi, "document-properties"); + e_menu_item_callback_set(mi, _e_fm2_file_properties, ic); - /* see if we have any glob handlers registered for this file */ - ext = strrchr(ic->info.file, '.'); - if (ext) - { - snprintf(buf, sizeof(buf), "*%s", ext); - l = e_fm2_mime_handler_glob_handlers_get(buf); - if (l) - { - _e_fm2_icon_realpath(ic, buf, sizeof(buf)); - _e_fm2_context_menu_append(obj, buf, l, mn, ic); - eina_list_free(l); - } - } + if (ic->info.mime) + { + /* see if we have any mime handlers registered for this file */ + l = e_fm2_mime_handler_mime_handlers_get(ic->info.mime); + if (l) + { + _e_fm2_icon_realpath(ic, buf, sizeof(buf)); + _e_fm2_context_menu_append(obj, buf, l, mn, ic); + } + } - if (sd->icon_menu.end.func) - sd->icon_menu.end.func(sd->icon_menu.end.data, sd->obj, mn, &(ic->info)); + /* see if we have any glob handlers registered for this file */ + ext = strrchr(ic->info.file, '.'); + if (ext) + { + snprintf(buf, sizeof(buf), "*%s", ext); + l = e_fm2_mime_handler_glob_handlers_get(buf); + if (l) + { + _e_fm2_icon_realpath(ic, buf, sizeof(buf)); + _e_fm2_context_menu_append(obj, buf, l, mn, ic); + eina_list_free(l); + } + } + + if (sd->icon_menu.end.func) + sd->icon_menu.end.func(sd->icon_menu.end.data, sd->obj, mn, &(ic->info)); } man = e_manager_current_get(); if (!man) { - e_object_del(E_OBJECT(mn)); - return; + e_object_del(E_OBJECT(mn)); + return; } con = e_container_current_get(man); if (!con) { - e_object_del(E_OBJECT(mn)); - return; + e_object_del(E_OBJECT(mn)); + return; } ecore_x_pointer_xy_get(con->win, &x, &y); zone = e_util_zone_current_get(man); if (!zone) { - e_object_del(E_OBJECT(mn)); - return; + e_object_del(E_OBJECT(mn)); + return; } ic->menu = mn; e_menu_post_deactivate_callback_set(mn, _e_fm2_icon_menu_post_cb, ic); e_menu_activate_mouse(mn, zone, - x, y, 1, 1, - E_MENU_POP_DIRECTION_DOWN, timestamp); + x, y, 1, 1, + E_MENU_POP_DIRECTION_DOWN, timestamp); } static inline void @@ -8160,31 +8200,31 @@ _e_fm2_context_menu_append(Evas_Object *obj, const char *path, Eina_List *l, E_M EINA_LIST_FOREACH(l, ll, handler) { - E_Fm2_Context_Menu_Data *md = NULL; - E_Menu_Item *mi; + E_Fm2_Context_Menu_Data *md = NULL; + E_Menu_Item *mi; - if ((!handler) || (!e_fm2_mime_handler_test(handler, obj, path)) || - (!handler->label)) continue; - if (ll == l) - { - /* only append the separator if this is the first item */ - /* we do this in here because we dont want to add a separator - * when we have no context entries */ - mi = e_menu_item_new(mn); - e_menu_item_separator_set(mi, 1); - } + if ((!handler) || (!e_fm2_mime_handler_test(handler, obj, path)) || + (!handler->label)) continue; + if (ll == l) + { + /* only append the separator if this is the first item */ + /* we do this in here because we dont want to add a separator + * when we have no context entries */ + mi = e_menu_item_new(mn); + e_menu_item_separator_set(mi, 1); + } - md = E_NEW(E_Fm2_Context_Menu_Data, 1); - if (!md) continue; - md->icon = ic; - md->handler = handler; - _e_fm2_menu_contexts = eina_list_append(_e_fm2_menu_contexts, md); + md = E_NEW(E_Fm2_Context_Menu_Data, 1); + if (!md) continue; + md->icon = ic; + md->handler = handler; + _e_fm2_menu_contexts = eina_list_append(_e_fm2_menu_contexts, md); - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, handler->label); - if (handler->icon_group) - e_util_menu_item_theme_icon_set(mi, handler->icon_group); - e_menu_item_callback_set(mi, _e_fm2_icon_menu_item_cb, md); + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, handler->label); + if (handler->icon_group) + e_util_menu_item_theme_icon_set(mi, handler->icon_group); + e_menu_item_callback_set(mi, _e_fm2_icon_menu_item_cb, md); } } @@ -8211,7 +8251,7 @@ _e_fm2_icon_menu_post_cb(void *data, E_Menu *m __UNUSED__) ic = data; ic->menu = NULL; EINA_LIST_FREE(_e_fm2_menu_contexts, md) - E_FREE(md); + E_FREE(md); } static void @@ -8225,7 +8265,7 @@ _e_fm2_icon_menu_item_cb(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNU if (!md) return; obj = md->icon->info.fm; if (!obj) return; - snprintf(buf, sizeof(buf), "%s/%s", + snprintf(buf, sizeof(buf), "%s/%s", e_fm2_real_path_get(obj), md->icon->info.file); e_fm2_mime_handler_call(md->handler, obj, buf); } @@ -8282,10 +8322,10 @@ _e_fm2_view_menu_icon_size_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi { E_Fm2_Smart_Data *sd = data; E_Menu *subm; - const short *itr, sizes[] = - { - 22, 32, 48, 64, 96, 128, 256, -1 - }; + const short *itr, sizes[] = + { + 22, 32, 48, 64, 96, 128, 256, -1 + }; short current_size = _e_fm2_icon_w_get(sd); if (e_scale > 0.0) @@ -8296,30 +8336,30 @@ _e_fm2_view_menu_icon_size_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi for (itr = sizes; *itr > -1; itr++) { - char buf[32]; - struct e_fm2_view_menu_icon_size_data *d; + char buf[32]; + struct e_fm2_view_menu_icon_size_data *d; - d = malloc(sizeof(*d)); - if (!d) - continue; - d->sd = sd; - d->size = *itr; + d = malloc(sizeof(*d)); + if (!d) + continue; + d->sd = sd; + d->size = *itr; - snprintf(buf, sizeof(buf), "%hd", *itr); + snprintf(buf, sizeof(buf), "%hd", *itr); - mi = e_menu_item_new(subm); - e_object_data_set(E_OBJECT(mi), d); - e_object_del_attach_func_set - (E_OBJECT(mi), _e_fm2_view_menu_icon_size_data_free); + mi = e_menu_item_new(subm); + e_object_data_set(E_OBJECT(mi), d); + e_object_del_attach_func_set + (E_OBJECT(mi), _e_fm2_view_menu_icon_size_data_free); - e_menu_item_label_set(mi, buf); - e_menu_item_radio_group_set(mi, 1); - e_menu_item_radio_set(mi, 1); + e_menu_item_label_set(mi, buf); + e_menu_item_radio_group_set(mi, 1); + e_menu_item_radio_set(mi, 1); - if (current_size == *itr) - e_menu_item_toggle_set(mi, 1); + if (current_size == *itr) + e_menu_item_toggle_set(mi, 1); - e_menu_item_callback_set(mi, _e_fm2_view_menu_icon_size_change, d); + e_menu_item_callback_set(mi, _e_fm2_view_menu_icon_size_change, d); } mi = e_menu_item_new(subm); @@ -8399,7 +8439,7 @@ _e_fm2_view_menu_common(E_Menu *subm, E_Fm2_Smart_Data *sd) e_menu_item_label_set(mi, buf); e_menu_item_submenu_pre_callback_set(mi, _e_fm2_view_menu_icon_size_pre, sd); } - + static void _e_fm2_icon_view_menu_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi) { @@ -8431,18 +8471,18 @@ _e_fm2_view_menu_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi) _e_fm2_view_menu_common(subm, sd); snprintf(buf, sizeof(buf), "%s/.directory.desktop", sd->realpath); - access_ok = ecore_file_exists(buf) ? ecore_file_can_write(buf) - : ecore_file_can_write(sd->realpath); + access_ok = ecore_file_exists(buf) ? ecore_file_can_write(buf) + : ecore_file_can_write(sd->realpath); if (access_ok) { mi = e_menu_item_new(subm); e_menu_item_separator_set(mi, 1); - + mi = e_menu_item_new(subm); e_menu_item_label_set(mi, _("Set background...")); e_util_menu_item_theme_icon_set(mi, "preferences-desktop-wallpaper"); e_menu_item_callback_set(mi, _e_fm2_view_menu_set_background_cb, sd); - + mi = e_menu_item_new(subm); e_menu_item_label_set(mi, _("Set overlay...")); e_menu_item_callback_set(mi, _e_fm2_view_menu_set_overlay_cb, sd); @@ -8517,16 +8557,16 @@ _e_fm2_view_menu_use_default_cb(void *data, E_Menu *m, E_Menu_Item *mi) } static void -_e_fm2_view_image_sel(E_Fm2_Smart_Data *sd, const char *title, - void (*ok_cb) (void *data, E_Dialog *dia), - void (*clear_cb) (void *data, E_Dialog *dia)) +_e_fm2_view_image_sel(E_Fm2_Smart_Data *sd, const char *title, + void (*ok_cb)(void *data, E_Dialog *dia), + void (*clear_cb)(void *data, E_Dialog *dia)) { E_Manager *man; E_Container *con; E_Dialog *dia; Evas_Object *o; Evas_Coord w, h; - + man = e_manager_current_get(); if (!man) return; con = e_container_current_get(man); @@ -8535,7 +8575,7 @@ _e_fm2_view_image_sel(E_Fm2_Smart_Data *sd, const char *title, dia = e_dialog_new(con, "E", "_fm2_view_image_select_dialog"); if (!dia) return; e_dialog_title_set(dia, title); - + o = e_widget_fsel_add(dia->win->evas, "/", sd->realpath, NULL, NULL, NULL, sd, NULL, sd, 1); evas_object_show(o); e_widget_size_min_get(o, &w, &h); @@ -8556,7 +8596,7 @@ static void _e_fm2_view_image_sel_close(void *data, E_Dialog *dia) { E_Fm2_Smart_Data *sd; - + sd = data; e_object_del(E_OBJECT(dia)); sd->image_dialog = NULL; @@ -8568,7 +8608,7 @@ _custom_file_key_set(E_Fm2_Smart_Data *sd, const char *key, const char *value) Efreet_Desktop *ef; char buf[PATH_MAX]; int len; - + snprintf(buf, sizeof(buf), "%s/.directory.desktop", sd->realpath); ef = efreet_desktop_new(buf); if (!ef) @@ -8578,13 +8618,13 @@ _custom_file_key_set(E_Fm2_Smart_Data *sd, const char *key, const char *value) ef->type = EFREET_DESKTOP_TYPE_DIRECTORY; ef->name = strdup("Directory look and feel"); } - + len = strlen(sd->realpath); if (!strncmp(value, sd->realpath, len)) - efreet_desktop_x_field_set(ef, key, value + len + 1); + efreet_desktop_x_field_set(ef, key, value + len + 1); else - efreet_desktop_x_field_set(ef, key, value); - + efreet_desktop_x_field_set(ef, key, value); + efreet_desktop_save(ef); efreet_desktop_free(ef); } @@ -8598,41 +8638,41 @@ _custom_file_key_del(E_Fm2_Smart_Data *sd, const char *key) snprintf(buf, sizeof(buf), "%s/.directory.desktop", sd->realpath); ef = efreet_desktop_new(buf); if (!ef) return; - + if (efreet_desktop_x_field_del(ef, key)) - efreet_desktop_save(ef); - + efreet_desktop_save(ef); + efreet_desktop_free(ef); } static void _set_background_cb(void *data, E_Dialog *dia) { - E_Fm2_Smart_Data *sd; - const char *file; - - sd = data; - if (!sd) return; - - file = e_widget_fsel_selection_path_get(dia->data); + E_Fm2_Smart_Data *sd; + const char *file; - if (file) + sd = data; + if (!sd) return; + + file = e_widget_fsel_selection_path_get(dia->data); + + if (file) _custom_file_key_set(sd, "X-Enlightenment-Directory-Wallpaper", file); - - _e_fm2_view_image_sel_close(data, dia); - evas_object_smart_callback_call(sd->obj, "dir_changed", NULL); + + _e_fm2_view_image_sel_close(data, dia); + evas_object_smart_callback_call(sd->obj, "dir_changed", NULL); } static void _clear_background_cb(void *data, E_Dialog *dia) { E_Fm2_Smart_Data *sd; - + sd = data; if (!sd) return; - + _e_fm2_view_image_sel_close(data, dia); - + _custom_file_key_del(sd, "X-Enlightenment-Directory-Wallpaper"); evas_object_smart_callback_call(sd->obj, "dir_changed", NULL); } @@ -8645,36 +8685,36 @@ _e_fm2_view_menu_set_background_cb(void *data, E_Menu *m __UNUSED__, E_Menu_Item sd = data; if (sd->image_dialog) return; - _e_fm2_view_image_sel(sd, _("Set background..."), _set_background_cb, + _e_fm2_view_image_sel(sd, _("Set background..."), _set_background_cb, _clear_background_cb); } static void _set_overlay_cb(void *data, E_Dialog *dia) { - E_Fm2_Smart_Data *sd; - const char *file; - - sd = data; - if (!sd) return; - - file = e_widget_fsel_selection_path_get(dia->data); + E_Fm2_Smart_Data *sd; + const char *file; - if (file) + sd = data; + if (!sd) return; + + file = e_widget_fsel_selection_path_get(dia->data); + + if (file) _custom_file_key_set(sd, "X-Enlightenment-Directory-Overlay", file); - _e_fm2_view_image_sel_close(data, dia); - evas_object_smart_callback_call(sd->obj, "dir_changed", NULL); + _e_fm2_view_image_sel_close(data, dia); + evas_object_smart_callback_call(sd->obj, "dir_changed", NULL); } static void _clear_overlay_cb(void *data, E_Dialog *dia) { E_Fm2_Smart_Data *sd; - + sd = data; if (!sd) return; - + _e_fm2_view_image_sel_close(data, dia); _custom_file_key_del(sd, "X-Enlightenment-Directory-Overlay"); @@ -8688,8 +8728,8 @@ _e_fm2_view_menu_set_overlay_cb(void *data, E_Menu *m __UNUSED__, E_Menu_Item *m sd = data; if (sd->image_dialog) return; - - _e_fm2_view_image_sel(sd, _("Set overlay..."), _set_overlay_cb, + + _e_fm2_view_image_sel(sd, _("Set overlay..."), _set_overlay_cb, _clear_overlay_cb); } @@ -8727,17 +8767,17 @@ _e_fm2_toggle_ordering(void *data, E_Menu *m, E_Menu_Item *mi) sd = data; if (sd->order_file) { - snprintf(buf, sizeof(buf), "%s/.order", sd->realpath); - /* FIXME: move to e_fm_main */ - ecore_file_unlink(buf); + snprintf(buf, sizeof(buf), "%s/.order", sd->realpath); + /* FIXME: move to e_fm_main */ + ecore_file_unlink(buf); } else { - FILE *f; + FILE *f; - snprintf(buf, sizeof(buf), "%s/.order", sd->realpath); - f = fopen(buf, "w"); - if (f) fclose(f); + snprintf(buf, sizeof(buf), "%s/.order", sd->realpath); + f = fopen(buf, "w"); + if (f) fclose(f); } sd->inherited_dir_props = EINA_FALSE; _e_fm2_refresh(data, m, mi); @@ -8750,7 +8790,7 @@ _e_fm2_sort(void *data, E_Menu *m, E_Menu_Item *mi) sd = data; sd->icons = eina_list_sort(sd->icons, eina_list_count(sd->icons), - _e_fm2_cb_icon_sort); + _e_fm2_cb_icon_sort); _e_fm2_refresh(data, m, mi); } @@ -8770,10 +8810,10 @@ _e_fm2_new_directory(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED_ if (!con) return; sd->entry_dialog = e_entry_dialog_show(_("Create a new Directory"), "folder", - _("New Directory Name:"), - "", NULL, NULL, - _e_fm2_new_directory_yes_cb, - _e_fm2_new_directory_no_cb, sd); + _("New Directory Name:"), + "", NULL, NULL, + _e_fm2_new_directory_yes_cb, + _e_fm2_new_directory_no_cb, sd); E_OBJECT(sd->entry_dialog)->data = sd; e_object_del_attach_func_set(E_OBJECT(sd->entry_dialog), _e_fm2_new_directory_delete_cb); } @@ -8797,9 +8837,9 @@ _e_fm2_new_directory_yes_cb(char *text, void *data) sd->entry_dialog = NULL; if ((text) && (text[0])) { - snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, text); + snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, text); - _e_fm2_client_file_mkdir(buf, "", 0, 0, 0, sd->w, sd->h, sd->obj); + _e_fm2_client_file_mkdir(buf, "", 0, 0, 0, sd->w, sd->h, sd->obj); } } @@ -8824,28 +8864,28 @@ _e_fm2_file_rename(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) if (!_e_fm2_icon_entry_widget_add(ic)) { snprintf(text, PATH_MAX + 256, - _("Rename %s to:"), - ic->info.file); + _("Rename %s to:"), + ic->info.file); ic->entry_dialog = e_entry_dialog_show(_("Rename File"), "edit-rename", - text, ic->info.file, NULL, NULL, - _e_fm2_file_rename_yes_cb, - _e_fm2_file_rename_no_cb, ic); + text, ic->info.file, NULL, NULL, + _e_fm2_file_rename_yes_cb, + _e_fm2_file_rename_no_cb, ic); E_OBJECT(ic->entry_dialog)->data = ic; - e_object_del_attach_func_set(E_OBJECT(ic->entry_dialog), + e_object_del_attach_func_set(E_OBJECT(ic->entry_dialog), _e_fm2_file_rename_delete_cb); } } -static Evas_Object* +static Evas_Object * _e_fm2_icon_entry_widget_add(E_Fm2_Icon *ic) { Evas_Object *eo; if (ic->sd->iop_icon) - _e_fm2_icon_entry_widget_accept(ic->sd->iop_icon); + _e_fm2_icon_entry_widget_accept(ic->sd->iop_icon); if (!edje_object_part_exists(ic->obj, "e.swallow.entry")) - return NULL; + return NULL; ic->entry_widget = e_widget_entry_add(evas_object_evas_get(ic->obj), NULL, NULL, NULL, NULL); @@ -8882,9 +8922,9 @@ _e_fm2_icon_entry_widget_cb_key_down(void *data, Evas *e __UNUSED__, Evas_Object ic = data; if (!strcmp(ev->key, "Escape")) - _e_fm2_icon_entry_widget_del(ic); + _e_fm2_icon_entry_widget_del(ic); else if (!strcmp(ev->key, "Return")) - _e_fm2_icon_entry_widget_accept(ic); + _e_fm2_icon_entry_widget_accept(ic); } static void @@ -8947,7 +8987,7 @@ _e_fm2_file_do_rename(const char *text, E_Fm2_Icon *ic) } } -static E_Dialog* +static E_Dialog * _e_fm_retry_abort_dialog(int pid, const char *str) { E_Manager *man; @@ -8974,8 +9014,8 @@ _e_fm_retry_abort_dialog(int pid, const char *str) e_dialog_title_set(dialog, _("Error")); e_dialog_icon_set(dialog, "dialog-error", 64); snprintf(text, sizeof(text), - _("%s"), - str); + _("%s"), + str); e_dialog_text_set(dialog, text); e_win_centered_set(dialog->win, 1); @@ -8983,14 +9023,14 @@ _e_fm_retry_abort_dialog(int pid, const char *str) return dialog; } -static void +static void _e_fm_retry_abort_delete_cb(void *obj) { int *id = E_OBJECT(obj)->data; free(id); } -static void +static void _e_fm_retry_abort_retry_cb(void *data __UNUSED__, E_Dialog *dialog) { int *id = E_OBJECT(dialog)->data; @@ -8999,7 +9039,7 @@ _e_fm_retry_abort_retry_cb(void *data __UNUSED__, E_Dialog *dialog) e_object_del(E_OBJECT(dialog)); } -static void +static void _e_fm_retry_abort_abort_cb(void *data __UNUSED__, E_Dialog *dialog) { int *id = E_OBJECT(dialog)->data; @@ -9008,7 +9048,7 @@ _e_fm_retry_abort_abort_cb(void *data __UNUSED__, E_Dialog *dialog) e_object_del(E_OBJECT(dialog)); } -static E_Dialog* +static E_Dialog * _e_fm_overwrite_dialog(int pid, const char *str) { E_Manager *man; @@ -9037,7 +9077,7 @@ _e_fm_overwrite_dialog(int pid, const char *str) e_dialog_title_set(dialog, _("Warning")); e_dialog_icon_set(dialog, "dialog-warning", 64); snprintf(text, sizeof(text), - _("File already exists, overwrite?
%s"), str); + _("File already exists, overwrite?
%s"), str); e_dialog_text_set(dialog, text); e_win_centered_set(dialog->win, 1); @@ -9088,7 +9128,7 @@ _e_fm_overwrite_yes_all_cb(void *data __UNUSED__, E_Dialog *dialog) e_object_del(E_OBJECT(dialog)); } -static E_Dialog* +static E_Dialog * _e_fm_error_dialog(int pid, const char *str) { E_Manager *man; @@ -9116,9 +9156,9 @@ _e_fm_error_dialog(int pid, const char *str) e_dialog_button_focus_num(dialog, 0); e_dialog_title_set(dialog, _("Error")); snprintf(text, sizeof(text), - _("An error occurred while performing an operation.
" - "%s"), - str); + _("An error occurred while performing an operation.
" + "%s"), + str); e_dialog_text_set(dialog, text); e_win_centered_set(dialog->win, 1); @@ -9187,7 +9227,7 @@ _e_fm_device_error_dialog(const char *title, const char *msg, const char *pstr) e_dialog_title_set(dialog, title); e_dialog_icon_set(dialog, "drive-harddisk", 64); e_dialog_button_add(dialog, _("OK"), NULL, NULL, NULL); - + u = pstr; pstr += strlen(pstr) + 1; d = pstr; @@ -9292,17 +9332,17 @@ _e_fm2_file_delete(Evas_Object *obj) sel = e_fm2_selected_list_get(obj); if ((!sel) || (eina_list_count(sel) == 1)) snprintf(text, sizeof(text), - _("Are you sure you want to delete
" - "%s ?"), - ic->info.file); + _("Are you sure you want to delete
" + "%s ?"), + ic->info.file); else { - snprintf(text, sizeof(text), - _("Are you sure you want to delete
" - "the %d selected files in:
" - "%s ?"), - eina_list_count(sel), - ic->sd->realpath); + snprintf(text, sizeof(text), + _("Are you sure you want to delete
" + "the %d selected files in:
" + "%s ?"), + eina_list_count(sel), + ic->sd->realpath); } if (sel) eina_list_free(sel); e_dialog_text_set(dialog, text); @@ -9324,16 +9364,16 @@ _e_fm_string_append_char(char *str, size_t *size, size_t *len, char c) { if (!str) { - str = malloc(4096); - str[0] = '\x00'; - *size = 4096; - *len = 0; + str = malloc(4096); + str[0] = '\x00'; + *size = 4096; + *len = 0; } if (*len >= *size - 1) { - *size += 1024; - str = realloc(str, *size); + *size += 1024; + str = realloc(str, *size); } str[(*len)++] = c; @@ -9342,7 +9382,6 @@ _e_fm_string_append_char(char *str, size_t *size, size_t *len, char c) return str; } - static char * _e_fm_string_append_quoted(char *str, size_t *size, size_t *len, const char *src) { @@ -9350,17 +9389,17 @@ _e_fm_string_append_quoted(char *str, size_t *size, size_t *len, const char *src while (*src) { - if (*src == '\'') - { - str = _e_fm_string_append_char(str, size, len, '\''); - str = _e_fm_string_append_char(str, size, len, '\\'); - str = _e_fm_string_append_char(str, size, len, '\''); - str = _e_fm_string_append_char(str, size, len, '\''); - } - else - str = _e_fm_string_append_char(str, size, len, *src); + if (*src == '\'') + { + str = _e_fm_string_append_char(str, size, len, '\''); + str = _e_fm_string_append_char(str, size, len, '\\'); + str = _e_fm_string_append_char(str, size, len, '\''); + str = _e_fm_string_append_char(str, size, len, '\''); + } + else + str = _e_fm_string_append_char(str, size, len, *src); - src++; + src++; } str = _e_fm_string_append_char(str, size, len, '\''); @@ -9386,23 +9425,23 @@ _e_fm2_file_delete_yes_cb(void *data, E_Dialog *dialog) sel = e_fm2_selected_list_get(ic->sd->obj); if (sel && (eina_list_count(sel) != 1)) { - EINA_LIST_FOREACH(sel, l, ici) - { - snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ici->file); - if (e_filereg_file_protected(buf)) continue; + EINA_LIST_FOREACH(sel, l, ici) + { + snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ici->file); + if (e_filereg_file_protected(buf)) continue; - files = _e_fm_string_append_quoted(files, &size, &len, buf); - if (eina_list_next(l)) - files = _e_fm_string_append_char(files, &size, &len, ' '); - } + files = _e_fm_string_append_quoted(files, &size, &len, buf); + if (eina_list_next(l)) + files = _e_fm_string_append_char(files, &size, &len, ' '); + } - eina_list_free(sel); + eina_list_free(sel); } else { - _e_fm2_icon_realpath(ic, buf, sizeof(buf)); - if (e_filereg_file_protected(buf)) return; - files = _e_fm_string_append_quoted(files, &size, &len, buf); + _e_fm2_icon_realpath(ic, buf, sizeof(buf)); + if (e_filereg_file_protected(buf)) return; + files = _e_fm_string_append_quoted(files, &size, &len, buf); } _e_fm_client_file_del(files, ic->sd->obj); @@ -9433,9 +9472,6 @@ _e_fm2_refresh_job_cb(void *data) sd->refresh_job = NULL; } - - - static void _e_fm2_live_file_add(Evas_Object *obj, const char *file, const char *file_rel, int after, E_Fm2_Finfo *finf) { @@ -9515,21 +9551,21 @@ _e_fm2_live_process_end(Evas_Object *obj) sd = evas_object_smart_data_get(obj); EINA_LIST_FREE(sd->live.actions, a) { - eina_stringshare_del(a->file); - eina_stringshare_del(a->file2); - eina_stringshare_del(a->finf.lnk); - eina_stringshare_del(a->finf.rlnk); - free(a); + eina_stringshare_del(a->file); + eina_stringshare_del(a->file2); + eina_stringshare_del(a->finf.lnk); + eina_stringshare_del(a->finf.rlnk); + free(a); } if (sd->live.idler) { - ecore_idler_del(sd->live.idler); - sd->live.idler = NULL; + ecore_idler_del(sd->live.idler); + sd->live.idler = NULL; } if (sd->live.timer) { - ecore_timer_del(sd->live.timer); - sd->live.timer = NULL; + ecore_timer_del(sd->live.timer); + sd->live.timer = NULL; } sd->tmp.last_insert = NULL; } @@ -9549,73 +9585,76 @@ _e_fm2_live_process(Evas_Object *obj) switch (a->type) { case FILE_ADD: - /* new file to sort in place */ - if (!strcmp(a->file, ".order")) - { - sd->order_file = EINA_TRUE; - /* FIXME: reload fm view */ - } - else - { - if (!((a->file[0] == '.') && (!sd->show_hidden_files))) - _e_fm2_file_add(obj, a->file, 1, a->file2, a->flags, &(a->finf)); - } - break; - case FILE_DEL: - if (!strcmp(a->file, ".order")) - { - sd->order_file = EINA_FALSE; - /* FIXME: reload fm view */ - } - else - { - if (!((a->file[0] == '.') && (!sd->show_hidden_files))) - _e_fm2_file_del(obj, a->file); - sd->live.deletions = EINA_TRUE; - } - break; - case FILE_CHANGE: - if (!strcmp(a->file, ".order")) - { - /* FIXME: reload fm view - ignore for now */ - } - else - { - if (!((a->file[0] == '.') && (!sd->show_hidden_files))) - { - EINA_LIST_FOREACH(sd->icons, l, ic) - { - if (!strcmp(ic->info.file, a->file)) - { - if (ic->removable_state_change) - { - _e_fm2_icon_unfill(ic); - _e_fm2_icon_fill(ic, &(a->finf)); - ic->removable_state_change = EINA_FALSE; - if ((ic->realized) && (ic->obj_icon)) - { - _e_fm2_icon_removable_update(ic); - _e_fm2_icon_label_set(ic, ic->obj); - } - } - else - { - int realized; + /* new file to sort in place */ + if (!strcmp(a->file, ".order")) + { + sd->order_file = EINA_TRUE; + /* FIXME: reload fm view */ + } + else + { + if (!((a->file[0] == '.') && (!sd->show_hidden_files))) + _e_fm2_file_add(obj, a->file, 1, a->file2, a->flags, &(a->finf)); + } + break; + + case FILE_DEL: + if (!strcmp(a->file, ".order")) + { + sd->order_file = EINA_FALSE; + /* FIXME: reload fm view */ + } + else + { + if (!((a->file[0] == '.') && (!sd->show_hidden_files))) + _e_fm2_file_del(obj, a->file); + sd->live.deletions = EINA_TRUE; + } + break; + + case FILE_CHANGE: + if (!strcmp(a->file, ".order")) + { + /* FIXME: reload fm view - ignore for now */ + } + else + { + if (!((a->file[0] == '.') && (!sd->show_hidden_files))) + { + EINA_LIST_FOREACH(sd->icons, l, ic) + { + if (!strcmp(ic->info.file, a->file)) + { + if (ic->removable_state_change) + { + _e_fm2_icon_unfill(ic); + _e_fm2_icon_fill(ic, &(a->finf)); + ic->removable_state_change = EINA_FALSE; + if ((ic->realized) && (ic->obj_icon)) + { + _e_fm2_icon_removable_update(ic); + _e_fm2_icon_label_set(ic, ic->obj); + } + } + else + { + int realized; + + realized = ic->realized; + if (realized) _e_fm2_icon_unrealize(ic); + _e_fm2_icon_unfill(ic); + _e_fm2_icon_fill(ic, &(a->finf)); + if (realized) _e_fm2_icon_realize(ic); + } + break; + } + } + } + } + break; - realized = ic->realized; - if (realized) _e_fm2_icon_unrealize(ic); - _e_fm2_icon_unfill(ic); - _e_fm2_icon_fill(ic, &(a->finf)); - if (realized) _e_fm2_icon_realize(ic); - } - break; - } - } - } - } - break; default: - break; + break; } eina_stringshare_del(a->file); eina_stringshare_del(a->file2); @@ -9635,8 +9674,8 @@ _e_fm2_cb_live_idler(void *data) t = ecore_time_get(); do { - if (!sd->live.actions) break; - _e_fm2_live_process(data); + if (!sd->live.actions) break; + _e_fm2_live_process(data); } while ((ecore_time_get() - t) > 0.02); if (sd->live.actions) return ECORE_CALLBACK_RENEW; @@ -9644,7 +9683,7 @@ _e_fm2_cb_live_idler(void *data) _e_fm2_cb_live_timer(data); if ((sd->order_file) || (sd->config->view.always_order)) { - e_fm2_refresh(data); + e_fm2_refresh(data); } sd->live.idler = NULL; return ECORE_CALLBACK_CANCEL; @@ -9660,17 +9699,17 @@ _e_fm2_cb_live_timer(void *data) if (sd->queue) _e_fm2_queue_process(data); else if (sd->iconlist_changed) { - if (sd->resize_job) ecore_job_del(sd->resize_job); - sd->resize_job = ecore_job_add(_e_fm2_cb_resize_job, sd->obj); + if (sd->resize_job) ecore_job_del(sd->resize_job); + sd->resize_job = ecore_job_add(_e_fm2_cb_resize_job, sd->obj); } else { - if (sd->live.deletions) - { - sd->iconlist_changed = EINA_TRUE; - if (sd->resize_job) ecore_job_del(sd->resize_job); - sd->resize_job = ecore_job_add(_e_fm2_cb_resize_job, sd->obj); - } + if (sd->live.deletions) + { + sd->iconlist_changed = EINA_TRUE; + if (sd->resize_job) ecore_job_del(sd->resize_job); + sd->resize_job = ecore_job_add(_e_fm2_cb_resize_job, sd->obj); + } } sd->live.deletions = EINA_FALSE; sd->live.timer = NULL; @@ -9692,15 +9731,15 @@ _e_fm2_theme_edje_object_set(E_Fm2_Smart_Data *sd, Evas_Object *o, const char *c if (sd->custom_theme) { - if (edje_object_file_set(o, sd->custom_theme, buf)) return 1; + if (edje_object_file_set(o, sd->custom_theme, buf)) return 1; } if (sd->custom_theme) { - if (!ecore_file_exists(sd->custom_theme)) - { - eina_stringshare_del(sd->custom_theme); - sd->custom_theme = NULL; - } + if (!ecore_file_exists(sd->custom_theme)) + { + eina_stringshare_del(sd->custom_theme); + sd->custom_theme = NULL; + } } ret = e_theme_edje_object_set(o, category, buf); return ret; @@ -9715,58 +9754,58 @@ _e_fm2_theme_edje_icon_object_set(E_Fm2_Smart_Data *sd, Evas_Object *o, const ch // if (sd->custom_theme_content) // snprintf(buf, sizeof(buf), "e/icons/fileman/%s/%s", sd->custom_theme_content, group); // else - snprintf(buf, sizeof(buf), "e/icons/fileman/%s", group); + snprintf(buf, sizeof(buf), "e/icons/fileman/%s", group); if (sd->custom_theme) { - if (edje_object_file_set(o, sd->custom_theme, buf)) return 1; + if (edje_object_file_set(o, sd->custom_theme, buf)) return 1; } if (sd->custom_theme) { - if (!ecore_file_exists(sd->custom_theme)) - { - eina_stringshare_del(sd->custom_theme); - sd->custom_theme = NULL; - } + if (!ecore_file_exists(sd->custom_theme)) + { + eina_stringshare_del(sd->custom_theme); + sd->custom_theme = NULL; + } } ret = e_theme_edje_object_set(o, category, buf); return ret; } -static void +static void _e_fm2_volume_mount(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) { E_Volume *v; const char *mp; - + v = data; if (!v) return; - + mp = e_fm2_device_volume_mountpoint_get(v); _e_fm2_client_mount(v->udi, mp); eina_stringshare_del(mp); } -static void +static void _e_fm2_volume_unmount(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) { E_Volume *v; - + v = data; if (!v) return; - + v->auto_unmount = EINA_FALSE; _e_fm2_client_unmount(v->udi); } -static void +static void _e_fm2_volume_eject(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) { E_Volume *v; - + v = data; if (!v) return; - + v->auto_unmount = EINA_FALSE; _e_fm2_client_eject(v->udi); } @@ -9782,12 +9821,12 @@ _update_volume_icon(E_Volume *v, E_Fm2_Icon *ic) if (v) { if (v->mounted) - edje_object_signal_emit(ic->obj, "e,state,volume,mounted", "e"); + edje_object_signal_emit(ic->obj, "e,state,volume,mounted", "e"); else - edje_object_signal_emit(ic->obj, "e,state,volume,unmounted", "e"); + edje_object_signal_emit(ic->obj, "e,state,volume,unmounted", "e"); } else - edje_object_signal_emit(ic->obj, "e,state,volume,off", "e"); + edje_object_signal_emit(ic->obj, "e,state,volume,off", "e"); } static void @@ -9799,25 +9838,25 @@ _e_fm2_volume_icon_update(E_Volume *v) E_Fm2_Icon *ic; if (!v || !v->storage) return; - + e_user_dir_snprintf(fav, sizeof(fav), "fileman/favorites"); e_user_homedir_concat(desk, sizeof(desk), _("Desktop")); - snprintf(file, sizeof(file), "|%s_%d.desktop", + snprintf(file, sizeof(file), "|%s_%d.desktop", ecore_file_file_get(v->storage->udi), v->partition_number); - + EINA_LIST_FOREACH(_e_fm2_list, l, o) { const char *rp; - + if ((_e_fm2_list_walking > 0) && (eina_list_data_find(_e_fm2_list_remove, o))) continue; - + rp = e_fm2_real_path_get(o); if (strcmp(rp, fav) && strcmp(rp, desk)) continue; - + ic = _e_fm2_icon_find(o, file); if (ic) - _update_volume_icon(v, ic); + _update_volume_icon(v, ic); } } @@ -9825,7 +9864,7 @@ static void _e_fm2_icon_removable_update(E_Fm2_Icon *ic) { E_Volume *v; - + if (!ic) return; v = e_fm2_device_volume_find(ic->info.link); _update_volume_icon(v, ic); @@ -9839,18 +9878,19 @@ _e_fm2_operation_abort_internal(E_Fm2_Op_Registry_Entry *ere) ere->needs_attention = 0; ere->dialog = NULL; e_fm2_op_registry_entry_changed(ere); - _e_fm_client_send(E_FM_OP_ABORT, ere->id, NULL, 0); + _e_fm_client_send(E_FM_OP_ABORT, ere->id, NULL, 0); } EAPI void e_fm2_operation_abort(int id) { E_Fm2_Op_Registry_Entry *ere; - + ere = e_fm2_op_registry_entry_get(id); if (!ere) return; - + e_fm2_op_registry_entry_ref(ere); e_fm2_op_registry_entry_abort(ere); e_fm2_op_registry_entry_unref(ere); } +