Search
lxdream.org :: lxdream/src/vmu/vmulist.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/vmu/vmulist.h
changeset 1035:e3093fd7d1da
prev1034:7044e01148f0
author nkeynes
date Tue Jul 21 20:21:52 2009 +1000 (14 years ago)
permissions -rw-r--r--
last change Fix assorted -Wall warnings
view annotate diff log raw
     1 /**
     2  * $Id$
     3  *
     4  * VMU management - maintains a list of all known VMUs
     5  *
     6  * Copyright (c) 2009 Nathan Keynes.
     7  *
     8  * This program is free software; you can redistribute it and/or modify
     9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  */
    20 #ifndef lxdream_vmulist_H
    21 #define lxdream_vmulist_H 1
    23 #ifdef __cplusplus
    24 extern "C" {
    25 #endif
    27 #include "hook.h"
    28 #include "vmu/vmuvol.h"
    30 typedef enum { VMU_ADDED, VMU_MODIFIED, VMU_REMOVED } vmulist_change_type_t;
    32 /* Hook for notification of list change events */
    33 typedef gboolean (*vmulist_change_hook_t)(vmulist_change_type_t change, int rowidx, void *user_data);
    34 DECLARE_HOOK(vmulist_change_hook, vmulist_change_hook_t);
    36 vmu_volume_t vmulist_get_vmu(unsigned int index);
    38 /** Retrieve a known vmu by name */
    39 vmu_volume_t vmulist_get_vmu_by_name(const gchar *name);
    41 /** Retrieve a vmu by filename. The filename/vmu will be added to the list if it's
    42  * not already in it.
    43  */
    44 vmu_volume_t vmulist_get_vmu_by_filename(const gchar *name);
    46 const char *vmulist_get_name(unsigned int index);
    48 const char *vmulist_get_filename(unsigned int index);
    50 const char *vmulist_get_volume_name( vmu_volume_t vol );
    54 /** Mark a VMU as being attached.
    55  * @return FALSE if the VMU was already attached, otherwise TRUE
    56  */
    57 gboolean vmulist_attach_vmu( vmu_volume_t vol, const gchar *where );
    59 /** Mark a VMU as detached. */
    60 void vmulist_detach_vmu( vmu_volume_t vol );
    62 /** 
    63  * Create a new VMU at the given filename, and add it to the list 
    64  * @param filename to save the new VMU as
    65  * @param create_only if TRUE, the file must not already exist. If FALSE,
    66  *   the create will overwrite any existing file at that filename.
    67  * @return index of the VMU in the list, or -1 if the call failed.
    68  **/
    69 int vmulist_create_vmu(const gchar *filename, gboolean create_only);
    71 /** Add a VMU volume to the list. Returns the index of the added volume */
    72 int vmulist_add_vmu(const gchar *filename, vmu_volume_t vol);
    74 int vmulist_get_index_by_filename( const gchar *name );
    76 /** Remove a VMU volume from the list */
    77 void vmulist_remove_vmu(vmu_volume_t vol);
    79 /** Initialize the list */
    80 void vmulist_init(void);
    82 /** Save all VMUs in the list (actually only ones which have been written to
    83  * some point)
    84  **/
    85 void vmulist_save_all(void);
    87 void vmulist_shutdown(void);
    89 unsigned int vmulist_get_size(void);
    91 #ifdef __cplusplus
    92 }
    93 #endif
    95 #endif /* !lxdream_vmulist_H */
.