1 /*
2     Copyright 2007, 2008, 2009, 2010 Geyer Klaus
3 
4     This file is part of Cat'sEyE.
5 
6     Cat'sEyE is free software: you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation, either version 3 of the License, or
9     (at your option) any later version.
10 
11     Cat'sEyE is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with Cat'sEyE.  If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 
21 
22 #ifndef LISTITEMS_H_
23 #define LISTITEMS_H_
24 
25 #define MAXTYPELENGTH 10                //the max length of the types (as they are searched for)
26 #define FIELDSIZE (3 * MAXTYPELENGTH)       //used in the struct below and to fill its variablse
27 
28 
29 struct FileAttributs{
30 	char type[FIELDSIZE];
31 	guint64 size;
32 	int owner;
33 	int group;
34 	char permission[FIELDSIZE];
35 	char accessed[FIELDSIZE];
36 	char changed[FIELDSIZE];
37 	int type_d;	//(4 = directory, 10=link) look man dirent, when it is link here stays how to tread hem (as file, as Directory)
38 	time_t	utaccessed;	//untouched timestamp from files
39 	time_t 	utchanged;
40 	gboolean hiddenfile;	//TRUE if hidden
41 	GString *gstrLinkTarget;    //only set when the item is a link
42 };
43 
44 
45 struct SearchItemStruct{
46 	GString *gstrSearchString;
47 	GtkTreeSelection *selection;
48 };
49 
50 
51 struct RecursiveSizeStructure{
52 	GtkWindow *mainWin;
53 	int *ibreak;	//to stop Operation  0=goOn...........	//free it
54 	GtkWidget *theLabel;
55 	GString *gstrPath;		//................   			//free it
56 	GString **gstrDPItems;  //................				//free it
57 	int ItemCounter;	//Number of items in gstrDPItems	//for cleanup
58 	int ItemStringCounter;	//Number of items stored completle in lists for strings, sizes and types
59 	guint64 *intPSizes;  //Sizes of the items;				//free it
60 	guint64 *intPTypes;	//Type of the items;				//free it
61 	int iReadyForCleanUp; 				//=0 if the calculate-Threads has not received  the ibreak=1 yet
62 	guint64 guint64_size; //holds the size in bytes of the Items;
63 	int SideObjectOrFileshelfItem;	//0=SideObject, 1=Fileshelf	used in getSizeOfSelectedItemsRecursive to decide if we need to build directoryString
64 	int ErrorOccured;   //becomes 1, when there was an error opening a directory. Its 0, when no error occured
65 };
66 
67 
68 struct myLocationStruct {
69     GString *gstrLocation;
70     GError  *error;
71     GFile   *gfileLocation;
72     GFileEnumerator *enumerator;
73     GFileInfo *gfileInfo;
74 };
75 
76 
77 void markedNamesToClipboard(GtkTreeView *TreeView, gboolean bWithPath, int iColumnName, int iColumnPath, char *cpPath);
78 void CopyReMoveItemsViaList(void *data);
79 void CopyReMoveItemsViaList_SizeCalc (void *data);
80 int isValidDirectory(char *cpDirectory);
81 int openLocation (char *cpLocation, struct myLocationStruct *struLocation, gboolean bUseMessageWidgets, gboolean bMakeThreadSave);
82 int getNextItemInLocation(struct myLocationStruct *struLocation, GString *gstrName, gboolean bUseMessageWidgets, gboolean bMakeThreadSave);
83 int closeLocation (struct myLocationStruct *struLocation);
84 int fileAttributesGet(struct FileAttributs *attribs,char *path, char *name);
85 int makeDirectory(char *Directory, int iShowErrorMessage, GString *gstrErrorStorage);
86 void callItemsToSystem(void *data);
87 int getDirectorySize(guint64 *size, GString *gstrDirectory, int *ibreak, gboolean bFollowLinks);
88 void getSizeOfSelectedItemsRecursive_dialog(void *data);
89 void markItemsWithSameType(GtkTreeView *treeview, int ColType);
90 gboolean mySelectAllFunction( GtkTreeView *treeview, gpointer user_data);
91 
92 #endif /*LISTITEMS_H_*/
93 
94 
95