Search
lxdream.org :: lxdream/src/gdlist.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/gdlist.h
changeset 1109:700c5ab26a63
prev736:a02d1475ccfd
author nkeynes
date Wed Jul 04 12:01:31 2012 +1000 (11 years ago)
permissions -rw-r--r--
last change Remove use of extended regexes to make porting easier
view annotate diff log raw
     1 /**
     2  * $Id$
     3  *
     4  * GD-Rom list manager - maintains the list of recently accessed images and
     5  * available devices for the UI + config. 
     6  *
     7  * Copyright (c) 2005 Nathan Keynes.
     8  *
     9  * This program is free software; you can redistribute it and/or modify
    10  * it under the terms of the GNU General Public License as published by
    11  * the Free Software Foundation; either version 2 of the License, or
    12  * (at your option) any later version.
    13  *
    14  * This program is distributed in the hope that it will be useful,
    15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    17  * GNU General Public License for more details.
    18  */
    20 #ifndef lxdream_gdlist_H
    21 #define lxdream_gdlist_H 1
    23 #include <stdio.h>
    24 #include "hook.h"
    26 #ifdef __cplusplus
    27 extern "C" {
    28 #endif
    30 typedef gboolean (*gdrom_list_change_hook_t)(gboolean list_changed, int selection, void *user_data);
    31 DECLARE_HOOK(gdrom_list_change_hook, gdrom_list_change_hook_t);
    34 /**
    35  * Initialize the gdrom list (registers with the gdrom driver, creates the 
    36  * initial lists, etc). Must be called exactly once before using the lists.
    37  */
    38 void gdrom_list_init(void);
    40 /**
    41  * Return the index of the currently selected GD-Rom item. If there is no disc
    42  * currently mounted, returns 0. 
    43  */ 
    44 int gdrom_list_get_selection(void);
    46 /**
    47  * Return the number of items in the list, including separators.
    48  */
    49 int gdrom_list_size(void);
    51 /**
    52  * Return the display name of the item at the specified index. If the
    53  * item is a separator, returns the empty string. If the index is out
    54  * of bounds, returns NULL. 
    55  * The list will currently follow the following structure:
    56  *   "Empty" (localised)
    57  *   Any CD/DVD drives attached to the system
    58  *   "" (empty string) - separator item
    59  *   An LRU list of disc image files (note without directory components).
    60  */
    61 const gchar *gdrom_list_get_display_name(int index);
    63 const gchar *gdrom_list_get_filename(int index);
    65 /**
    66  * Change the current gdrom selection to the selected index. This will mount the
    67  * appropriate drive/image where necessary.
    68  * @param err Updated if there was an error loading the selected gdrom
    69  * @return TRUE if the selection was updated, FALSE if the position was invalid. 
    70  */
    71 gboolean gdrom_list_set_selection(int posn, ERROR *err);
    73 #ifdef __cplusplus
    74 }
    75 #endif
    77 #endif /* lxdream_gdlist_H */
.