From 57c97339373b9b3dbbd421d527ef8e72fceafb26 Mon Sep 17 00:00:00 2001 From: Roland Illig Date: Sun, 6 Feb 2005 22:55:37 +0000 Subject: [PATCH] * achown.c (get_ownership): Renamed to update_ownership. * achown.c (update_permissions): Update the permission widgets without accessing WButton->text directly. * achown.c (print_flags): Use update_permissions. * achown.c (chown_info_update): Likewise. --- src/ChangeLog | 5 +++++ src/achown.c | 29 ++++++++++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index bcd3dfa1f..9bbc1ef65 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,11 @@ * achown.c (get_ownership): Simplified the code. Now it is more independent of the WButton internals. + * achown.c (get_ownership): Renamed to update_ownership. + * achown.c (update_permissions): Update the permission widgets + without accessing WButton->text directly. + * achown.c (print_flags): Use update_permissions. + * achown.c (chown_info_update): Likewise. 2005-02-05 Roland Illig diff --git a/src/achown.c b/src/achown.c index cbc3ae39b..0a613a410 100644 --- a/src/achown.c +++ b/src/achown.c @@ -68,12 +68,12 @@ static struct { { B_CANCEL, NORMAL_BUTTON, 4, 53, N_("&Cancel") }, { B_ENTER, DEFPUSH_BUTTON,4, 40, N_("&Set") }, { B_SKIP, NORMAL_BUTTON, 4, 23, N_("S&kip") }, - { B_SETALL, NORMAL_BUTTON, 4, 0, N_("Set &all")}, + { B_SETALL, NORMAL_BUTTON, 4, 0, N_("Set &all")}, { B_ENTER, NARROW_BUTTON, 0, 47, ""}, { B_ENTER, NARROW_BUTTON, 0, 29, ""}, - { B_ENTER, NARROW_BUTTON, 0, 19, " "}, - { B_ENTER, NARROW_BUTTON, 0, 11, " "}, - { B_ENTER, NARROW_BUTTON, 0, 3, " "} + { B_ENTER, NARROW_BUTTON, 0, 19, ""}, + { B_ENTER, NARROW_BUTTON, 0, 11, ""}, + { B_ENTER, NARROW_BUTTON, 0, 3, ""} }; static WButton *b_att[3]; /* permission */ @@ -92,7 +92,7 @@ static int current_file; static int single_set; static char *fname; -static void get_ownership (void) +static void update_ownership (void) { button_set_text (b_user, get_owner (sf_stat->st_uid)); button_set_text (b_group, get_group (sf_stat->st_gid)); @@ -137,6 +137,17 @@ static void set_perm_by_flags (char *s, int f_p) } } +static void update_permissions (void) +{ + char flags[] = "---"; + set_perm_by_flags (flags, 0); + button_set_text (b_att[0], flags); + set_perm_by_flags (flags, 3); + button_set_text (b_att[1], flags); + set_perm_by_flags (flags, 6); + button_set_text (b_att[2], flags); +} + static umode_t get_perm (char *s, int base) { umode_t m; @@ -187,9 +198,7 @@ static void print_flags (void) addch (ch_flags [i+6]); } - set_perm_by_flags (b_att[0]->text, 0); - set_perm_by_flags (b_att[1]->text, 3); - set_perm_by_flags (b_att[2]->text, 6); + update_permissions (); for (i = 0; i < 15; i++){ dlg_move (ch_dlg, BY+1, 35+i); @@ -368,9 +377,7 @@ static void chown_info_update (void) printw ("%12o", get_mode ()); /* permissions */ - set_perm_by_flags (b_att[0]->text, 0); - set_perm_by_flags (b_att[1]->text, 3); - set_perm_by_flags (b_att[2]->text, 6); + update_permissions (); } static void b_setpos (int f_pos) {