diff options
-rw-r--r-- | file.c | 19 | ||||
-rw-r--r-- | gtk/progress_dlg.c | 36 | ||||
-rw-r--r-- | gtk/rtp_analysis.c | 4 | ||||
-rw-r--r-- | progress_dlg.h | 12 | ||||
-rw-r--r-- | proto_hier_stats.c | 4 |
5 files changed, 32 insertions, 43 deletions
@@ -1,7 +1,7 @@ /* file.c * File I/O routines * - * $Id: file.c,v 1.343 2004/01/20 18:47:21 ulfl Exp $ + * $Id: file.c,v 1.344 2004/01/21 22:00:27 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -398,7 +398,7 @@ cf_read(capture_file *cf, int *err) } if (progbar == NULL) { /* Create the progress bar if necessary */ - progbar = delayed_create_progress_dlg("Loading", load_msg, "Stop", + progbar = delayed_create_progress_dlg("Loading", load_msg, &stop_flag, &start_time, prog_val); if (progbar != NULL) g_free(load_msg); @@ -1100,7 +1100,7 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, if (progbar == NULL) /* Create the progress bar if necessary */ - progbar = delayed_create_progress_dlg(action, action_item, "Stop", &stop_flag, + progbar = delayed_create_progress_dlg(action, action_item, &stop_flag, &start_time, prog_val); if (progbar != NULL) { @@ -1266,7 +1266,7 @@ typedef enum { psp_return_t process_specified_packets(capture_file *cf, packet_range_t *range, - const char *string1, const char *string2, const char *stop_button_title, + const char *string1, const char *string2, gboolean (*callback)(capture_file *, frame_data *, union wtap_pseudo_header *, const guint8 *, void *), void *callback_args) @@ -1318,7 +1318,6 @@ process_specified_packets(capture_file *cf, packet_range_t *range, if (progbar == NULL) /* Create the progress bar if necessary */ progbar = delayed_create_progress_dlg(string1, string2, - stop_button_title, &progbar_stop_flag, &progbar_start_time, progbar_val); @@ -1408,7 +1407,7 @@ retap_packets(capture_file *cf) packet_range_init(&range); packet_range_process_init(&range); switch (process_specified_packets(cf, &range, "Refiltering statistics on", - "all packets", "Stop", retap_packet, + "all packets", retap_packet, NULL)) { case PSP_FINISHED: /* Completed successfully. */ @@ -1585,7 +1584,7 @@ print_packets(capture_file *cf, print_args_t *print_args) /* Iterate through the list of packets, printing the packets we were told to print. */ switch (process_specified_packets(cf, &print_args->range, "Printing", - "selected packets", "Stop", print_packet, + "selected packets", print_packet, &callback_args)) { case PSP_FINISHED: /* Completed successfully. */ @@ -1710,7 +1709,7 @@ change_time_formats(capture_file *cf) if (progbar == NULL) /* Create the progress bar if necessary */ - progbar = delayed_create_progress_dlg("Changing", "time display", "Stop", + progbar = delayed_create_progress_dlg("Changing", "time display", &stop_flag, &start_time, prog_val); if (progbar != NULL) { @@ -2155,7 +2154,7 @@ find_packet(capture_file *cf, /* Create the progress bar if necessary */ if (progbar == NULL) - progbar = delayed_create_progress_dlg("Searching", cf->sfilter, "Cancel", + progbar = delayed_create_progress_dlg("Searching", cf->sfilter, &stop_flag, &start_time, prog_val); if (progbar != NULL) { @@ -2600,7 +2599,7 @@ cf_save(char *fname, capture_file *cf, packet_range_t *range, guint save_format) callback_args.pdh = pdh; callback_args.fname = fname; switch (process_specified_packets(cf, range, "Saving", - "selected packets", "Stop", save_packet, + "selected packets", save_packet, &callback_args)) { case PSP_FINISHED: diff --git a/gtk/progress_dlg.c b/gtk/progress_dlg.c index 64146bb53e..9a6d9aa307 100644 --- a/gtk/progress_dlg.c +++ b/gtk/progress_dlg.c @@ -1,7 +1,7 @@ /* progress_dlg.c * Routines for progress-bar (modal) dialog * - * $Id: progress_dlg.c,v 1.20 2004/01/05 18:11:28 ulfl Exp $ + * $Id: progress_dlg.c,v 1.21 2004/01/21 22:00:28 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -78,11 +78,11 @@ struct progdlg { */ progdlg_t * create_progress_dlg(const gchar *task_title, const gchar *item_title, - const gchar *stop_title, gboolean *stop_flag) + gboolean *stop_flag) { progdlg_t *dlg; GtkWidget *dlg_w, *main_vb, *title_lb, *status_lb, *elapsed_lb, *time_left_lb, *percentage_lb; - GtkWidget *prog_bar, *bbox, *stop_bt; + GtkWidget *prog_bar, *bbox, *cancel_bt; GtkWidget *static_vb, *tmp_lb, *main_hb, *dynamic_vb, *percentage_hb; gchar tmp[100]; @@ -191,28 +191,21 @@ create_progress_dlg(const gchar *task_title, const gchar *item_title, gtk_box_pack_start(GTK_BOX(main_hb), dynamic_vb, FALSE, TRUE, 3); gtk_box_pack_start(GTK_BOX(main_vb), main_hb, FALSE, TRUE, 3); - /* - * Button row: cancel button. - * (We put it in an HButtonBox, even though there's only one - * of them, so that it doesn't expand to the width of the window.) - */ - bbox = gtk_hbutton_box_new(); - gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); - gtk_container_add(GTK_CONTAINER(main_vb), bbox); + /* Button row */ + bbox = dlg_button_row_new(GTK_STOCK_CANCEL, NULL); + gtk_container_add(GTK_CONTAINER(main_vb), bbox); + gtk_widget_show(bbox); + + cancel_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CANCEL); + gtk_widget_grab_default(cancel_bt); /* - * Allow user to either click a "stop this operation" button, or + * Allow user to either click the "Cancel" button, or * the close button on the window, to stop an operation in * progress. */ - stop_bt = gtk_button_new_with_label(stop_title); - gtk_box_pack_start(GTK_BOX (bbox), stop_bt, TRUE, TRUE, 0); - SIGNAL_CONNECT(stop_bt, "clicked", stop_cb, stop_flag); + SIGNAL_CONNECT(cancel_bt, "clicked", stop_cb, stop_flag); SIGNAL_CONNECT(dlg_w, "delete_event", delete_event_cb, stop_flag); - GTK_WIDGET_SET_FLAGS(stop_bt, GTK_CAN_DEFAULT); - gtk_widget_grab_default(stop_bt); - GTK_WIDGET_SET_FLAGS(stop_bt, GTK_CAN_DEFAULT); - gtk_widget_grab_default(stop_bt); gtk_widget_show_all(dlg_w); @@ -226,8 +219,7 @@ create_progress_dlg(const gchar *task_title, const gchar *item_title, progdlg_t * delayed_create_progress_dlg(const gchar *task_title, const gchar *item_title, - const gchar *stop_title, gboolean *stop_flag, - const GTimeVal *start_time, gfloat progress) + gboolean *stop_flag, const GTimeVal *start_time, gfloat progress) { GTimeVal time_now; gdouble delta_time; @@ -283,7 +275,7 @@ delayed_create_progress_dlg(const gchar *task_title, const gchar *item_title, if (progress >= (delta_time / (delta_time + min_display))) return NULL; - dlg = create_progress_dlg(task_title, item_title, stop_title, stop_flag); + dlg = create_progress_dlg(task_title, item_title, stop_flag); /* set dialog start_time to the start of processing, not box creation */ dlg->start_time = *start_time; diff --git a/gtk/rtp_analysis.c b/gtk/rtp_analysis.c index 406bc04d3c..1175a26e1d 100644 --- a/gtk/rtp_analysis.c +++ b/gtk/rtp_analysis.c @@ -1,7 +1,7 @@ /* rtp_analysis.c * RTP analysis addition for ethereal * - * $Id: rtp_analysis.c,v 1.21 2004/01/21 03:54:31 ulfl Exp $ + * $Id: rtp_analysis.c,v 1.22 2004/01/21 22:00:28 ulfl Exp $ * * Copyright 2003, Alcatel Business Systems * By Lars Ruoff <lars.ruoff@gmx.net> @@ -1070,7 +1070,7 @@ static gboolean copy_file(gchar *dest, gint channels, /*gint format,*/ user_data return FALSE; } - progbar = create_progress_dlg("Saving voice in a file", dest, "Stop", &stop_flag); + progbar = create_progress_dlg("Saving voice in a file", dest, &stop_flag); /* First we write the .au header. XXX Hope this is endian independant */ /* the magic word 0x2e736e64 == .snd */ diff --git a/progress_dlg.h b/progress_dlg.h index a2dc6d9fb7..2cac3c0c76 100644 --- a/progress_dlg.h +++ b/progress_dlg.h @@ -1,7 +1,7 @@ /* progress_dlg.h * Definitions for progress dialog box routines * - * $Id: progress_dlg.h,v 1.5 2002/08/28 22:28:42 guy Exp $ + * $Id: progress_dlg.h,v 1.6 2004/01/21 22:00:28 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -41,25 +41,23 @@ typedef struct progdlg progdlg_t; * * The first argument is the task to do, e.g. "Loading". * The second argument is the item to do, e.g. "capture.cap". - * The third argument is the string to put in the "stop this operation" button. - * The fourth argument is a pointer to a Boolean variable that will be + * The third argument is a pointer to a Boolean variable that will be * set to TRUE if the user hits that button. */ progdlg_t *create_progress_dlg(const gchar *task_title, const gchar *item_title, - const gchar *stop_title, gboolean *stop_flag); + gboolean *stop_flag); /* Create a progress dialog, but only if it's not likely to disappear * immediately, which can be disconcerting for the user. * - * The first four arguments are as for create_progress_dlg(). + * The first three arguments are as for create_progress_dlg(). * Following those is a pointer to a GTimeVal structure which holds * the time at which the caller started to process the data, and the * current progress (0..1). */ progdlg_t * delayed_create_progress_dlg(const gchar *task_title, const gchar *item_title, - const gchar *stop_title, gboolean *stop_flag, const GTimeVal *start_time, - gfloat progress); + gboolean *stop_flag, const GTimeVal *start_time, gfloat progress); /* * Update the progress information of the progress dialog box. diff --git a/proto_hier_stats.c b/proto_hier_stats.c index 5a3346a09b..e89ac15c27 100644 --- a/proto_hier_stats.c +++ b/proto_hier_stats.c @@ -1,7 +1,7 @@ /* proto_hier_stats.c * Routines for calculating statistics based on protocol. * - * $Id: proto_hier_stats.c,v 1.21 2004/01/09 21:38:21 guy Exp $ + * $Id: proto_hier_stats.c,v 1.22 2004/01/21 22:00:28 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -205,7 +205,7 @@ ph_stats_new(void) if (progbar == NULL) /* Create the progress bar if necessary */ progbar = delayed_create_progress_dlg( - "Computing", "protocol hierarchy statistics", "Stop", + "Computing", "protocol hierarchy statistics", &stop_flag, &start_time, prog_val); if (progbar != NULL) { |