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 Thu Jun 10 22:13:16 2010 +1000 (11 years ago)
permissions -rw-r--r--
last change Integrate executable wrapping into the user interface
- command-line now loads wrapped by default, -e <bin> to run binary
- add support for .bin executables
- Add useful (internal) error codes
file annotate diff log raw
nkeynes@691
     1
/**
nkeynes@691
     2
 * $Id$
nkeynes@691
     3
 *
nkeynes@691
     4
 * GD-Rom list manager - maintains the list of recently accessed images and
nkeynes@691
     5
 * available devices for the UI + config. 
nkeynes@691
     6
 *
nkeynes@691
     7
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@691
     8
 *
nkeynes@691
     9
 * This program is free software; you can redistribute it and/or modify
nkeynes@691
    10
 * it under the terms of the GNU General Public License as published by
nkeynes@691
    11
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@691
    12
 * (at your option) any later version.
nkeynes@691
    13
 *
nkeynes@691
    14
 * This program is distributed in the hope that it will be useful,
nkeynes@691
    15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@691
    16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@691
    17
 * GNU General Public License for more details.
nkeynes@691
    18
 */
nkeynes@691
    19
nkeynes@691
    20
#ifndef lxdream_gdlist_H
nkeynes@691
    21
#define lxdream_gdlist_H 1
nkeynes@691
    22
nkeynes@1109
    23
#include <stdio.h>
nkeynes@691
    24
#include "hook.h"
nkeynes@691
    25
nkeynes@736
    26
#ifdef __cplusplus
nkeynes@736
    27
extern "C" {
nkeynes@736
    28
#endif
nkeynes@736
    29
nkeynes@691
    30
typedef gboolean (*gdrom_list_change_hook_t)(gboolean list_changed, int selection, void *user_data);
nkeynes@691
    31
DECLARE_HOOK(gdrom_list_change_hook, gdrom_list_change_hook_t);
nkeynes@691
    32
nkeynes@691
    33
nkeynes@691
    34
/**
nkeynes@691
    35
 * Initialize the gdrom list (registers with the gdrom driver, creates the 
nkeynes@691
    36
 * initial lists, etc). Must be called exactly once before using the lists.
nkeynes@691
    37
 */
nkeynes@691
    38
void gdrom_list_init(void);
nkeynes@691
    39
nkeynes@691
    40
/**
nkeynes@691
    41
 * Return the index of the currently selected GD-Rom item. If there is no disc
nkeynes@691
    42
 * currently mounted, returns 0. 
nkeynes@691
    43
 */ 
nkeynes@691
    44
int gdrom_list_get_selection(void);
nkeynes@691
    45
nkeynes@691
    46
/**
nkeynes@691
    47
 * Return the number of items in the list, including separators.
nkeynes@691
    48
 */
nkeynes@691
    49
int gdrom_list_size(void);
nkeynes@691
    50
nkeynes@691
    51
/**
nkeynes@691
    52
 * Return the display name of the item at the specified index. If the
nkeynes@691
    53
 * item is a separator, returns the empty string. If the index is out
nkeynes@691
    54
 * of bounds, returns NULL. 
nkeynes@691
    55
 * The list will currently follow the following structure:
nkeynes@691
    56
 *   "Empty" (localised)
nkeynes@691
    57
 *   Any CD/DVD drives attached to the system
nkeynes@691
    58
 *   "" (empty string) - separator item
nkeynes@691
    59
 *   An LRU list of disc image files (note without directory components).
nkeynes@691
    60
 */
nkeynes@691
    61
const gchar *gdrom_list_get_display_name(int index);
nkeynes@691
    62
nkeynes@696
    63
const gchar *gdrom_list_get_filename(int index);
nkeynes@696
    64
nkeynes@691
    65
/**
nkeynes@691
    66
 * Change the current gdrom selection to the selected index. This will mount the
nkeynes@691
    67
 * appropriate drive/image where necessary.
nkeynes@1109
    68
 * @param err Updated if there was an error loading the selected gdrom
nkeynes@691
    69
 * @return TRUE if the selection was updated, FALSE if the position was invalid. 
nkeynes@691
    70
 */
nkeynes@1109
    71
gboolean gdrom_list_set_selection(int posn, ERROR *err);
nkeynes@691
    72
nkeynes@736
    73
#ifdef __cplusplus
nkeynes@736
    74
}
nkeynes@736
    75
#endif
nkeynes@736
    76
nkeynes@691
    77
#endif /* lxdream_gdlist_H */
.