aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gtk/about_dlg.c4
-rw-r--r--gtk/capture_dlg.h25
-rw-r--r--gtk/compat_macros.h33
-rw-r--r--gtk/dlg_utils.c65
-rw-r--r--gtk/dlg_utils.h23
-rw-r--r--gtk/file_dlg.c36
-rw-r--r--gtk/file_dlg.h79
-rw-r--r--gtk/filter_prefs.c4
-rw-r--r--gtk/filter_prefs.h100
-rw-r--r--gtk/follow_dlg.c9
-rw-r--r--gtk/goto_dlg.c35
-rw-r--r--gtk/goto_dlg.h34
-rw-r--r--gtk/gtkglobals.h40
-rw-r--r--gtk/help_dlg.c4
-rw-r--r--gtk/help_dlg.h24
-rw-r--r--gtk/main.c294
-rw-r--r--gtk/main.h267
-rw-r--r--gtk/menu.c165
-rw-r--r--gtk/proto_draw.c7
-rw-r--r--gtk/recent.c7
-rw-r--r--gtk/rtp_analysis.c6
-rw-r--r--gtk/rtp_stream_dlg.c4
-rw-r--r--gtk/toolbar.h43
23 files changed, 759 insertions, 549 deletions
diff --git a/gtk/about_dlg.c b/gtk/about_dlg.c
index 483d0964fa..52f51bbf2c 100644
--- a/gtk/about_dlg.c
+++ b/gtk/about_dlg.c
@@ -1,6 +1,6 @@
/* about_dlg.c
*
- * $Id: about_dlg.c,v 1.12 2004/05/27 16:41:33 ulfl Exp $
+ * $Id: about_dlg.c,v 1.13 2004/06/01 17:33:35 ulfl Exp $
*
* Ulf Lamping <ulf.lamping@web.de>
*
@@ -148,7 +148,7 @@ about_folders_page_new(void)
table = simple_list_new(3, titles);
/* "file open" */
- about_folders_row(table, "\"File\" dialogs", last_open_dir,
+ about_folders_row(table, "\"File\" dialogs", get_last_open_dir(),
"capture files");
/* temp */
diff --git a/gtk/capture_dlg.h b/gtk/capture_dlg.h
index a149044398..5a50dba2b4 100644
--- a/gtk/capture_dlg.h
+++ b/gtk/capture_dlg.h
@@ -1,7 +1,7 @@
/* capture_dlg.h
* Definitions for packet capture windows
*
- * $Id: capture_dlg.h,v 1.4 2004/01/29 23:11:37 ulfl Exp $
+ * $Id: capture_dlg.h,v 1.5 2004/06/01 17:33:35 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -26,9 +26,26 @@
#ifndef __CAPTURE_DLG_H__
#define __CAPTURE_DLG_H__
-void capture_prep_cb(GtkWidget *, gpointer);
-void capture_stop_cb(GtkWidget *, gpointer);
+/** @file
+ * "Capture Options" dialog box.
+ */
+
+/** User requested the "Capture Options" dialog box by menu or toolbar.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+void capture_prep_cb(GtkWidget *widget, gpointer data);
-void capture_prep(void);
+/** User requested capture stop by menu or toolbar.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+void capture_stop_cb(GtkWidget *widget, gpointer data);
+
+/** Create the "Capture Options" dialog box.
+ */
+void capture_prep(void);
#endif /* capture.h */
diff --git a/gtk/compat_macros.h b/gtk/compat_macros.h
index 0af83f2508..be7ab247de 100644
--- a/gtk/compat_macros.h
+++ b/gtk/compat_macros.h
@@ -1,7 +1,7 @@
/* compat_macros.h
* GTK-related Global defines, etc.
*
- * $Id: compat_macros.h,v 1.16 2004/05/31 15:47:34 ulfl Exp $
+ * $Id: compat_macros.h,v 1.17 2004/06/01 17:33:35 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -28,8 +28,9 @@
/** @file
*
- * Helper macros for gtk1.2/gtk2 compatibility :
- * in gtk2, gtk_signal_xxx is deprecated in favor of g_signal_xxx,
+ * Helper macros for gtk1.x / gtk2.x compatibility. Use these macros instead of the GTK deprecated functions,
+ * to keep compatibility between GTK 1.x and 2.x.
+ * For example in gtk2.x, gtk_signal_xxx is deprecated in favor of g_signal_xxx,
* gtk_object_xxx is deprecated in favor of g_object_xxx,
* gtk_widget_set_usize is deprecated in favor of
* gtk_widget_set_size_request, ...
@@ -222,21 +223,47 @@ gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), name)
#define ETHEREAL_STOCK_EDIT "Edit..."
#define ETHEREAL_STOCK_ADD_EXPRESSION "Add Expression..."
+/** Create a stock button. Will create a "normal" button for GTK1.
+ *
+ * @param stock_id the stock id for this button (e.g. GTK_STOCK_OK)
+ * @return the new button
+ */
#define BUTTON_NEW_FROM_STOCK(stock_id) \
gtk_button_new_with_label(stock_id);
+/** Create a check button.
+ *
+ * @param label_text the text to display
+ * @param accel_group accelerator group (GTK1 only)
+ * @return the new check button
+ */
#define CHECK_BUTTON_NEW_WITH_MNEMONIC(label_text, accel_group) \
dlg_check_button_new_with_label_with_mnemonic(label_text, accel_group)
+/** Create a radio button.
+ *
+ * @param radio_group group the radio buttons (another radio button or NULL for first one)
+ * @param label_text the text to display
+ * @param accel_group accelerator group (GTK1 only)
+ * @return the new radio button
+ */
#define RADIO_BUTTON_NEW_WITH_MNEMONIC(radio_group, label_text, accel_group) \
dlg_radio_button_new_with_label_with_mnemonic( \
radio_group ? gtk_radio_button_group(GTK_RADIO_BUTTON(radio_group)) : NULL, \
label_text, accel_group)
+/** Create a toggle button.
+ *
+ * @param label_text the text to display
+ * @param accel_group accelerator group (GTK1 only)
+ * @return the new toggle button
+ */
#define TOGGLE_BUTTON_NEW_WITH_MNEMONIC(label_text, accel_group) \
dlg_toggle_button_new_with_label_with_mnemonic(label_text, accel_group)
+/** tag(s) start for first row of simple_dialog (and others). */
#define PRIMARY_TEXT_START ""
+/** tag(s) end for first row of simple_dialog (and others). */
#define PRIMARY_TEXT_END ""
#else /* GTK_MAJOR_VERSION >= 2 */
diff --git a/gtk/dlg_utils.c b/gtk/dlg_utils.c
index 6d15b11ad2..87929d17f1 100644
--- a/gtk/dlg_utils.c
+++ b/gtk/dlg_utils.c
@@ -1,7 +1,7 @@
/* dlg_utils.c
* Utilities to use when constructing dialogs
*
- * $Id: dlg_utils.c,v 1.36 2004/05/26 03:49:22 ulfl Exp $
+ * $Id: dlg_utils.c,v 1.37 2004/06/01 17:33:35 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -48,6 +48,9 @@
/* Keys ... */
#define E_FS_CALLER_PTR_KEY "fs_caller_ptr"
+static gchar *last_open_dir = NULL;
+static gboolean updated_last_open_dir = FALSE;
+
static void
dlg_activate (GtkWidget *widget, gpointer ok_button);
@@ -379,6 +382,14 @@ file_selection_new(const gchar *title, file_selection_action_t action)
ok_button_text, GTK_RESPONSE_ACCEPT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NULL);
+
+ gtk_file_selection_set_filename(GTK_FILE_SELECTION(win), "");
+
+ /* If we've opened a file before, start out by showing the files in the directory
+ in which that file resided. */
+ if (last_open_dir)
+ file_selection_set_current_folder(win, last_open_dir);
+
return win;
}
#else
@@ -392,6 +403,14 @@ file_selection_new(const gchar *title, file_selection_action_t action _U_)
gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER_ON_PARENT);
#endif
gtk_window_set_transient_for(GTK_WINDOW(win), GTK_WINDOW(top_level));
+
+ gtk_file_selection_set_filename(GTK_FILE_SELECTION(win), "");
+
+ /* If we've opened a file before, start out by showing the files in the directory
+ in which that file resided. */
+ if (last_open_dir)
+ file_selection_set_current_folder(win, last_open_dir);
+
return win;
}
#endif
@@ -449,11 +468,6 @@ file_selection_browse(GtkWidget *file_bt, GtkWidget *file_te, const char *label,
fs = file_selection_new(label, action);
- /* If we've opened a file, start out by showing the files in the directory
- in which that file resided. */
- if (last_open_dir)
- file_selection_set_current_folder(fs, last_open_dir);
-
OBJECT_SET_DATA(fs, PRINT_FILE_TE_KEY, file_te);
/* Set the E_FS_CALLER_PTR_KEY for the new dialog to point to our caller. */
@@ -504,8 +518,7 @@ file_selection_browse_ok_cb(GtkWidget *w _U_, gpointer data)
/* It's a directory - set the file selection box to display it. */
set_last_open_dir(f_name);
g_free(f_name);
- gtk_file_selection_set_filename(GTK_FILE_SELECTION(data),
- last_open_dir);
+ file_selection_set_current_folder(data, last_open_dir);
return;
}
@@ -536,7 +549,43 @@ file_selection_browse_destroy_cb(GtkWidget *win, GtkWidget* parent_te)
}
+void
+set_last_open_dir(char *dirname)
+{
+ int len;
+ gchar *new_last_open_dir;
+
+ if (dirname) {
+ len = strlen(dirname);
+ if (dirname[len-1] == G_DIR_SEPARATOR) {
+ new_last_open_dir = g_strconcat(dirname, NULL);
+ }
+ else {
+ new_last_open_dir = g_strconcat(dirname,
+ G_DIR_SEPARATOR_S, NULL);
+ }
+
+ if (last_open_dir == NULL ||
+ strcmp(last_open_dir, new_last_open_dir) != 0)
+ updated_last_open_dir = TRUE;
+ }
+ else {
+ new_last_open_dir = NULL;
+ if (last_open_dir != NULL)
+ updated_last_open_dir = TRUE;
+ }
+
+ if (last_open_dir) {
+ g_free(last_open_dir);
+ }
+ last_open_dir = new_last_open_dir;
+}
+char *
+get_last_open_dir(void)
+{
+ return last_open_dir;
+}
/* Set the "activate" signal for a widget to call a routine to
activate the "OK" button for a dialog box.
diff --git a/gtk/dlg_utils.h b/gtk/dlg_utils.h
index 301a5b7f1f..3bf2458b7b 100644
--- a/gtk/dlg_utils.h
+++ b/gtk/dlg_utils.h
@@ -1,7 +1,7 @@
/* dlg_utils.h
* Declarations of utilities to use when constructing dialogs
*
- * $Id: dlg_utils.h,v 1.17 2004/05/31 15:47:34 ulfl Exp $
+ * $Id: dlg_utils.h,v 1.18 2004/06/01 17:33:36 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -23,14 +23,29 @@
*/
/** @file
- * Utility functions for dialog windows related to Ethereal's main window,
- * depending on the window functions in ui_util.h. See window_new() and others in
- * ui_util.h for further explanation of dialogs and windows in Ethereal.
+ * Utility functions for dialog boxes, depending on the window functions in
+ * ui_util.h. These dialog box windows will be related to Ethereal's main
+ * window. See window_new() and others in ui_util.h for further explanation
+ * of dialogs and windows in Ethereal.
*/
#ifndef __DLG_UTILS_H__
#define __DLG_UTILS_H__
+/** Get the latest opened directory.
+ *
+ * @return the dirname
+ */
+char *get_last_open_dir(void);
+
+/** Set the latest opened directory.
+ * Will already be done when using file_selection_new().
+ *
+ * @param dirname the dirname
+ */
+void set_last_open_dir(char *dirname);
+
+
/** Create a dialog box window that belongs to Ethereal's main window.
* If you want to create a window, use window_new() instead.
* See window_new() for general window usage.
diff --git a/gtk/file_dlg.c b/gtk/file_dlg.c
index 3d606d4e55..8d77a24666 100644
--- a/gtk/file_dlg.c
+++ b/gtk/file_dlg.c
@@ -1,7 +1,7 @@
/* file_dlg.c
* Dialog boxes for handling files
*
- * $Id: file_dlg.c,v 1.107 2004/05/27 19:59:49 ulfl Exp $
+ * $Id: file_dlg.c,v 1.108 2004/06/01 17:33:36 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -134,8 +134,7 @@ file_open_cmd(GtkWidget *w)
directory, if we could determine it, as the directory, otherwise
use the "last opened" directory saved in the preferences file if
there was one. */
- if (last_open_dir)
- file_selection_set_current_folder(file_open_w, last_open_dir);
+ /* This is now the default behaviour in file_selection_new() */
break;
case FO_STYLE_SPECIFIED:
@@ -304,9 +303,9 @@ file_open_ok_cb(GtkWidget *w, gpointer fs) {
if (test_for_directory(cf_name) == EISDIR) {
/* It's a directory - set the file selection box to display that
directory, don't try to open the directory as a capture file. */
- set_last_open_dir(cf_name);
+ set_last_open_dir(cf_name);
g_free(cf_name);
- gtk_file_selection_set_filename(GTK_FILE_SELECTION(fs), last_open_dir);
+ file_selection_set_current_folder(fs, get_last_open_dir());
return;
}
@@ -580,11 +579,6 @@ file_save_as_cmd(action_after_save_e action_after_save, gpointer action_after_sa
gtk_window_add_accel_group(GTK_WINDOW(file_save_as_w), accel_group);
#endif
- /* If we've opened a file, start out by showing the files in the directory
- in which that file resided. */
- if (last_open_dir)
- file_selection_set_current_folder(file_save_as_w, last_open_dir);
-
/* Container for each row of widgets */
main_vb = gtk_vbox_new(FALSE, 5);
@@ -653,8 +647,6 @@ file_save_as_cmd(action_after_save_e action_after_save, gpointer action_after_sa
SIGNAL_CONNECT(file_save_as_w, "delete_event", window_delete_event_cb, NULL);
- gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_save_as_w), "");
-
gtk_widget_show(file_save_as_w);
window_present(file_save_as_w);
#endif
@@ -684,7 +676,7 @@ file_save_as_ok_cb(GtkWidget *w _U_, gpointer fs) {
directory, and leave the selection box displayed. */
set_last_open_dir(cf_name);
g_free(cf_name);
- gtk_file_selection_set_filename(GTK_FILE_SELECTION(fs), last_open_dir);
+ file_selection_set_current_folder(fs, get_last_open_dir());
return;
}
@@ -832,7 +824,7 @@ color_global_cb(GtkWidget *widget _U_, gpointer data)
#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
gtk_file_chooser_select_filename(GTK_FILE_CHOOSER(fs_widget), path);
#else
- gtk_file_selection_set_filename(GTK_FILE_SELECTION(fs_widget), path);
+ file_selection_set_current_folder(fs_widget, path);
#endif
g_free((gchar *)path);
}
@@ -865,11 +857,6 @@ file_color_import_cmd_cb(GtkWidget *w _U_, gpointer data)
gtk_window_add_accel_group(GTK_WINDOW(file_color_import_w), accel_group);
#endif
- /* If we've opened a file, start out by showing the files in the directory
- in which that file resided. */
- if (last_open_dir)
- file_selection_set_current_folder(file_color_import_w, last_open_dir);
-
/* Container for each row of widgets */
main_vb = gtk_vbox_new(FALSE, 3);
gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
@@ -929,9 +916,9 @@ file_color_import_ok_cb(GtkWidget *w, gpointer fs) {
if (test_for_directory(cf_name) == EISDIR) {
/* It's a directory - set the file selection box to display that
directory, don't try to open the directory as a capture file. */
- set_last_open_dir(cf_name);
+ set_last_open_dir(cf_name);
g_free(cf_name);
- gtk_file_selection_set_filename(GTK_FILE_SELECTION(fs), last_open_dir);
+ file_selection_set_current_folder(fs, get_last_open_dir());
return;
}
@@ -1019,11 +1006,6 @@ file_color_export_cmd_cb(GtkWidget *w _U_, gpointer data _U_)
file_color_export_w = file_selection_new("Ethereal: Export Color Filters",
FILE_SELECTION_SAVE);
- /* If we've opened a file, start out by showing the files in the directory
- in which that file resided. */
- if (last_open_dir)
- file_selection_set_current_folder(file_color_export_w, last_open_dir);
-
/* Container for each row of widgets */
main_vb = gtk_vbox_new(FALSE, 3);
gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
@@ -1087,7 +1069,7 @@ file_color_export_ok_cb(GtkWidget *w _U_, gpointer fs) {
directory, and leave the selection box displayed. */
set_last_open_dir(cf_name);
g_free(cf_name);
- gtk_file_selection_set_filename(GTK_FILE_SELECTION(fs), last_open_dir);
+ file_selection_set_current_folder(fs, get_last_open_dir());
return;
}
diff --git a/gtk/file_dlg.h b/gtk/file_dlg.h
index fc57038d50..18d581367b 100644
--- a/gtk/file_dlg.h
+++ b/gtk/file_dlg.h
@@ -1,7 +1,7 @@
/* file_dlg.h
* Definitions for dialog boxes for handling files
*
- * $Id: file_dlg.h,v 1.10 2004/05/26 03:49:22 ulfl Exp $
+ * $Id: file_dlg.h,v 1.11 2004/06/01 17:33:36 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -25,27 +25,76 @@
#ifndef __FILE_DLG_H__
#define __FILE_DLG_H__
+/** @file
+ * "Open" / "Close" / "Save" / "Save As" / etc dialog boxes.
+ */
+
+/** the action to take, after save has been done */
typedef enum {
- after_save_no_action,
- after_save_close_file,
- after_save_open_dialog,
- after_save_open_recent_file,
- after_save_open_dnd_file,
- after_save_capture_dialog,
- after_save_exit
+ after_save_no_action, /**< no action to take */
+ after_save_close_file, /**< close the file */
+ after_save_open_dialog, /**< open the file open dialog */
+ after_save_open_recent_file, /**< open the specified recent file */
+ after_save_open_dnd_file, /**< open the specified file from drag and drop */
+ after_save_capture_dialog, /**< open the capture dialog */
+ after_save_exit /**< exit program */
} action_after_save_e;
+/** Open the "Save As" dialog box.
+ *
+ * @param action_after_save the action to take, when save completed
+ * @param action_after_save_data data for action_after_save
+ */
void file_save_as_cmd(action_after_save_e action_after_save, gpointer action_after_save_data);
+/** User requested the "Open" dialog box.
+ *
+ * @param widget parent widget
+ * @param data unused
+ */
+void file_open_cmd_cb(GtkWidget *widget, gpointer data);
+
+/** User requested the "Save" dialog box.
+ *
+ * @param widget parent widget
+ * @param data unused
+ */
+void file_save_cmd_cb(GtkWidget *widget, gpointer data);
+
+/** User requested the "Save As" dialog box.
+ *
+ * @param widget parent widget
+ * @param data unused
+ */
+void file_save_as_cmd_cb(GtkWidget *widget, gpointer data);
+
+/** User requested "Close".
+ *
+ * @param widget parent widget
+ * @param data unused
+ */
+void file_close_cmd_cb(GtkWidget *widget, gpointer data);
-void file_open_cmd_cb(GtkWidget *, gpointer);
-void file_save_cmd_cb(GtkWidget *, gpointer);
-void file_save_as_cmd_cb(GtkWidget *, gpointer);
-void file_close_cmd_cb(GtkWidget *, gpointer);
-void file_reload_cmd_cb(GtkWidget *, gpointer);
+/** User requested "Reload".
+ *
+ * @param widget parent widget
+ * @param data unused
+ */
+void file_reload_cmd_cb(GtkWidget *widget, gpointer data);
-void file_color_import_cmd_cb(GtkWidget *w, gpointer data);
-void file_color_export_cmd_cb(GtkWidget *, gpointer);
+/** User requested "Import". Currently only called from the color dialog.
+ *
+ * @param widget parent widget
+ * @param data unused
+ */
+void file_color_import_cmd_cb(GtkWidget *widget, gpointer data);
+
+/** User requested "Export". Currently only called from the color dialog.
+ *
+ * @param widget parent widget
+ * @param data unused
+ */
+void file_color_export_cmd_cb(GtkWidget *widget, gpointer data);
/*
* Set the "Save only marked packets" toggle button as appropriate for
diff --git a/gtk/filter_prefs.c b/gtk/filter_prefs.c
index 7c9b5722c0..44fd08cc0b 100644
--- a/gtk/filter_prefs.c
+++ b/gtk/filter_prefs.c
@@ -3,7 +3,7 @@
* (This used to be a notebook page under "Preferences", hence the
* "prefs" in the file name.)
*
- * $Id: filter_prefs.c,v 1.65 2004/05/27 19:59:49 ulfl Exp $
+ * $Id: filter_prefs.c,v 1.66 2004/06/01 17:33:36 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -166,7 +166,7 @@ display_filter_construct_cb(GtkWidget *w, gpointer construct_args_ptr)
}
/* Should be called when a button that creates filters is destroyed; it
- destroys any filter created by that button. */
+ destroys any filter dialog created by that button. */
void
filter_button_destroy_cb(GtkWidget *button, gpointer user_data _U_)
{
diff --git a/gtk/filter_prefs.h b/gtk/filter_prefs.h
index 93df1def75..9c5f2f022a 100644
--- a/gtk/filter_prefs.h
+++ b/gtk/filter_prefs.h
@@ -3,7 +3,7 @@
* (This used to be a notebook page under "Preferences", hence the
* "prefs" in the file name.)
*
- * $Id: filter_prefs.h,v 1.18 2004/02/28 04:18:47 guy Exp $
+ * $Id: filter_prefs.h,v 1.19 2004/06/01 17:33:36 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -27,31 +27,99 @@
#ifndef __FILTER_H__
#define __FILTER_H__
-/*
+/** @file
+ * "Capture Filter" / "Display Filter" / "Add expression" dialog boxes.
+ * (This used to be a notebook page under "Preferences", hence the
+ * "prefs" in the file name.)
+ * @todo rename this and the corresponding .c file to filter_dlg to reflect current implementation
+ */
+
+/**
* Structure giving properties of the filter editing dialog box to be
* created.
*/
typedef struct {
- gchar *title; /* title of dialog box */
- gboolean wants_apply_button; /* if it should have an Apply button */
- gboolean activate_on_ok; /* if parent text widget should be
- activated on "Ok" or "Apply" */
+ gchar *title; /**< title of dialog box */
+ gboolean wants_apply_button; /**< dialog should have an Apply button */
+ gboolean activate_on_ok; /**< if parent text widget should be
+ activated on "Ok" or "Apply" */
} construct_args_t;
-void capture_filter_construct_cb(GtkWidget *w, gpointer user_data);
-void display_filter_construct_cb(GtkWidget *w, gpointer construct_args_ptr);
-void filter_button_destroy_cb(GtkWidget *button, gpointer user_data);
-void cfilter_dialog_cb(GtkWidget *w);
-void dfilter_dialog_cb(GtkWidget *w);
+/** Create a "Capture Filter" dialog box caused by a button click.
+ *
+ * @param widget parent widget
+ * @param user_data unused
+ */
+void capture_filter_construct_cb(GtkWidget *widget, gpointer user_data);
+
+/** Create a "Display Filter" dialog box caused by a button click.
+ *
+ * @param widget parent widget
+ * @param construct_args_ptr parameters to construct the dialog (construct_args_t)
+ */
+void display_filter_construct_cb(GtkWidget *widget, gpointer construct_args_ptr);
+
+/** Should be called when the widget (usually a button) that creates filters
+ * is destroyed. It destroys any filter dialog created by that widget.
+ *
+ * @param widget parent widget
+ * @param user_data unused
+ */
+void filter_button_destroy_cb(GtkWidget *widget, gpointer user_data);
+
+/** User requested the "Capture Filter" dialog box by menu or toolbar.
+ *
+ * @param widget parent widget
+ */
+void cfilter_dialog_cb(GtkWidget *widget);
+
+/** User requested the "Display Filter" dialog box by menu or toolbar.
+ *
+ * @param widget parent widget
+ */
+void dfilter_dialog_cb(GtkWidget *widget);
+
+/** Create an "Add expression" dialog box caused by a button click.
+ *
+ * @param widget unused
+ * @param main_w_arg parent widget
+ */
+void filter_add_expr_bt_cb(GtkWidget *widget, gpointer main_w_arg);
-void filter_add_expr_bt_cb(GtkWidget *w _U_, gpointer main_w_arg);
-void colorize_filter_te_as_empty(GtkWidget *w);
-void colorize_filter_te_as_invalid(GtkWidget *w);
-void colorize_filter_te_as_valid(GtkWidget *w);
-void filter_te_syntax_check_cb(GtkWidget *w);
+/** Colorize a text entry as empty.
+ *
+ * @param widget the text entry to colorize
+ */
+void colorize_filter_te_as_empty(GtkWidget *widget);
+
+/** Colorize a text entry as a invalid.
+ *
+ * @param widget the text entry to colorize
+ */
+void colorize_filter_te_as_invalid(GtkWidget *widget);
+/** Colorize a text entry as a valid.
+ *
+ * @param widget the text entry to colorize
+ */
+void colorize_filter_te_as_valid(GtkWidget *widget);
+
+/** Colorize a filter text entry depending on "validity".
+ *
+ * @param widget the text entry to colorize
+ */
+void filter_te_syntax_check_cb(GtkWidget *widget);
+
+/** ???
+ * @todo check usage of this define */
#define E_FILT_BT_PTR_KEY "filter_bt_ptr"
+
+/** ???
+ * @todo check usage of this define */
#define E_FILT_TE_PTR_KEY "filter_te_ptr"
+
+/** ???
+ * @todo check usage of this define */
#define E_FILT_FILTER_TE_KEY "filter_filter_te"
#endif /* filter.h */
diff --git a/gtk/follow_dlg.c b/gtk/follow_dlg.c
index 111afed751..531e52412e 100644
--- a/gtk/follow_dlg.c
+++ b/gtk/follow_dlg.c
@@ -1,6 +1,6 @@
/* follow_dlg.c
*
- * $Id: follow_dlg.c,v 1.64 2004/05/27 23:09:09 ulfl Exp $
+ * $Id: follow_dlg.c,v 1.65 2004/06/01 17:33:36 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -994,11 +994,6 @@ follow_save_as_cmd_cb(GtkWidget *w _U_, gpointer data)
/* Tuck away the follow_info object into the window */
OBJECT_SET_DATA(new_win, E_FOLLOW_INFO_KEY, follow_info);
- /* If we've opened a file, start out by showing the files in the directory
- in which that file resided. */
- if (last_open_dir)
- file_selection_set_current_folder(new_win, last_open_dir);
-
SIGNAL_CONNECT(new_win, "destroy", follow_save_as_destroy_cb, follow_info);
#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
@@ -1048,7 +1043,7 @@ follow_save_as_ok_cb(GtkWidget * w _U_, gpointer fs)
directory, and leave the selection box displayed. */
set_last_open_dir(to_name);
g_free(to_name);
- file_selection_set_current_folder(fs, last_open_dir);
+ file_selection_set_current_folder(fs, get_last_open_dir());
return;
}
diff --git a/gtk/goto_dlg.c b/gtk/goto_dlg.c
index c156ce6270..ef9ade53e1 100644
--- a/gtk/goto_dlg.c
+++ b/gtk/goto_dlg.c
@@ -1,7 +1,7 @@
/* goto_dlg.c
* Routines for "go to packet" window
*
- * $Id: goto_dlg.c,v 1.26 2004/05/26 03:49:23 ulfl Exp $
+ * $Id: goto_dlg.c,v 1.27 2004/06/01 17:33:36 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -130,3 +130,36 @@ goto_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w)
}
}
+/*
+ * Go to frame specified by currently selected protocol tree item.
+ */
+void
+goto_framenum_cb(GtkWidget *w _U_, gpointer data _U_)
+{
+ if (cfile.finfo_selected) {
+ header_field_info *hfinfo;
+ guint32 framenum;
+
+ hfinfo = cfile.finfo_selected->hfinfo;
+ g_assert(hfinfo);
+ if (hfinfo->type == FT_FRAMENUM) {
+ framenum = fvalue_get_integer(&cfile.finfo_selected->value);
+ if (framenum != 0)
+ goto_frame(&cfile, framenum);
+ }
+ }
+}
+
+void
+goto_top_frame_cb(GtkWidget *w _U_, gpointer d _U_)
+{
+ goto_top_frame(&cfile);
+}
+
+void
+goto_bottom_frame_cb(GtkWidget *w _U_, gpointer d _U_)
+{
+ goto_bottom_frame(&cfile);
+}
+
+
diff --git a/gtk/goto_dlg.h b/gtk/goto_dlg.h
index c44c6906c3..e0d6ddd145 100644
--- a/gtk/goto_dlg.h
+++ b/gtk/goto_dlg.h
@@ -1,7 +1,7 @@
/* goto_dlg.h
* Definitions for "go to frame" window
*
- * $Id: goto_dlg.h,v 1.2 2002/08/28 21:03:47 jmayer Exp $
+ * $Id: goto_dlg.h,v 1.3 2004/06/01 17:33:36 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -26,6 +26,36 @@
#ifndef __GOTO_DLG_H__
#define __GOTO_DLG_H__
-void goto_frame_cb(GtkWidget *, gpointer);
+/** @file
+ * "Go To" dialog box and similar functions.
+ */
+
+/** User requested the "Go To" dialog box by menu or toolbar.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void goto_frame_cb(GtkWidget *widget, gpointer data);
+
+/** User requested "Go To Corresponding Packet" by menu.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void goto_framenum_cb(GtkWidget *widget, gpointer data);
+
+/** User requested "Go To First Packet" by menu or toolbar.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void goto_top_frame_cb(GtkWidget *widget, gpointer data);
+
+/** User requested "Go To Last Packet" by menu or toolbar.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void goto_bottom_frame_cb(GtkWidget *widget, gpointer data);
#endif /* goto_dlg.h */
diff --git a/gtk/gtkglobals.h b/gtk/gtkglobals.h
index b95dbe0c71..f87284a711 100644
--- a/gtk/gtkglobals.h
+++ b/gtk/gtkglobals.h
@@ -1,7 +1,7 @@
/* gtkglobals.h
* GTK-related Global defines, etc.
*
- * $Id: gtkglobals.h,v 1.24 2004/01/09 08:36:23 guy Exp $
+ * $Id: gtkglobals.h,v 1.25 2004/06/01 17:33:36 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -25,18 +25,44 @@
#ifndef __GTKGLOBALS_H__
#define __GTKGLOBALS_H__
-extern GtkWidget *top_level, *packet_list, *tree_view, *byte_nb_ptr;
-#if GTK_MAJOR_VERSION < 2
-extern GdkFont *m_r_font, *m_b_font;
-extern guint m_font_height, m_font_width;
+/** @file
+ * GTK globals like the main application window.
+ */
+
+/** application window */
+extern GtkWidget *top_level;
+
+/** packet list pane */
+extern GtkWidget *packet_list;
+/** tree view (packet details) pane */
+extern GtkWidget *tree_view;
+
+/** byte notebook (packet bytes) pane */
+extern GtkWidget *byte_nb_ptr;
+
+#if GTK_MAJOR_VERSION < 2
+/** normal font */
+extern GdkFont *m_r_font;
+/** bold font */
+extern GdkFont *m_b_font;
+/** font height */
+extern guint m_font_height;
+/** font width */
+extern guint m_font_width;
+/** ???
+ * @todo what's this?
+ */
extern GtkStyle *item_style;
#else
-extern PangoFontDescription *m_r_font, *m_b_font;
+/** normal font */
+extern PangoFontDescription *m_r_font;
+/** bold font */
+extern PangoFontDescription *m_b_font;
#endif
#if GTK_MAJOR_VERSION >= 2 || GTK_MINOR_VERSION >= 3
-/*
+/**
* XXX - "isprint()" can return "true" for non-ASCII characters, but
* those don't work with GTK+ 1.3 or later, as they take UTF-8 strings
* as input. Until we fix up Ethereal to properly handle non-ASCII
diff --git a/gtk/help_dlg.c b/gtk/help_dlg.c
index f1e9777a97..53920b31b4 100644
--- a/gtk/help_dlg.c
+++ b/gtk/help_dlg.c
@@ -1,6 +1,6 @@
/* help_dlg.c
*
- * $Id: help_dlg.c,v 1.54 2004/05/30 11:54:37 ulfl Exp $
+ * $Id: help_dlg.c,v 1.55 2004/06/01 17:33:36 ulfl Exp $
*
* Laurent Deniel <laurent.deniel@free.fr>
*
@@ -237,7 +237,7 @@ void help_cb(GtkWidget *w _U_, gpointer data _U_)
* Open the help dialog and show a specific help page.
*/
-void help_topic_cb(GtkWidget *w _U_, gpointer data _U_) {
+void help_topic_cb(GtkWidget *w _U_, gpointer data) {
gchar *topic = data;
gchar *page_topic;
GtkWidget *help_nb;
diff --git a/gtk/help_dlg.h b/gtk/help_dlg.h
index 986e1c052b..1e4fb47000 100644
--- a/gtk/help_dlg.h
+++ b/gtk/help_dlg.h
@@ -1,6 +1,6 @@
/* help_dlg.h
*
- * $Id: help_dlg.h,v 1.6 2004/01/25 21:27:16 ulfl Exp $
+ * $Id: help_dlg.h,v 1.7 2004/06/01 17:33:36 ulfl Exp $
*
* Laurent Deniel <laurent.deniel@free.fr>
*
@@ -27,10 +27,26 @@
#ifndef __HELP_DLG_H__
#define __HELP_DLG_H__
-void help_cb(GtkWidget *, gpointer);
-void help_topic_cb(GtkWidget *w _U_, gpointer data _U_);
+/** @file
+ * "Help" dialog box.
+ */
+
+/** User requested the "Help" dialog box by menu or toolbar.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+void help_cb(GtkWidget *widget, gpointer data);
+
+/** Create a "Help" dialog box and start with a specific topic.
+ * Will show the first page if topic is not found.
+ *
+ * @param widget parent widget (unused)
+ * @param topic the topic to display (a string)
+ */
+void help_topic_cb(GtkWidget *widget, gpointer topic);
-/* Redraw all the text widgets, to use a new font. */
+/** Redraw all the text widgets, to use a new font. */
void help_redraw(void);
#endif
diff --git a/gtk/main.c b/gtk/main.c
index 407d6f193e..5b073643fc 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.439 2004/05/23 17:37:36 ulfl Exp $
+ * $Id: main.c,v 1.440 2004/06/01 17:33:36 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -132,6 +132,18 @@
#include "follow_dlg.h"
+/*
+ * File under personal preferences directory in which GTK settings for
+ * Ethereal are stored.
+ */
+#define RC_FILE "gtkrc"
+
+#ifdef HAVE_LIBPCAP
+#define DEF_READY_MESSAGE " Ready to load or capture"
+#else
+#define DEF_READY_MESSAGE " Ready to load file"
+#endif
+
capture_file cfile;
GtkWidget *main_display_filter_widget=NULL;
GtkWidget *top_level = NULL, *tree_view, *byte_nb_ptr, *tv_scrollw;
@@ -152,8 +164,6 @@ static guint packets_ctx;
static gchar *packets_str = NULL;
GString *comp_info_str, *runtime_info_str;
gchar *ethereal_path = NULL;
-gchar *last_open_dir = NULL;
-static gboolean updated_last_open_dir = FALSE;
#if GTK_MAJOR_VERSION < 2
GtkStyle *item_style;
@@ -183,6 +193,11 @@ static void try_to_get_windows_font_gtk2 (void);
#define E_DFILTER_CM_KEY "display_filter_combo"
#define E_DFILTER_FL_KEY "display_filter_list"
+#if GTK_MAJOR_VERSION < 2
+void set_fonts(GdkFont *regular, GdkFont *bold);
+#else
+void set_fonts(PangoFontDescription *regular, PangoFontDescription *bold);
+#endif
#if GTK_MAJOR_VERSION < 2
@@ -205,39 +220,6 @@ set_fonts(PangoFontDescription *regular, PangoFontDescription *bold)
#endif
}
-/*
- * Go to frame specified by currently selected protocol tree item.
- */
-void
-goto_framenum_cb(GtkWidget *w _U_, gpointer data _U_)
-{
- if (cfile.finfo_selected) {
- header_field_info *hfinfo;
- guint32 framenum;
-
- hfinfo = cfile.finfo_selected->hfinfo;
- g_assert(hfinfo);
- if (hfinfo->type == FT_FRAMENUM) {
- framenum = fvalue_get_integer(&cfile.finfo_selected->value);
- if (framenum != 0)
- goto_frame(&cfile, framenum);
- }
- }
-}
-
-void
-goto_top_frame_cb(GtkWidget *w _U_, gpointer d _U_)
-{
- goto_top_frame(&cfile);
-}
-
-void
-goto_bottom_frame_cb(GtkWidget *w _U_, gpointer d _U_)
-{
- goto_bottom_frame(&cfile);
-}
-
-
void
view_zoom_in_cb(GtkWidget *w _U_, gpointer d _U_)
{
@@ -395,112 +377,14 @@ match_selected_cb_do(gpointer data, int action, gchar *text)
}
void
-match_selected_cb_replace_ptree(GtkWidget *w, gpointer data)
-{
- if (cfile.finfo_selected)
- match_selected_cb_do((data ? data : w),
- MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW,
- proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
-}
-
-void
-match_selected_cb_and_ptree(GtkWidget *w, gpointer data)
-{
- if (cfile.finfo_selected)
- match_selected_cb_do((data ? data : w),
- MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW,
- proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
-}
-
-void
-match_selected_cb_or_ptree(GtkWidget *w, gpointer data)
-{
- if (cfile.finfo_selected)
- match_selected_cb_do((data ? data : w),
- MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW,
- proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
-}
-
-void
-match_selected_cb_not_ptree(GtkWidget *w, gpointer data)
-{
- if (cfile.finfo_selected)
- match_selected_cb_do((data ? data : w),
- MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW,
- proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
-}
-
-void
-match_selected_cb_and_ptree_not(GtkWidget *w, gpointer data)
-{
- if (cfile.finfo_selected)
- match_selected_cb_do((data ? data : w),
- MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW,
- proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
-}
-
-void
-match_selected_cb_or_ptree_not(GtkWidget *w, gpointer data)
-{
- if (cfile.finfo_selected)
- match_selected_cb_do((data ? data : w),
- MATCH_SELECTED_OR_NOT,
- proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
-}
-
-void
-prepare_selected_cb_replace_ptree(GtkWidget *w, gpointer data)
-{
- if (cfile.finfo_selected)
- match_selected_cb_do((data ? data : w),
- MATCH_SELECTED_REPLACE,
- proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
-}
-
-void
-prepare_selected_cb_and_ptree(GtkWidget *w, gpointer data)
-{
- if (cfile.finfo_selected)
- match_selected_cb_do((data ? data : w),
- MATCH_SELECTED_AND,
- proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
-}
-
-void
-prepare_selected_cb_or_ptree(GtkWidget *w, gpointer data)
-{
- if (cfile.finfo_selected)
- match_selected_cb_do((data ? data : w),
- MATCH_SELECTED_OR,
- proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
-}
-
-void
-prepare_selected_cb_not_ptree(GtkWidget *w, gpointer data)
-{
- if (cfile.finfo_selected)
- match_selected_cb_do((data ? data : w),
- MATCH_SELECTED_NOT,
- proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
-}
-
-void
-prepare_selected_cb_and_ptree_not(GtkWidget *w, gpointer data)
+match_selected_ptree_cb(GtkWidget *w, gpointer data, MATCH_SELECTED_E action)
{
if (cfile.finfo_selected)
match_selected_cb_do((data ? data : w),
- MATCH_SELECTED_AND_NOT,
+ action,
proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
}
-void
-prepare_selected_cb_or_ptree_not(GtkWidget *w, gpointer data)
-{
- if (cfile.finfo_selected)
- match_selected_cb_do((data ? data : w),
- MATCH_SELECTED_OR_NOT,
- proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
-}
static gchar *
get_text_from_packet_list(gpointer data)
@@ -543,100 +427,13 @@ get_text_from_packet_list(gpointer data)
}
void
-match_selected_cb_replace_plist(GtkWidget *w _U_, gpointer data)
-{
- match_selected_cb_do(data,
- MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW,
- get_text_from_packet_list(data));
-}
-
-void
-match_selected_cb_and_plist(GtkWidget *w _U_, gpointer data)
-{
- match_selected_cb_do(data,
- MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW,
- get_text_from_packet_list(data));
-}
-
-void
-match_selected_cb_or_plist(GtkWidget *w _U_, gpointer data)
-{
- match_selected_cb_do(data,
- MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW,
- get_text_from_packet_list(data));
-}
-
-void
-match_selected_cb_not_plist(GtkWidget *w _U_, gpointer data)
+match_selected_plist_cb(GtkWidget *w _U_, gpointer data, MATCH_SELECTED_E action)
{
match_selected_cb_do(data,
- MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW,
+ action,
get_text_from_packet_list(data));
}
-void
-match_selected_cb_and_plist_not(GtkWidget *w _U_, gpointer data)
-{
- match_selected_cb_do(data,
- MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW,
- get_text_from_packet_list(data));
-}
-
-void
-match_selected_cb_or_plist_not(GtkWidget *w _U_, gpointer data)
-{
- match_selected_cb_do(data,
- MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW,
- get_text_from_packet_list(data));
-}
-
-void
-prepare_selected_cb_replace_plist(GtkWidget *w _U_, gpointer data)
-{
- match_selected_cb_do(data,
- MATCH_SELECTED_REPLACE,
- get_text_from_packet_list(data));
-}
-
-void
-prepare_selected_cb_and_plist(GtkWidget *w _U_, gpointer data)
-{
- match_selected_cb_do(data,
- MATCH_SELECTED_AND,
- get_text_from_packet_list(data));
-}
-
-void
-prepare_selected_cb_or_plist(GtkWidget *w _U_, gpointer data)
-{
- match_selected_cb_do(data,
- MATCH_SELECTED_OR,
- get_text_from_packet_list(data));
-}
-
-void
-prepare_selected_cb_not_plist(GtkWidget *w _U_, gpointer data)
-{
- match_selected_cb_do(data,
- MATCH_SELECTED_NOT,
- get_text_from_packet_list(data));
-}
-
-void
-prepare_selected_cb_and_plist_not(GtkWidget *w _U_, gpointer data)
-{
- match_selected_cb_do(data,
- MATCH_SELECTED_AND_NOT,
- get_text_from_packet_list(data));
-}
-
-void
-prepare_selected_cb_or_plist_not(GtkWidget *w _U_, gpointer data)
-{
- match_selected_cb_do(data,
- MATCH_SELECTED_OR_NOT,
- get_text_from_packet_list(data));
-}
/* XXX: use a preference for this setting! */
@@ -800,16 +597,12 @@ set_frame_reftime(gboolean set, frame_data *frame, gint row) {
reftime_packets(&cfile);
}
-/* 0: toggle ref time status for the selected frame
- * 1: find next ref time frame
- * 2: find previous reftime frame
- */
void
-reftime_frame_cb(GtkWidget *w _U_, gpointer data _U_, guint action)
+reftime_frame_cb(GtkWidget *w _U_, gpointer data _U_, REFTIME_ACTION_E action)
{
switch(action){
- case 0: /* toggle ref frame */
+ case REFTIME_TOGGLE:
if (cfile.current_frame) {
/* XXX hum, should better have a "cfile->current_row" here ... */
set_frame_reftime(!cfile.current_frame->flags.ref_time,
@@ -817,10 +610,10 @@ reftime_frame_cb(GtkWidget *w _U_, gpointer data _U_, guint action)
packet_list_find_row_from_data(cfile.current_frame));
}
break;
- case 1: /* find next ref frame */
+ case REFTIME_FIND_NEXT:
find_previous_next_frame_with_filter("frame.ref_time", FALSE);
break;
- case 2: /* find previous ref frame */
+ case REFTIME_FIND_PREV:
find_previous_next_frame_with_filter("frame.ref_time", TRUE);
break;
}
@@ -2749,7 +2542,7 @@ main(int argc, char *argv[])
argument. */
s = get_dirname(cf_name);
/* we might already set this from the recent file, don't overwrite this */
- if(last_open_dir == NULL)
+ if(get_last_open_dir() == NULL)
set_last_open_dir(s);
g_free(cf_name);
cf_name = NULL;
@@ -3885,36 +3678,3 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
status_pane = gtk_hpaned_new();
gtk_widget_show(status_pane);
}
-
-
-void
-set_last_open_dir(char *dirname)
-{
- int len;
- gchar *new_last_open_dir;
-
- if (dirname) {
- len = strlen(dirname);
- if (dirname[len-1] == G_DIR_SEPARATOR) {
- new_last_open_dir = g_strconcat(dirname, NULL);
- }
- else {
- new_last_open_dir = g_strconcat(dirname,
- G_DIR_SEPARATOR_S, NULL);
- }
-
- if (last_open_dir == NULL ||
- strcmp(last_open_dir, new_last_open_dir) != 0)
- updated_last_open_dir = TRUE;
- }
- else {
- new_last_open_dir = NULL;
- if (last_open_dir != NULL)
- updated_last_open_dir = TRUE;
- }
-
- if (last_open_dir) {
- g_free(last_open_dir);
- }
- last_open_dir = new_last_open_dir;
-}
diff --git a/gtk/main.h b/gtk/main.h
index 2b1aec75f5..cbbac76103 100644
--- a/gtk/main.h
+++ b/gtk/main.h
@@ -1,7 +1,7 @@
/* main.h
* Global defines, etc.
*
- * $Id: main.h,v 1.49 2004/05/21 08:44:45 guy Exp $
+ * $Id: main.h,v 1.50 2004/06/01 17:33:36 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -31,108 +31,221 @@
#include "globals.h"
-/*
- * File under personal preferences directory in which GTK settings for
- * Ethereal are stored.
+/** @file
+ * Various functions provided by main.c
*/
-#define RC_FILE "gtkrc"
-#ifdef HAVE_LIBPCAP
-#define DEF_READY_MESSAGE " Ready to load or capture"
-#else
-#define DEF_READY_MESSAGE " Ready to load file"
-#endif
+/** User requested "Zoom In" by menu or toolbar.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void view_zoom_in_cb(GtkWidget *widget, gpointer data);
-#define MATCH_SELECTED_REPLACE 0
-#define MATCH_SELECTED_AND 1
-#define MATCH_SELECTED_OR 2
-#define MATCH_SELECTED_NOT 3
-#define MATCH_SELECTED_AND_NOT 4
-#define MATCH_SELECTED_OR_NOT 5
+/** User requested "Zoom Out" by menu or toolbar.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void view_zoom_out_cb(GtkWidget *widget, gpointer data);
-#define MATCH_SELECTED_MASK 0x0ff
-#define MATCH_SELECTED_APPLY_NOW 0x100
+/** User requested "Zoom 100%" by menu or toolbar.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void view_zoom_100_cb(GtkWidget *widget, gpointer data);
-typedef struct _selection_info {
- GtkWidget *tree;
- GtkWidget *text;
-} selection_info;
+/** "Apply as Filter" / "Prepare a Filter" action type. */
+typedef enum {
+ MATCH_SELECTED_REPLACE, /**< "Selected" */
+ MATCH_SELECTED_AND, /**< "and Selected" */
+ MATCH_SELECTED_OR, /**< "or Selected" */
+ MATCH_SELECTED_NOT, /**< "Not Selected" */
+ MATCH_SELECTED_AND_NOT, /**< "and not Selected" */
+ MATCH_SELECTED_OR_NOT /**< "or not Selected" */
+} MATCH_SELECTED_E;
-#if GTK_MAJOR_VERSION < 2
-extern GtkStyle *item_style;
-#endif
+/** mask MATCH_SELECTED_E values (internally used) */
+#define MATCH_SELECTED_MASK 0x0ff
-void goto_framenum_cb(GtkWidget *, gpointer);
-void goto_top_frame_cb(GtkWidget *w _U_, gpointer d _U_);
-void goto_bottom_frame_cb(GtkWidget *w _U_, gpointer d _U_);
-void view_zoom_in_cb(GtkWidget *w _U_, gpointer d _U_);
-void view_zoom_out_cb(GtkWidget *w _U_, gpointer d _U_);
-void view_zoom_100_cb(GtkWidget *w _U_, gpointer d _U_);
-void match_selected_cb_replace_ptree( GtkWidget *, gpointer);
-void match_selected_cb_and_ptree( GtkWidget *, gpointer);
-void match_selected_cb_or_ptree( GtkWidget *, gpointer);
-void match_selected_cb_not_ptree( GtkWidget *, gpointer);
-void match_selected_cb_and_ptree_not( GtkWidget *, gpointer);
-void match_selected_cb_or_ptree_not( GtkWidget *, gpointer);
-void prepare_selected_cb_replace_ptree( GtkWidget *, gpointer);
-void prepare_selected_cb_and_ptree( GtkWidget *, gpointer);
-void prepare_selected_cb_or_ptree( GtkWidget *, gpointer);
-void prepare_selected_cb_not_ptree( GtkWidget *, gpointer);
-void prepare_selected_cb_and_ptree_not( GtkWidget *, gpointer);
-void prepare_selected_cb_or_ptree_not( GtkWidget *, gpointer);
-void match_selected_cb_replace_plist( GtkWidget *, gpointer);
-void match_selected_cb_and_plist( GtkWidget *, gpointer);
-void match_selected_cb_or_plist( GtkWidget *, gpointer);
-void match_selected_cb_not_plist( GtkWidget *, gpointer);
-void match_selected_cb_and_plist_not( GtkWidget *, gpointer);
-void match_selected_cb_or_plist_not( GtkWidget *, gpointer);
-void prepare_selected_cb_replace_plist( GtkWidget *, gpointer);
-void prepare_selected_cb_and_plist( GtkWidget *, gpointer);
-void prepare_selected_cb_or_plist( GtkWidget *, gpointer);
-void prepare_selected_cb_not_plist( GtkWidget *, gpointer);
-void prepare_selected_cb_and_plist_not( GtkWidget *, gpointer);
-void prepare_selected_cb_or_plist_not( GtkWidget *, gpointer);
-void file_quit_cmd_cb(GtkWidget *, gpointer);
-void file_print_cmd_cb(GtkWidget *, gpointer);
-void export_text_cmd_cb(GtkWidget *, gpointer);
-void export_ps_cmd_cb(GtkWidget *, gpointer);
-void export_psml_cmd_cb(GtkWidget *, gpointer);
-void export_pdml_cmd_cb(GtkWidget *, gpointer);
-void tools_plugins_cmd_cb(GtkWidget *, gpointer);
-void expand_tree_cb(GtkWidget *, gpointer);
-void expand_all_cb(GtkWidget *, gpointer);
-void collapse_all_cb(GtkWidget *, gpointer);
-void resolve_name_cb(GtkWidget *, gpointer);
-void reftime_frame_cb(GtkWidget *, gpointer, guint);
-
-extern gboolean dfilter_combo_add_recent(gchar *s);
+/** "bitwise or" this with MATCH_SELECTED_E value for instant apply instead of prepare only */
+#define MATCH_SELECTED_APPLY_NOW 0x100
+
+/** User requested one of "Apply as Filter" or "Prepare a Filter" functions
+ * by menu or context menu of protocol tree.
+ *
+ * @param widget parent widget
+ * @param data parent widget
+ * @param action the function to use
+ */
+extern void match_selected_ptree_cb(GtkWidget *widget, gpointer data, MATCH_SELECTED_E action);
+
+/** User requested one of "Apply as Filter" or "Prepare a Filter" functions
+ * by context menu of packet list.
+ *
+ * @param widget parent widget (unused)
+ * @param data parent widget
+ * @param action the function to use
+ */
+extern void match_selected_plist_cb(GtkWidget *widget, gpointer data, MATCH_SELECTED_E action);
+
+/** User requested "Quit" by menu or toolbar.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void file_quit_cmd_cb(GtkWidget *widget, gpointer data);
+
+/** User requested "Print" by menu or toolbar.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void file_print_cmd_cb(GtkWidget *widget, gpointer data);
+
+/** User requested "Export as Plain Text" by menu.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void export_text_cmd_cb(GtkWidget *widget, gpointer data);
+
+/** User requested "Export as Postscript" by menu.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void export_ps_cmd_cb(GtkWidget *widget, gpointer data);
+
+/** User requested "Export as PSML" by menu.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void export_psml_cmd_cb(GtkWidget *widget, gpointer data);
+
+/** User requested "Export as PDML" by menu.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void export_pdml_cmd_cb(GtkWidget *widget, gpointer data);
+
+/** User requested "Expand Tree" by menu.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void expand_tree_cb(GtkWidget *widget, gpointer data);
+
+/** User requested "Expand All" by menu.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void expand_all_cb(GtkWidget *widget, gpointer data);
+
+/** User requested "Collapse All" by menu.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void collapse_all_cb(GtkWidget *widget, gpointer data);
+
+/** User requested "Resolve Name" by menu.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void resolve_name_cb(GtkWidget *widget, gpointer data);
+
+/** Action to take for reftime_frame_cb() */
+typedef enum {
+ REFTIME_TOGGLE, /**< toggle ref frame */
+ REFTIME_FIND_NEXT, /**< find next ref frame */
+ REFTIME_FIND_PREV, /**< find previous ref frame */
+} REFTIME_ACTION_E;
+
+/** User requested one of the "Time Reference" functions by menu.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ * @param action the function to use
+ */
+extern void reftime_frame_cb(GtkWidget *widget, gpointer data, REFTIME_ACTION_E action);
+
+/** Add a display filter coming from the user's recent file to the dfilter combo box.
+ *
+ * @param dftext the filter string
+ */
+extern gboolean dfilter_combo_add_recent(gchar *dftext);
+
+/** Empty out the combobox entry field */
extern void dfilter_combo_add_empty(void);
+
+/** Write all non empty display filters (until maximum count)
+ * of the combo box GList to the user's recent file.
+ *
+ * @param rf the recent file
+ */
extern void dfilter_recent_combo_write_all(FILE *rf);
+/** Quit the program.
+ *
+ * @return TRUE, if a file read is in progress
+ */
extern gboolean main_do_quit(void);
+
+/** Rearrange the main window widgets, user changed it's preferences. */
extern void main_widgets_rearrange(void);
+
+/** Show or hide the main window widgets, user changed it's preferences. */
extern void main_widgets_show_or_hide(void);
+
+/** Apply a new filter string.
+ * Call filter_packets() and add this filter string to the recent filter list.
+ *
+ * @param cf the capture file
+ * @param dftext the new filter string
+ * @param force force the refiltering, even if filter string doesn't changed
+ * @return TRUE, if the filtering succeeded
+ */
extern gboolean main_filter_packets(capture_file *cf, const gchar *dftext,
gboolean force);
+
+/** Open a new file coming from drag and drop.
+ * @param cf_name the new capture filename
+ */
extern void dnd_open_file_cmd(gpointer cf_name);
+
+/** Update the packets statusbar to the current values. */
extern void packets_bar_update(void);
#ifdef _WIN32
+/** Win32 only: Create a console. Beware: cannot be closed again. */
extern void create_console(void);
#endif
+/** Return value from font_apply() */
typedef enum {
- FA_SUCCESS,
- FA_FONT_NOT_RESIZEABLE,
- FA_FONT_NOT_AVAILABLE
+ FA_SUCCESS, /**< function succeeded */
+ FA_FONT_NOT_RESIZEABLE, /**< the choosen font isn't resizable */
+ FA_FONT_NOT_AVAILABLE /**< the choosen font isn't available */
} fa_ret_t;
+
+/** Applies a new font. Will also redraw the screen.
+ *
+ * @return if the new font could be set or not
+ */
extern fa_ret_t font_apply(void);
#if GTK_MAJOR_VERSION < 2
-char *font_boldify(const char *);
-void set_fonts(GdkFont *regular, GdkFont *bold);
-#else
-void set_fonts(PangoFontDescription *regular, PangoFontDescription *bold);
+/* Try to convert a font name to it's bold version.
+ *
+ * @param the font to convert
+ * @return the bold font
+ */
+char *font_boldify(const char *font_name);
#endif
-void set_last_open_dir(char *dirname);
#endif /* __MAIN_H__ */
diff --git a/gtk/menu.c b/gtk/menu.c
index 60bf3969ca..1027c187b0 100644
--- a/gtk/menu.c
+++ b/gtk/menu.c
@@ -1,7 +1,7 @@
/* menu.c
* Menu routines
*
- * $Id: menu.c,v 1.198 2004/05/26 03:49:23 ulfl Exp $
+ * $Id: menu.c,v 1.199 2004/06/01 17:33:37 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -197,9 +197,9 @@ static GtkItemFactoryEntry menu_items[] =
find_previous_cb, 0, GTK_STOCK_GO_BACK),
ITEM_FACTORY_ENTRY("/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL),
ITEM_FACTORY_ENTRY("/Edit/_Time Reference", NULL, NULL, 0, "<Branch>", NULL),
- ITEM_FACTORY_ENTRY("/Edit/Time Reference/Set Time Reference (toggle)", "<control>T", reftime_frame_cb, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Edit/Time Reference/Find Next", NULL, reftime_frame_cb, 1, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Edit/Time Reference/Find Previous", NULL, reftime_frame_cb, 2, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Edit/Time Reference/Set Time Reference (toggle)", "<control>T", reftime_frame_cb, REFTIME_TOGGLE, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Edit/Time Reference/Find Next", NULL, reftime_frame_cb, REFTIME_FIND_NEXT, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Edit/Time Reference/Find Previous", NULL, reftime_frame_cb, REFTIME_FIND_PREV, NULL, NULL),
ITEM_FACTORY_ENTRY("/Edit/_Mark Packet", "<control>M", mark_frame_cb,
0, NULL, NULL),
ITEM_FACTORY_ENTRY("/Edit/Mark _All Packets", NULL, mark_all_frames_cb,
@@ -278,31 +278,31 @@ static GtkItemFactoryEntry menu_items[] =
ITEM_FACTORY_STOCK_ENTRY("/Analyze/_Display Filters...", NULL, dfilter_dialog_cb,
0, ETHEREAL_STOCK_DISPLAY_FILTER),
ITEM_FACTORY_ENTRY("/Analyze/Appl_y as Filter", NULL, NULL, 0, "<Branch>", NULL),
- ITEM_FACTORY_ENTRY("/Analyze/Apply as Filter/_Selected", NULL,
- match_selected_cb_replace_ptree, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Analyze/Apply as Filter/_Not Selected", NULL,
- match_selected_cb_not_ptree, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Analyze/Apply as Filter/... _and Selected", NULL,
- match_selected_cb_and_ptree, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Analyze/Apply as Filter/... _or Selected", NULL,
- match_selected_cb_or_ptree, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Analyze/Apply as Filter/... a_nd not Selected", NULL,
- match_selected_cb_and_ptree_not, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Analyze/Apply as Filter/... o_r not Selected", NULL,
- match_selected_cb_or_ptree_not, 0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Analyze/Apply as Filter/_Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Analyze/Apply as Filter/_Not Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Analyze/Apply as Filter/... _and Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Analyze/Apply as Filter/... _or Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Analyze/Apply as Filter/... a_nd not Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Analyze/Apply as Filter/... o_r not Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
ITEM_FACTORY_ENTRY("/Analyze/_Prepare a Filter", NULL, NULL, 0, "<Branch>", NULL),
- ITEM_FACTORY_ENTRY("/Analyze/Prepare a Filter/_Selected", NULL,
- prepare_selected_cb_replace_ptree, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Analyze/Prepare a Filter/_Not Selected", NULL,
- prepare_selected_cb_not_ptree, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Analyze/Prepare a Filter/... _and Selected", NULL,
- prepare_selected_cb_and_ptree, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Analyze/Prepare a Filter/... _or Selected", NULL,
- prepare_selected_cb_or_ptree, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Analyze/Prepare a Filter/... a_nd not Selected", NULL,
- prepare_selected_cb_and_ptree_not, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Analyze/Prepare a Filter/... o_r not Selected", NULL,
- prepare_selected_cb_or_ptree_not, 0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Analyze/Prepare a Filter/_Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_REPLACE, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Analyze/Prepare a Filter/_Not Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_NOT, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Analyze/Prepare a Filter/... _and Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_AND, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Analyze/Prepare a Filter/... _or Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_OR, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Analyze/Prepare a Filter/... a_nd not Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_AND_NOT, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Analyze/Prepare a Filter/... o_r not Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_OR_NOT, NULL, NULL),
ITEM_FACTORY_ENTRY("/Analyze/<separator>", NULL, NULL, 0, "<Separator>", NULL),
ITEM_FACTORY_ENTRY("/Analyze/_Enabled Protocols...", "<shift><control>R", proto_cb, 0, NULL, NULL),
ITEM_FACTORY_ENTRY("/Analyze/Decode _As...", NULL, decode_as_cb,
@@ -324,10 +324,6 @@ static GtkItemFactoryEntry menu_items[] =
ITEM_FACTORY_STOCK_ENTRY("/Help/_Contents", "F1", help_cb, 0, GTK_STOCK_HELP),
ITEM_FACTORY_ENTRY("/Help/_Supported Protocols", NULL, supported_cb, 0, NULL, NULL),
ITEM_FACTORY_ENTRY("/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL),
-#ifdef HAVE_PLUGINS
-/* ITEM_FACTORY_ENTRY("/Help/About _Plugins", NULL, tools_plugins_cmd_cb,
- 0, NULL, NULL),*/
-#endif /* HAVE_PLUGINS */
ITEM_FACTORY_ENTRY("/Help/_About Ethereal", NULL, about_ethereal_cb,
0, NULL, NULL)
};
@@ -347,35 +343,37 @@ static GtkItemFactoryEntry packet_list_menu_items[] =
ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
ITEM_FACTORY_ENTRY("/Mark Packet", NULL, mark_frame_cb, 0, NULL, NULL),
ITEM_FACTORY_ENTRY("/Time Reference", NULL, NULL, 0, "<Branch>", NULL),
- ITEM_FACTORY_ENTRY("/Time Reference/Set Time Reference (toggle)", NULL, reftime_frame_cb, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Time Reference/Find Next", NULL, reftime_frame_cb, 1, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Time Reference/Find Previous", NULL, reftime_frame_cb, 2, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Time Reference/Set Time Reference (toggle)", NULL, reftime_frame_cb, REFTIME_TOGGLE, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Time Reference/Find Next", NULL, reftime_frame_cb, REFTIME_FIND_NEXT, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Time Reference/Find Previous", NULL, reftime_frame_cb, REFTIME_FIND_PREV, NULL, NULL),
ITEM_FACTORY_ENTRY("/Apply as Filter", NULL, NULL, 0, "<Branch>", NULL),
- ITEM_FACTORY_ENTRY("/Apply as Filter/_Selected", NULL,
- match_selected_cb_replace_plist, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Apply as Filter/_Not Selected", NULL,
- match_selected_cb_not_plist, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Apply as Filter/... _and Selected", NULL,
- match_selected_cb_and_plist, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Apply as Filter/... _or Selected", NULL, match_selected_cb_or_plist,
- 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Apply as Filter/... a_nd not Selected", NULL,
- match_selected_cb_and_plist_not, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Apply as Filter/... o_r not Selected", NULL,
- match_selected_cb_or_plist_not, 0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Apply as Filter/_Selected", NULL, match_selected_plist_cb,
+ MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Apply as Filter/_Not Selected", NULL, match_selected_plist_cb,
+ MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Apply as Filter/... _and Selected", NULL, match_selected_plist_cb,
+ MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Apply as Filter/... _or Selected", NULL, match_selected_plist_cb,
+ MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Apply as Filter/... a_nd not Selected", NULL, match_selected_plist_cb,
+ MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Apply as Filter/... o_r not Selected", NULL, match_selected_plist_cb,
+ MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+
ITEM_FACTORY_ENTRY("/Prepare a Filter", NULL, NULL, 0, "<Branch>", NULL),
- ITEM_FACTORY_ENTRY("/Prepare a Filter/_Selected", NULL,
- prepare_selected_cb_replace_plist, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Prepare a Filter/_Not Selected", NULL,
- prepare_selected_cb_not_plist, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Prepare a Filter/... _and Selected", NULL,
- prepare_selected_cb_and_plist, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Prepare a Filter/... _or Selected", NULL,
- prepare_selected_cb_or_plist, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Prepare a Filter/... a_nd not Selected", NULL,
- prepare_selected_cb_and_plist_not, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Prepare a Filter/... o_r not Selected", NULL,
- prepare_selected_cb_or_plist_not, 0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare a Filter/_Selected", NULL, match_selected_plist_cb,
+ MATCH_SELECTED_REPLACE, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare a Filter/_Not Selected", NULL, match_selected_plist_cb,
+ MATCH_SELECTED_NOT, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare a Filter/... _and Selected", NULL, match_selected_plist_cb,
+ MATCH_SELECTED_AND, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare a Filter/... _or Selected", NULL, match_selected_plist_cb,
+ MATCH_SELECTED_OR, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare a Filter/... a_nd not Selected", NULL, match_selected_plist_cb,
+ MATCH_SELECTED_AND_NOT, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare a Filter/... o_r not Selected", NULL, match_selected_plist_cb,
+ MATCH_SELECTED_OR_NOT, NULL, NULL),
+
ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
ITEM_FACTORY_ENTRY("/Coloring Rules...", NULL, color_display_cb,
0, NULL, NULL),
@@ -399,31 +397,32 @@ static GtkItemFactoryEntry tree_view_menu_items[] =
ITEM_FACTORY_ENTRY("/Protocol Properties...", NULL, properties_cb,
0, NULL, NULL),
ITEM_FACTORY_ENTRY("/Apply as Filter", NULL, NULL, 0, "<Branch>", NULL),
- ITEM_FACTORY_ENTRY("/Apply as Filter/_Selected", NULL,
- match_selected_cb_replace_ptree, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Apply as Filter/_Not Selected", NULL,
- match_selected_cb_not_ptree, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Apply as Filter/... _and Selected", NULL,
- match_selected_cb_and_ptree, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Apply as Filter/... _or Selected", NULL, match_selected_cb_or_ptree,
- 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Apply as Filter/... a_nd not Selected", NULL,
- match_selected_cb_and_ptree_not, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Apply as Filter/... o_r not Selected", NULL,
- match_selected_cb_or_ptree_not, 0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Apply as Filter/_Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Apply as Filter/_Not Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Apply as Filter/... _and Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Apply as Filter/... _or Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Apply as Filter/... a_nd not Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Apply as Filter/... o_r not Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW, NULL, NULL),
+
ITEM_FACTORY_ENTRY("/Prepare a Filter", NULL, NULL, 0, "<Branch>", NULL),
- ITEM_FACTORY_ENTRY("/Prepare a Filter/_Selected", NULL,
- prepare_selected_cb_replace_ptree, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Prepare a Filter/_Not Selected", NULL,
- prepare_selected_cb_not_ptree, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Prepare a Filter/... _and Selected", NULL,
- prepare_selected_cb_and_ptree, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Prepare a Filter/... _or Selected", NULL,
- prepare_selected_cb_or_ptree, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Prepare a Filter/... a_nd not Selected", NULL,
- prepare_selected_cb_and_ptree_not, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Prepare a Filter/... o_r not Selected", NULL,
- prepare_selected_cb_or_ptree_not, 0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare a Filter/_Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_REPLACE, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare a Filter/_Not Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_NOT, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare a Filter/... _and Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_AND, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare a Filter/... _or Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_OR, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare a Filter/... a_nd not Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_AND_NOT, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare a Filter/... o_r not Selected", NULL, match_selected_ptree_cb,
+ MATCH_SELECTED_OR_NOT, NULL, NULL),
ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
ITEM_FACTORY_ENTRY("/Collapse All", NULL, collapse_all_cb, 0, NULL, NULL),
ITEM_FACTORY_ENTRY("/Expand All", NULL, expand_all_cb, 0, NULL, NULL),
diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c
index 7e682b086d..1562565724 100644
--- a/gtk/proto_draw.c
+++ b/gtk/proto_draw.c
@@ -1,7 +1,7 @@
/* proto_draw.c
* Routines for GTK+ packet display
*
- * $Id: proto_draw.c,v 1.103 2004/06/01 01:01:31 guy Exp $
+ * $Id: proto_draw.c,v 1.104 2004/06/01 17:33:37 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -891,11 +891,6 @@ void savehex_cb(GtkWidget * w _U_, gpointer data _U_)
*/
savehex_dlg = file_selection_new("Ethereal: Export Selected Packet Bytes", FILE_SELECTION_SAVE);
- /* If we've opened a file, start out by showing the files in the directory
- in which that file resided. */
- if (last_open_dir)
- file_selection_set_current_folder(savehex_dlg, last_open_dir);
-
/* label */
label = g_strdup_printf("Will save %u %s of raw binary data to specified file.",
end - start, plurality(end - start, "byte", "bytes"));
diff --git a/gtk/recent.c b/gtk/recent.c
index 54e7edae95..bf81510cd2 100644
--- a/gtk/recent.c
+++ b/gtk/recent.c
@@ -2,7 +2,7 @@
* Recent "preference" handling routines
* Copyright 2004, Ulf Lamping <ulf.lamping@web.de>
*
- * $Id: recent.c,v 1.16 2004/05/31 02:42:39 guy Exp $
+ * $Id: recent.c,v 1.17 2004/06/01 17:33:37 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -39,6 +39,7 @@
#include "prefs.h"
#include "prefs-int.h"
#include "ui_util.h"
+#include "dlg_utils.h"
#define RECENT_KEY_MAIN_TOOLBAR_SHOW "gui.toolbar_main_show"
@@ -190,9 +191,9 @@ write_recent(char **rf_path_return)
fprintf(rf, RECENT_GUI_GEOMETRY_STATUS_PANE ": %d\n",
recent.gui_geometry_status_pane);
- if (last_open_dir != NULL) {
+ if (get_last_open_dir() != NULL) {
fprintf(rf, "\n# Last directory navigated to in File Open dialog.\n");
- fprintf(rf, RECENT_GUI_FILEOPEN_REMEMBERED_DIR ": %s\n", last_open_dir);
+ fprintf(rf, RECENT_GUI_FILEOPEN_REMEMBERED_DIR ": %s\n", get_last_open_dir());
}
window_geom_recent_write_all(rf);
diff --git a/gtk/rtp_analysis.c b/gtk/rtp_analysis.c
index 4fcf73b0bd..959abe66b8 100644
--- a/gtk/rtp_analysis.c
+++ b/gtk/rtp_analysis.c
@@ -1,7 +1,7 @@
/* rtp_analysis.c
* RTP analysis addition for ethereal
*
- * $Id: rtp_analysis.c,v 1.44 2004/05/27 19:59:50 ulfl Exp $
+ * $Id: rtp_analysis.c,v 1.45 2004/06/01 17:33:37 ulfl Exp $
*
* Copyright 2003, Alcatel Business Systems
* By Lars Ruoff <lars.ruoff@gmx.net>
@@ -969,7 +969,7 @@ static void save_csv_as_ok_cb(GtkWidget *bt _U_, gpointer fs /*user_data_t *user
/* It's a directory - set the file selection box to display it. */
set_last_open_dir(g_dest);
g_free(g_dest);
- gtk_file_selection_set_filename(GTK_FILE_SELECTION(fs), last_open_dir);
+ file_selection_set_current_folder(fs, get_last_open_dir());
return;
}
@@ -1391,7 +1391,7 @@ static void save_voice_as_ok_cb(GtkWidget *ok_bt _U_, gpointer fs _U_)
/* It's a directory - set the file selection box to display it. */
set_last_open_dir(g_dest);
g_free(g_dest);
- gtk_file_selection_set_filename(GTK_FILE_SELECTION(fs), last_open_dir);
+ file_selection_set_current_folder(fs, get_last_open_dir());
return;
}
diff --git a/gtk/rtp_stream_dlg.c b/gtk/rtp_stream_dlg.c
index 495ff2828e..ac177cb2c8 100644
--- a/gtk/rtp_stream_dlg.c
+++ b/gtk/rtp_stream_dlg.c
@@ -1,7 +1,7 @@
/* rtp_stream_dlg.c
* RTP streams summary addition for ethereal
*
- * $Id: rtp_stream_dlg.c,v 1.21 2004/05/26 03:49:24 ulfl Exp $
+ * $Id: rtp_stream_dlg.c,v 1.22 2004/06/01 17:33:37 ulfl Exp $
*
* Copyright 2003, Alcatel Business Systems
* By Lars Ruoff <lars.ruoff@gmx.net>
@@ -161,7 +161,7 @@ static void save_stream_ok_cb(GtkWidget *ok_bt _U_, gpointer user_data _U_)
/* It's a directory - set the file selection box to display it. */
set_last_open_dir(g_dest);
g_free(g_dest);
- gtk_file_selection_set_filename(GTK_FILE_SELECTION(rtpstream_save_dlg), last_open_dir);
+ file_selection_set_current_folder(rtpstream_save_dlg, get_last_open_dir());
return;
}
diff --git a/gtk/toolbar.h b/gtk/toolbar.h
index 39108f66be..62546134fd 100644
--- a/gtk/toolbar.h
+++ b/gtk/toolbar.h
@@ -2,7 +2,7 @@
* Definitions for toolbar utility routines
* Copyright 2003, Ulf Lamping <ulf.lamping@web.de>
*
- * $Id: toolbar.h,v 1.7 2004/01/20 02:21:17 ulfl Exp $
+ * $Id: toolbar.h,v 1.8 2004/06/01 17:33:37 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -26,14 +26,49 @@
#ifndef __TOOLBAR_H__
#define __TOOLBAR_H__
+/** @file
+ * The main toolbar.
+ */
+
+/** Create the main toolbar.
+ * @return the new (still hidden) toolbar
+ */
+GtkWidget *toolbar_new(void);
+
+/** Redraw the main toolbar. Used, when user changes preferences. */
+void toolbar_redraw_all(void);
+
+/** We have (or don't have) a capture file now.
+ *
+ * @param have_capture_file TRUE, if we have a capture file
+ */
void set_toolbar_for_capture_file(gboolean have_capture_file);
+
+/** We have (or don't have) an unsaved capture file now.
+ *
+ * @param have_unsaved_capture_file TRUE, if we have an unsaved capture file
+ */
void set_toolbar_for_unsaved_capture_file(gboolean have_unsaved_capture_file);
+
+/** We have (or don't have) a capture in progress now.
+ *
+ * @param have_capture_file TRUE, if we have a capture in progress file
+ */
void set_toolbar_for_capture_in_progress(gboolean have_capture_file);
-void set_toolbar_for_captured_packets(gboolean have_captured_packets);
-GtkWidget *toolbar_new(void);
-void toolbar_redraw_all(void);
+/** We have (or don't have) captured packets now.
+ *
+ * @param have_captured_packets TRUE, if we have captured packets
+ */
+void set_toolbar_for_captured_packets(gboolean have_captured_packets);
+/** Set object data of some buttons (where needed). It's needed so callback
+ * functions can read back their required data. Acts like OBJECT_SET_DATA()
+ * on multiple buttons.
+ *
+ * @param key the key
+ * @param data the data to set
+ */
void set_toolbar_object_data(gchar *key, gpointer data);
#endif /* __TOOLBAR_H__ */