diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2013-08-21 21:44:48 +0000 |
---|---|---|
committer | Martin Kaiser <wireshark@kaiser.cx> | 2013-08-21 21:44:48 +0000 |
commit | 8c484c090b756f0c6eda16688d745792b6bb7f44 (patch) | |
tree | 481486d6d1083e22ba1f1a1e721f70620fc9e2d9 /ui/gtk/export_pdu_dlg.c | |
parent | ac73f00086ff62bf19803c34ce31609f587bf187 (diff) |
The export PDU mechanism creates a new capture which contains only the
exported PDUs. The currently opened capture file is closed.
Make sure that this does not discard any unsaved data. Ask the user for
confirmation and save the changes before running the export.
svn path=/trunk/; revision=51459
Diffstat (limited to 'ui/gtk/export_pdu_dlg.c')
-rw-r--r-- | ui/gtk/export_pdu_dlg.c | 63 |
1 files changed, 30 insertions, 33 deletions
diff --git a/ui/gtk/export_pdu_dlg.c b/ui/gtk/export_pdu_dlg.c index 99752a4b8c..a8799a7dc7 100644 --- a/ui/gtk/export_pdu_dlg.c +++ b/ui/gtk/export_pdu_dlg.c @@ -38,6 +38,7 @@ #include "ui/alert_box.h" #include "ui/simple_dialog.h" +#include "ui/gtk/capture_file_dlg.h" #include "ui/gtk/dlg_utils.h" #include "ui/gtk/gui_utils.h" #include "ui/gtk/filter_dlg.h" @@ -229,40 +230,36 @@ export_pdu_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_) export_pdu_dlg = NULL; } -static void -export_pdu_ok_cb(GtkWidget *widget _U_, gpointer data) +void +do_export_pdu(gpointer data) { - const char *filter = NULL; - GString *error_string; - exp_pdu_t *exp_pdu_tap_data = (exp_pdu_t *)data; - gchar *tap_name = NULL; - - filter = gtk_entry_get_text(GTK_ENTRY(exp_pdu_tap_data->filter_widget)); - tap_name = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(exp_pdu_tap_data->tap_name_widget)); - - /* Register this tap listener now */ - error_string = register_tap_listener(tap_name, /* The name of the tap we want to listen to */ - exp_pdu_tap_data, /* instance identifier/pointer to a struct holding - * all state variables - */ - filter, /* pointer to a filter string */ - TL_REQUIRES_NOTHING, /* flags for the tap listener */ - export_pdu_reset, - export_pdu_packet, - export_pdu_draw); - if (error_string){ - /* Error. We failed to attach to the tap. Clean up */ - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); - g_free(exp_pdu_tap_data); - g_string_free(error_string, TRUE); - return; - } - - - exp_pdu_file_open(exp_pdu_tap_data); - - window_destroy(export_pdu_dlg); + const char *filter = NULL; + GString *error_string; + exp_pdu_t *exp_pdu_tap_data = (exp_pdu_t *)data; + gchar *tap_name = NULL; + + filter = gtk_entry_get_text(GTK_ENTRY(exp_pdu_tap_data->filter_widget)); + tap_name = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(exp_pdu_tap_data->tap_name_widget)); + + /* Register this tap listener now */ + error_string = register_tap_listener(tap_name, /* The name of the tap we want to listen to */ + exp_pdu_tap_data, /* instance identifier/pointer to a struct holding + * all state variables */ + filter, /* pointer to a filter string */ + TL_REQUIRES_NOTHING, /* flags for the tap listener */ + export_pdu_reset, + export_pdu_packet, + export_pdu_draw); + if (error_string){ + /* Error. We failed to attach to the tap. Clean up */ + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str); + g_free(exp_pdu_tap_data); + g_string_free(error_string, TRUE); + return; + } + exp_pdu_file_open(exp_pdu_tap_data); + window_destroy(export_pdu_dlg); } @@ -353,7 +350,7 @@ export_pdu_show_cb(GtkWidget *w _U_, gpointer d _U_) gtk_widget_set_tooltip_text(close_bt, "Close this dialog"); ok_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_OK); - g_signal_connect(ok_bt, "clicked", G_CALLBACK(export_pdu_ok_cb), exp_pdu_tap_data); + g_signal_connect(ok_bt, "clicked", G_CALLBACK(file_export_pdu_ok_cb), exp_pdu_tap_data); gtk_widget_grab_default(ok_bt); gtk_widget_set_tooltip_text(ok_bt, "Export PDU:s to a temporary capture file"); |