1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
/*
* nvidia-installer: A tool for installing NVIDIA software packages on
* Unix and Linux systems.
*
* Copyright (C) 2003 NVIDIA Corporation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the:
*
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307, USA
*
*
* nv_installer_ui.h
*/
#ifndef __NVIDIA_INSTALLER_UI_H__
#define __NVIDIA_INSTALLER_UI_H__
#include "nvidia-installer.h"
#include "command-list.h"
#define NV_MSG_LEVEL_LOG 0
#define NV_MSG_LEVEL_MESSAGE 1
#define NV_MSG_LEVEL_WARNING 2
#define NV_MSG_LEVEL_ERROR 3
/*
* InstallerrUI - this structure defines the dispatch table that each
* user interface module must provide.
*/
typedef struct __nv_installer_ui {
/*
* detect - returns TRUE if the user interface is present (eg for
* gtk check that the DISPLAY environment variable is set and can
* be connected to).
*/
int (*detect)(Options *op);
/*
* init - initialize the ui and print a welcome message.
*/
int (*init)(Options *op, FormatTextRows format_text_rows);
/*
* set_title - set the title to be displayed by the user interface
*/
void (*set_title)(Options *op, const char *title);
/*
* get_input - prompt for user input with the given msg; returns
* the user inputted string.
*/
char *(*get_input)(Options *op, const char *def, const char *msg);
/*
* display_license - given the text from the license file, display
* the text to the user and prompt the user for acceptance.
* Returns whether or not the user accepted the license.
*/
int (*display_license)(Options *op, const char *license);
/*
* message - display a message at the specified message level; the
* possible message levels are:
*
* NV_MSG_LEVEL_LOG: only print the message to the ui's message
* log
*
* NV_MSG_LEVEL_MESSAGE: display the message where users will see
* it; possibly require them to acknowledge that they've seen it
* (by requiring them to clikc "OK" to continue, for example).
* This message may also be printed in the ui's message log.
*
* NV_MSG_LEVEL_WARNING: display the message where users will see
* it; possibly require them to acknowledge that they've seen it
* (by requiring them to clikc "OK" to continue, for example).
* This message may also be printed in the ui's message log. The
* ui should do something to indicate that this message is a
* warning.
*
* NV_MSG_LEVEL_ERROR: display the message where users will see
* it; possibly require them to acknowledge that they've seen it
* (by requiring them to clikc "OK" to continue, for example).
* This message may also be printed in the ui's message log. The
* ui should do something to indicate that this message is an
* error.
*/
void (*message)(Options *op, int level, const char *msg);
/*
* command_output - print output from executing a command; this
* might be stuff like the output from compiling the kernel
* module; a ui might choose to display this in a special window,
* or it might ignore it all together.
*/
void (*command_output)(Options *op, const char *msg);
/*
* approve_command_list - display the command list to the user;
* returns TRUE if the user accepts that those commands will be
* executed, or FALSE if the user does not accept. This is only
* done in expert mode.
*/
int (*approve_command_list)(Options *op, CommandList *c,const char *descr);
/*
* yes_no - ask the yes/no question 'msg' and return TRUE for yes,
* and FALSE for no.
*/
int (*yes_no)(Options *op, const int def, const char *msg);
/*
* status_begin(), status_update(), status_end() - these three
* functions display the status of some process. It is expected
* that status_begin() would be called, followed by some number of
* status_update() calls, followed by a status_end() call.
*/
void (*status_begin)(Options *op, const char *title, const char *msg);
void (*status_update)(Options *op, const float percent, const char *msg);
void (*status_end)(Options *op, const char *msg);
/*
* close - close down the ui.
*/
void (*close)(Options *op);
} InstallerUI;
#endif /* __NVIDIA_INSTALLER_UI_H__ */
|