| 1 |
/* |
| 2 |
* fm-dir-list-job.h |
| 3 |
* |
| 4 |
* Copyright 2009 PCMan <[email protected]> |
| 5 |
* Copyright 2013 Andriy Grytsenko (LStranger) <[email protected]> |
| 6 |
* |
| 7 |
* This file is a part of the Libfm library. |
| 8 |
* |
| 9 |
* This library is free software; you can redistribute it and/or |
| 10 |
* modify it under the terms of the GNU Lesser General Public |
| 11 |
* License as published by the Free Software Foundation; either |
| 12 |
* version 2.1 of the License, or (at your option) any later version. |
| 13 |
* |
| 14 |
* This library 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 GNU |
| 17 |
* Lesser General Public License for more details. |
| 18 |
* |
| 19 |
* You should have received a copy of the GNU Lesser General Public |
| 20 |
* License along with this library; if not, write to the Free Software |
| 21 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 22 |
*/ |
| 23 |
|
| 24 |
|
| 25 |
#ifndef __FM_DIR_LIST_JOB_H__ |
| 26 |
#define __FM_DIR_LIST_JOB_H__ |
| 27 |
|
| 28 |
#include "fm-job.h" |
| 29 |
#include "fm-path.h" |
| 30 |
#include "fm-file-info.h" |
| 31 |
|
| 32 |
G_BEGIN_DECLS |
| 33 |
|
| 34 |
#define FM_TYPE_DIR_LIST_JOB (fm_dir_list_job_get_type()) |
| 35 |
#define FM_DIR_LIST_JOB(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\ |
| 36 |
FM_TYPE_DIR_LIST_JOB, FmDirListJob)) |
| 37 |
#define FM_DIR_LIST_JOB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\ |
| 38 |
FM_TYPE_DIR_LIST_JOB, FmDirListJobClass)) |
| 39 |
#define FM_IS_DIR_LIST_JOB(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\ |
| 40 |
FM_TYPE_DIR_LIST_JOB)) |
| 41 |
#define FM_IS_DIR_LIST_JOB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\ |
| 42 |
FM_TYPE_DIR_LIST_JOB)) |
| 43 |
|
| 44 |
/** |
| 45 |
* FmDirListJobFlags: |
| 46 |
* @FM_DIR_LIST_JOB_FAST: default listing mode with minimized I/O |
| 47 |
* @FM_DIR_LIST_JOB_DIR_ONLY: skip non-directories in output |
| 48 |
* @FM_DIR_LIST_JOB_DETAILED: listing with test files content types |
| 49 |
*/ |
| 50 |
typedef enum { |
| 51 |
FM_DIR_LIST_JOB_FAST = 0, |
| 52 |
FM_DIR_LIST_JOB_DIR_ONLY = 1 << 0, |
| 53 |
FM_DIR_LIST_JOB_DETAILED = 1 << 1 |
| 54 |
} FmDirListJobFlags; |
| 55 |
|
| 56 |
typedef struct _FmDirListJob FmDirListJob; |
| 57 |
typedef struct _FmDirListJobClass FmDirListJobClass; |
| 58 |
|
| 59 |
/** |
| 60 |
* FmDirListJob |
| 61 |
* @parent: the parent object |
| 62 |
* @dir_path: directory to get listing |
| 63 |
* @flags: flags for the job |
| 64 |
* @dir_fi: file info of the directory |
| 65 |
* @files: the listing of the directory |
| 66 |
*/ |
| 67 |
struct _FmDirListJob |
| 68 |
{ |
| 69 |
/* FIXME: should seal this all */ |
| 70 |
/*< public >*/ |
| 71 |
FmJob parent; |
| 72 |
FmPath* dir_path; |
| 73 |
FmDirListJobFlags flags; |
| 74 |
FmFileInfo* dir_fi; |
| 75 |
FmFileInfoList* files; |
| 76 |
/*< private >*/ |
| 77 |
gboolean emit_files_found; |
| 78 |
guint delay_add_files_handler; |
| 79 |
GSList* files_to_add; |
| 80 |
}; |
| 81 |
|
| 82 |
struct _FmDirListJobClass |
| 83 |
{ |
| 84 |
/*< private >*/ |
| 85 |
FmJobClass parent_class; |
| 86 |
|
| 87 |
/* signals */ |
| 88 |
void (*files_found)(FmDirListJob* job, GSList* files); |
| 89 |
}; |
| 90 |
|
| 91 |
GType fm_dir_list_job_get_type(void); |
| 92 |
#ifndef FM_DISABLE_DEPRECATED |
| 93 |
FmDirListJob* fm_dir_list_job_new(FmPath* path, gboolean dir_only); |
| 94 |
#endif |
| 95 |
FmDirListJob *fm_dir_list_job_new2(FmPath *path, FmDirListJobFlags flags); |
| 96 |
FmDirListJob* fm_dir_list_job_new_for_gfile(GFile* gf); |
| 97 |
FmFileInfoList* fm_dir_list_job_get_files(FmDirListJob* job); |
| 98 |
void fm_dir_list_job_set_incremental(FmDirListJob* job, gboolean set); |
| 99 |
|
| 100 |
/* |
| 101 |
FmPath* fm_dir_list_job_get_dir_path(FmDirListJob* job); |
| 102 |
FmFileInfo* fm_dir_list_job_get_dir_info(FmDirListJob* job); |
| 103 |
void fm_dir_list_job_set_dir_path(FmDirListJob* job, FmPath* path); |
| 104 |
void fm_dir_list_job_set_dir_info(FmDirListJob* job, FmFileInfo* info); |
| 105 |
|
| 106 |
void fm_dir_list_job_set_emit_files_found(FmDirListJob* job, gboolean emit_files_found); |
| 107 |
gboolean fm_dir_list_job_get_emit_files_found(FmDirListJob* job); |
| 108 |
*/ |
| 109 |
void fm_dir_list_job_add_found_file(FmDirListJob* job, FmFileInfo* file); |
| 110 |
|
| 111 |
G_END_DECLS |
| 112 |
|
| 113 |
#endif /* __FM-DIR-LIST-JOB_H__ */ |