Just a little correction at the it.po file.
[midnight-commander.git] / src / dialog.c
blob15b51fd2bd7fca80502899f7283fed8cc500ccb3
1 /* Dialog managing.
2 Copyright (C) 1994 Miguel de Icaza.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 #include <config.h>
19 #include <stdio.h>
20 #include <stdarg.h>
21 #include <sys/types.h>
22 #include <string.h>
23 #include "global.h"
24 #include "dialog.h"
25 #include "key.h" /* we_are_background */
26 #include "main.h" /* fast_refresh */
29 /* The refresh stack */
30 typedef struct Refresh {
31 void (*refresh_fn)(void *);
32 void *parameter;
33 int flags;
34 struct Refresh *next;
35 } Refresh;
37 static Refresh *refresh_list;
39 void
40 push_refresh (refresh_fn new_refresh, void *parameter, int flags)
42 Refresh *new;
44 new = g_new (Refresh, 1);
45 new->next = (struct Refresh *) refresh_list;
46 new->refresh_fn = new_refresh;
47 new->parameter = parameter;
48 new->flags = flags;
49 refresh_list = new;
52 void
53 pop_refresh (void)
55 Refresh *old;
57 if (!refresh_list)
58 fprintf (stderr, _("\n\n\nrefresh stack underflow!\n\n\n"));
59 else {
60 old = refresh_list;
61 refresh_list = refresh_list->next;
62 g_free (old);
66 static void
67 do_complete_refresh (Refresh *refresh_list)
69 if (!refresh_list)
70 return;
72 if (refresh_list->flags != REFRESH_COVERS_ALL)
73 do_complete_refresh (refresh_list->next);
75 (*(refresh_list->refresh_fn)) (refresh_list->parameter);
78 void
79 do_refresh (void)
81 if (we_are_background || !refresh_list)
82 return;
84 if (fast_refresh)
85 (*(refresh_list->refresh_fn)) (refresh_list->parameter);
86 else {
87 do_complete_refresh (refresh_list);