Ticket #1488: mc-4.7.0-pre1.mountlist.patch

File mc-4.7.0-pre1.mountlist.patch, 8.9 KB (added by angel_il, 12 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  
    6060        menu.c menu.h mountlist.c mountlist.h mouse.c mouse.h myslang.h \ 
    6161        option.c option.h panel.h panelize.c panelize.h poptalloca.h    \ 
    6262        popt.c poptconfig.c popt.h popthelp.c poptint.h poptparse.c     \ 
    63         rxvt.c screen.c setup.c setup.h \ 
     63        rxvt.c screen.c selmnt.c selmnt.h setup.c setup.h       \ 
    6464        slint.c subshell.c subshell.h textconf.c textconf.h             \ 
    6565        tree.c tree.h treestore.c treestore.h timefmt.h tty.c tty.h user.c      \ 
    6666        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  
    115115        mountlist.c mountlist.h mouse.c mouse.h myslang.h option.c \ 
    116116        option.h panel.h panelize.c panelize.h poptalloca.h popt.c \ 
    117117        poptconfig.c popt.h popthelp.c poptint.h poptparse.c rxvt.c \ 
    118         screen.c setup.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 \ 
    119119        textconf.c textconf.h tree.c tree.h treestore.c treestore.h \ 
    120120        timefmt.h tty.c tty.h user.c user.h util.c util.h utilunix.c \ 
    121121        view.c view.h vfsdummy.h widget.c widget.h win.c win.h \ 
     
    136136        mountlist.$(OBJEXT) mouse.$(OBJEXT) option.$(OBJEXT) \ 
    137137        panelize.$(OBJEXT) popt.$(OBJEXT) poptconfig.$(OBJEXT) \ 
    138138        popthelp.$(OBJEXT) poptparse.$(OBJEXT) rxvt.$(OBJEXT) \ 
    139         screen.$(OBJEXT) setup.$(OBJEXT) slint.$(OBJEXT) \ 
     139        screen.$(OBJEXT) selmnt.$(OBJEXT) setup.$(OBJEXT) slint.$(OBJEXT) \ 
    140140        subshell.$(OBJEXT) textconf.$(OBJEXT) tree.$(OBJEXT) \ 
    141141        treestore.$(OBJEXT) tty.$(OBJEXT) user.$(OBJEXT) \ 
    142142        util.$(OBJEXT) utilunix.$(OBJEXT) view.$(OBJEXT) \ 
     
    415415        menu.c menu.h mountlist.c mountlist.h mouse.c mouse.h myslang.h \ 
    416416        option.c option.h panel.h panelize.c panelize.h poptalloca.h    \ 
    417417        popt.c poptconfig.c popt.h popthelp.c poptint.h poptparse.c     \ 
    418         rxvt.c screen.c setup.c setup.h \ 
     418        rxvt.c screen.c selmnt.c selmnt.h setup.c setup.h       \ 
    419419        slint.c subshell.c subshell.h textconf.c textconf.h             \ 
    420420        tree.c tree.h treestore.c treestore.h timefmt.h tty.c tty.h user.c      \ 
    421421        user.h util.c util.h utilunix.c view.c view.h vfsdummy.h widget.c       \ 
     
    603603@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rxvt.Po@am__quote@ 
    604604@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/screen.Po@am__quote@ 
    605605@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/selcodepage.Po@am__quote@ 
     606@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/selmnt.Po@am__quote@ 
    606607@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setup.Po@am__quote@ 
    607608@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slint.Po@am__quote@ 
    608609@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  
    7878#include "chmod.h" 
    7979#include "chown.h" 
    8080#include "achown.h" 
     81#include "selmnt.h" 
    8182 
    8283#ifdef WITH_SMBFS 
    8384#include "../vfs/smbfs.h"       /* smbfs_set_debug() */ 
     
    13001301} 
    13011302 
    13021303static const key_map default_map[] = { 
     1304    { KEY_F(11),  select_mnt_left  }, 
     1305    { KEY_F(12),  select_mnt_right }, 
     1306 
    13031307    {KEY_F (19), menu_last_selected_cmd}, 
    13041308    {KEY_F (20), quiet_quit_cmd}, 
    13051309 
  • src/mountlist.c

    diff -Naur mc-4.7.0-pre1~/src/mountlist.c mc-4.7.0-pre1/src/mountlist.c
    old new  
    127127#    define HAVE_INFOMOUNT 
    128128#endif 
    129129 
    130 /* A mount table entry. */ 
    131 struct mount_entry 
    132 { 
    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  
    140130struct fs_usage 
    141131{ 
    142132    fsblkcnt_t fsu_blocks;      /* Total blocks. */ 
     
    309299   If ALL_FS is zero, do not return entries for filesystems that 
    310300   are automounter (dummy) entries.  */ 
    311301 
    312 static struct mount_entry * 
     302struct mount_entry * 
    313303read_filesystem_list (int need_fs_type, int all_fs) 
    314304{ 
    315305    struct mount_entry *mlist; 
     
    627617** this hack. 
    628618*/ 
    629619 
    630 static struct mount_entry * 
     620struct mount_entry * 
    631621read_filesystem_list(int need_fs_type, int all_fs) 
    632622{ 
    633623        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  
    3737void init_my_statfs (void); 
    3838void my_statfs (struct my_statfs *myfs_stats, const char *path); 
    3939 
     40/* A mount table entry. */ 
     41struct 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 
     50struct mount_entry *read_filesystem_list (int need_fs_type, int all_fs); 
     51 
    4052#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 
     24static unsigned char 
     25get_hotkey (int n) 
     26{ 
     27    return (n <= 9) ? '0' + n : 'a' + n - 10; 
     28} 
     29 
     30 
     31static void 
     32destroy_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 
     46static void 
     47select_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 
     137void 
     138select_mnt_left (void) 
     139{ 
     140    if (get_display_type(0) == view_listing) {  /* XXX why? */ 
     141        select_mnt(left_panel); 
     142    } 
     143} 
     144 
     145 
     146void 
     147select_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 
     4void select_mnt_left (void); 
     5void select_mnt_right (void); 
     6 
     7#endif