from Sake Blok:
I have changed the patch according to your suggestions and also changed the doc[book] files accordingly. I tested the patch and it does seem to work fine on my test-system. ULFL: In addition, I've added the en-/disabling to the other (already existing) Copy menu items - some just did nothing, some crashed if nothing was selected. I've also sligthly changed the menu seperators and made both context menus look a bit more identical. svn path=/trunk/; revision=21005
This commit is contained in:
parent
78028f02b5
commit
acefba187a
|
@ -731,6 +731,17 @@ dialog box popped up by this menu item.
|
|||
|
||||
Exit the application.
|
||||
|
||||
=item Edit:Copy:As Filter
|
||||
|
||||
Create a display filter based on the data currently highlighted in the
|
||||
packet details and copy that filter to the clipboard.
|
||||
|
||||
If that data is a field that can be tested in a display filter
|
||||
expression, the display filter will test that field; otherwise, the
|
||||
display filter will be based on the absolute offset within the packet.
|
||||
Therefore it could be unreliable if the packet contains protocols with
|
||||
variable-length headers, such as a source-routed token-ring packet.
|
||||
|
||||
=item Edit:Find Packet
|
||||
|
||||
Search forward or backward, starting with the currently selected packet
|
||||
|
@ -972,28 +983,27 @@ changed, or deleted.
|
|||
|
||||
=item Analyze:Apply as Filter
|
||||
|
||||
Create a display filter, or add to the display filter strip at the
|
||||
bottom, a display filter based on the data currently highlighted in the
|
||||
packe details, and apply the filter.
|
||||
Create a display filter based on the data currently highlighted in the
|
||||
packet details and apply the filter.
|
||||
|
||||
If that data is a field that can be tested in a display filter
|
||||
expression, the display filter will test that field; otherwise, the
|
||||
display filter will be based on absolute offset within the packet, and
|
||||
so could be unreliable if the packet contains protocols with
|
||||
display filter will be based on the absolute offset within the packet.
|
||||
Therefore it could be unreliable if the packet contains protocols with
|
||||
variable-length headers, such as a source-routed token-ring packet.
|
||||
|
||||
The B<Selected> option creates a display filter that tests for a match
|
||||
of the data; the B<Not Selected> option creates a display filter that
|
||||
tests for a non-match of the data. The B<And Selected>, B<Or Selected>,
|
||||
B<And Not Selected>, and B<Or Not Selected> options add to the end of
|
||||
the display filter in the strip at the bottom an AND or OR operator
|
||||
followed by the new display filter expression.
|
||||
the display filter in the strip at the top (or bottom) an AND or OR
|
||||
operator followed by the new display filter expression.
|
||||
|
||||
=item Analyze:Prepare a Filter
|
||||
|
||||
Create a display filter, or add to the display filter strip at the
|
||||
bottom, a display filter based on the data currently highlighted in the
|
||||
packet details, but don't apply the filter.
|
||||
Create a display filter based on the data currently highlighted in the
|
||||
packet details. The filter strip at the top (or bottom) is updated but
|
||||
it is not yet applied.
|
||||
|
||||
=item Analyze:Enabled Protocols
|
||||
|
||||
|
@ -2227,3 +2237,4 @@ L<http://www.wireshark.org/docs/man-pages>.
|
|||
|
||||
=head1 AUTHORS
|
||||
|
||||
|
||||
|
|
|
@ -573,6 +573,20 @@
|
|||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><command>Copy > As Filter</command></entry>
|
||||
<entry></entry>
|
||||
<entry><para>
|
||||
This menu item will use the selected item in the detail view to
|
||||
create a display filter. This display filter is then copied to
|
||||
the clipboard.
|
||||
</para></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><command>------</command></entry>
|
||||
<entry></entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><command>Find Packet...</command></entry>
|
||||
<entry>Ctrl+F</entry>
|
||||
|
|
|
@ -184,6 +184,16 @@
|
|||
</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><command>Copy as Filter</command></entry>
|
||||
<entry>Analyze</entry>
|
||||
<entry>
|
||||
<para>
|
||||
Prepare a display filter based on the currently selected item
|
||||
and copy that filter to the clipboard.
|
||||
</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><command>Copy/ Bytes (Offset Hex Text)</command></entry>
|
||||
<entry>-</entry>
|
||||
|
@ -350,6 +360,16 @@
|
|||
<para>
|
||||
Copy the displayed text of the selected field to the system
|
||||
clipboard.
|
||||
</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><command>Copy/ As Filter</command></entry>
|
||||
<entry>-</entry>
|
||||
<entry>
|
||||
<para>
|
||||
Prepare a display filter based on the currently selected item
|
||||
and copy it to the clipboard.
|
||||
</para>
|
||||
</entry>
|
||||
</row>
|
||||
|
@ -1485,3 +1505,4 @@ eth.src[1-2] == 00:83
|
|||
<!-- End of WSUG Chapter Work -->
|
||||
|
||||
|
||||
|
||||
|
|
28
gtk/main.c
28
gtk/main.c
|
@ -247,8 +247,11 @@ match_selected_cb_do(gpointer data, int action, gchar *text)
|
|||
GtkWidget *filter_te;
|
||||
char *cur_filter, *new_filter;
|
||||
|
||||
if (!text)
|
||||
if ((!text) || (0 == strlen(text))) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not acquire information to build a filter!\nTry expanding or choosing another item.");
|
||||
return;
|
||||
}
|
||||
|
||||
g_assert(data);
|
||||
filter_te = OBJECT_GET_DATA(data, E_DFILTER_TE_KEY);
|
||||
g_assert(filter_te);
|
||||
|
@ -302,12 +305,20 @@ match_selected_cb_do(gpointer data, int action, gchar *text)
|
|||
/* Free up the copy we got of the old filter text. */
|
||||
g_free(cur_filter);
|
||||
|
||||
/* create a new one and set the display filter entry accordingly */
|
||||
gtk_entry_set_text(GTK_ENTRY(filter_te), new_filter);
|
||||
/* Don't change the current display filter if we only want to copy the filter */
|
||||
if (action&MATCH_SELECTED_COPY_ONLY) {
|
||||
GString *gtk_text_str = g_string_new("");
|
||||
g_string_sprintfa(gtk_text_str, "%s", new_filter);
|
||||
copy_to_clipboard(gtk_text_str);
|
||||
g_string_free(gtk_text_str, TRUE);
|
||||
} else {
|
||||
/* create a new one and set the display filter entry accordingly */
|
||||
gtk_entry_set_text(GTK_ENTRY(filter_te), new_filter);
|
||||
|
||||
/* Run the display filter so it goes in effect. */
|
||||
if (action&MATCH_SELECTED_APPLY_NOW)
|
||||
main_filter_packets(&cfile, new_filter, FALSE);
|
||||
/* Run the display filter so it goes in effect. */
|
||||
if (action&MATCH_SELECTED_APPLY_NOW)
|
||||
main_filter_packets(&cfile, new_filter, FALSE);
|
||||
}
|
||||
|
||||
/* Free up the new filter text. */
|
||||
g_free(new_filter);
|
||||
|
@ -321,8 +332,7 @@ match_selected_ptree_cb(GtkWidget *w, gpointer data, MATCH_SELECTED_E action)
|
|||
if (cfile.finfo_selected) {
|
||||
filter = proto_construct_match_selected_string(cfile.finfo_selected,
|
||||
cfile.edt);
|
||||
if (filter != NULL)
|
||||
match_selected_cb_do((data ? data : w), action, filter);
|
||||
match_selected_cb_do((data ? data : w), action, filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4638,6 +4648,8 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
|
|||
* of any widget that ends up calling a callback which needs
|
||||
* that text entry pointer */
|
||||
set_menu_object_data("/File/Open...", E_DFILTER_TE_KEY, filter_te);
|
||||
set_menu_object_data("/Edit/Copy/As Filter", E_DFILTER_TE_KEY,
|
||||
filter_te);
|
||||
set_menu_object_data("/Analyze/Display Filters...", E_FILT_TE_PTR_KEY,
|
||||
filter_te);
|
||||
set_menu_object_data("/Analyze/Follow TCP Stream", E_DFILTER_TE_KEY,
|
||||
|
|
|
@ -126,6 +126,9 @@ typedef enum {
|
|||
/** "bitwise or" this with MATCH_SELECTED_E value for instant apply instead of prepare only */
|
||||
#define MATCH_SELECTED_APPLY_NOW 0x100
|
||||
|
||||
/** "bitwise or" this with MATCH_SELECTED_E value for copy to clipboard instead of prepare only */
|
||||
#define MATCH_SELECTED_COPY_ONLY 0x200
|
||||
|
||||
/** User highlited item in details window and then right clicked and selected the copy option
|
||||
*
|
||||
* @param widget parent widget
|
||||
|
|
55
gtk/menu.c
55
gtk/menu.c
|
@ -432,6 +432,9 @@ static GtkItemFactoryEntry menu_items[] =
|
|||
ITEM_FACTORY_STOCK_ENTRY("/File/_Quit", "<control>Q", file_quit_cmd_cb,
|
||||
0, GTK_STOCK_QUIT),
|
||||
ITEM_FACTORY_ENTRY("/_Edit", NULL, NULL, 0, "<Branch>", NULL),
|
||||
ITEM_FACTORY_ENTRY("/Edit/Copy", NULL, NULL, 0, "<Branch>", NULL),
|
||||
ITEM_FACTORY_ENTRY("/Edit/Copy/As Filter", NULL, match_selected_ptree_cb,
|
||||
MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY, NULL, NULL),
|
||||
#if 0
|
||||
/* Un-#if this when we actually implement Cut/Copy/Paste. */
|
||||
ITEM_FACTORY_STOCK_ENTRY("/Edit/Cut", "<control>X", NULL,
|
||||
|
@ -440,8 +443,8 @@ static GtkItemFactoryEntry menu_items[] =
|
|||
0, GTK_STOCK_COPY),
|
||||
ITEM_FACTORY_STOCK_ENTRY("/Edit/Paste", "<control>V", NULL,
|
||||
0, GTK_STOCK_PASTE),
|
||||
ITEM_FACTORY_ENTRY("/Edit/<separator>", NULL, NULL, 0, "<Separator>"),
|
||||
#endif
|
||||
ITEM_FACTORY_ENTRY("/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
||||
ITEM_FACTORY_STOCK_ENTRY("/Edit/_Find Packet...", "<control>F",
|
||||
find_frame_cb, 0, GTK_STOCK_FIND),
|
||||
ITEM_FACTORY_ENTRY("/Edit/Find Ne_xt", "<control>N", find_next_cb, 0, NULL, NULL),
|
||||
|
@ -721,6 +724,9 @@ static GtkItemFactoryEntry packet_list_menu_items[] =
|
|||
ITEM_FACTORY_ENTRY("/Copy/Summary (Text)", NULL, packet_list_copy_summary_cb, CS_TEXT, NULL, NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/Summary (CSV)", NULL, packet_list_copy_summary_cb, CS_CSV, NULL, NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/As Filter", NULL, match_selected_plist_cb,
|
||||
MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY, NULL, NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/Bytes (Offset Hex Text)", NULL, copy_hex_cb, CD_ALLINFO, NULL, NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/Bytes (Offset Hex)", NULL, copy_hex_cb, CD_HEXCOLUMNS, NULL, NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/Bytes (Printable Text Only)", NULL, copy_hex_cb, CD_TEXTONLY, NULL, NULL),
|
||||
|
@ -730,8 +736,6 @@ static GtkItemFactoryEntry packet_list_menu_items[] =
|
|||
ITEM_FACTORY_ENTRY("/Copy/Bytes (Binary Stream)", NULL, copy_hex_cb, CD_BINARY, NULL, NULL),
|
||||
#endif
|
||||
|
||||
ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
||||
|
||||
ITEM_FACTORY_ENTRY("/Export Selected Packet Bytes...", NULL, savehex_cb,
|
||||
0, NULL, NULL),
|
||||
|
||||
|
@ -752,24 +756,6 @@ static GtkItemFactoryEntry tree_view_menu_items[] =
|
|||
|
||||
ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
||||
|
||||
ITEM_FACTORY_ENTRY("/Copy", NULL, NULL, 0, "<Branch>", NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/Description", NULL, copy_selected_plist_cb, 0, NULL, NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/Bytes (Offset Hex Text)", NULL, copy_hex_cb, CD_ALLINFO | CD_FLAGS_SELECTEDONLY, NULL, NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/Bytes (Offset Hex)", NULL, copy_hex_cb, CD_HEXCOLUMNS | CD_FLAGS_SELECTEDONLY, NULL, NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/Bytes (Printable Text Only)", NULL, copy_hex_cb, CD_TEXTONLY | CD_FLAGS_SELECTEDONLY, NULL, NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/Bytes (Hex Stream)", NULL, copy_hex_cb, CD_HEX | CD_FLAGS_SELECTEDONLY, NULL, NULL),
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
ITEM_FACTORY_ENTRY("/Copy/Bytes (Binary Stream)", NULL, copy_hex_cb, CD_BINARY | CD_FLAGS_SELECTEDONLY, NULL, NULL),
|
||||
#endif
|
||||
|
||||
ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
||||
|
||||
ITEM_FACTORY_ENTRY("/Export Selected Packet Bytes...", NULL, savehex_cb,
|
||||
0, NULL, NULL),
|
||||
|
||||
ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
||||
|
||||
ITEM_FACTORY_ENTRY("/Apply as Filter", NULL, NULL, 0, "<Branch>", NULL),
|
||||
ITEM_FACTORY_ENTRY("/Apply as Filter/_Selected", NULL, match_selected_ptree_cb,
|
||||
MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
|
||||
|
@ -805,6 +791,25 @@ static GtkItemFactoryEntry tree_view_menu_items[] =
|
|||
|
||||
ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
||||
|
||||
ITEM_FACTORY_ENTRY("/Copy", NULL, NULL, 0, "<Branch>", NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/Description", NULL, copy_selected_plist_cb, 0, NULL, NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/As Filter", NULL, match_selected_ptree_cb, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY, NULL, NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/Bytes (Offset Hex Text)", NULL, copy_hex_cb, CD_ALLINFO | CD_FLAGS_SELECTEDONLY, NULL, NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/Bytes (Offset Hex)", NULL, copy_hex_cb, CD_HEXCOLUMNS | CD_FLAGS_SELECTEDONLY, NULL, NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/Bytes (Printable Text Only)", NULL, copy_hex_cb, CD_TEXTONLY | CD_FLAGS_SELECTEDONLY, NULL, NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
||||
ITEM_FACTORY_ENTRY("/Copy/Bytes (Hex Stream)", NULL, copy_hex_cb, CD_HEX | CD_FLAGS_SELECTEDONLY, NULL, NULL),
|
||||
#if GTK_MAJOR_VERSION >= 2
|
||||
ITEM_FACTORY_ENTRY("/Copy/Bytes (Binary Stream)", NULL, copy_hex_cb, CD_BINARY | CD_FLAGS_SELECTEDONLY, NULL, NULL),
|
||||
#endif
|
||||
|
||||
ITEM_FACTORY_ENTRY("/Export Selected Packet Bytes...", NULL, savehex_cb,
|
||||
0, NULL, NULL),
|
||||
|
||||
ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
|
||||
|
||||
ITEM_FACTORY_STOCK_ENTRY("/Wiki Protocol Page", NULL, selected_ptree_info_cb,
|
||||
0, WIRESHARK_STOCK_WIKI),
|
||||
ITEM_FACTORY_STOCK_ENTRY("/Filter Field Reference", NULL, selected_ptree_ref_cb,
|
||||
|
@ -2395,6 +2400,8 @@ set_menus_for_selected_packet(capture_file *cf)
|
|||
cf->current_frame != NULL && (g_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
|
||||
set_menu_sensitivity(tree_view_menu_factory, "/Resolve Name",
|
||||
cf->current_frame != NULL && (g_resolv_flags & RESOLV_ALL_ADDRS) != RESOLV_ALL_ADDRS);
|
||||
set_menu_sensitivity(packet_list_menu_factory, "/Copy",
|
||||
cf->current_frame != NULL);
|
||||
set_menu_sensitivity(packet_list_menu_factory, "/Apply as Filter",
|
||||
cf->current_frame != NULL);
|
||||
set_menu_sensitivity(packet_list_menu_factory, "/Prepare a Filter",
|
||||
|
@ -2482,6 +2489,10 @@ set_menus_for_selected_tree_row(capture_file *cf)
|
|||
"/Go/Go to Corresponding Packet", hfinfo->type == FT_FRAMENUM);
|
||||
set_menu_sensitivity(tree_view_menu_factory,
|
||||
"/Go to Corresponding Packet", hfinfo->type == FT_FRAMENUM);
|
||||
set_menu_sensitivity(main_menu_factory, "/Edit/Copy",
|
||||
proto_can_match_selected(cf->finfo_selected, cf->edt));
|
||||
set_menu_sensitivity(tree_view_menu_factory, "/Copy",
|
||||
proto_can_match_selected(cf->finfo_selected, cf->edt));
|
||||
set_menu_sensitivity(main_menu_factory, "/Analyze/Apply as Filter",
|
||||
proto_can_match_selected(cf->finfo_selected, cf->edt));
|
||||
set_menu_sensitivity(tree_view_menu_factory, "/Apply as Filter",
|
||||
|
@ -2503,6 +2514,8 @@ set_menus_for_selected_tree_row(capture_file *cf)
|
|||
"/Go/Go to Corresponding Packet", FALSE);
|
||||
set_menu_sensitivity(tree_view_menu_factory,
|
||||
"/Go to Corresponding Packet", FALSE);
|
||||
set_menu_sensitivity(main_menu_factory, "/Edit/Copy", FALSE);
|
||||
set_menu_sensitivity(tree_view_menu_factory, "/Copy", FALSE);
|
||||
set_menu_sensitivity(main_menu_factory, "/Analyze/Apply as Filter", FALSE);
|
||||
set_menu_sensitivity(tree_view_menu_factory, "/Apply as Filter", FALSE);
|
||||
set_menu_sensitivity(main_menu_factory, "/Analyze/Prepare a Filter", FALSE);
|
||||
|
|
Loading…
Reference in New Issue