1
1

patches by Rostislav Beneš: mc-24-achown

added str_term_width1, str_trunc to all chmod / chown dialogs
Этот коммит содержится в:
Slava Zanko 2008-12-29 01:10:44 +02:00
родитель 87a8b257ae
Коммит 1b34b52cb6
3 изменённых файлов: 12 добавлений и 9 удалений

Просмотреть файл

@ -35,6 +35,7 @@
#include "widget.h"
#include "wtools.h" /* For init_box_colors() */
#include "key.h" /* XCTRL and ALT macros */
#include "strutil.h"
#include "dir.h"
#include "panel.h" /* Needed for the externs */
@ -373,7 +374,7 @@ static void chown_info_update (void)
/* name && mode */
dlg_move (ch_dlg, 3, 8);
tty_printf ("%s", name_trunc (fname, 45));
addstr (str_fit_to_term (fname, 45, J_LEFT_FIT));
dlg_move (ch_dlg, BY + 2, 9);
tty_printf ("%12o", get_mode ());
@ -545,7 +546,7 @@ init_chown_advanced (void)
int dx, cx;
for (i = 0 ; i < n_elem ; i++) {
chown_advanced_but[i].text = _(chown_advanced_but[i].text);
i18n_len += strlen (chown_advanced_but[i].text) + 3;
i18n_len += str_term_width1 (chown_advanced_but[i].text) + 3;
if (DEFPUSH_BUTTON == chown_advanced_but[i].flags)
i18n_len += 2; /* "<>" */
}
@ -554,7 +555,7 @@ init_chown_advanced (void)
/* Reversed order */
for (i = n_elem - 1; i >= 0; i--) {
chown_advanced_but[i].x = cx;
cx += strlen (chown_advanced_but[i].text) + 3 + dx;
cx += str_term_width1 (chown_advanced_but[i].text) + 3 + dx;
}
}
#endif /* ENABLE_NLS */

Просмотреть файл

@ -36,6 +36,7 @@
#include "panel.h" /* do_file_mark() */
#include "main.h" /* update_panels() */
#include "chmod.h"
#include "strutil.h"
static int single_set;
@ -296,11 +297,11 @@ void chmod_cmd (void)
}
/* Set the labels */
c_fname = name_trunc (fname, 21);
c_fname = str_trunc (fname, 21);
add_widget (ch_dlg, label_new (FY+2, FX+2, c_fname));
c_fown = name_trunc (get_owner (sf_stat.st_uid), 21);
c_fown = str_trunc (get_owner (sf_stat.st_uid), 21);
add_widget (ch_dlg, label_new (FY+6, FX+2, c_fown));
c_fgrp = name_trunc (get_group (sf_stat.st_gid), 21);
c_fgrp = str_trunc (get_group (sf_stat.st_gid), 21);
add_widget (ch_dlg, label_new (FY+8, FX+2, c_fgrp));
g_snprintf (buffer, sizeof (buffer), "%o", c_stat);
statl = label_new (FY+4, FX+2, buffer);

Просмотреть файл

@ -33,6 +33,7 @@
#include "color.h"
#include "dialog.h"
#include "widget.h"
#include "strutil.h"
/* Needed for the extern declarations of integer parameters */
#include "dir.h"
@ -268,9 +269,9 @@ chown_cmd (void)
if (fe)
listbox_select_entry (l_group, fe);
chown_label (0, name_trunc (fname, 15));
chown_label (1, name_trunc (get_owner (sf_stat.st_uid), 15));
chown_label (2, name_trunc (get_group (sf_stat.st_gid), 15));
chown_label (0, str_trunc (fname, 15));
chown_label (1, str_trunc (get_owner (sf_stat.st_uid), 15));
chown_label (2, str_trunc (get_group (sf_stat.st_gid), 15));
size_trunc_len (buffer, 15, sf_stat.st_size, 0);
chown_label (3, buffer);
chown_label (4, string_perm (sf_stat.st_mode));