static void mcview_hook (void *v) { mcview_t *view = (mcview_t *) v; WPanel *panel; /* If the user is busy typing, wait until he finishes to update the screen */ if (!is_idle ()) { if (!hook_present (idle_hook, mcview_hook)) add_hook (&idle_hook, mcview_hook, v); return; } delete_hook (&idle_hook, mcview_hook); if (get_current_type () == view_listing) panel = current_panel; else if (get_other_type () == view_listing) panel = other_panel; else return; mcview_done (view); mcview_init (view); mcview_load (view, 0, panel->dir.list[panel->selected].fname, 0, 0, 0); mcview_display (view); }
void mcview_toggle_magic_mode (mcview_t * view) { char *filename, *command; dir_list *dir; int *dir_idx; mcview_altered_magic_flag = 1; view->magic_mode = !view->magic_mode; /* reinit view */ filename = g_strdup (vfs_path_as_str (view->filename_vpath)); command = g_strdup (view->command); dir = view->dir; dir_idx = view->dir_idx; view->dir = NULL; view->dir_idx = NULL; mcview_done (view); mcview_init (view); mcview_load (view, command, filename, 0); view->dir = dir; view->dir_idx = dir_idx; g_free (filename); g_free (command); view->dpy_bbar_dirty = TRUE; view->dirty++; }