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 USERDATA_H_ 21 #define USERDATA_H_ 22 23 24 25 ///////////////////////////////////////////////////////////////////////////////////////////////// 26 ///////////////// USER DATA LIST ////////////////////////////////////////////////////////////// 27 ///////////////////////////////////////////////////////////////////////////////////////////////// 28 struct UserDataList{ 29 //GString *UserCommand; 30 //GString *UserCommandName; //fill this with the name (including the path) of the usercommand as shown in the contextmenu 31 GString *gstrCompleteName; //means the name with path (more/item) 32 GString *gstrMenuName; //the name without the path (item) 33 void *ListElement; //will hold the element of the list from struct _UserCommandList, struct _OptionsList for bookmarks 34 35 int iSourceType; //from an Object or Fileshelf 36 void *Object; //SideObjectList or FileShelfObjectList for usercommands, Notebook for bookmarks 37 38 GtkWidget *MenuToAddTo; //pointer to a menue to which this item should be added 39 40 struct UserDataList *prevItem; 41 struct UserDataList *nextItem; 42 }; 43 44 45 void UserDataList_AddItem(struct UserDataList **theList, char *cpCompleteName, void *ListElement); 46 void UserDataList_DeleteList(struct UserDataList **theList); 47 struct UserDataList *UserDataList_getFirstItem(struct UserDataList *theList); 48 struct UserDataList *UserDataList_getLastItem(struct UserDataList *theList); 49 struct UserDataList *UserDataList_getStandardItem(struct UserDataList *theList); 50 struct UserDataList *UserDataList_getItemByListElement(struct UserDataList *theList, void *ListElement); 51 int UserDataList_CreateDummyCommand (struct UserDataList *theDummyItem, const char *cpCommand, void *Object, int iSource, int iCallType); 52 //struct UserDataList *UserDataList_CreateListFrom_UserCommandList (struct _UserCommandList *userCommandList); 53 54 55 ///////////////////////////////////////////////////////////////////////////////////////////////// 56 ///////////////// MENU OBJECT LIST ////////////////////////////////////////////////////////////// 57 ///////////////////////////////////////////////////////////////////////////////////////////////// 58 struct MenuObjectList{ 59 GtkWidget *submenu; 60 GString *gstrName; 61 GtkWidget *MenuToAddTo; 62 63 struct MenuObjectList *prevItem; 64 struct MenuObjectList *nextItem; 65 }; 66 67 void MenuObjectList_DeleteList(struct MenuObjectList **theList); 68 void MenuObjectList_AddItem(struct MenuObjectList **theList, char *Name, GtkWidget *submenu, GtkWidget *MenuToAddTo); 69 struct MenuObjectList *MenuObjectList_getFirstItem(struct MenuObjectList *theList); 70 struct MenuObjectList *MenuObjectList_getLastItem(struct MenuObjectList *theList); 71 72 73 ///////////////////////////////////////////////////////////////////////////////////////////////// 74 ///////////////// _CallUserCommand_StartThreadStructure ////////////////////////////////////////////////////////////// 75 ///////////////////////////////////////////////////////////////////////////////////////////////// 76 struct _CallUserCommand_StartThreadStructure{ 77 //gets filled in CallUserCommand_StartThread 78 79 //do not forget to free this thinks!!!! 80 struct UserDataList *OurUserDataListItem; 81 GList *glistItemsWithPath; 82 GList *glistItemsWithoutPath; 83 GString *gstrThisSidePath; 84 GString *gstrOtherSidePath; 85 GString *gstrLeftSidePath; 86 GString *gstrRightSidePath; 87 GString *gstrHomeDir; 88 GString *gstrWorkingDir; 89 GString *gstrParsedCommand; 90 GString *gstrQuitReplyText; 91 GString *gstrActionNoteText; 92 93 struct ListWidgetCommunicationStruct *commStru; //if calling via list this comes in handy 94 95 //creating the userdialog we had some trouble as we want Cat'sEyE not to be blocked as long the dialog runs. 96 //for this we need some more variables: 97 // following variables will not be freed in CallUserCommand_StartThreadStructure_freeStruct like the above items 98 GtkWidget * wdgtUserDialog; //init: NULL 99 GtkWidget * wdgtUSerDialogMainVBox; //init: NULL 100 GCond * gcontDialogCondition; //init: NULL 101 GCond * gcontEachCondition; //init: NULL 102 int iUserDialogReturnValue; //initialized by 0 103 104 //No need to free this 105 unsigned int uiCurrentPositionInList; //saves the current position in the list glistItemsWithPath, glistItemsWithoutPath should have the same order 106 unsigned int uiSizeOfLists; //saves the size of the lists glistItemsWithPath and WithoutPath 107 108 int iCancelAll; //0=continue, 1=cancel one, 2=cancel all to cancel processing the list (e.g. in each mode!, but also in list mode too) 109 }; 110 111 112 void UserCommand_CreateUserMenu(GtkWidget *rootmenu, struct UserDataList *UserData, struct MenuObjectList **MenuObjects); 113 void UserCommand_AttachUserMenu(struct MenuObjectList *MenuObjects); 114 115 116 117 //////////////////////////////////////////////////////////////////////////////////////////// 118 ///////////////// Functions //////////////////////////////////////////////////////////////// 119 //////////////////////////////////////////////////////////////////////////////////////////// 120 121 int CallUserCommand_StartThread (struct UserDataList *OurUserDataListItem, GList *glistItemsWithPath, GList *glistItemsWithoutPath, GString *gstrThisSidePath, GString *gstrOtherSidePath, GString *gstrLeftSidePath, GString *gstrRightSidePath, GString *gstrHomeDir); 122 void CallUserCommand_ProcessItemThread (struct ListWidgetCommunicationStruct *commStru); 123 int UserOption_callTerminal(void *Object, int iSource); 124 int UserOption_callStandardEditor(void *Object, int iSource); 125 int UserOption_callOption (void *Object, int iSource, const char *ccpOptioniD); 126 int UserDataListFromBookmarkList(struct UserDataList **UserDataListToFill); 127 128 129 #endif //USERDATA_H_ 130 131 132 133 134 135