Ethereal-dev: [ethereal-dev] ethereal 0.8.12: add "/Capture/Stop" menu item

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Santeri Paavolainen <santtu@xxxxxxx>
Date: Mon, 25 Sep 2000 13:04:21 +0300 (EEST)
This patch (a bit crude, and crossing some module boundaries, but
works) adds a /Capture/Stop menu item.

Rationale: I usually run ethereal maximized and as topmost window with the
real time update set on. It often happens that I lose the "capture
progress" window where the "stop" button is located, and have to hunt it
down.

With this patch the main window has the capability to stop the capture in
addition to start it. Which is nice.

-- 
santtu@xxxxxx                    I have become death, destroyer of the worlds.
diff -wcr ethereal-0.8.12-orig/capture.c ethereal-0.8.12/capture.c
*** ethereal-0.8.12-orig/capture.c	Tue Aug 22 09:04:40 2000
--- ethereal-0.8.12/capture.c	Mon Sep 25 12:55:30 2000
***************
*** 1457,1462 ****
--- 1457,1470 ----
    ld->go = FALSE;
  }
  
+ void capture_stop (gpointer data)
+ {
+ #ifndef _WIN32
+     if (fork_child != -1)
+         kill(fork_child, SIGUSR1);
+ #endif
+ }
+ 
  static void
  capture_pcap_cb(u_char *user, const struct pcap_pkthdr *phdr,
    const u_char *pd) {
diff -wcr ethereal-0.8.12-orig/gtk/capture_dlg.c ethereal-0.8.12/gtk/capture_dlg.c
*** ethereal-0.8.12-orig/gtk/capture_dlg.c	Wed Aug 23 23:55:44 2000
--- ethereal-0.8.12/gtk/capture_dlg.c	Mon Sep 25 12:53:08 2000
***************
*** 89,94 ****
--- 89,101 ----
  static void
  capture_prep_destroy_cb(GtkWidget *win, gpointer user_data);
  
+ void
+ capture_stop_cb(GtkWidget *w, gpointer d)
+ {
+     extern void capture_stop ();
+     capture_stop();
+ }
+ 
  /*
   * Keep a static pointer to the current "Capture Preferences" window, if
   * any, so that if somebody tries to do "Capture:Start" while there's
diff -wcr ethereal-0.8.12-orig/gtk/capture_dlg.h ethereal-0.8.12/gtk/capture_dlg.h
*** ethereal-0.8.12-orig/gtk/capture_dlg.h	Thu Sep  9 06:32:01 1999
--- ethereal-0.8.12/gtk/capture_dlg.h	Mon Sep 25 12:14:57 2000
***************
*** 27,31 ****
--- 27,32 ----
  #define __CAPTURE_DLG_H__
  
  void   capture_prep_cb(GtkWidget *, gpointer);
+ void   capture_stop_cb(GtkWidget *, gpointer);
  
  #endif /* capture.h */
diff -wcr ethereal-0.8.12-orig/gtk/menu.c ethereal-0.8.12/gtk/menu.c
*** ethereal-0.8.12-orig/gtk/menu.c	Tue Sep 12 23:25:59 2000
--- ethereal-0.8.12/gtk/menu.c	Mon Sep 25 12:14:10 2000
***************
*** 124,129 ****
--- 124,130 ----
  #ifdef HAVE_LIBPCAP
    {"/_Capture", NULL, NULL, 0, "<Branch>" },
    {"/Capture/_Start...", "<control>K", GTK_MENU_FUNC(capture_prep_cb), 0, NULL},
+   {"/Capture/S_top", "<control>E", GTK_MENU_FUNC(capture_stop_cb), 0, NULL},
  #endif
    {"/_Display", NULL, NULL, 0, "<Branch>" },
    {"/Display/_Options...", NULL, GTK_MENU_FUNC(display_opt_cb), 0, NULL},
***************
*** 346,351 ****
--- 347,353 ----
  {
    set_menu_sensitivity("/File/Open...", !capture_in_progress);
    set_menu_sensitivity("/Capture/Start...", !capture_in_progress);
+   set_menu_sensitivity("/Capture/Stop", capture_in_progress);
  }
  
  /* Enable or disable menu items based on whether you have some captured