00001 #ifndef __FILEMODEL_H__
00002 #define __FILEMODEL_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include <gtk/gtk.h>
00038
00039 #include <libermetadb/ermetadb.h>
00040
00041 G_BEGIN_DECLS
00042
00043
00044 #define SPECIAL_ITEM_NAME "special"
00045 #define SPECIAL_BOOKS "books"
00046 #define SPECIAL_IMAGES "images"
00047 #define SPECIAL_NEWS "news"
00048 #define SPECIAL_HELP "help"
00049 #define SPECIAL_PERSONAL "personal"
00050 #define SPECIAL_DIR "dir"
00051 #define SPECIAL_SHORTCUTS "shortcuts"
00052 #define SPECIAL_NOTES "notes"
00053 #define SPECIAL_SETTINGS "settings"
00054 #define SPECIAL_SEARCH "search"
00055 #define SPECIAL_RECENT "recent"
00056 #define SPECIAL_UPDIR ".."
00057
00058
00059 #define DIR_DESKTOP_TEMPLATE SYSCONFDIR "/desktop"
00060 #define DIR_DESKTOP_INTERNAL "/var/tmp/" // NOT really used
00061 #define DIR_STORAGE_MNT "/media" // mountpoint for removable storage devices
00062 #define DIR_LIBRARY DIR_STORAGE_MNT "/mmcblk0p1" // mountpoint for internal SD card
00063
00064
00065 typedef enum
00066 {
00067 MODCOL_FILENAME = 0,
00068 MODCOL_TITLE,
00069 MODCOL_FILETYPE,
00070 MODCOL_FILETYPE_DISPLAY,
00071 MODCOL_DIRECTORY_PATH,
00072 MODCOL_IS_DIRECTORY,
00073 MODCOL_FILESIZE,
00074 MODCOL_FILEDATE,
00075 MODCOL_SUBTITLE,
00076 MODCOL_THUMBNAIL,
00077 MODCOL_TOGGLED,
00078 N_FILEMODEL_COLUMNS
00079 } filemodel_column_t;
00080
00081 #define FILEMODEL_COLUMN_TYPES \
00082 G_TYPE_STRING, \
00083 G_TYPE_STRING, \
00084 G_TYPE_STRING, \
00085 G_TYPE_STRING, \
00086 G_TYPE_STRING, \
00087 G_TYPE_BOOLEAN, \
00088 G_TYPE_STRING, \
00089 G_TYPE_STRING, \
00090 G_TYPE_STRING, \
00091 GDK_TYPE_PIXBUF, \
00092 G_TYPE_INT, \
00093 NULL
00094
00095
00096 typedef enum
00097 {
00098 MODTHUMB_MINI = 0,
00099 MODTHUMB_SMALL,
00100 MODTHUMB_MEDIUM,
00101 MODTHUMB_LARGE,
00102 N_FILEMODEL_THUMB_SIZES
00103 } filemodel_thumbsize_t;
00104
00105
00106 typedef struct
00107 {
00108 GString *filename;
00109 GString *filename_display;
00110 GString *filetype;
00111 GString *directory_path;
00112 gboolean is_directory;
00113 } filelist_entry_t;
00114
00115 typedef enum
00116 {
00117 BROWSE_MODE = 0,
00118 DELETE_MODE,
00119 } ctb_viewmodes_t;
00120
00121
00122 typedef enum
00123 {
00124 CTB_SORT_BY_NAME = 0,
00125 CTB_SORT_BY_TYPE,
00126 CTB_SORT_BY_SIZE,
00127 CTB_SORT_BY_DATE_ADDED,
00128 CTB_SORT_BY_DATE_READ,
00129 CTB_SORT_BY_AUTHOR,
00130 N_CTB_SORT_ORDER
00131 } ctb_sort_order_t;
00132
00133 typedef enum
00134 {
00135 DESKTOP_VIEW = 0,
00136 SETTINGS_VIEW,
00137 BOOKS_VIEW,
00138 NEWS_VIEW,
00139 IMAGES_VIEW,
00140 PERSONAL_VIEW,
00141 DIR_VIEW,
00142 SHORTCUT_VIEW,
00143 NOTES_VIEW,
00144 HELP_VIEW,
00145 RECENT_VIEW,
00146 SEARCH_VIEW,
00147 } ViewMode;
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160 void filemodel_init();
00161
00162 void filemodel_quit();
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176 GtkTreeModel* get_filemodel();
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191 erMetadb filemodel_get_database();
00192
00193
00194
00195
00196 gboolean filemodel_set_sortorder(ctb_sort_order_t sort_order,
00197 const gchar* cursor_item,
00198 gboolean updateScreen);
00199
00200
00201 void filemodel_set_viewmode2(ViewMode newmode);
00202
00203 void filemodel_set_search_filter(const gchar* search_string);
00204
00205 const gchar* filemodel_get_title();
00206
00207 const gchar* filemodel_get_subtitle();
00208
00209 const gchar* filemodel_get_menu_content();
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223 gboolean filemodel_set_viewsize(const int n_items, gboolean updateScreen);
00224
00225
00226 void filemodel_set_viewmode(ctb_viewmodes_t newmode, gboolean updateScreen);
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242 void filemodel_set_thumbsize(const filemodel_thumbsize_t thumb_size, gboolean reload);
00243
00244
00245
00246 gboolean filemodel_has_prev_page();
00247
00248 gboolean filemodel_has_next_page();
00249
00250 void filemodel_page_previous();
00251
00252 void filemodel_page_next();
00253
00254 void filemodel_update_pagecounter();
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265 int filemodel_scroll_to_letter(gchar letter, gboolean jump_to_dir, gboolean* same_page);
00266
00267 void filemodel_scroll_to_filename(const gchar *filename);
00268
00269
00270
00271 int filemodel_get_display_index(const gchar *filename);
00272
00273
00274
00275
00276 int filemodel_chdir_desktop();
00277
00278
00279 int filemodel_chdir_down(const gchar *dir, const gchar *last_item);
00280
00281
00282 gchar *filemodel_chdir_up();
00283
00284
00285
00286 gboolean filemodel_resync(gboolean force_reload);
00287
00288 gboolean filemodel_current_is_desktop();
00289
00290 const gchar* filemodel_get_current_dir();
00291
00292
00293 int filemodel_get_dir_depth();
00294
00295
00296
00297 int filemodel_get_first_alpha_index();
00298
00299
00300
00301
00302 #define ALPHA_HAS_DIR 0x01
00303 #define ALPHA_HAS_FILE 0x02
00304 #define FILEMODEL_NUM_ALPHA 27
00305 const gchar* filemodel_get_alpha_list();
00306
00307 gboolean filemodel_show_alphabar();
00308
00309 gboolean filemodel_has_searchbutton();
00310
00311
00312
00313 void filemodel_toggle_entry(int index, int state, GtkTreeIter *iter);
00314
00315
00316 void filemodel_delete_toggled();
00317
00318
00319 int filemodel_num_toggled();
00320
00321
00322 void filemodel_set_delete_text(const gchar* text);
00323
00324 #if MACHINE_IS_DR800S || MACHINE_IS_DR800SG || MACHINE_IS_DR800SW
00325 void filemodel_update_last_read(const filelist_entry_t *fileinfo);
00326 #endif
00327
00328
00329 filelist_entry_t* iter_to_entry(GtkTreeModel *model, GtkTreeIter *iter);
00330
00331 filelist_entry_t* filelist_entry_new();
00332
00333 void filelist_entry_free(filelist_entry_t *thiz);
00334
00335 filelist_entry_t* filelist_entry_copy(const filelist_entry_t *src);
00336
00337 gboolean filemodel_window_is_on_top();
00338
00339 void filemodel_set_window_is_on_top(gboolean is_on_top );
00340
00341 #if (TIMING_ON)
00342 void start_duration_timer();
00343 void stop_duration_timer();
00344 #endif
00345
00346 G_END_DECLS
00347
00348 #endif
00349