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 #ifndef HELPERS_H_ 21 #define HELPERS_H_ 22 23 struct ListWidgetCommunicationStruct; 24 struct CopyReMoveList; 25 26 27 28 void textbuffer_commandHistory_addText (char *text, char *tag); 29 gboolean myWrapOf__g_spawn_command_line_sync (const gchar *command_line, gchar **standard_output, gchar **standard_error, gint *exit_status, GError **error, gboolean ThreadSave); 30 void CancelButtonFunctionForIBreak(GtkButton *button, gpointer data); //used as callback function 31 32 void CursorToWait(GtkWidget *widget); 33 void CursorToNormal(GtkWidget *widget); 34 35 //Information aquiring 36 double GetTimeMine(GTimeVal time); 37 int getHomeDirectory(GString *HomeDir); 38 int completePath(char *cpText, char **ToComplete); 39 gboolean checkStringIsPath(char *cpPath); 40 int getRandomIntNumber(int iMin, int iMax); 41 GFile *getCorrectGFileTypeFromLocation(char *location, int *iType); 42 int manipulateCounter (int *iCounter, gboolean bCountUp, const char *ccpSource); 43 int checkItemIsLink (const char *ccpItem); 44 45 //String manipulation 46 int CheckForEndingInEndingList (const char *ccpEndings, const char *ccpSingleEnding); 47 void BytesToHumanity(guint64 bytes, double *newBytes, int *iEPow, GString *gstrEPow); 48 void BytesToHumanityString (guint64 bytes, GString *gstrBytesString, int decimalplaces); 49 char *mine_strnstr(char *big, char *little, int size); 50 int myTokenFunction (GString *gstrCompleteString, int TokenNumber, char *devider, GString *gstrToken); 51 void cutSpacesFromGString(GString *ToCut); 52 void cutLeadingSpacesFromGString(GString *ToCut); 53 void checkPathForLastChar(GString *Path); 54 void checkPathForLastCharOtherwise(GString *Path); 55 void cutTapsFromGString(GString *ToCut); 56 void cutCharFromGString(GString *ToCut, char thechar, int OnlyLeadingOnes); 57 void getLastStringInPath(GString *Path); 58 int GetPathFromPathWithName(GString *PathAndName, int iDoIt); 59 void cutStringToNChars(GString *Text,int Size); 60 void cleverCutStringToNChars(GString *ToCut, char *textToAddBetween, int Size); 61 int exchangeNameWithValue(GString *gstrText, GString *gstrEnemy, GString *NewString); 62 int ExchangeSpecialCharachterForXML (GString *gstrText); 63 64 //Data Storage manipulation 65 int AddNewGStringToDPointer(GString ***gstrTPString,int OldCount, GString *NewOne); 66 int AddNewGUInt64ToPointerArray(guint64 **intArray, int OldCount, guint64 NewOne); 67 void *GListFreeGStrings (gpointer data, gpointer user_data); //use it with: g_list_foreach(listDirs, (GFunc) GListFreeGStrings, NULL); g_list_free(listDirs); 68 69 //Widgets 70 GtkWidget *CreateMyWindow(char *title, GtkWindow *parent, int x, int y, gboolean bResizeable, gboolean bDestroyWithParent, gboolean bKeepOnTop, int *iDeleteNotification, gboolean bParentInteraction, gboolean bDeletable); 71 GtkWidget *CreateMyDialog(char *title, GtkWindow *parent, int iButtons, char *respText1, int resp1, char *respText2, int resp2, char *respText3, int resp3, gboolean bResizeable); 72 void MyMessageWidget(GtkWindow *parrent, char *title, char* message); 73 int MyEasyInputWidget (GtkWindow *parrent, char *title, char *text, GString *gstrUserText); 74 int MyEasyInputWidget_Two (GtkWindow *parrent, char *title, char *text1, GString *gstrUserText1, char *text2, GString *gstrUserText2, char *button0, char *button1, char *button2, char *button3); 75 void MyEasyInputWidget_EntryBoxActivate(GtkEntry *entry, gpointer data); 76 void AddMyIconsToWindow(GtkWindow *Window); 77 int scrollListStoreToName(GtkTreeView *listView, GtkListStore *listStore, GString *NameToScroll, int ColumnToSearch); 78 //int AddESCButtonToAMainWidget (GtkWidget *TheWidget); 79 //gboolean AddESCButtonToAMainWidget_SignalHandler(GtkWidget *widget, GdkEventKey *event, GtkWidget *TheWidget); 80 81 82 gboolean ListWidget_MousePressEventCatcher (GtkWidget *widget, GdkEventButton *event, struct ListWidgetCommunicationStruct *commStru); 83 84 struct AllInformationAllUseStruct{ //a structure which holds plenty of information for much functions 85 //created when working on fileshelf to make use of functions which are ment for the normal Objects 86 //and, with the help of this structure, can now be used for the fileshelf too. 87 //But this structure can be used everywhere where more information has to be exchanged with only one pointer 88 89 int source; //filled with one item of the enum above. E.g. SOURCE_FILESHELFT 90 void *Info_1; // this becomes: struct CallUserDataStruct *TheStruct = info->Info_1; 91 void *Info_2; // holds info->Info_2=(void *)ItemList; (FileList) 92 void *Info_3; // used for fileshelf in special, holds listView from fileshelf 93 void *Info_4; // used for fileshelf, holds the path from the first marked item 94 void *Info_5; 95 void *Info_6; 96 }; 97 98 #endif //HELPERS_H_ 99 100