1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/vmu/vmulist.h Wed Jun 24 02:41:12 2009 +0000
1.5 + * $Id: vmulist.h 869 2008-09-08 07:56:33Z nkeynes $
1.7 + * VMU management - maintains a list of all known VMUs
1.9 + * Copyright (c) 2009 Nathan Keynes.
1.11 + * This program is free software; you can redistribute it and/or modify
1.12 + * it under the terms of the GNU General Public License as published by
1.13 + * the Free Software Foundation; either version 2 of the License, or
1.14 + * (at your option) any later version.
1.16 + * This program is distributed in the hope that it will be useful,
1.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.19 + * GNU General Public License for more details.
1.23 +#ifndef lxdream_vmulist_H
1.24 +#define lxdream_vmulist_H 1
1.31 +#include "vmu/vmuvol.h"
1.33 +typedef enum { VMU_ADDED, VMU_MODIFIED, VMU_REMOVED } vmulist_change_type_t;
1.35 +/* Hook for notification of list change events */
1.36 +typedef gboolean (*vmulist_change_hook_t)(vmulist_change_type_t change, int rowidx, void *user_data);
1.37 +DECLARE_HOOK(vmulist_change_hook, vmulist_change_hook_t);
1.39 +vmu_volume_t vmulist_get_vmu(unsigned int index);
1.41 +/** Retrieve a known vmu by name */
1.42 +vmu_volume_t vmulist_get_vmu_by_name(const gchar *name);
1.44 +/** Retrieve a vmu by filename. The filename/vmu will be added to the list if it's
1.45 + * not already in it.
1.47 +vmu_volume_t vmulist_get_vmu_by_filename(const gchar *name);
1.49 +const char *vmulist_get_name(unsigned int index);
1.51 +const char *vmulist_get_filename(unsigned int index);
1.53 +const char *vmulist_get_volume_name( vmu_volume_t vol );
1.57 +/** Mark a VMU as being attached.
1.58 + * @return FALSE if the VMU was already attached, otherwise TRUE
1.60 +gboolean vmulist_attach_vmu( vmu_volume_t vol, const gchar *where );
1.62 +/** Mark a VMU as detached. */
1.63 +void vmulist_detach_vmu( vmu_volume_t vol );
1.66 + * Create a new VMU at the given filename, and add it to the list
1.67 + * @param filename to save the new VMU as
1.68 + * @param create_only if TRUE, the file must not already exist. If FALSE,
1.69 + * the create will overwrite any existing file at that filename.
1.70 + * @return index of the VMU in the list, or -1 if the call failed.
1.72 +int vmulist_create_vmu(const gchar *filename, gboolean create_only);
1.74 +/** Add a VMU volume to the list. Returns the index of the added volume */
1.75 +int vmulist_add_vmu(const gchar *filename, vmu_volume_t vol);
1.77 +int vmulist_get_index_by_filename( const gchar *name );
1.79 +/** Remove a VMU volume from the list */
1.80 +void vmulist_remove_vmu(vmu_volume_t vol);
1.82 +/** Initialize the list */
1.83 +void vmulist_init(void);
1.85 +/** Save all VMUs in the list (actually only ones which have been written to
1.88 +void vmulist_save_all(void);
1.90 +void vmulist_shutdown(void);
1.92 +unsigned int vmulist_get_size(void);
1.98 +#endif /* !lxdream_vmulist_H */