#include "magic.h"
#include "chimara-glk-private.h"
-extern ChimaraGlkPrivate *glk_data;
+extern GPrivate *glk_data_key;
/**
* glk_fileref_iterate:
glk_fileref_iterate(frefid_t fref, glui32 *rockptr)
{
VALID_FILEREF_OR_NULL(fref, return NULL);
-
+
+ ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key);
GList *retnode;
if(fref == NULL)
{
g_return_val_if_fail(filename != NULL, NULL);
+ ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key);
+
frefid_t f = g_new0(struct glk_fileref_struct, 1);
f->magic = MAGIC_FILEREF;
f->rock = rock;
* @fmode must be one of these values:
* <variablelist>
* <varlistentry>
- * <term>#filemode_Read</term>
+ * <term>%filemode_Read</term>
* <listitem><para>The file must already exist; and the player will be asked
* to select from existing files which match the usage.</para></listitem>
* </varlistentry>
* <varlistentry>
- * <term>#filemode_Write</term>
+ * <term>%filemode_Write</term>
* <listitem><para>The file should not exist; if the player selects an
* existing file, he will be warned that it will be replaced.
* </para></listitem>
* </varlistentry>
* <varlistentry>
- * <term>#filemode_ReadWrite</term>
+ * <term>%filemode_ReadWrite</term>
* <listitem><para>The file may or may not exist; if it already exists, the
* player will be warned that it will be modified.</para></listitem>
* </varlistentry>
* <varlistentry>
- * <term>#filemode_WriteAppend</term>
- * <listitem><para>Same behavior as #filemode_ReadWrite.</para></listitem>
+ * <term>%filemode_WriteAppend</term>
+ * <listitem><para>Same behavior as %filemode_ReadWrite.</para></listitem>
* </varlistentry>
* </variablelist>
*
for each usage */
GtkWidget *chooser;
+ ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key);
+
gdk_threads_enter();
switch(fmode)
{
g_return_val_if_fail(name != NULL && strlen(name) > 0, NULL);
+ ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key);
+
/* Do any string-munging here to remove illegal Latin-1 characters from
filename. On ext3, the only illegal characters are '/' and '\0'. */
-
- char *ptr = name;
- while(*ptr++)
- if(*ptr == '/')
- *ptr = '_';
+ g_strdelimit(name, "/", '_');
/* Find out what encoding filenames are in */
const gchar **charsets; /* Do not free */
* original fileref is not modified.)
*
* The use of this function can be tricky. If you change the type of the fileref
- * (#fileusage_Data, #fileusage_SavedGame, etc), the new reference may or may
+ * (%fileusage_Data, %fileusage_SavedGame, etc), the new reference may or may
* not point to the same actual disk file.
*
* <note><para>
* unpredictable. It is safest to change the type of a fileref only if it refers
* to a nonexistent file.
*
- * If you change the mode of a fileref (#fileusage_TextMode,
- * #fileusage_BinaryMode), but leave the rest of the type unchanged, the new
+ * If you change the mode of a fileref (%fileusage_TextMode,
+ * %fileusage_BinaryMode), but leave the rest of the type unchanged, the new
* fileref will definitely point to the same disk file as the old one.
*
* Obviously, if you write to a file in text mode and then read from it in
glk_fileref_destroy(frefid_t fref)
{
VALID_FILEREF(fref, return);
+
+ ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key);
glk_data->fileref_list = g_list_delete_link(glk_data->fileref_list, fref->fileref_list);
if(fref->filename)