Have "goto_frame()" put up error dialog boxes itself, rather than having
its callers put up the same error dialog boxes. Have it just return a success vs. failure Boolean. svn path=/trunk/; revision=7254
This commit is contained in:
parent
3b37905e24
commit
6c9deead35
23
file.c
23
file.c
|
@ -1,7 +1,7 @@
|
|||
/* file.c
|
||||
* File I/O routines
|
||||
*
|
||||
* $Id: file.c,v 1.296 2002/12/01 20:19:44 guy Exp $
|
||||
* $Id: file.c,v 1.297 2003/03/02 22:07:21 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -1554,7 +1554,7 @@ find_packet(capture_file *cf, dfilter_t *sfcode)
|
|||
return FALSE; /* failure */
|
||||
}
|
||||
|
||||
goto_result_t
|
||||
gboolean
|
||||
goto_frame(capture_file *cf, guint fnumber)
|
||||
{
|
||||
frame_data *fdata;
|
||||
|
@ -1563,10 +1563,19 @@ goto_frame(capture_file *cf, guint fnumber)
|
|||
for (fdata = cf->plist; fdata != NULL && fdata->num < fnumber; fdata = fdata->next)
|
||||
;
|
||||
|
||||
if (fdata == NULL)
|
||||
return NO_SUCH_FRAME; /* we didn't find that frame */
|
||||
if (!fdata->flags.passed_dfilter)
|
||||
return FRAME_NOT_DISPLAYED; /* the frame with that number isn't displayed */
|
||||
if (fdata == NULL) {
|
||||
/* we didn't find that frame */
|
||||
simple_dialog(ESD_TYPE_CRIT, NULL,
|
||||
"There is no frame with that frame number.");
|
||||
return FALSE; /* we failed to go to that frame */
|
||||
}
|
||||
if (!fdata->flags.passed_dfilter) {
|
||||
/* the frame with that number isn't displayed */
|
||||
/* XXX - add it to the set of displayed frames? */
|
||||
simple_dialog(ESD_TYPE_CRIT, NULL,
|
||||
"The frame with that frame number is not currently being displayed.");
|
||||
return FALSE; /* we failed to go to that frame */
|
||||
}
|
||||
|
||||
/* We found that frame, and it's currently being displayed.
|
||||
Find what row it's in. */
|
||||
|
@ -1575,7 +1584,7 @@ goto_frame(capture_file *cf, guint fnumber)
|
|||
|
||||
/* Select that row, make it the focus row, and make it visible. */
|
||||
packet_list_set_selected_row(row);
|
||||
return FOUND_FRAME;
|
||||
return TRUE; /* we got to that frame */
|
||||
}
|
||||
|
||||
/* Select the packet on a given row. */
|
||||
|
|
9
file.h
9
file.h
|
@ -1,7 +1,7 @@
|
|||
/* file.h
|
||||
* Definitions for file structures and routines
|
||||
*
|
||||
* $Id: file.h,v 1.98 2002/09/06 22:45:40 sahlberg Exp $
|
||||
* $Id: file.h,v 1.99 2003/03/02 22:07:21 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -57,12 +57,7 @@ int print_packets(capture_file *cf, print_args_t *print_args);
|
|||
void change_time_formats(capture_file *);
|
||||
gboolean find_packet(capture_file *cf, dfilter_t *sfcode);
|
||||
|
||||
typedef enum {
|
||||
FOUND_FRAME, /* found the frame */
|
||||
NO_SUCH_FRAME, /* no frame with that number */
|
||||
FRAME_NOT_DISPLAYED /* frame with that number isn't displayed */
|
||||
} goto_result_t;
|
||||
goto_result_t goto_frame(capture_file *cf, guint fnumber);
|
||||
gboolean goto_frame(capture_file *cf, guint fnumber);
|
||||
|
||||
void select_packet(capture_file *, int);
|
||||
void unselect_packet(capture_file *);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* goto_dlg.c
|
||||
* Routines for "go to frame" window
|
||||
*
|
||||
* $Id: goto_dlg.c,v 1.19 2002/11/11 15:39:05 oabad Exp $
|
||||
* $Id: goto_dlg.c,v 1.20 2003/03/02 22:07:25 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -143,20 +143,9 @@ goto_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w)
|
|||
return;
|
||||
}
|
||||
|
||||
switch (goto_frame(&cfile, fnumber)) {
|
||||
|
||||
case NO_SUCH_FRAME:
|
||||
simple_dialog(ESD_TYPE_CRIT, NULL, "There is no frame with that frame number.");
|
||||
return;
|
||||
|
||||
case FRAME_NOT_DISPLAYED:
|
||||
/* XXX - add it to the display filter? */
|
||||
simple_dialog(ESD_TYPE_CRIT, NULL, "The frame with that frame number is not currently being displayed.");
|
||||
return;
|
||||
|
||||
case FOUND_FRAME:
|
||||
if (goto_frame(&cfile, fnumber)) {
|
||||
/* We succeeded in going to that frame; we're done. */
|
||||
gtk_widget_destroy(GTK_WIDGET(parent_w));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
22
gtk/main.c
22
gtk/main.c
|
@ -1,6 +1,6 @@
|
|||
/* main.c
|
||||
*
|
||||
* $Id: main.c,v 1.282 2003/03/01 10:18:54 guy Exp $
|
||||
* $Id: main.c,v 1.283 2003/03/02 22:07:25 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -231,24 +231,8 @@ goto_framenum_cb(GtkWidget *w _U_, gpointer data _U_)
|
|||
g_assert(hfinfo);
|
||||
if (hfinfo->type == FT_FRAMENUM) {
|
||||
framenum = fvalue_get_integer(finfo_selected->value);
|
||||
if (framenum != 0) {
|
||||
switch (goto_frame(&cfile, framenum)) {
|
||||
|
||||
case NO_SUCH_FRAME:
|
||||
simple_dialog(ESD_TYPE_CRIT, NULL,
|
||||
"There is no frame with that frame number.");
|
||||
break;
|
||||
|
||||
case FRAME_NOT_DISPLAYED:
|
||||
/* XXX - add it to the display filter? */
|
||||
simple_dialog(ESD_TYPE_CRIT, NULL,
|
||||
"The frame with that frame number is not currently being displayed.");
|
||||
return;
|
||||
|
||||
case FOUND_FRAME:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (framenum != 0)
|
||||
goto_frame(&cfile, framenum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue