forked from osmocom/wireshark
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
This commit is contained in:
parent
fe01ebe5d2
commit
0c73ead218
|
@ -1,7 +1,7 @@
|
||||||
/* gui_prefs.c
|
/* gui_prefs.c
|
||||||
* Dialog box for GUI preferences
|
* 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
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -103,13 +103,20 @@ static const enum_val expander_style_vals[] = {
|
||||||
any marked packets. */
|
any marked packets. */
|
||||||
static gboolean colors_changed;
|
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*
|
GtkWidget*
|
||||||
gui_prefs_show(void)
|
gui_prefs_show(void)
|
||||||
{
|
{
|
||||||
GtkWidget *main_tb, *main_vb, *font_bt, *color_bt;
|
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;
|
colors_changed = FALSE;
|
||||||
|
font_changed = FALSE;
|
||||||
|
|
||||||
/* Main vertical box */
|
/* Main vertical box */
|
||||||
main_vb = gtk_vbox_new(FALSE, 5);
|
main_vb = gtk_vbox_new(FALSE, 5);
|
||||||
|
@ -282,6 +289,7 @@ font_browse_cb(GtkWidget *w, gpointer data)
|
||||||
static void
|
static void
|
||||||
font_browse_ok_cb(GtkWidget *w, GtkFontSelectionDialog *fs)
|
font_browse_ok_cb(GtkWidget *w, GtkFontSelectionDialog *fs)
|
||||||
{
|
{
|
||||||
|
font_changed = TRUE;
|
||||||
if (prefs.gui_font_name != NULL)
|
if (prefs.gui_font_name != NULL)
|
||||||
g_free(prefs.gui_font_name);
|
g_free(prefs.gui_font_name);
|
||||||
prefs.gui_font_name =
|
prefs.gui_font_name =
|
||||||
|
@ -359,13 +367,15 @@ gui_prefs_fetch(GtkWidget *w)
|
||||||
void
|
void
|
||||||
gui_prefs_apply(GtkWidget *w)
|
gui_prefs_apply(GtkWidget *w)
|
||||||
{
|
{
|
||||||
GdkFont *font;
|
GdkFont *font = NULL;
|
||||||
|
|
||||||
font = gdk_font_load(prefs.gui_font_name);
|
if (font_changed) {
|
||||||
if (font == NULL) {
|
font = gdk_font_load(prefs.gui_font_name);
|
||||||
/* XXX - make this a dialog box, and don't let them
|
if (font == NULL) {
|
||||||
continue! */
|
/* XXX - make this a dialog box, and don't let them
|
||||||
fprintf(stderr, "Can't open font %s\n", prefs.gui_font_name);
|
continue! */
|
||||||
|
fprintf(stderr, "Can't open font %s\n", prefs.gui_font_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set_scrollbar_placement_all(prefs.gui_scrollbar_on_right);
|
set_scrollbar_placement_all(prefs.gui_scrollbar_on_right);
|
||||||
|
|
Loading…
Reference in New Issue