aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capture.c6
-rw-r--r--file.c57
-rw-r--r--file.h5
-rw-r--r--gtk/compat_macros.h20
-rw-r--r--gtk/gui_prefs.c68
-rw-r--r--gtk/main.c428
-rw-r--r--gtk/main.h10
-rw-r--r--gtk/menu.c13
-rw-r--r--gtk/recent.c15
-rw-r--r--gtk/recent.h4
-rw-r--r--gtk/toolbar.c34
-rw-r--r--prefs.c44
-rw-r--r--prefs.h12
13 files changed, 610 insertions, 106 deletions
diff --git a/capture.c b/capture.c
index 4ff4392146..3f0202eadb 100644
--- a/capture.c
+++ b/capture.c
@@ -1,7 +1,7 @@
/* capture.c
* Routines for packet capture windows
*
- * $Id: capture.c,v 1.222 2004/01/18 04:13:44 guy Exp $
+ * $Id: capture.c,v 1.223 2004/01/20 18:47:21 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -428,7 +428,7 @@ do_capture(const char *save_file)
/* Convert font name to a quote-encapsulated string and pass to child */
argv = add_arg(argv, &argc, "-m");
- fontstring = quote_encapsulate(prefs.gui_font_name);
+ fontstring = quote_encapsulate(prefs.PREFS_GUI_FONT_NAME);
argv = add_arg(argv, &argc, fontstring);
/* Convert pipe write handle to a string and pass to child */
@@ -465,7 +465,7 @@ do_capture(const char *save_file)
}
argv = add_arg(argv, &argc, "-m");
- argv = add_arg(argv, &argc, prefs.gui_font_name);
+ argv = add_arg(argv, &argc, prefs.PREFS_GUI_FONT_NAME);
if (cfile.cfilter != NULL && strlen(cfile.cfilter) != 0) {
argv = add_arg(argv, &argc, "-f");
diff --git a/file.c b/file.c
index 65f3736a0d..fbc9ea813b 100644
--- a/file.c
+++ b/file.c
@@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
- * $Id: file.c,v 1.342 2004/01/16 19:35:32 guy Exp $
+ * $Id: file.c,v 1.343 2004/01/20 18:47:21 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -2267,6 +2267,61 @@ goto_frame(capture_file *cf, guint fnumber)
return TRUE; /* we got to that packet */
}
+gboolean
+goto_top_frame(capture_file *cf)
+{
+ frame_data *fdata;
+ int row;
+ frame_data *lowest_fdata = NULL;
+
+ for (fdata = cf->plist; fdata != NULL; fdata = fdata->next) {
+ if (fdata->flags.passed_dfilter) {
+ lowest_fdata = fdata;
+ break;
+ }
+ }
+
+ if (lowest_fdata == NULL) {
+ return FALSE;
+ }
+
+ /* We found that packet, and it's currently being displayed.
+ Find what row it's in. */
+ row = packet_list_find_row_from_data(lowest_fdata);
+ g_assert(row != -1);
+
+ /* Select that row, make it the focus row, and make it visible. */
+ packet_list_set_selected_row(row);
+ return TRUE; /* we got to that packet */
+}
+
+gboolean
+goto_bottom_frame(capture_file *cf)
+{
+ frame_data *fdata;
+ int row;
+ frame_data *highest_fdata = NULL;
+
+ for (fdata = cf->plist; fdata != NULL; fdata = fdata->next) {
+ if (fdata->flags.passed_dfilter) {
+ highest_fdata = fdata;
+ }
+ }
+
+ if (highest_fdata == NULL) {
+ return FALSE;
+ }
+
+ /* We found that packet, and it's currently being displayed.
+ Find what row it's in. */
+ row = packet_list_find_row_from_data(highest_fdata);
+ g_assert(row != -1);
+
+ /* Select that row, make it the focus row, and make it visible. */
+ packet_list_set_selected_row(row);
+ return TRUE; /* we got to that packet */
+}
+
/* Select the packet on a given row. */
void
select_packet(capture_file *cf, int row)
diff --git a/file.h b/file.h
index c8b26aba9a..3cd339ad92 100644
--- a/file.h
+++ b/file.h
@@ -1,7 +1,7 @@
/* file.h
* Definitions for file structures and routines
*
- * $Id: file.h,v 1.110 2004/01/13 22:33:26 guy Exp $
+ * $Id: file.h,v 1.111 2004/01/20 18:47:21 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -70,6 +70,9 @@ guint8 get_int_value(char char_val);
gboolean find_ascii(capture_file *cf, char *ascii_text, gboolean ascii_search, char *ftype, gboolean case_type);
gboolean find_in_gtk_data(capture_file *cf, gpointer *data, char *ascii_text, gboolean case_type, gboolean search_type);
gboolean goto_frame(capture_file *cf, guint fnumber);
+gboolean goto_bottom_frame(capture_file *cf);
+gboolean goto_top_frame(capture_file *cf);
+
void select_packet(capture_file *, int);
void unselect_packet(capture_file *);
diff --git a/gtk/compat_macros.h b/gtk/compat_macros.h
index 106b2ae0e3..8a3e5c64bf 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.9 2004/01/20 02:35:31 guy Exp $
+ * $Id: compat_macros.h,v 1.10 2004/01/20 18:47:23 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -89,9 +89,12 @@ gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), name)
#define GTK_STOCK_COPY "Copy"
#define GTK_STOCK_DELETE "Delete"
#define GTK_STOCK_FIND "Find"
+#define GTK_STOCK_GO_BACK "Back"
#define GTK_STOCK_GO_DOWN "Down"
#define GTK_STOCK_GO_FORWARD "Next"
#define GTK_STOCK_GO_UP "Up"
+#define GTK_STOCK_GOTO_BOTTOM "Bottom"
+#define GTK_STOCK_GOTO_TOP "Top"
#define GTK_STOCK_HELP "Help"
#define GTK_STOCK_JUMP_TO "GoTo"
#define GTK_STOCK_NEW "New"
@@ -106,15 +109,18 @@ gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), name)
#define GTK_STOCK_SELECT_COLOR "Color"
#define GTK_STOCK_SELECT_FONT "Font"
#define GTK_STOCK_STOP "Stop"
+#define GTK_STOCK_ZOOM_IN "Zoom In"
+#define GTK_STOCK_ZOOM_OUT "Zoom Out"
+#define GTK_STOCK_ZOOM_100 "Zoom 100%"
#ifdef HAVE_LIBPCAP
-#define ETHEREAL_STOCK_CAPTURE_START ETHEREAL_STOCK_LABEL_CAPTURE_START
-#define ETHEREAL_STOCK_CAPTURE_FILTER ETHEREAL_STOCK_LABEL_CAPTURE_FILTER
-#define ETHEREAL_STOCK_CAPTURE_FILTER_ENTRY ETHEREAL_STOCK_LABEL_CAPTURE_FILTER_ENTRY
+#define ETHEREAL_STOCK_CAPTURE_START "New"
+#define ETHEREAL_STOCK_CAPTURE_FILTER "CFilter"
+#define ETHEREAL_STOCK_CAPTURE_FILTER_ENTRY "CFilter:"
#endif
-#define ETHEREAL_STOCK_DISPLAY_FILTER ETHEREAL_STOCK_LABEL_DISPLAY_FILTER
-#define ETHEREAL_STOCK_DISPLAY_FILTER_ENTRY ETHEREAL_STOCK_LABEL_DISPLAY_FILTER_ENTRY
-#define ETHEREAL_STOCK_PREFS ETHEREAL_STOCK_LABEL_PREFS
+#define ETHEREAL_STOCK_DISPLAY_FILTER "DFilter"
+#define ETHEREAL_STOCK_DISPLAY_FILTER_ENTRY "DFilter:"
+#define ETHEREAL_STOCK_PREFS "Prefs"
#define BUTTON_NEW_FROM_STOCK(stock_id) \
gtk_button_new_with_label(stock_id);
diff --git a/gtk/gui_prefs.c b/gtk/gui_prefs.c
index 6285b0f311..56b05a053c 100644
--- a/gtk/gui_prefs.c
+++ b/gtk/gui_prefs.c
@@ -1,7 +1,7 @@
/* gui_prefs.c
* Dialog box for GUI preferences
*
- * $Id: gui_prefs.c,v 1.54 2004/01/17 03:09:24 guy Exp $
+ * $Id: gui_prefs.c,v 1.55 2004/01/20 18:47:23 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -33,7 +33,6 @@
#include "globals.h"
#include "gui_prefs.h"
#include "gtkglobals.h"
-#include "follow_dlg.h"
#include "help_dlg.h"
#include "supported_protos_dlg.h"
#include "prefs.h"
@@ -321,7 +320,7 @@ gui_font_prefs_show(void)
a fix; hopefully, it'll show up in 1.2.9 if, as, and when
they put out a 1.2.9 release. */
gtk_font_selection_set_font_name(
- GTK_FONT_SELECTION(font_browse_w), prefs.gui_font_name);
+ GTK_FONT_SELECTION(font_browse_w), prefs.PREFS_GUI_FONT_NAME);
gtk_widget_show(font_browse_w);
@@ -353,7 +352,7 @@ font_fetch(void)
#if GTK_MAJOR_VERSION < 2
/* Get the name that the boldface version of that font would have. */
- bold_font_name = boldify(font_name);
+ bold_font_name = font_boldify(font_name);
/* Now load those fonts, just to make sure we can. */
new_r_font = gdk_font_load(font_name);
@@ -453,52 +452,26 @@ gui_prefs_fetch(GtkWidget *w)
* places where there *can* be a bad preference value.
*/
if (font_fetch()) {
- if (strcmp(new_font_name, prefs.gui_font_name) != 0) {
+ if (strcmp(new_font_name, prefs.PREFS_GUI_FONT_NAME) != 0) {
font_changed = TRUE;
- if (prefs.gui_font_name != NULL)
- g_free(prefs.gui_font_name);
- prefs.gui_font_name = g_strdup(new_font_name);
+ if (prefs.PREFS_GUI_FONT_NAME != NULL)
+ g_free(prefs.PREFS_GUI_FONT_NAME);
+ prefs.PREFS_GUI_FONT_NAME = g_strdup(new_font_name);
}
}
}
+
+
void
gui_prefs_apply(GtkWidget *w _U_)
{
-#if GTK_MAJOR_VERSION < 2
- GdkFont *new_r_font, *new_b_font;
- char *bold_font_name;
- GdkFont *old_r_font = NULL, *old_b_font = NULL;
-#else
- PangoFontDescription *new_r_font, *new_b_font;
- PangoFontDescription *old_r_font = NULL, *old_b_font = NULL;
-#endif
- if (font_changed) {
- /* XXX - what if the world changed out from under
- us, so that one or both of these fonts cannot
- be loaded? */
-#if GTK_MAJOR_VERSION < 2
- new_r_font = gdk_font_load(prefs.gui_font_name);
- bold_font_name = boldify(prefs.gui_font_name);
- new_b_font = gdk_font_load(bold_font_name);
-#else
- new_r_font = pango_font_description_from_string(prefs.gui_font_name);
- new_b_font = pango_font_description_copy(new_r_font);
- pango_font_description_set_weight(new_b_font,
- PANGO_WEIGHT_BOLD);
-#endif
- set_plist_font(new_r_font);
- set_ptree_font_all(new_r_font);
- old_r_font = m_r_font;
- old_b_font = m_b_font;
- set_fonts(new_r_font, new_b_font);
-#if GTK_MAJOR_VERSION < 2
- g_free(bold_font_name);
-#endif
+ if (font_changed) {
+ font_apply();
}
- /* Redraw the hex dump windows, in case either the font or the
+ /* Redraw the hex dump windows, in case the
highlight style changed. */
redraw_hex_dump_all();
@@ -506,10 +479,6 @@ gui_prefs_apply(GtkWidget *w _U_)
supported_redraw();
help_redraw();
- /* Redraw the "Follow TCP Stream" windows, if the font changed. */
- if (font_changed)
- follow_redraw_all();
-
/* XXX: redraw the toolbar only, if style changed */
toolbar_redraw_all();
@@ -517,19 +486,6 @@ gui_prefs_apply(GtkWidget *w _U_)
set_plist_sel_browse(prefs.gui_plist_sel_browse);
set_ptree_sel_browse_all(prefs.gui_ptree_sel_browse);
set_tree_styles_all();
-
- /* We're no longer using the old fonts; unreference them. */
-#if GTK_MAJOR_VERSION < 2
- if (old_r_font != NULL)
- gdk_font_unref(old_r_font);
- if (old_b_font != NULL)
- gdk_font_unref(old_b_font);
-#else
- if (old_r_font != NULL)
- pango_font_description_free(old_r_font);
- if (old_b_font != NULL)
- pango_font_description_free(old_b_font);
-#endif
}
void
diff --git a/gtk/main.c b/gtk/main.c
index aa8125b48f..d904925f69 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.362 2004/01/20 02:26:00 ulfl Exp $
+ * $Id: main.c,v 1.363 2004/01/20 18:47:23 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -124,6 +124,7 @@
#include "find_dlg.h"
#include "packet_list.h"
#include "recent.h"
+#include "follow_dlg.h"
#ifdef WIN32
#include "capture-wpcap.h"
@@ -177,6 +178,7 @@ static gboolean list_link_layer_types;
#endif
static void create_main_window(gint, gint, gint, e_prefs*);
+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"
@@ -296,6 +298,44 @@ goto_framenum_cb(GtkWidget *w _U_, gpointer data _U_)
}
}
+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_)
+{
+
+ recent.gui_zoom_level++;
+ font_apply();
+}
+
+void
+view_zoom_out_cb(GtkWidget *w _U_, gpointer d _U_)
+{
+
+ recent.gui_zoom_level--;
+ font_apply();
+}
+
+void
+view_zoom_100_cb(GtkWidget *w _U_, gpointer d _U_)
+{
+
+ recent.gui_zoom_level = 0;
+ font_apply();
+}
+
+
/* Match selected byte pattern */
static void
match_selected_cb_do(gpointer data, int action, gchar *text)
@@ -1726,9 +1766,9 @@ main(int argc, char *argv[])
#endif
break;
case 'm': /* Fixed-width font for the display */
- if (prefs->gui_font_name != NULL)
- g_free(prefs->gui_font_name);
- prefs->gui_font_name = g_strdup(optarg);
+ if (prefs->PREFS_GUI_FONT_NAME != NULL)
+ g_free(prefs->PREFS_GUI_FONT_NAME);
+ prefs->PREFS_GUI_FONT_NAME = g_strdup(optarg);
break;
case 'n': /* No name resolution */
g_resolv_flags = RESOLV_NONE;
@@ -2127,16 +2167,24 @@ main(int argc, char *argv[])
#endif
#endif
+#ifdef WIN32
+#if GTK_MAJOR_VERSION >= 2
+ try_to_get_windows_font_gtk2();
+#endif
+#endif
+
+ /* read in rc file from global and personal configuration paths. */
+ gtk_rc_parse(RC_FILE);
rc_file = get_persconffile_path(RC_FILE, FALSE);
gtk_rc_parse(rc_file);
/* Try to load the regular and boldface fixed-width fonts */
#if GTK_MAJOR_VERSION < 2
- bold_font_name = boldify(prefs->gui_font_name);
- m_r_font = gdk_font_load(prefs->gui_font_name);
+ bold_font_name = font_boldify(prefs->PREFS_GUI_FONT_NAME);
+ m_r_font = gdk_font_load(prefs->PREFS_GUI_FONT_NAME);
m_b_font = gdk_font_load(bold_font_name);
#else
- m_r_font = pango_font_description_from_string(prefs->gui_font_name);
+ m_r_font = pango_font_description_from_string(prefs->PREFS_GUI_FONT_NAME);
m_b_font = pango_font_description_copy(m_r_font);
pango_font_description_set_weight(m_b_font, PANGO_WEIGHT_BOLD);
#endif
@@ -2151,7 +2199,7 @@ main(int argc, char *argv[])
#else
fprintf(stderr, "ethereal: Warning: font %s not found - defaulting to Monospace 9\n",
#endif
- prefs->gui_font_name);
+ prefs->PREFS_GUI_FONT_NAME);
} else {
#if GTK_MAJOR_VERSION < 2
gdk_font_unref(m_r_font);
@@ -2168,7 +2216,7 @@ main(int argc, char *argv[])
bold_font_name);
#else
fprintf(stderr, "ethereal: Warning: bold font %s not found - defaulting"
- " to Monospace 9\n", prefs->gui_font_name);
+ " to Monospace 9\n", prefs->PREFS_GUI_FONT_NAME);
#endif
} else {
#if GTK_MAJOR_VERSION < 2
@@ -2197,12 +2245,12 @@ main(int argc, char *argv[])
#endif
exit(1);
}
- g_free(prefs->gui_font_name);
+ g_free(prefs->PREFS_GUI_FONT_NAME);
#if GTK_MAJOR_VERSION < 2
- prefs->gui_font_name = g_strdup("6x13");
+ prefs->PREFS_GUI_FONT_NAME = g_strdup("6x13");
#else
pango_font_description_set_weight(m_b_font, PANGO_WEIGHT_BOLD);
- prefs->gui_font_name = g_strdup("Monospace 9");
+ prefs->PREFS_GUI_FONT_NAME = g_strdup("Monospace 9");
#endif
}
@@ -2644,7 +2692,7 @@ static const struct {
#define N_WEIGHTS (sizeof weight_map / sizeof weight_map[0])
char *
-boldify(const char *font_name)
+font_boldify(const char *font_name)
{
char *bold_font_name;
gchar **xlfd_tokens;
@@ -2692,6 +2740,353 @@ not_xlfd:
#endif
+char *font_zoom(char *gui_font_name)
+{
+ char new_font_name[200];
+ char *font_name_dup;
+ char *font_name_p;
+ long font_point_size_l;
+#if GTK_MAJOR_VERSION < 2
+ int minus_chars;
+ char *font_foundry;
+ char *font_family;
+ char *font_weight;
+ char *font_slant;
+ char *font_set_width;
+ char *font_add_style;
+ char *font_pixel_size;
+ char *font_point_size;
+ char *font_res_x;
+ char *font_res_y;
+ char *font_spacing;
+ char *font_aver_width;
+ char *font_charset_reg;
+ char *font_charset_encoding;
+#endif
+
+#if GTK_MAJOR_VERSION >= 2
+ font_name_dup = strdup(gui_font_name);
+ font_name_p = font_name_dup;
+
+ /* find the start of the font_size string */
+ font_name_p = strrchr(font_name_dup, ' ');
+ *font_name_p = 0;
+ font_name_p++;
+
+ /* calculate the new font size */
+ font_point_size_l = strtoul(font_name_p, NULL, 10);
+ font_point_size_l += recent.gui_zoom_level;
+
+ /* build a new font name */
+ sprintf(new_font_name, "%s %u", font_name_dup, font_point_size_l);
+ g_free(font_name_dup);
+
+ return strdup(new_font_name);
+#else
+ font_name_dup = strdup(gui_font_name);
+ font_name_p = font_name_dup;
+
+ minus_chars = 0;
+ /* replace all '-' chars by 0 and count them */
+ while (font_name_p = strchr(font_name_p, '-')) {
+ *font_name_p = 0;
+ font_name_p++;
+ minus_chars++;
+ }
+
+ if (minus_chars != 14) {
+ return NULL;
+ }
+
+ /* first element empty */
+ font_name_p = font_name_dup;
+ font_name_p += strlen(font_name_p);
+ font_name_p++;
+
+ /* get pointers to all font name elements */
+ font_foundry = font_name_p;
+ font_name_p += strlen(font_name_p);
+ font_name_p++;
+
+ font_family = font_name_p;
+ font_name_p += strlen(font_name_p);
+ font_name_p++;
+
+ font_weight = font_name_p;
+ font_name_p += strlen(font_name_p);
+ font_name_p++;
+
+ font_slant = font_name_p;
+ font_name_p += strlen(font_name_p);
+ font_name_p++;
+
+ font_set_width = font_name_p;
+ font_name_p += strlen(font_name_p);
+ font_name_p++;
+
+ font_add_style = font_name_p;
+ font_name_p += strlen(font_name_p);
+ font_name_p++;
+
+ font_pixel_size = font_name_p;
+ font_name_p += strlen(font_name_p);
+ font_name_p++;
+
+ font_point_size = font_name_p;
+ font_name_p += strlen(font_name_p);
+ font_name_p++;
+
+ font_res_x = font_name_p;
+ font_name_p += strlen(font_name_p);
+ font_name_p++;
+
+ font_res_y = font_name_p;
+ font_name_p += strlen(font_name_p);
+ font_name_p++;
+
+ font_spacing = font_name_p;
+ font_name_p += strlen(font_name_p);
+ font_name_p++;
+
+ font_aver_width = font_name_p;
+ font_name_p += strlen(font_name_p);
+ font_name_p++;
+
+ font_charset_reg = font_name_p;
+ font_name_p += strlen(font_name_p);
+ font_name_p++;
+
+ font_charset_encoding = font_name_p;
+ font_name_p += strlen(font_name_p);
+ font_name_p++;
+
+ /* calculate the new font size */
+ font_point_size_l = strtoul(font_point_size, NULL, 10);
+ font_point_size_l += recent.gui_zoom_level*10;
+ if (font_point_size_l < 0)
+ font_point_size_l = 0;
+
+ /* build a new font name */
+ sprintf(new_font_name, "-%s-%s-%s-%s-%s--%s-%u-%s-%s-%s-%s-%s-%s",
+ font_foundry, font_family, font_weight, font_slant, font_set_width,
+ font_pixel_size, font_point_size_l, font_res_x, font_res_y,
+ font_spacing, font_aver_width, font_charset_reg, font_charset_encoding);
+ g_free(font_name_dup);
+
+ return strdup(new_font_name);
+#endif
+}
+
+
+void
+font_apply(void) {
+ char *gui_font_name;
+#if GTK_MAJOR_VERSION < 2
+ GdkFont *new_r_font, *new_b_font;
+ char *bold_font_name;
+ GdkFont *old_r_font = NULL, *old_b_font = NULL;
+#else
+ PangoFontDescription *new_r_font, *new_b_font;
+ PangoFontDescription *old_r_font = NULL, *old_b_font = NULL;
+#endif
+
+
+ /* convert font name to reflect the zoom level */
+ gui_font_name = font_zoom(prefs.PREFS_GUI_FONT_NAME);
+ if (gui_font_name == NULL) {
+ simple_dialog(ESD_TYPE_WARN, NULL,
+ "Font name: \"%s\" invalid, please update font setting in Edit->Preferences",
+ gui_font_name);
+ return;
+ }
+
+ /* XXX - what if the world changed out from under
+ us, so that one or both of these fonts cannot
+ be loaded? */
+#if GTK_MAJOR_VERSION < 2
+ new_r_font = gdk_font_load(gui_font_name);
+ bold_font_name = font_boldify(gui_font_name);
+ new_b_font = gdk_font_load(bold_font_name);
+#else
+ new_r_font = pango_font_description_from_string(gui_font_name);
+ new_b_font = pango_font_description_copy(new_r_font);
+ pango_font_description_set_weight(new_b_font,
+ PANGO_WEIGHT_BOLD);
+#endif
+ set_plist_font(new_r_font);
+ set_ptree_font_all(new_r_font);
+ old_r_font = m_r_font;
+ old_b_font = m_b_font;
+ set_fonts(new_r_font, new_b_font);
+#if GTK_MAJOR_VERSION < 2
+ g_free(bold_font_name);
+#endif
+
+ /* Redraw the hex dump windows. */
+ redraw_hex_dump_all();
+
+ /* Redraw the "Follow TCP Stream" windows. */
+ follow_redraw_all();
+
+ /* We're no longer using the old fonts; unreference them. */
+#if GTK_MAJOR_VERSION < 2
+ if (old_r_font != NULL)
+ gdk_font_unref(old_r_font);
+ if (old_b_font != NULL)
+ gdk_font_unref(old_b_font);
+#else
+ if (old_r_font != NULL)
+ pango_font_description_free(old_r_font);
+ if (old_b_font != NULL)
+ pango_font_description_free(old_b_font);
+#endif
+ g_free(gui_font_name);
+}
+
+
+
+
+#ifdef WIN32
+
+#define NAME_BUFFER_LEN 32
+
+#if GTK_MAJOR_VERSION < 2
+
+
+/* coming from: Allin Cottrell, http://www.ecn.wfu.edu/~cottrell/gtk_win32 */
+int get_windows_font_gtk1(char *fontspec)
+{
+ HDC h_dc;
+ HGDIOBJ h_font;
+ TEXTMETRIC tm;
+ char name[NAME_BUFFER_LEN];
+ int len, pix_height;
+
+ h_dc = CreateDC("DISPLAY", NULL, NULL, NULL);
+ if (h_dc == NULL) return 1;
+ h_font = GetStockObject(DEFAULT_GUI_FONT);
+ if (h_font == NULL || !SelectObject(h_dc, h_font)) {
+ DeleteDC(h_dc);
+ return 1;
+ }
+ len = GetTextFace(h_dc, NAME_BUFFER_LEN, name);
+ if (len <= 0) {
+ DeleteDC(h_dc);
+ return 1;
+ }
+ if (!GetTextMetrics(h_dc, &tm)) {
+ DeleteDC(h_dc);
+ return 1;
+ }
+ pix_height = tm.tmHeight;
+ DeleteDC(h_dc);
+ sprintf(fontspec, "-*-%s-*-*-*-*-%i-*-*-*-p-*-iso8859-1", name,
+ pix_height);
+ return 0;
+}
+
+void set_app_font_gtk1(GtkWidget *top_level_w)
+{
+ GtkStyle *style;
+ char winfont[80];
+
+ style = gtk_widget_get_style(top_level);
+ if (get_windows_font_gtk1(winfont) == 0)
+ style->font = gdk_font_load(winfont);
+ if (style->font) gtk_widget_set_style(top_level, style);
+}
+
+#else /* GTK_MAJOR_VERSION */
+static char appfontname[128] = "tahoma 8";
+
+void set_app_font_gtk2(const char *fontname)
+{
+ GtkSettings *settings;
+
+ if (fontname != NULL && *fontname == 0) return;
+
+ settings = gtk_settings_get_default();
+
+ if (fontname == NULL) {
+ g_object_set(G_OBJECT(settings), "gtk-font-name", appfontname, NULL);
+ } else {
+ GtkWidget *w;
+ PangoFontDescription *pfd;
+ PangoContext *pc;
+ PangoFont *pfont;
+
+ w = gtk_label_new(NULL);
+ pfd = pango_font_description_from_string(fontname);
+ pc = gtk_widget_get_pango_context(w);
+ pfont = pango_context_load_font(pc, pfd);
+
+ if (pfont != NULL) {
+ strcpy(appfontname, fontname);
+ g_object_set(G_OBJECT(settings), "gtk-font-name", appfontname, NULL);
+ }
+
+ gtk_widget_destroy(w);
+ pango_font_description_free(pfd);
+ }
+}
+
+char *default_windows_menu_fontspec_gtk2(void)
+{
+ gchar *fontspec = NULL;
+ NONCLIENTMETRICS ncm;
+
+ memset(&ncm, 0, sizeof ncm);
+ ncm.cbSize = sizeof ncm;
+
+ if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0)) {
+ HDC screen = GetDC(0);
+ double y_scale = 72.0 / GetDeviceCaps(screen, LOGPIXELSY);
+ int point_size = (int) (ncm.lfMenuFont.lfHeight * y_scale);
+
+ if (point_size < 0) point_size = -point_size;
+ fontspec = g_strdup_printf("%s %d", ncm.lfMenuFont.lfFaceName,
+ point_size);
+ ReleaseDC(0, screen);
+ }
+
+ return fontspec;
+}
+
+static void try_to_get_windows_font_gtk2(void)
+{
+ gchar *fontspec;
+
+ fontspec = default_windows_menu_fontspec_gtk2();
+
+ if (fontspec != NULL) {
+ int match = 0;
+ PangoFontDescription *pfd;
+ PangoFont *pfont;
+ PangoContext *pc;
+ GtkWidget *w;
+
+ pfd = pango_font_description_from_string(fontspec);
+
+ w = gtk_label_new(NULL);
+ pc = gtk_widget_get_pango_context(w);
+ pfont = pango_context_load_font(pc, pfd);
+ match = (pfont != NULL);
+
+ pango_font_description_free(pfd);
+ g_object_unref(G_OBJECT(pc));
+ gtk_widget_destroy(w);
+
+ if (match) set_app_font_gtk2(fontspec);
+ g_free(fontspec);
+ }
+}
+#endif /* GTK_MAJOR_VERSION */
+
+#endif /* WIN32 */
+
+
+
+
/*
* Helper for main_widgets_rearrange()
*/
@@ -2802,6 +3197,13 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
/* Main window */
top_level = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+
+#ifdef WIN32
+#if GTK_MAJOR_VERSION < 2
+ set_app_font_gtk1(top_level);
+#endif
+#endif
+
gtk_widget_set_name(top_level, "main window");
SIGNAL_CONNECT(top_level, "delete_event", main_window_delete_event_cb,
NULL);
diff --git a/gtk/main.h b/gtk/main.h
index c33716ece1..63bfecdcbe 100644
--- a/gtk/main.h
+++ b/gtk/main.h
@@ -1,7 +1,7 @@
/* main.h
* Global defines, etc.
*
- * $Id: main.h,v 1.36 2004/01/19 00:42:09 ulfl Exp $
+ * $Id: main.h,v 1.37 2004/01/20 18:47:24 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -64,6 +64,11 @@ extern GtkStyle *item_style;
void about_ethereal( GtkWidget *, gpointer);
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);
@@ -101,8 +106,9 @@ extern void dfilter_recent_combo_write_all(FILE *rf);
extern void main_widgets_rearrange(void);
-char *boldify(const char *);
+extern void 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);
diff --git a/gtk/menu.c b/gtk/menu.c
index 204d36d54b..ce8f5b68b0 100644
--- a/gtk/menu.c
+++ b/gtk/menu.c
@@ -1,7 +1,7 @@
/* menu.c
* Menu routines
*
- * $Id: menu.c,v 1.139 2004/01/19 23:03:20 guy Exp $
+ * $Id: menu.c,v 1.140 2004/01/20 18:47:24 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -159,6 +159,10 @@ static GtkItemFactoryEntry menu_items[] =
ITEM_FACTORY_STOCK_ENTRY("/Edit/Find Pre_vious", "<control>B",
find_previous_cb, 0, GTK_STOCK_GO_BACK),
ITEM_FACTORY_ENTRY("/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL),
+ ITEM_FACTORY_STOCK_ENTRY("/Edit/_Go To First Packet...", NULL,
+ goto_top_frame_cb, 0, GTK_STOCK_GOTO_TOP),
+ ITEM_FACTORY_STOCK_ENTRY("/Edit/_Go To Last Packet...", NULL,
+ goto_bottom_frame_cb, 0, GTK_STOCK_GOTO_BOTTOM),
ITEM_FACTORY_STOCK_ENTRY("/Edit/_Go To Packet...", "<control>G",
goto_frame_cb, 0, GTK_STOCK_JUMP_TO),
ITEM_FACTORY_ENTRY("/Edit/Go To _Corresponding Packet", NULL, goto_framenum_cb,
@@ -209,6 +213,13 @@ static GtkItemFactoryEntry menu_items[] =
0, NULL, NULL),
#endif
ITEM_FACTORY_ENTRY("/View/<separator>", NULL, NULL, 0, "<Separator>", NULL),
+ ITEM_FACTORY_STOCK_ENTRY("/View/Zoom In", "<control>plus", view_zoom_in_cb,
+ 0, GTK_STOCK_ZOOM_IN),
+ ITEM_FACTORY_STOCK_ENTRY("/View/Zoom Out", "<control>minus", view_zoom_out_cb,
+ 0, GTK_STOCK_ZOOM_OUT),
+ ITEM_FACTORY_STOCK_ENTRY("/View/Normal Size", "<control>equal", view_zoom_100_cb,
+ 0, GTK_STOCK_ZOOM_100),
+ ITEM_FACTORY_ENTRY("/View/<separator>", NULL, NULL, 0, "<Separator>", NULL),
ITEM_FACTORY_ENTRY("/View/Collapse _All", NULL, collapse_all_cb,
0, NULL, NULL),
ITEM_FACTORY_ENTRY("/View/_Expand All", NULL, expand_all_cb,
diff --git a/gtk/recent.c b/gtk/recent.c
index 871aed1ed8..57bc1e6633 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.4 2004/01/19 23:03:20 guy Exp $
+ * $Id: recent.c,v 1.5 2004/01/20 18:47:25 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -141,6 +141,11 @@ write_recent(char **rf_path_return)
fprintf(rf, RECENT_GUI_TIME_FORMAT ": %s\n",
ts_type_text[recent.gui_time_format]);
+ fprintf(rf, "\n# Zoom level.\n");
+ fprintf(rf, "# A decimal number.\n");
+ fprintf(rf, RECENT_GUI_ZOOM_LEVEL ": %d\n",
+ recent.gui_zoom_level);
+
fclose(rf);
/* XXX - catch I/O errors (e.g. "ran out of disk space") and return
@@ -203,8 +208,10 @@ read_set_recent_pair(gchar *key, gchar *value)
recent.statusbar_show = FALSE;
}
} else if (strcmp(key, RECENT_GUI_TIME_FORMAT) == 0) {
- recent.gui_time_format =
- find_index_from_string_array(value, ts_type_text, TS_RELATIVE);
+ recent.gui_time_format =
+ find_index_from_string_array(value, ts_type_text, TS_RELATIVE);
+ } else if (strcmp(key, RECENT_GUI_ZOOM_LEVEL) == 0) {
+ recent.gui_zoom_level = strtol(value, NULL, 0);
}
return PREFS_SET_OK;
@@ -227,6 +234,7 @@ read_recent(char **rf_path_return, int *rf_errno_return)
recent.byte_view_show = TRUE;
recent.statusbar_show = TRUE;
recent.gui_time_format = TS_RELATIVE;
+ recent.gui_zoom_level = 0;
/* Construct the pathname of the user's recent file. */
rf_path = get_persconffile_path(RECENT_FILE_NAME, FALSE);
@@ -252,6 +260,7 @@ read_recent(char **rf_path_return, int *rf_errno_return)
}
menu_recent_read_finished();
+ font_apply();
}
diff --git a/gtk/recent.h b/gtk/recent.h
index 1e603f98bf..3f2527cf6c 100644
--- a/gtk/recent.h
+++ b/gtk/recent.h
@@ -2,7 +2,7 @@
* Definitions for recent "preference" handling routines
* Copyright 2004, Ulf Lamping <ulf.lamping@web.de>
*
- * $Id: recent.h,v 1.2 2004/01/19 03:46:43 ulfl Exp $
+ * $Id: recent.h,v 1.3 2004/01/20 18:47:25 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -38,6 +38,7 @@
#define RECENT_KEY_BYTE_VIEW_SHOW "gui.byte_view_show"
#define RECENT_KEY_STATUSBAR_SHOW "gui.statusbar_show"
#define RECENT_GUI_TIME_FORMAT "gui.time_format"
+#define RECENT_GUI_ZOOM_LEVEL "gui.zoom_level"
typedef struct recent_settings_tag {
gboolean main_toolbar_show;
@@ -49,6 +50,7 @@ typedef struct recent_settings_tag {
gboolean byte_view_show;
gboolean statusbar_show;
gint gui_time_format;
+ gint gui_zoom_level;
} recent_settings_t;
extern recent_settings_t recent;
diff --git a/gtk/toolbar.c b/gtk/toolbar.c
index f0be38d82e..c377bd64bb 100644
--- a/gtk/toolbar.c
+++ b/gtk/toolbar.c
@@ -2,7 +2,7 @@
* The main toolbar
* Copyright 2003, Ulf Lamping <ulf.lamping@web.de>
*
- * $Id: toolbar.c,v 1.22 2004/01/20 02:36:04 guy Exp $
+ * $Id: toolbar.c,v 1.23 2004/01/20 18:47:25 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -78,8 +78,14 @@
#include "../image/toolbar/stock_refresh_24.xpm"
#include "../image/toolbar/stock_print_24.xpm"
#include "../image/toolbar/stock_search_24.xpm"
+#include "../image/toolbar/stock_left_arrow_24.xpm"
#include "../image/toolbar/stock_right_arrow_24.xpm"
#include "../image/toolbar/stock_jump_to_24.xpm"
+#include "../image/toolbar/stock_top_24.xpm"
+#include "../image/toolbar/stock_bottom_24.xpm"
+#include "../image/toolbar/stock_zoom_in_24.xpm"
+#include "../image/toolbar/stock_zoom_out_24.xpm"
+#include "../image/toolbar/stock_zoom_1_24.xpm"
#include "../image/toolbar/stock_colorselector_24.xpm"
#include "../image/toolbar/stock_help_24.xpm"
#endif /* GTK_MAJOR_VERSION */
@@ -104,8 +110,10 @@ static GtkWidget *new_button, *stop_button;
static GtkWidget *capture_filter_button;
#endif /* HAVE_LIBPCAP */
static GtkWidget *open_button, *save_button, *save_as_button, *close_button, *reload_button;
-static GtkWidget *print_button, *find_button, *find_next_button, *go_to_button;
+static GtkWidget *print_button, *find_button, *find_next_button, *find_prev_button;
+static GtkWidget *go_to_button, *go_to_top_button, *go_to_bottom_button;
static GtkWidget *display_filter_button;
+static GtkWidget *zoom_in_button, *zoom_out_button, *zoom_100_button;
static GtkWidget *color_display_button, *prefs_button, *help_button;
#if GTK_MAJOR_VERSION >= 2
@@ -256,7 +264,13 @@ void set_toolbar_for_captured_packets(gboolean have_captured_packets) {
gtk_widget_set_sensitive(print_button, have_captured_packets);
gtk_widget_set_sensitive(find_button, have_captured_packets);
gtk_widget_set_sensitive(find_next_button, have_captured_packets);
+ gtk_widget_set_sensitive(find_prev_button, have_captured_packets);
gtk_widget_set_sensitive(go_to_button, have_captured_packets);
+ gtk_widget_set_sensitive(go_to_top_button, have_captured_packets);
+ gtk_widget_set_sensitive(go_to_bottom_button, have_captured_packets);
+ gtk_widget_set_sensitive(zoom_in_button, have_captured_packets);
+ gtk_widget_set_sensitive(zoom_out_button, have_captured_packets);
+ gtk_widget_set_sensitive(zoom_100_button, have_captured_packets);
/* XXX - I don't see a reason why this should be done (as it is in the
* menus) */
/* gtk_widget_set_sensitive(color_display_button, have_captured_packets);*/
@@ -367,10 +381,26 @@ toolbar_new(void)
toolbar_item(find_button, window, main_tb,
GTK_STOCK_FIND, "Find a packet...", stock_search_24_xpm, find_frame_cb);
+ toolbar_item(find_prev_button, window, main_tb,
+ GTK_STOCK_GO_BACK, "Find the previous matching packet", stock_left_arrow_24_xpm, find_previous_cb);
toolbar_item(find_next_button, window, main_tb,
GTK_STOCK_GO_FORWARD, "Find the next matching packet", stock_right_arrow_24_xpm, find_next_cb);
+ toolbar_append_separator(main_tb);
+
toolbar_item(go_to_button, window, main_tb,
GTK_STOCK_JUMP_TO, "Go to the packet with number...", stock_jump_to_24_xpm, goto_frame_cb);
+ toolbar_item(go_to_top_button, window, main_tb,
+ GTK_STOCK_GOTO_TOP, "Go to the first packet", stock_top_24_xpm, goto_top_frame_cb);
+ toolbar_item(go_to_bottom_button, window, main_tb,
+ GTK_STOCK_GOTO_BOTTOM, "Go to the last packet", stock_bottom_24_xpm, goto_bottom_frame_cb);
+ toolbar_append_separator(main_tb);
+
+ toolbar_item(zoom_in_button, window, main_tb,
+ GTK_STOCK_ZOOM_IN, "Zoom in", stock_zoom_in_24_xpm, view_zoom_in_cb);
+ toolbar_item(zoom_out_button, window, main_tb,
+ GTK_STOCK_ZOOM_OUT, "Zoom out", stock_zoom_out_24_xpm, view_zoom_out_cb);
+ toolbar_item(zoom_100_button, window, main_tb,
+ GTK_STOCK_ZOOM_100, "Zoom 100%", stock_zoom_1_24_xpm, view_zoom_100_cb);
toolbar_append_separator(main_tb);
#ifdef HAVE_LIBPCAP
diff --git a/prefs.c b/prefs.c
index 9a0be6b94f..07fc65430a 100644
--- a/prefs.c
+++ b/prefs.c
@@ -1,7 +1,7 @@
/* prefs.c
* Routines for handling preferences
*
- * $Id: prefs.c,v 1.121 2004/01/19 00:42:08 ulfl Exp $
+ * $Id: prefs.c,v 1.122 2004/01/20 18:47:22 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -923,7 +923,8 @@ read_prefs(int *gpf_errno_return, int *gpf_read_errno_return,
prefs.gui_hex_dump_highlight_style = 1;
prefs.gui_toolbar_main_style = TB_STYLE_ICONS;
#ifdef WIN32
- prefs.gui_font_name = g_strdup("-*-lucida console-medium-r-*-*-*-100-*-*-*-*-*-*");
+ prefs.gui_font_name1 = g_strdup("-*-lucida console-medium-r-*-*-*-100-*-*-*-*-*-*");
+ prefs.gui_font_name2 = g_strdup("Lucida Console 10");
#else
/*
* XXX - for now, we make the initial font name a pattern that matches
@@ -970,7 +971,9 @@ read_prefs(int *gpf_errno_return, int *gpf_read_errno_return,
* protocol-tree, and hex-dump windows involves a lot more than, say,
* just using font sets rather than fonts.
*/
- prefs.gui_font_name = g_strdup("-*-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-iso8859-1");
+ prefs.gui_font_name1 = g_strdup("-*-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-iso8859-1");
+ /* XXX- is this the correct default font name for GTK2 none win32? */
+ prefs.gui_font_name2 = g_strdup("fixed medium 12");
#endif
prefs.gui_marked_fg.pixel = 65535;
prefs.gui_marked_fg.red = 65535;
@@ -1275,7 +1278,8 @@ prefs_set_pref(char *prefarg)
#define PRS_GUI_PTREE_LINE_STYLE "gui.protocol_tree_line_style"
#define PRS_GUI_PTREE_EXPANDER_STYLE "gui.protocol_tree_expander_style"
#define PRS_GUI_HEX_DUMP_HIGHLIGHT_STYLE "gui.hex_dump_highlight_style"
-#define PRS_GUI_FONT_NAME "gui.font_name"
+#define PRS_GUI_FONT_NAME_1 "gui.font_name"
+#define PRS_GUI_FONT_NAME_2 "gui.gtk2.font_name"
#define PRS_GUI_MARKED_FG "gui.marked_frame.fg"
#define PRS_GUI_MARKED_BG "gui.marked_frame.bg"
#define PRS_GUI_FILEOPEN_STYLE "gui.fileopen.style"
@@ -1530,10 +1534,14 @@ set_pref(gchar *pref_name, gchar *value)
prefs.gui_toolbar_main_style =
find_index_from_string_array(value, gui_toolbar_style_text,
TB_STYLE_ICONS);
- } else if (strcmp(pref_name, PRS_GUI_FONT_NAME) == 0) {
- if (prefs.gui_font_name != NULL)
- g_free(prefs.gui_font_name);
- prefs.gui_font_name = g_strdup(value);
+ } else if (strcmp(pref_name, PRS_GUI_FONT_NAME_1) == 0) {
+ if (prefs.gui_font_name1 != NULL)
+ g_free(prefs.gui_font_name1);
+ prefs.gui_font_name1 = g_strdup(value);
+ } else if (strcmp(pref_name, PRS_GUI_FONT_NAME_2) == 0) {
+ if (prefs.gui_font_name2 != NULL)
+ g_free(prefs.gui_font_name2);
+ prefs.gui_font_name2 = g_strdup(value);
} else if (strcmp(pref_name, PRS_GUI_MARKED_FG) == 0) {
cval = strtoul(value, NULL, 16);
prefs.gui_marked_fg.pixel = 0;
@@ -2116,8 +2124,11 @@ write_prefs(char **pf_path_return)
fprintf(pf, PRS_GUI_TOOLBAR_MAIN_STYLE ": %s\n",
gui_toolbar_style_text[prefs.gui_toolbar_main_style]);
- fprintf(pf, "\n# Font name for packet list, protocol tree, and hex dump panes.\n");
- fprintf(pf, PRS_GUI_FONT_NAME ": %s\n", prefs.gui_font_name);
+ fprintf(pf, "\n# Font name for packet list, protocol tree, and hex dump panes (GTK version 1).\n");
+ fprintf(pf, PRS_GUI_FONT_NAME_1 ": %s\n", prefs.gui_font_name1);
+
+ fprintf(pf, "\n# Font name for packet list, protocol tree, and hex dump panes (GTK version 2).\n");
+ fprintf(pf, PRS_GUI_FONT_NAME_2 ": %s\n", prefs.gui_font_name2);
fprintf (pf, "\n# Color preferences for a marked frame.\n");
fprintf (pf, "# Each value is a six digit hexadecimal color value in the form rrggbb.\n");
@@ -2262,7 +2273,8 @@ copy_prefs(e_prefs *dest, e_prefs *src)
dest->gui_fileopen_dir = g_strdup(src->gui_fileopen_dir);
dest->gui_fileopen_remembered_dir = g_strdup(src->gui_fileopen_remembered_dir);
dest->gui_fileopen_style = src->gui_fileopen_style;
- dest->gui_font_name = g_strdup(src->gui_font_name);
+ dest->gui_font_name1 = g_strdup(src->gui_font_name1);
+ dest->gui_font_name2 = g_strdup(src->gui_font_name2);
dest->gui_marked_fg = src->gui_marked_fg;
dest->gui_marked_bg = src->gui_marked_bg;
dest->gui_geometry_save_position = src->gui_geometry_save_position;
@@ -2296,9 +2308,13 @@ free_prefs(e_prefs *pr)
pr->pr_cmd = NULL;
}
free_col_info(pr);
- if (pr->gui_font_name != NULL) {
- g_free(pr->gui_font_name);
- pr->gui_font_name = NULL;
+ if (pr->gui_font_name1 != NULL) {
+ g_free(pr->gui_font_name1);
+ pr->gui_font_name1 = NULL;
+ }
+ if (pr->gui_font_name2 != NULL) {
+ g_free(pr->gui_font_name2);
+ pr->gui_font_name2 = NULL;
}
if (pr->gui_fileopen_dir != NULL) {
g_free(pr->gui_fileopen_dir);
diff --git a/prefs.h b/prefs.h
index 4006906d12..d573949d1d 100644
--- a/prefs.h
+++ b/prefs.h
@@ -1,7 +1,7 @@
/* prefs.h
* Definitions for preference handling routines
*
- * $Id: prefs.h,v 1.54 2004/01/19 00:42:08 ulfl Exp $
+ * $Id: prefs.h,v 1.55 2004/01/20 18:47:22 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -37,6 +37,13 @@
#define MAX_VAL_LEN 1024
+/* only GTK1 *or* GTK2 font_name should be used */
+#if GTK_MAJOR_VERSION < 2
+#define PREFS_GUI_FONT_NAME gui_font_name1
+#else
+#define PREFS_GUI_FONT_NAME gui_font_name2
+#endif
+
/*
* Convert a string listing name resolution types to a bitmask of
* those types.
@@ -75,7 +82,8 @@ typedef struct _e_prefs {
gint gui_ptree_expander_style;
gboolean gui_hex_dump_highlight_style;
gint gui_toolbar_main_style;
- gchar *gui_font_name;
+ gchar *gui_font_name1;
+ gchar *gui_font_name2;
color_t gui_marked_fg;
color_t gui_marked_bg;
gboolean gui_geometry_save_position;