Search
lxdream.org :: lxdream/src/vmu/vmulist.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/vmu/vmulist.h
changeset 1034:7044e01148f0
next1035:e3093fd7d1da
author nkeynes
date Wed Jun 24 02:41:12 2009 +0000 (14 years ago)
permissions -rw-r--r--
last change Add initial VMU support
file annotate diff log raw
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.3 @@ -0,0 +1,95 @@
1.4 +/**
1.5 + * $Id: vmulist.h 869 2008-09-08 07:56:33Z nkeynes $
1.6 + *
1.7 + * VMU management - maintains a list of all known VMUs
1.8 + *
1.9 + * Copyright (c) 2009 Nathan Keynes.
1.10 + *
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.15 + *
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.20 + */
1.21 +
1.22 +
1.23 +#ifndef lxdream_vmulist_H
1.24 +#define lxdream_vmulist_H 1
1.25 +
1.26 +#ifdef __cplusplus
1.27 +extern "C" {
1.28 +#endif
1.29 +
1.30 +#include "hook.h"
1.31 +#include "vmu/vmuvol.h"
1.32 +
1.33 +typedef enum { VMU_ADDED, VMU_MODIFIED, VMU_REMOVED } vmulist_change_type_t;
1.34 +
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.38 +
1.39 +vmu_volume_t vmulist_get_vmu(unsigned int index);
1.40 +
1.41 +/** Retrieve a known vmu by name */
1.42 +vmu_volume_t vmulist_get_vmu_by_name(const gchar *name);
1.43 +
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.46 + */
1.47 +vmu_volume_t vmulist_get_vmu_by_filename(const gchar *name);
1.48 +
1.49 +const char *vmulist_get_name(unsigned int index);
1.50 +
1.51 +const char *vmulist_get_filename(unsigned int index);
1.52 +
1.53 +const char *vmulist_get_volume_name( vmu_volume_t vol );
1.54 +
1.55 +
1.56 +
1.57 +/** Mark a VMU as being attached.
1.58 + * @return FALSE if the VMU was already attached, otherwise TRUE
1.59 + */
1.60 +gboolean vmulist_attach_vmu( vmu_volume_t vol, const gchar *where );
1.61 +
1.62 +/** Mark a VMU as detached. */
1.63 +void vmulist_detach_vmu( vmu_volume_t vol );
1.64 +
1.65 +/**
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.71 + **/
1.72 +int vmulist_create_vmu(const gchar *filename, gboolean create_only);
1.73 +
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.76 +
1.77 +int vmulist_get_index_by_filename( const gchar *name );
1.78 +
1.79 +/** Remove a VMU volume from the list */
1.80 +void vmulist_remove_vmu(vmu_volume_t vol);
1.81 +
1.82 +/** Initialize the list */
1.83 +void vmulist_init(void);
1.84 +
1.85 +/** Save all VMUs in the list (actually only ones which have been written to
1.86 + * some point)
1.87 + **/
1.88 +void vmulist_save_all(void);
1.89 +
1.90 +void vmulist_shutdown(void);
1.91 +
1.92 +unsigned int vmulist_get_size(void);
1.93 +
1.94 +#ifdef __cplusplus
1.95 +}
1.96 +#endif
1.97 +
1.98 +#endif /* !lxdream_vmulist_H */
.