Ticket #1488: mc-4.7.0-pre1.mountlist.patch
File mc-4.7.0-pre1.mountlist.patch, 8.9 KB (added by angel_il, 15 years ago) |
---|
-
src/Makefile.am
diff -Naur mc-4.7.0-pre1~/src/Makefile.am mc-4.7.0-pre1/src/Makefile.am
old new 60 60 menu.c menu.h mountlist.c mountlist.h mouse.c mouse.h myslang.h \ 61 61 option.c option.h panel.h panelize.c panelize.h poptalloca.h \ 62 62 popt.c poptconfig.c popt.h popthelp.c poptint.h poptparse.c \ 63 rxvt.c screen.c se tup.c setup.h \63 rxvt.c screen.c selmnt.c selmnt.h setup.c setup.h \ 64 64 slint.c subshell.c subshell.h textconf.c textconf.h \ 65 65 tree.c tree.h treestore.c treestore.h timefmt.h tty.c tty.h user.c \ 66 66 user.h util.c util.h utilunix.c view.c view.h vfsdummy.h widget.c \ -
src/Makefile.in
diff -Naur mc-4.7.0-pre1~/src/Makefile.in mc-4.7.0-pre1/src/Makefile.in
old new 115 115 mountlist.c mountlist.h mouse.c mouse.h myslang.h option.c \ 116 116 option.h panel.h panelize.c panelize.h poptalloca.h popt.c \ 117 117 poptconfig.c popt.h popthelp.c poptint.h poptparse.c rxvt.c \ 118 screen.c se tup.c setup.h slint.c subshell.c subshell.h \118 screen.c selmnt.c selmnt.h setup.c setup.h slint.c subshell.c subshell.h \ 119 119 textconf.c textconf.h tree.c tree.h treestore.c treestore.h \ 120 120 timefmt.h tty.c tty.h user.c user.h util.c util.h utilunix.c \ 121 121 view.c view.h vfsdummy.h widget.c widget.h win.c win.h \ … … 136 136 mountlist.$(OBJEXT) mouse.$(OBJEXT) option.$(OBJEXT) \ 137 137 panelize.$(OBJEXT) popt.$(OBJEXT) poptconfig.$(OBJEXT) \ 138 138 popthelp.$(OBJEXT) poptparse.$(OBJEXT) rxvt.$(OBJEXT) \ 139 screen.$(OBJEXT) se tup.$(OBJEXT) slint.$(OBJEXT) \139 screen.$(OBJEXT) selmnt.$(OBJEXT) setup.$(OBJEXT) slint.$(OBJEXT) \ 140 140 subshell.$(OBJEXT) textconf.$(OBJEXT) tree.$(OBJEXT) \ 141 141 treestore.$(OBJEXT) tty.$(OBJEXT) user.$(OBJEXT) \ 142 142 util.$(OBJEXT) utilunix.$(OBJEXT) view.$(OBJEXT) \ … … 415 415 menu.c menu.h mountlist.c mountlist.h mouse.c mouse.h myslang.h \ 416 416 option.c option.h panel.h panelize.c panelize.h poptalloca.h \ 417 417 popt.c poptconfig.c popt.h popthelp.c poptint.h poptparse.c \ 418 rxvt.c screen.c se tup.c setup.h \418 rxvt.c screen.c selmnt.c selmnt.h setup.c setup.h \ 419 419 slint.c subshell.c subshell.h textconf.c textconf.h \ 420 420 tree.c tree.h treestore.c treestore.h timefmt.h tty.c tty.h user.c \ 421 421 user.h util.c util.h utilunix.c view.c view.h vfsdummy.h widget.c \ … … 603 603 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rxvt.Po@am__quote@ 604 604 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/screen.Po@am__quote@ 605 605 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/selcodepage.Po@am__quote@ 606 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/selmnt.Po@am__quote@ 606 607 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setup.Po@am__quote@ 607 608 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slint.Po@am__quote@ 608 609 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strescape.Po@am__quote@ -
mc-4.7.0-pre1
diff -Naur mc-4.7.0-pre1~/src/main.c mc-4.7.0-pre1/src/main.c
old new 78 78 #include "chmod.h" 79 79 #include "chown.h" 80 80 #include "achown.h" 81 #include "selmnt.h" 81 82 82 83 #ifdef WITH_SMBFS 83 84 #include "../vfs/smbfs.h" /* smbfs_set_debug() */ … … 1300 1301 } 1301 1302 1302 1303 static const key_map default_map[] = { 1304 { KEY_F(11), select_mnt_left }, 1305 { KEY_F(12), select_mnt_right }, 1306 1303 1307 {KEY_F (19), menu_last_selected_cmd}, 1304 1308 {KEY_F (20), quiet_quit_cmd}, 1305 1309 -
src/mountlist.c
diff -Naur mc-4.7.0-pre1~/src/mountlist.c mc-4.7.0-pre1/src/mountlist.c
old new 127 127 # define HAVE_INFOMOUNT 128 128 #endif 129 129 130 /* A mount table entry. */131 struct mount_entry132 {133 char *me_devname; /* Device node pathname, including "/dev/". */134 char *me_mountdir; /* Mount point directory pathname. */135 char *me_type; /* "nfs", "4.2", etc. */136 dev_t me_dev; /* Device number of me_mountdir. */137 struct mount_entry *me_next;138 };139 140 130 struct fs_usage 141 131 { 142 132 fsblkcnt_t fsu_blocks; /* Total blocks. */ … … 309 299 If ALL_FS is zero, do not return entries for filesystems that 310 300 are automounter (dummy) entries. */ 311 301 312 st atic struct mount_entry *302 struct mount_entry * 313 303 read_filesystem_list (int need_fs_type, int all_fs) 314 304 { 315 305 struct mount_entry *mlist; … … 627 617 ** this hack. 628 618 */ 629 619 630 st atic struct mount_entry *620 struct mount_entry * 631 621 read_filesystem_list(int need_fs_type, int all_fs) 632 622 { 633 623 struct _disk_entry de; -
src/mountlist.h
diff -Naur mc-4.7.0-pre1~/src/mountlist.h mc-4.7.0-pre1/src/mountlist.h
old new 37 37 void init_my_statfs (void); 38 38 void my_statfs (struct my_statfs *myfs_stats, const char *path); 39 39 40 /* A mount table entry. */ 41 struct mount_entry 42 { 43 char *me_devname; /* Device node pathname, including "/dev/". */ 44 char *me_mountdir; /* Mount point directory pathname. */ 45 char *me_type; /* "nfs", "4.2", etc. */ 46 dev_t me_dev; /* Device number of me_mountdir. */ 47 struct mount_entry *me_next; 48 }; 49 50 struct mount_entry *read_filesystem_list (int need_fs_type, int all_fs); 51 40 52 #endif -
src/selmnt.c
diff -Naur mc-4.7.0-pre1~/src/selmnt.c mc-4.7.0-pre1/src/selmnt.c
old new 1 /* 2 * Mountpoint selector 3 * 4 * Written by Daniel Borca <dborca@yahoo.com> 5 * Original idea and code: Oleg "Olegarch" Konovalov <olegarch@linuxinside.com> 6 */ 7 8 9 #include <config.h> 10 #include <stdlib.h> 11 #include "global.h" 12 #include "color.h" 13 #include "layout.h" 14 #include "main.h" 15 #include "panel.h" 16 #include "wtools.h" 17 #include "mountlist.h" 18 #include "selmnt.h" 19 20 21 /* XXX HAVE_MOUNT* conditions? add usage for dir? */ 22 23 24 static unsigned char 25 get_hotkey (int n) 26 { 27 return (n <= 9) ? '0' + n : 'a' + n - 10; 28 } 29 30 31 static void 32 destroy_mnt_list (struct mount_entry *list) 33 { 34 struct mount_entry *e; 35 while (list != NULL) { 36 e = list; 37 list = list->me_next; 38 free(e->me_devname); 39 free(e->me_mountdir); 40 free(e->me_type); /* XXX this may be really undefined!!! */ 41 free(e); 42 } 43 } 44 45 46 static void 47 select_mnt (WPanel *p) 48 { 49 struct mount_entry *list, *e; 50 int rows, cols; 51 int i; 52 53 list = read_filesystem_list(0, 0); 54 if (list == NULL) { 55 return; 56 } 57 58 rows = 0; 59 cols = 0; 60 for (e = list; e != NULL; e = e->me_next) { 61 int len = strlen(e->me_mountdir); 62 if (cols < len) { 63 cols = len; 64 } 65 rows++; 66 } 67 68 #if 0 69 { 70 int rv; 71 Listbox *listbox; 72 73 listbox = create_listbox_window(cols + 2, rows, _(" Mountpoints "), "[Mountpoint selector]"); 74 if (listbox == NULL) { 75 destroy_mnt_list(list); 76 return; 77 } 78 for (i = 0, e = list; e != NULL; e = e->me_next, i++) { 79 LISTBOX_APPEND_TEXT(listbox, get_hotkey(i), e->me_mountdir, NULL); 80 } 81 rv = run_listbox(listbox); 82 if (rv != -1) { 83 for (i = 0, e = list; e != NULL; e = e->me_next, i++) { 84 if (i == rv) { 85 do_panel_cd(p, e->me_mountdir, cd_exact); 86 break; 87 } 88 } 89 } 90 } 91 #else 92 { 93 char *q; 94 Dlg_head *query_dlg; 95 WListbox *query_list; 96 int y, x; 97 int h, w; 98 99 h = rows + 2; 100 w = cols + 4; 101 if (w > p->widget.cols) { 102 w = p->widget.cols; 103 } 104 if (h > p->widget.lines) { 105 h = p->widget.lines; 106 } 107 y = p->widget.y + (p->widget.lines - h) / 2; 108 x = p->widget.x + (p->widget.cols - w) / 2; 109 query_dlg = create_dlg(y, x, h, w, dialog_colors, NULL, "[Mountpoint selector]", _(" Mountpoints "), DLG_COMPACT); 110 if (query_dlg == NULL) { 111 destroy_mnt_list(list); 112 return; 113 } 114 query_list = listbox_new(1, 1, h - 2, w - 2, NULL); 115 if (query_list == NULL) { 116 destroy_dlg(query_dlg); 117 destroy_mnt_list(list); 118 return; 119 } 120 add_widget(query_dlg, query_list); 121 for (i = 0, e = list; e != NULL; e = e->me_next, i++) { 122 listbox_add_item(query_list, LISTBOX_APPEND_AT_END, get_hotkey(i), e->me_mountdir, NULL); 123 } 124 run_dlg(query_dlg); 125 if (query_dlg->ret_value != B_CANCEL) { 126 listbox_get_current(query_list, &q, NULL); 127 do_panel_cd(p, q, cd_exact); 128 } 129 destroy_dlg(query_dlg); 130 } 131 #endif 132 133 destroy_mnt_list(list); 134 } 135 136 137 void 138 select_mnt_left (void) 139 { 140 if (get_display_type(0) == view_listing) { /* XXX why? */ 141 select_mnt(left_panel); 142 } 143 } 144 145 146 void 147 select_mnt_right (void) 148 { 149 if (get_display_type(1) == view_listing) { /* XXX why? */ 150 select_mnt(right_panel); 151 } 152 } -
src/selmnt.h
diff -Naur mc-4.7.0-pre1~/src/selmnt.h mc-4.7.0-pre1/src/selmnt.h
old new 1 #ifndef SELMNT_H_included 2 #define SELMNT_H_included 3 4 void select_mnt_left (void); 5 void select_mnt_right (void); 6 7 #endif