aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2005-01-24 19:33:47 +0000
committerUlf Lamping <ulf.lamping@web.de>2005-01-24 19:33:47 +0000
commit5c19161dc29278da588f0f4d3a59ca31033f6899 (patch)
tree1650b936bd67905247e151bc6f5fb4dc5318b98a /gtk
parent777f7299587b7a1c775b36f89e3571881ab2893d (diff)
downloadwireshark-5c19161dc29278da588f0f4d3a59ca31033f6899.tar.gz
wireshark-5c19161dc29278da588f0f4d3a59ca31033f6899.tar.bz2
wireshark-5c19161dc29278da588f0f4d3a59ca31033f6899.zip
if context menu item "Print" is clicked from the packet list context menu, it should use the selected range setting as default. As we currently have only one packet selectable, this will print only this one.
If we would allow selecting multiple packets in the packet list in the future, this option would print all selected packets. svn path=/trunk/; revision=13169
Diffstat (limited to 'gtk')
-rw-r--r--gtk/main.h7
-rw-r--r--gtk/menu.c2
-rw-r--r--gtk/print_dlg.c19
3 files changed, 25 insertions, 3 deletions
diff --git a/gtk/main.h b/gtk/main.h
index 75db92e69e..4d58bb7534 100644
--- a/gtk/main.h
+++ b/gtk/main.h
@@ -145,6 +145,13 @@ extern void file_quit_cmd_cb(GtkWidget *widget, gpointer data);
*/
extern void file_print_cmd_cb(GtkWidget *widget, gpointer data);
+/** User requested "Print" by packet list context menu.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void file_print_selected_cmd_cb(GtkWidget *widget _U_, gpointer data _U_);
+
/** User requested "Export as Plain Text" by menu.
*
* @param widget parent widget (unused)
diff --git a/gtk/menu.c b/gtk/menu.c
index 1ccf053c87..4b53801508 100644
--- a/gtk/menu.c
+++ b/gtk/menu.c
@@ -420,7 +420,7 @@ static GtkItemFactoryEntry packet_list_menu_items[] =
ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
ITEM_FACTORY_ENTRY("/Decode As...", NULL, decode_as_cb, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Print...", NULL, file_print_cmd_cb, 0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Print...", NULL, file_print_selected_cmd_cb, 0, NULL, NULL),
ITEM_FACTORY_ENTRY("/Show Packet in New Window", NULL, new_window_cb,
0, NULL, NULL)
};
diff --git a/gtk/print_dlg.c b/gtk/print_dlg.c
index eedaeaa5f3..114917a3f9 100644
--- a/gtk/print_dlg.c
+++ b/gtk/print_dlg.c
@@ -112,7 +112,7 @@ static gboolean print_prefs_init = FALSE;
void
-file_print_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
+file_print_cmd(gboolean print_selected)
{
print_args_t *args = &print_args;
@@ -134,14 +134,29 @@ file_print_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
args->print_hex = FALSE;
args->print_formfeed = FALSE;
}
-
+
/* init the printing range */
packet_range_init(&args->range);
+ if(print_selected) {
+ args->range.process = range_process_selected;
+ }
+
print_win = open_print_dialog("Ethereal: Print", output_action_print, args);
SIGNAL_CONNECT(print_win, "destroy", print_destroy_cb, &print_win);
}
+void
+file_print_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
+{
+ file_print_cmd(FALSE);
+}
+
+void
+file_print_selected_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
+{
+ file_print_cmd(TRUE);
+}
/*
* Keep a static pointer to the current "Export text" window, if any, so that if