[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [E-devel] [PATCH] Show Hidden Files Option in File Selector



Patch attached, and diff -u'd.

metrics
Index: src/bin/e_fm.c
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_fm.c,v
retrieving revision 1.70
diff -u -r1.70 e_fm.c
--- src/bin/e_fm.c	18 Sep 2006 14:52:43 -0000	1.70
+++ src/bin/e_fm.c	19 Sep 2006 15:08:30 -0000
@@ -58,6 +58,7 @@
    unsigned char     iconlist_changed : 1;
    unsigned char     order_file : 1;
    unsigned char     typebuf_visible : 1;
+   unsigned char     show_hidden_files : 1;
 
    E_Fm2_Config     *config;
 
@@ -200,6 +201,7 @@
 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_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_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);
@@ -234,6 +236,7 @@
      }
    else return 0;
 
+
    _e_fm2_smart = evas_smart_new("e_fm",
 				 _e_fm2_smart_add, /* add */
 				 _e_fm2_smart_del, /* del */
@@ -3190,10 +3193,10 @@
      {
 	dp = readdir(sd->dir);
 	if (!dp) goto endscan;
-	/* no - you don't want the cuirrent and parent dir links listed */
+	/* no - you don't want the current and parent dir links listed */
 	if ((!strcmp(dp->d_name, ".")) || (!strcmp(dp->d_name, ".."))) return 1;
-	/* skip dotfiles */
-	if (dp->d_name[0] == '.') return 1;
+	/* skip dotfiles if we're not showing hidden files */
+	if (dp->d_name[0] == '.' && !sd->show_hidden_files) return 1;
 	_e_fm2_file_add(data, dp->d_name);
      }
    return 1;
@@ -3511,6 +3514,16 @@
 			     "e/fileman/button/refresh");
    e_menu_item_callback_set(mi, _e_fm2_refresh, sd);
 
+   mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, _("Show Hidden Files"));
+   e_menu_item_icon_edje_set(mi,
+			     e_theme_edje_file_get("base/theme/fileman",
+						   "e/fileman/button/hidden_files"),
+			     "e/fileman/button/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 (ecore_file_can_write(sd->realpath))
      {
 	mi = e_menu_item_new(mn);
@@ -3592,6 +3605,16 @@
 			     "e/fileman/button/refresh");
    e_menu_item_callback_set(mi, _e_fm2_refresh, ic->sd);
 
+   mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, _("Show Hidden Files"));
+   e_menu_item_icon_edje_set(mi,
+			     e_theme_edje_file_get("base/theme/fileman",
+						   "e/fileman/button/hidden_files"),
+			     "e/fileman/button/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 (ecore_file_can_write(sd->realpath))
      {
 	mi = e_menu_item_new(mn);
@@ -3719,6 +3742,20 @@
 }
 
 static void
+_e_fm2_toggle_hidden_files(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+   E_Fm2_Smart_Data *sd;
+   
+   sd = data;
+   if (sd->show_hidden_files)
+     sd->show_hidden_files = 0;
+   else
+     sd->show_hidden_files = 1;
+
+   _e_fm2_refresh(data, m, mi);
+}
+
+static void
 _e_fm2_new_directory(void *data, E_Menu *m, E_Menu_Item *mi)
 {
    E_Fm2_Smart_Data *sd;