Add menu item for capture comment dialog in GTK+

Qt already has a menu item for this in Statistics -> Capture File Properties

Bug: 9628
Change-Id: I85dd6f85d43fbfb60c2f4db82d9a02d91866127c
Reviewed-on: https://code.wireshark.org/review/12725
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Dirk 2015-12-19 11:21:12 -05:00 committed by Michael Mann
parent 85e3750b06
commit 07f0cf8633
5 changed files with 22 additions and 21 deletions

View File

@ -367,6 +367,11 @@ This will let you add a comment to a single packet. Note that the ability
to save packet comments depends on your file format. E.g. pcapng supports
comments, pcap does not.
|menu:Capture Comment...[] ||
This will let you add a capture comment. Note that the ability to save
capture comments depends on your file format. E.g. pcapng supports
comments, pcap does not.
|menu:Configuration Profiles...[] |kbd:[Shift+Ctrl+A]|
This menu item brings up a dialog box for handling configuration profiles. More
detail is provided in <<ChCustConfigProfilesSection>>.

View File

@ -168,9 +168,8 @@ edit_capture_comment_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
}
void
edit_capture_comment_dlg_launch (void)
edit_capture_comment_dlg_launch (GtkAction *action _U_, gpointer data _U_)
{
GtkWidget *vbox;
GtkWidget *view;
GtkWidget *scroll;
@ -178,7 +177,6 @@ edit_capture_comment_dlg_launch (void)
GtkWidget *ok_bt, *cancel_bt, *help_bt;
GtkTextBuffer *buffer = NULL;
const gchar *comment_str = NULL;
gchar *buf_str;
if (edit_or_add_capture_comment_dlg != NULL) {
/* There's already an "Edit Capture Comment" dialog box; reactivate it. */
@ -212,12 +210,8 @@ edit_capture_comment_dlg_launch (void)
/* Get the comment */
comment_str = cf_read_shb_comment(&cfile);
/*g_warning("Fetched comment '%s'",opt_comment);*/
if(comment_str != NULL){
buf_str = g_strdup_printf("%s", comment_str);
gtk_text_buffer_set_text (buffer, buf_str, -1);
g_free(buf_str);
gtk_text_buffer_set_text (buffer, comment_str, -1);
}
/* Button row. */
@ -240,9 +234,7 @@ edit_capture_comment_dlg_launch (void)
gtk_widget_grab_default (ok_bt);
g_signal_connect (edit_or_add_capture_comment_dlg, "delete_event", G_CALLBACK(window_delete_event_cb), NULL);
gtk_widget_show (edit_or_add_capture_comment_dlg);
}

View File

@ -24,7 +24,7 @@
#define __EDIT_PACKET_COMMENTS_H__
void edit_packet_comment_dlg (GtkAction *action, gpointer data);
void edit_capture_comment_dlg_launch (void);
void edit_capture_comment_dlg_launch (GtkAction *action, gpointer data);
void edit_capture_comment_dlg_hide (void);
#endif /* __EDIT_PACKET_COMMENTS_H__ */

View File

@ -859,6 +859,7 @@ static const char *ui_desc_menubar =
" <menuitem name='EditPacket' action='/Edit/EditPacket'/>\n"
#endif
" <menuitem name='AddEditPktComment' action='/Edit/AddEditPktComment'/>\n"
" <menuitem name='AddEditCaptureComment' action='/Edit/AddEditCaptureComment'/>\n"
" <separator/>\n"
" <menuitem name='ConfigurationProfiles' action='/Edit/ConfigurationProfiles'/>\n"
" <menuitem name='Preferences' action='/Edit/Preferences'/>\n"
@ -1364,15 +1365,16 @@ static const GtkActionEntry main_menu_bar_entries[] = {
{ "/Edit/ConfigurationProfiles", NULL, "_Configuration Profiles...", "<shift><control>A", NULL, G_CALLBACK(profile_dialog_cb) },
{ "/Edit/Preferences", GTK_STOCK_PREFERENCES, "_Preferences...", "<shift><control>P", NULL, G_CALLBACK(menus_prefs_cb) },
#ifdef WANT_PACKET_EDITOR
{ "/Edit/EditPacket", NULL, "_Edit Packet", NULL, NULL, G_CALLBACK(edit_window_cb) },
{ "/Edit/EditPacket", NULL, "_Edit Packet", NULL, NULL, G_CALLBACK(edit_window_cb) },
#endif
{ "/Edit/AddEditPktComment", WIRESHARK_STOCK_EDIT, "Packet Comment...", NULL, NULL, G_CALLBACK(edit_packet_comment_dlg) },
{ "/Edit/AddEditPktComment", WIRESHARK_STOCK_EDIT, "Packet Comment...", NULL, NULL, G_CALLBACK(edit_packet_comment_dlg) },
{ "/Edit/AddEditCaptureComment", NULL, "Capture Comment...", NULL, NULL, G_CALLBACK(edit_capture_comment_dlg_launch) },
{ "/View/TimeDisplayFormat", NULL, "_Time Display Format", NULL, NULL, NULL },
{ "/View/TimeDisplayFormat", NULL, "_Time Display Format", NULL, NULL, NULL },
{ "/View/NameResolution", NULL, "Name Resol_ution", NULL, NULL, NULL },
{ "/View/NameResolution/ResolveName", NULL, "_Resolve Name", NULL, NULL, G_CALLBACK(resolve_name_cb) },
{ "/View/NameResolution/ManuallyResolveName",NULL, "Manually Resolve Name", NULL, NULL, G_CALLBACK(manual_addr_resolv_dlg) },
{ "/View/NameResolution", NULL, "Name Resol_ution", NULL, NULL, NULL },
{ "/View/NameResolution/ResolveName", NULL, "_Resolve Name", NULL, NULL, G_CALLBACK(resolve_name_cb) },
{ "/View/NameResolution/ManuallyResolveName",NULL, "Manually Resolve Name", NULL, NULL, G_CALLBACK(manual_addr_resolv_dlg) },
{ "/View/ZoomIn", GTK_STOCK_ZOOM_IN, "_Zoom In", "<control>plus", NULL, G_CALLBACK(view_zoom_in_cb) },
{ "/View/ZoomOut", GTK_STOCK_ZOOM_OUT, "Zoom _Out", "<control>minus", NULL, G_CALLBACK(view_zoom_out_cb) },
@ -2241,9 +2243,9 @@ static const GtkActionEntry packet_list_menu_popup_action_entries[] = {
{ "/TimeShift", WIRESHARK_STOCK_TIME, "Time Shift...", NULL, NULL, G_CALLBACK(time_shift_cb) },
{ "/ManuallyResolveAddress", NULL, "Manually Resolve Address", NULL, NULL, G_CALLBACK(manual_addr_resolv_dlg) },
#ifdef WANT_PACKET_EDITOR
{ "/Edit/EditPacket", NULL, "_Edit Packet", NULL, NULL, G_CALLBACK(edit_window_cb) },
{ "/Edit/EditPacket", NULL, "_Edit Packet", NULL, NULL, G_CALLBACK(edit_window_cb) },
#endif
{ "/Edit/AddEditPktComment", WIRESHARK_STOCK_EDIT, "Packet Comment...", NULL, NULL, G_CALLBACK(edit_packet_comment_dlg) },
{ "/Edit/AddEditPktComment", WIRESHARK_STOCK_EDIT, "Packet Comment...", NULL, NULL, G_CALLBACK(edit_packet_comment_dlg) },
{ "/Conversation Filter", NULL, "Conversation Filter", NULL, NULL, NULL },
{ "/Colorize Conversation", NULL, "Colorize Conversation", NULL, NULL, NULL },
@ -4601,6 +4603,8 @@ set_menus_for_selected_packet(capture_file *cf)
#endif /* WANT_PACKET_EDITOR */
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/AddEditPktComment",
frame_selected && wtap_dump_can_write(cf->linktypes, WTAP_COMMENT_PER_PACKET));
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/AddEditCaptureComment",
frame_selected && wtap_dump_can_write(cf->linktypes, WTAP_COMMENT_PER_PACKET));
set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/IgnorePacket",
frame_selected);
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/EditMenu/IgnoreAllDisplayedPackets",
@ -5181,7 +5185,7 @@ menus_set_column_align_default (gboolean right_justify)
menu_item_child = gtk_bin_get_child(GTK_BIN(child_list_item->data));
if (menu_item_child != NULL) {
menu_item_name = gtk_label_get_text(GTK_LABEL(menu_item_child));
menu_item_len = strlen (menu_item_name);
menu_item_len = strlen(menu_item_name);
if(strncmp(menu_item_name, "Align Left", 10) == 0) {
if (!right_justify && menu_item_len == 10) {
gtk_label_set_text(GTK_LABEL(menu_item_child), "Align Left\t(default)");

View File

@ -565,7 +565,7 @@ expert_comp_dlg_event_cb(GtkWidget *w _U_, GdkEventButton *event _U_, gpointer u
static gboolean
edit_capture_comment_dlg_event_cb(GtkWidget *w _U_, GdkEventButton *event _U_, gpointer user_data _U_)
{
edit_capture_comment_dlg_launch();
edit_capture_comment_dlg_launch(NULL, NULL);
return TRUE;
}