aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/gui_prefs.c
diff options
context:
space:
mode:
authorLaurent Deniel <laurent.deniel@free.fr>2000-08-23 16:15:13 +0000
committerLaurent Deniel <laurent.deniel@free.fr>2000-08-23 16:15:13 +0000
commit0c73ead218af0febe5d5423655a5a75cbd228583 (patch)
tree2e75094efa9a6a5fe587d8f8d3c66a47a04ab6c1 /gtk/gui_prefs.c
parentfe01ebe5d25779850e6ee9e4bd445d2685d31242 (diff)
Do the same as with colors for the font selection dialog.
Add a boolean that will be set to TRUE if the user hit OK in the font selection dialog. And do nothing about fonts in the apply routine if the font dialog has not been used by the user. This gets rid of a warning which was displayed each time the preferences are "OK, Saved or cancelled" and that whether the user has used the font selection dialog or not (which was very annoying) ... svn path=/trunk/; revision=2348
Diffstat (limited to 'gtk/gui_prefs.c')
-rw-r--r--gtk/gui_prefs.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/gtk/gui_prefs.c b/gtk/gui_prefs.c
index 57b90ec8b9..30c65c4140 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.13 2000/08/23 10:38:43 deniel Exp $
+ * $Id: gui_prefs.c,v 1.14 2000/08/23 16:15:13 deniel Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -103,13 +103,20 @@ static const enum_val expander_style_vals[] = {
any marked packets. */
static gboolean colors_changed;
+/* Set to FALSE initially; set to TRUE if the user ever hits "OK" on
+ the "Font..." dialog, so that we know that they (probably) changed
+ the font, and therefore that the "apply" function needs to take care
+ of that */
+static gboolean font_changed;
+
GtkWidget*
gui_prefs_show(void)
{
GtkWidget *main_tb, *main_vb, *font_bt, *color_bt;
- /* The colors haven't been changed yet. */
+ /* The colors or font haven't been changed yet. */
colors_changed = FALSE;
+ font_changed = FALSE;
/* Main vertical box */
main_vb = gtk_vbox_new(FALSE, 5);
@@ -282,6 +289,7 @@ font_browse_cb(GtkWidget *w, gpointer data)
static void
font_browse_ok_cb(GtkWidget *w, GtkFontSelectionDialog *fs)
{
+ font_changed = TRUE;
if (prefs.gui_font_name != NULL)
g_free(prefs.gui_font_name);
prefs.gui_font_name =
@@ -359,13 +367,15 @@ gui_prefs_fetch(GtkWidget *w)
void
gui_prefs_apply(GtkWidget *w)
{
- GdkFont *font;
-
- font = gdk_font_load(prefs.gui_font_name);
- if (font == NULL) {
- /* XXX - make this a dialog box, and don't let them
- continue! */
- fprintf(stderr, "Can't open font %s\n", prefs.gui_font_name);
+ GdkFont *font = NULL;
+
+ if (font_changed) {
+ font = gdk_font_load(prefs.gui_font_name);
+ if (font == NULL) {
+ /* XXX - make this a dialog box, and don't let them
+ continue! */
+ fprintf(stderr, "Can't open font %s\n", prefs.gui_font_name);
+ }
}
set_scrollbar_placement_all(prefs.gui_scrollbar_on_right);