Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_fm.c e_fm.h 


Log Message:


delete all selected files... when u want to delete

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fm.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -3 -r1.82 -r1.83
--- e_fm.c      1 Oct 2006 12:05:33 -0000       1.82
+++ e_fm.c      8 Oct 2006 05:38:39 -0000       1.83
@@ -127,7 +127,6 @@
    unsigned char     last_selected : 1;
    unsigned char     saved_pos : 1;
    unsigned char     odd : 1;
-   unsigned char     deleted : 1;
    unsigned char     down_sel : 1;
 };
 
@@ -3997,7 +3996,7 @@
    for (l = sd->icons; l; l = l->next)
      {
        ic = l->data;
-       if (!ic->deleted)
+       if (!ic->info.deleted)
          fprintf(f, "%s\n", ic->info.file);
      }
    fclose(f);
@@ -4485,6 +4484,7 @@
    E_Dialog *dialog;
    E_Fm2_Icon *ic;
    char text[4096 + 256];
+   Evas_List *sel;
    
    man = e_manager_current_get();
    if (!man) return;
@@ -4501,10 +4501,21 @@
    e_dialog_button_add(dialog, _("No"), NULL, _e_fm2_file_delete_no_cb, ic);
    e_dialog_button_focus_num(dialog, 1);
    e_dialog_title_set(dialog, _("Confirm Delete"));
-   snprintf(text, sizeof(text), 
-           _("Are you sure you want to delete <br>"
-             "<hilight>%s</hilight> ?"),
-           ic->info.file);
+   sel = e_fm2_selected_list_get(ic->sd->obj);
+   if ((!sel) || (evas_list_count(sel) == 1))
+     snprintf(text, sizeof(text), 
+             _("Are you sure you want to delete<br>"
+               "<hilight>%s</hilight> ?"),
+             ic->info.file);
+   else
+     {
+       snprintf(text, sizeof(text), 
+                _("Are you sure you want to delete<br>"
+                  "the selected files in:<br>"
+                  "<hilight>%s</hilight> ?"),
+                ic->sd->realpath);
+     }
+   if (sel) evas_list_free(sel);
    e_dialog_text_set(dialog, text);
    e_win_centered_set(dialog->win, 1);
    e_dialog_show(dialog);
@@ -4526,41 +4537,85 @@
    E_Container *con;
    E_Fm2_Icon *ic;
    char buf[4096];
-
+   Evas_List *sel, *l;
+   E_Fm2_Icon_Info *ici;
+   
    ic = data;
    ic->dialog = NULL;
    
-   if (!ic->info.pseudo_link)
+   e_object_del(E_OBJECT(dialog));
+   sel = e_fm2_selected_list_get(ic->sd->obj);
+   if (sel)
      {
-       snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file);
-
-       /* FIXME: recursive rm might block - need to get smart */
-       if (!(ecore_file_recursive_rm(buf)))
+       for (l = sel; l; l = l->next)
          {
-            char text[4096 + 256];
-            
-            man = e_manager_current_get();
-            if (!man) return;
-            con = e_container_current_get(man);
-            if (!con) return;
-            
-            e_object_del(E_OBJECT(dialog));
-            dialog = e_dialog_new(con, "E", "_fm_file_delete_error_dialog");
-            e_dialog_button_add(dialog, _("OK"), NULL, NULL, NULL);
-            e_dialog_button_focus_num(dialog, 1);
-            e_dialog_title_set(dialog, _("Error"));
-            snprintf(text, sizeof(text),
-                     _("Could not delete <br>"
-                       "<hilight>%s</hilight>"), buf);
-            e_dialog_text_set(dialog, text);
-            e_win_centered_set(dialog->win, 1);
-            e_dialog_show(dialog);
-            e_object_del(E_OBJECT(dialog));
-            return;
+            ici = l->data;
+            if (!ici->pseudo_link)
+              {
+                 snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, 
ici->file);
+                 
+                 /* FIXME: recursive rm might block - need to get smart */
+                 if (!(ecore_file_recursive_rm(buf)))
+                   {
+                      char text[4096 + 256];
+                      
+                      man = e_manager_current_get();
+                      if (man)
+                        {
+                           con = e_container_current_get(man);
+                           if (con)
+                             {
+                                dialog = e_dialog_new(con, "E", 
"_fm_file_delete_error_dialog");
+                                e_dialog_button_add(dialog, _("OK"), NULL, 
NULL, NULL);
+                                e_dialog_button_focus_num(dialog, 1);
+                                e_dialog_title_set(dialog, _("Error"));
+                                snprintf(text, sizeof(text),
+                                         _("Could not delete <br>"
+                                           "<hilight>%s</hilight>"), buf);
+                                e_dialog_text_set(dialog, text);
+                                e_win_centered_set(dialog->win, 1);
+                                e_dialog_show(dialog);
+                                // e_object_del(E_OBJECT(dialog));
+                             }
+                        }
+                   }
+                 else ici->deleted = 1;
+              }
          }
+       evas_list_free(sel);
+     }
+   else
+     {
+       if (!ic->info.pseudo_link)
+         {
+            snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, 
ic->info.file);
+
+            /* FIXME: recursive rm might block - need to get smart */
+            if (!(ecore_file_recursive_rm(buf)))
+              {
+                 char text[4096 + 256];
+                 
+                 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_delete_error_dialog");
+                 e_dialog_button_add(dialog, _("OK"), NULL, NULL, NULL);
+                 e_dialog_button_focus_num(dialog, 1);
+                 e_dialog_title_set(dialog, _("Error"));
+                 snprintf(text, sizeof(text),
+                          _("Could not delete <br>"
+                            "<hilight>%s</hilight>"), buf);
+                 e_dialog_text_set(dialog, text);
+                 e_win_centered_set(dialog->win, 1);
+                 e_dialog_show(dialog);
+                 // e_object_del(E_OBJECT(dialog));
+                 return;
+              }
+         }
+       ic->info.deleted = 1;
      }
-   e_object_del(E_OBJECT(dialog));
-   ic->deleted = 1;
    if (ic->sd->order_file) _e_fm2_order_file_rewrite(ic->sd->obj);
    
    if (ic->sd->refresh_job) ecore_job_del(ic->sd->refresh_job);
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fm.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- e_fm.h      1 Oct 2006 12:05:33 -0000       1.23
+++ e_fm.h      8 Oct 2006 05:38:39 -0000       1.24
@@ -99,6 +99,7 @@
    struct stat       statinfo;
    unsigned char     mount : 1;
    unsigned char     pseudo_link : 1;
+   unsigned char     deleted : 1;
 };
 
 EAPI int                   e_fm2_init(void);



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to