1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ 2 3 /* fm-list-model.h - a GtkTreeModel for file lists. 4 5 Copyright (C) 2001, 2002 Anders Carlsson 6 7 The Gnome Library is free software; you can redistribute it and/or 8 modify it under the terms of the GNU Library General Public License as 9 published by the Free Software Foundation; either version 2 of the 10 License, or (at your option) any later version. 11 12 The Gnome Library is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 Library General Public License for more details. 16 17 You should have received a copy of the GNU Library General Public 18 License along with the Gnome Library; see the file COPYING.LIB. If not, 19 write to the Free Software Foundation, Inc., 51 Franklin Street - Suite 500, 20 Boston, MA 02110-1335, USA. 21 22 Authors: Anders Carlsson <andersca@gnu.org> 23 */ 24 25 #include <gtk/gtk.h> 26 #include <gdk/gdk.h> 27 #include <libnemo-private/nemo-file.h> 28 #include <libnemo-private/nemo-directory.h> 29 #include <libnemo-extension/nemo-column.h> 30 31 #ifndef NEMO_LIST_MODEL_H 32 #define NEMO_LIST_MODEL_H 33 34 #define NEMO_TYPE_LIST_MODEL nemo_list_model_get_type() 35 #define NEMO_LIST_MODEL(obj) \ 36 (G_TYPE_CHECK_INSTANCE_CAST ((obj), NEMO_TYPE_LIST_MODEL, NemoListModel)) 37 #define NEMO_LIST_MODEL_CLASS(klass) \ 38 (G_TYPE_CHECK_CLASS_CAST ((klass), NEMO_TYPE_LIST_MODEL, NemoListModelClass)) 39 #define NEMO_IS_LIST_MODEL(obj) \ 40 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NEMO_TYPE_LIST_MODEL)) 41 #define NEMO_IS_LIST_MODEL_CLASS(klass) \ 42 (G_TYPE_CHECK_CLASS_TYPE ((klass), NEMO_TYPE_LIST_MODEL)) 43 #define NEMO_LIST_MODEL_GET_CLASS(obj) \ 44 (G_TYPE_INSTANCE_GET_CLASS ((obj), NEMO_TYPE_LIST_MODEL, NemoListModelClass)) 45 46 enum { 47 NEMO_LIST_MODEL_FILE_COLUMN, 48 NEMO_LIST_MODEL_SUBDIRECTORY_COLUMN, 49 NEMO_LIST_MODEL_SMALLEST_ICON_COLUMN, 50 NEMO_LIST_MODEL_SMALLER_ICON_COLUMN, 51 NEMO_LIST_MODEL_SMALL_ICON_COLUMN, 52 NEMO_LIST_MODEL_STANDARD_ICON_COLUMN, 53 NEMO_LIST_MODEL_LARGE_ICON_COLUMN, 54 NEMO_LIST_MODEL_LARGER_ICON_COLUMN, 55 NEMO_LIST_MODEL_LARGEST_ICON_COLUMN, 56 NEMO_LIST_MODEL_FILE_NAME_IS_EDITABLE_COLUMN, 57 NEMO_LIST_MODEL_TEXT_WEIGHT_COLUMN, 58 NEMO_LIST_MODEL_ICON_SHOWN, 59 NEMO_LIST_MODEL_NUM_COLUMNS 60 }; 61 62 typedef struct NemoListModelDetails NemoListModelDetails; 63 64 typedef struct NemoListModel { 65 GObject parent_instance; 66 NemoListModelDetails *details; 67 } NemoListModel; 68 69 typedef struct { 70 GObjectClass parent_class; 71 72 void (* subdirectory_unloaded)(NemoListModel *model, 73 NemoDirectory *subdirectory); 74 } NemoListModelClass; 75 76 GType nemo_list_model_get_type (void); 77 gboolean nemo_list_model_add_file (NemoListModel *model, 78 NemoFile *file, 79 NemoDirectory *directory); 80 void nemo_list_model_file_changed (NemoListModel *model, 81 NemoFile *file, 82 NemoDirectory *directory); 83 gboolean nemo_list_model_is_empty (NemoListModel *model); 84 guint nemo_list_model_get_length (NemoListModel *model); 85 void nemo_list_model_remove_file (NemoListModel *model, 86 NemoFile *file, 87 NemoDirectory *directory); 88 void nemo_list_model_clear (NemoListModel *model); 89 gboolean nemo_list_model_get_tree_iter_from_file (NemoListModel *model, 90 NemoFile *file, 91 NemoDirectory *directory, 92 GtkTreeIter *iter); 93 GList * nemo_list_model_get_all_iters_for_file (NemoListModel *model, 94 NemoFile *file); 95 gboolean nemo_list_model_get_first_iter_for_file (NemoListModel *model, 96 NemoFile *file, 97 GtkTreeIter *iter); 98 void nemo_list_model_set_should_sort_directories_first (NemoListModel *model, 99 gboolean sort_directories_first); 100 101 int nemo_list_model_get_sort_column_id_from_attribute (NemoListModel *model, 102 GQuark attribute); 103 GQuark nemo_list_model_get_attribute_from_sort_column_id (NemoListModel *model, 104 int sort_column_id); 105 void nemo_list_model_sort_files (NemoListModel *model, 106 GList **files); 107 108 NemoZoomLevel nemo_list_model_get_zoom_level_from_column_id (int column); 109 int nemo_list_model_get_column_id_from_zoom_level (NemoZoomLevel zoom_level); 110 111 NemoFile * nemo_list_model_file_for_path (NemoListModel *model, GtkTreePath *path); 112 gboolean nemo_list_model_load_subdirectory (NemoListModel *model, GtkTreePath *path, NemoDirectory **directory); 113 void nemo_list_model_unload_subdirectory (NemoListModel *model, GtkTreeIter *iter); 114 115 void nemo_list_model_set_drag_view (NemoListModel *model, 116 GtkTreeView *view, 117 int begin_x, 118 int begin_y); 119 120 GtkTargetList * nemo_list_model_get_drag_target_list (void); 121 122 int nemo_list_model_compare_func (NemoListModel *model, 123 NemoFile *file1, 124 NemoFile *file2); 125 126 127 int nemo_list_model_add_column (NemoListModel *model, 128 NemoColumn *column); 129 int nemo_list_model_get_column_number (NemoListModel *model, 130 const char *column_name); 131 132 void nemo_list_model_subdirectory_done_loading (NemoListModel *model, 133 NemoDirectory *directory); 134 135 void nemo_list_model_set_highlight_for_files (NemoListModel *model, 136 GList *files); 137 138 void nemo_list_model_set_temporarily_disable_sort (NemoListModel *model, gboolean disable); 139 gboolean nemo_list_model_get_temporarily_disable_sort (NemoListModel *model); 140 void nemo_list_model_set_expanding (NemoListModel *model, NemoDirectory *directory); 141 #endif /* NEMO_LIST_MODEL_H */ 142