]> git.street.me.uk Git - andy/viking.git/blobdiff - src/util.c
Enable i18n on 'Routing' preferences tab name.
[andy/viking.git] / src / util.c
index 7814fc29f28c29a17ea5388dd3850eb207f24480..86ddae5bd4112ba0fedb9c8d564978ca4a67fa1d 100644 (file)
@@ -1,6 +1,7 @@
 /*
  *    Viking - GPS data editor
  *    Copyright (C) 2007, Guilhem Bonnefille <guilhem.bonnefille@gmail.com>
 /*
  *    Viking - GPS data editor
  *    Copyright (C) 2007, Guilhem Bonnefille <guilhem.bonnefille@gmail.com>
+ *    Copyright (C) 2014, Rob Norris <rw_norris@hotmail.com>
  *    Based on:
  *    Copyright (C) 2003-2007, Leandro A. F. Pereira <leandro@linuxmag.com.br>
  *
  *    Based on:
  *    Copyright (C) 2003-2007, Leandro A. F. Pereira <leandro@linuxmag.com.br>
  *
@@ -169,3 +170,33 @@ gboolean split_string_from_file_on_equals ( const gchar *buf, gchar **key, gchar
 
   return TRUE;
 }
 
   return TRUE;
 }
+
+static GSList* deletion_list = NULL;
+
+/**
+ * util_add_to_deletion_list:
+ *
+ * Add a name of a file into the list that is to be deleted on program exit
+ * Normally this is for files that get used asynchronously,
+ *  so we don't know when it's time to delete them - other than at this program's end
+ */
+void util_add_to_deletion_list ( const gchar* filename )
+{
+       deletion_list = g_slist_append ( deletion_list, g_strdup (filename) );
+}
+
+/**
+ * util_remove_all_in_deletion_list:
+ *
+ * Delete all the files in the deletion list
+ * This should only be called on program exit
+ */
+void util_remove_all_in_deletion_list ( void )
+{
+       while ( deletion_list )
+       {
+               g_remove ( deletion_list->data );
+               g_free ( deletion_list->data );
+               deletion_list = g_slist_delete_link ( deletion_list, deletion_list );
+       }
+}