mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Fix auto-selection of presets in GTK.
In commit a7dc17c42 I apparently introduced two bugs in changed_preset(). Firstly, the Custom menu option was being written into the 'found' variable in nearly all cases, because it has a NULL user-data pointer which caused it to take the wrong branch of an if statement due to an erroneous complex condition. Secondly, having written _something_ into 'found', I had set it to inactive rather than active due to forgetting to change a FALSE into a TRUE. Now when I start up Net with my usual nonstandard default parameters (I like the 13x11 wrapping, so I set NET_DEFAULT=13x11w in my environment), the right menu entry comes up ticked.
This commit is contained in:
5
gtk.c
5
gtk.c
@ -1881,8 +1881,7 @@ static void changed_preset(frontend *fe)
|
||||
struct preset_menu_entry *entry =
|
||||
(struct preset_menu_entry *)g_object_get_data(
|
||||
G_OBJECT(gs->data), "user-data");
|
||||
|
||||
if (entry && entry->id != n)
|
||||
if (!entry || entry->id != n)
|
||||
gtk_check_menu_item_set_active(
|
||||
GTK_CHECK_MENU_ITEM(gs->data), FALSE);
|
||||
else
|
||||
@ -1890,7 +1889,7 @@ static void changed_preset(frontend *fe)
|
||||
}
|
||||
if (found)
|
||||
gtk_check_menu_item_set_active(
|
||||
GTK_CHECK_MENU_ITEM(found->data), FALSE);
|
||||
GTK_CHECK_MENU_ITEM(found->data), TRUE);
|
||||
}
|
||||
fe->preset_threaded = FALSE;
|
||||
|
||||
|
Reference in New Issue
Block a user