* view.c (view_load): Changed return type to gboolean. Adjusted
returned values. * view.c (view): Rewrote the code a little bit. * view.h (view): Rewrote the comment.
Этот коммит содержится в:
родитель
74318e44bb
Коммит
98240f77bd
@ -9,6 +9,10 @@
|
||||
* view.c (save_edit_changes): Changed return type to gboolean.
|
||||
* view.c (view_ok_to_quit): Changed return type to gboolean.
|
||||
Adjusted returned values.
|
||||
* view.c (view_load): Changed return type to gboolean. Adjusted
|
||||
returned values.
|
||||
* view.c (view): Rewrote the code a little bit.
|
||||
* view.h (view): Rewrote the comment.
|
||||
|
||||
2005-04-16 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
|
25
src/view.c
25
src/view.c
@ -584,8 +584,7 @@ init_growing_view (WView *view, const char *name, const char *filename)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return zero on success, -1 on failure */
|
||||
int
|
||||
gboolean
|
||||
view_load (WView *view, const char *_command, const char *_file,
|
||||
int start_line)
|
||||
{
|
||||
@ -669,7 +668,7 @@ view_load (WView *view, const char *_command, const char *_file,
|
||||
if (!view_is_in_panel (view)) {
|
||||
message (1, MSG_ERROR, "%s", error);
|
||||
g_free (error);
|
||||
return -1;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -696,7 +695,7 @@ view_load (WView *view, const char *_command, const char *_file,
|
||||
view->hexview_in_text = FALSE;
|
||||
view->change_list = NULL;
|
||||
|
||||
return 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2570,7 +2569,7 @@ view_dialog_callback (Dlg_head *h, dlg_msg_t msg, int parm)
|
||||
int
|
||||
view (const char *_command, const char *_file, int *move_dir_p, int start_line)
|
||||
{
|
||||
int error;
|
||||
gboolean succeeded;
|
||||
WView *wview;
|
||||
WButtonBar *bar;
|
||||
Dlg_head *view_dlg;
|
||||
@ -2587,22 +2586,18 @@ view (const char *_command, const char *_file, int *move_dir_p, int start_line)
|
||||
add_widget (view_dlg, bar);
|
||||
add_widget (view_dlg, wview);
|
||||
|
||||
error = view_load (wview, _command, _file, start_line);
|
||||
if (move_dir_p)
|
||||
*move_dir_p = 0;
|
||||
|
||||
/* Please note that if you add another widget,
|
||||
* you have to modify view_adjust_size to
|
||||
* be aware of it
|
||||
*/
|
||||
if (!error) {
|
||||
succeeded = view_load (wview, _command, _file, start_line);
|
||||
if (succeeded) {
|
||||
run_dlg (view_dlg);
|
||||
if (move_dir_p)
|
||||
*move_dir_p = wview->move_dir;
|
||||
} else {
|
||||
if (move_dir_p)
|
||||
*move_dir_p = 0;
|
||||
}
|
||||
destroy_dlg (view_dlg);
|
||||
|
||||
return !error;
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
static void
|
||||
|
10
src/view.h
10
src/view.h
@ -9,10 +9,12 @@ WView *view_new (int y, int x, int cols, int lines, int is_panel);
|
||||
int view_load (WView *view, const char *_command, const char *_file,
|
||||
int start_line);
|
||||
|
||||
/* Command: view a _file, if _command != NULL we use popen on _command */
|
||||
/* move direction should be a pointer that will hold the direction in which */
|
||||
/* the user wants to move (-1 previous file, 1 next file, 0 do nothing) */
|
||||
int view (const char *_command, const char *_file, int *move_direction,
|
||||
/* View a ''file'' or the output of a ''command'' in the internal viewer,
|
||||
* starting in line ''start_line''. ''ret_move_direction'' may be NULL or
|
||||
* point to a variable that will receive the direction in which the user
|
||||
* wants to move (-1 = previous file, 1 = next file, 0 = do nothing).
|
||||
*/
|
||||
int view (const char *command, const char *file, int *ret_move_direction,
|
||||
int start_line);
|
||||
|
||||
extern int mouse_move_pages_viewer;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user