Changeset 194 for trunk/desktop/class_c
- Timestamp:
- Jan 16, 2007, 8:32:50 PM (19 years ago)
- Location:
- trunk/desktop/class_c
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/desktop/class_c/wpdatafile.c
r176 r194 56 56 /* wpdatafile.ih includes some WPObject stuff and that needs these 57 57 includes. */ 58 #include "nomfolderwindow.h" 59 58 #include "wpfolderwindow.h" 59 #include "wpnotebook.h" 60 #include "wpfolder.h" 60 61 #include "wpdatafile.ih" 61 62 … … 94 95 } 95 96 #warning !!!!! Dont create an icon for each object !!!!! 96 return gdk_pixbuf_new_from_file (gchrIconName, &error); 97 if(ptrIcon) 98 return ptrIcon; 99 else 100 return gdk_pixbuf_new_from_file (gchrIconName, &error); 97 101 98 102 #if 0 -
trunk/desktop/class_c/wpfilesystem.c
r186 r194 49 49 #include "desktoptypes.h" 50 50 51 #include " nomfolderwindow.h"52 53 51 #include "wpfolderwindow.h" 52 #include "wpnotebook.h" 53 #include "wpfolder.h" 54 54 #include "wpfilesystem.ih" 55 55 -
trunk/desktop/class_c/wpfolder.c
r191 r194 71 71 #include "desktop.h" 72 72 #include "helper.h" 73 #include "exception.h" 73 74 74 75 typedef struct _FLDRGTREEVALUE … … 76 77 PGTree pGTree; 77 78 WPObject* wpObject; 78 constgchar* chrKey;79 gchar* chrKey; 79 80 }FLDRGTREEVALUE, *PFLDRGTREEVALUE; 80 81 … … 111 112 /***************************************************************/ 112 113 113 #if 0114 static BOOL115 fldr_fillStore (GtkListStore *store, const gchar* gchrPath)116 {117 118 GDir *gDir;119 const gchar *gchrCurrentEntry;120 GtkTreeIter iter;121 122 nomPrintf("In %s: %s\n", __FUNCTION__, gchrPath);123 124 /* First clear the store */125 gtk_list_store_clear (store);126 127 /* Now go through the directory and extract all the file128 * information */129 gDir = g_dir_open (gchrPath, 0, NULL);130 if (!gDir)131 return FALSE;132 133 while ((gchrCurrentEntry = g_dir_read_name (gDir))!= NULL)134 {135 gchar *path, *display_name;136 gboolean is_dir;137 138 if (gchrCurrentEntry[0] != '\0')139 {140 path = g_build_filename (gchrPath, gchrCurrentEntry, NULL);141 nomPrintf(" %s\n", path);142 143 display_name = g_filename_to_utf8 (gchrCurrentEntry, -1, NULL, NULL, NULL);144 if(g_file_test (path, G_FILE_TEST_IS_DIR))145 {146 /* It's a folder */147 WPFolder* wpFolder;148 149 wpFolder=WPFolderNew();150 if(nomIsObj((PNOMObject)wpFolder))151 {152 gtk_list_store_append (store, &iter);153 154 gtk_list_store_set (store, &iter,155 COL_OBJECT_PTR, wpFolder,156 COL_PATH, path,157 COL_DISPLAY_NAME, display_name,158 COL_IS_DIRECTORY, is_dir,159 COL_PIXBUF, _wpQueryIcon(wpFolder, NULLHANDLE), //folder_pixbuf ,160 -1);161 162 }/* if(nomIsObj(wpFolder)) */163 }/* if(g_file_test (path, G_FILE_TEST_IS_DIR)) */164 else165 {166 /* It's a file */167 WPDataFile* wpDataFile;168 169 wpDataFile=WPDataFileNew();170 171 if(nomIsObj((PNOMObject)wpDataFile))172 {173 gtk_list_store_append (store, &iter);174 175 #warning !!!! some problems with icon handling here !!!!176 nomPrintf("Icon ptr: %x\n", _wpQueryIcon((WPObject*)wpDataFile, NULLHANDLE));177 gtk_list_store_set (store, &iter,178 COL_OBJECT_PTR, wpDataFile,179 COL_PATH, path,180 COL_DISPLAY_NAME, display_name,181 COL_IS_DIRECTORY, is_dir,182 COL_PIXBUF, _wpQueryIcon((WPObject*)wpDataFile, NULLHANDLE), //file_pixbuf,183 -1);184 }185 }186 g_free (path);187 g_free (display_name);188 }/* if (gchrCurrentEntry[0] != '\0') */189 }/* while */190 191 g_dir_close(gDir);192 193 return TRUE;194 }195 /* pszPath contains the fully qualified path (checked with WPS) */196 NOM_Scope CORBA_boolean NOMLINK impl_WPFolder_wpPopulate(WPFolder* nomSelf, const CORBA_unsigned_long ulReserved,197 const CORBA_char * pszPath, const CORBA_boolean fFoldersOnly,198 CORBA_Environment *ev)199 {200 WPFolderData* nomThis=WPFolderGetData(nomSelf);201 GtkListStore* gStore;202 PPRIVFOLDERDATA priv;203 204 nomPrintf(" Entering %s with nomSelf: 0x%x. nomSelf is: %s. Path is %s\n",205 __FUNCTION__, nomSelf , nomSelf->mtab->nomClassName, pszPath);206 207 g_return_val_if_fail(_privFolderData!=NULLHANDLE, FALSE); /* Huh! What happened in wpInitData()? */208 g_log("WPFolder", G_LOG_LEVEL_DEBUG, "%s: Populating %s\n", __FUNCTION__, pszPath);209 210 211 #if 0212 /* Already populated? */213 if(fFoldersOnly &&214 (_wpQueryFldrFlags(nomSelf) & (FOI_POPULATEDWITHFOLDERS | FOI_POPULATEDWITHALL)))215 return TRUE;216 else if(_wpQueryFldrFlags(nomSelf) & FOI_POPULATEDWITHALL)217 return TRUE;218 #endif219 220 priv=_privFolderData;221 222 if(!priv->gstoreFldContents)223 {224 /* Create a store holding the folder contents */225 gStore=fldr_CreateStore();226 g_return_val_if_fail(gStore!=NULLHANDLE, FALSE);227 priv->gstoreFldContents=gStore;228 }229 230 /* Fill our store */231 if(gStore)232 fldr_fillStore(gStore, pszPath);233 else234 return FALSE;235 236 gtk_icon_view_set_model(GTK_ICON_VIEW (priv->gtkIconView), GTK_TREE_MODEL (priv->gstoreFldContents));237 238 /* We now set which model columns that correspond to the text239 * and pixbuf of each item240 */241 gtk_icon_view_set_text_column (GTK_ICON_VIEW (priv->gtkIconView), COL_DISPLAY_NAME);242 gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (priv->gtkIconView), COL_PIXBUF);243 gtk_icon_view_set_item_width (GTK_ICON_VIEW (priv->gtkIconView),244 100);245 246 g_object_unref (gStore);247 248 return FALSE;249 }250 #endif251 252 114 static 253 115 gboolean fillStoreTraverseFunc(gpointer pKey, gpointer pTraverseValue, gpointer pData) … … 258 120 GtkListStore *store=(GtkListStore *)pData; 259 121 260 g_message("In %s with %s %x", __FUNCTION__, (char*)pKey, (UINT)pValue->wpObject);122 // g_message("In %s with %s %x", __FUNCTION__, (char*)pKey, (UINT)pValue->wpObject); 261 123 262 124 #warning !!!!! Use Title here !!!!! 263 display_name= pKey;125 display_name=g_strdup(pKey); /* New string necessary? */ 264 126 265 127 … … 290 152 291 153 if(nomIsObj((NOMObject*)wpFolder)){ 292 154 #if 0 293 155 g_message("%d %s : %s, %s", 294 156 __LINE__, __FUNCTION__, (char*)pKey, 295 157 NOMPath_queryCString(WPFolder_wpQueryFileName(wpFolder, TRUE, NULLHANDLE), NULLHANDLE)); 296 158 #endif 297 159 298 160 gtk_list_store_append (store, &iter); … … 336 198 pValue->pGTree=_fldrObjects; 337 199 pValue->wpObject=wpObject; 338 pValue->chrKey=chrFileName; 339 g_tree_insert(_fldrObjects, chrFileName, pValue); 200 pValue->chrKey=g_strdup(chrFileName); 201 202 g_tree_insert(_fldrObjects, pValue->chrKey, pValue); 340 203 341 204 #if 0 … … 353 216 { 354 217 /* WPFolderData* nomThis=WPFolderGetData(nomSelf); */ 355 PWPObject nomRetval; 356 357 return nomRetval; 218 219 return NULLHANDLE; 358 220 } 359 221 … … 370 232 PNOMPath fldrPath; 371 233 372 g_log("WPFolder", G_LOG_LEVEL_DEBUG, "%s: Populating %s (0x%x)\n", __FUNCTION__, pszPath, (UINT)nomSelf);234 // g_log("WPFolder", G_LOG_LEVEL_DEBUG, "%s: Populating %s (0x%x)\n", __FUNCTION__, pszPath, (UINT)nomSelf); 373 235 374 236 /* Already populated? */ … … 409 271 if(nomIsObj((PNOMObject)wpObject)) 410 272 { 273 WPObject_wpLockObject(wpObject, NULLHANDLE); 411 274 WPObject_wpSetTitleFromCString(wpObject, display_name, NULLHANDLE); 412 275 WPFileSystem_tstSetFullPath((WPFileSystem*)wpObject, gchrCurrentEntry, NULLHANDLE); 413 276 WPFileSystem_wpSetFolder(wpObject, nomSelf, NULLHANDLE); 277 #if 9 414 278 g_message("%d %s : %s (%x) , %s", 415 279 __LINE__, __FUNCTION__, gchrCurrentEntry, (UINT)wpObject, 416 280 NOMPath_queryCString(WPFolder_wpQueryFileName(wpObject, TRUE, NULLHANDLE), NULLHANDLE)); 417 281 #endif 418 282 /* insert into contents list */ 419 WPFolder_wpAddToContent(nomSelf, wpObject, g _strdup(gchrCurrentEntry), NULLHANDLE);283 WPFolder_wpAddToContent(nomSelf, wpObject, gchrCurrentEntry, NULLHANDLE); 420 284 }/* if(nomIsObj(wpObject)) */ 421 285 g_free (path); … … 491 355 PPRIVFOLDERDATA priv; 492 356 GtkListStore* gStore; 493 357 GtkIconView* gtkIconView; 358 494 359 pszPath=NOMPath_queryCString(WPFolder_wpQueryFileName(nomSelf, TRUE, NULLHANDLE), NULLHANDLE); 495 360 g_message("%d %s, %s", __LINE__, __FUNCTION__, pszPath); … … 526 391 g_return_val_if_fail(gStore!=NULLHANDLE, FALSE); 527 392 priv->gstoreFldContents=gStore; 393 394 /* Fill our store */ 395 if(gStore) 396 fldr_fillStore(nomSelf, gStore, pszPath); 397 else 398 return FALSE; 528 399 } 529 530 /* Fill our store */ 531 if(gStore) 532 fldr_fillStore(nomSelf, gStore, pszPath); 533 else 534 return FALSE; 535 536 gtk_icon_view_set_model(GTK_ICON_VIEW (priv->gtkIconView), GTK_TREE_MODEL (priv->gstoreFldContents)); 537 400 401 gtkIconView=WPFolderWindow_wpQueryContainerHandle(wpFldrWindow, NULLHANDLE); 402 403 gtk_icon_view_set_model(GTK_ICON_VIEW (gtkIconView), 404 GTK_TREE_MODEL (priv->gstoreFldContents)); 405 538 406 /* We now set which model columns that correspond to the text 539 407 * and pixbuf of each item 540 408 */ 541 gtk_icon_view_set_text_column (GTK_ICON_VIEW ( priv->gtkIconView), COL_DISPLAY_NAME);542 gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW ( priv->gtkIconView), COL_PIXBUF);543 gtk_icon_view_set_item_width (GTK_ICON_VIEW ( priv->gtkIconView), 100);544 545 g_object_unref (gStore);409 gtk_icon_view_set_text_column (GTK_ICON_VIEW (gtkIconView), COL_DISPLAY_NAME); 410 gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (gtkIconView), COL_PIXBUF); 411 gtk_icon_view_set_item_width (GTK_ICON_VIEW (gtkIconView), 100); 412 413 // g_object_unref (gStore); 546 414 547 415 return wpFldrWindow; … … 609 477 g_message("%s: %s", __FUNCTION__, wpObject->mtab->nomClassName); 610 478 /* WPObject_wpOpen(wpObject, pWindow, OPEN_CONTENTS, NULL, NULL); */ 611 WPObject_wpViewObject(wpObject, pWindow, OPEN_DEFAULT, 0, NULLHANDLE, NULL); 479 TRY(FLDR_ITEMACTIVATED) { 480 WPObject_wpViewObject(wpObject, pWindow, OPEN_DEFAULT, 0, NULLHANDLE, NULL); 481 } 482 CATCH{ 483 LOUD; 484 g_message("Line %d: Trap in %s", __LINE__, __FUNCTION__); 485 }END_CATCH(FLDR_ITEMACTIVATED); 612 486 } 613 487 } … … 627 501 wpFldrWindow=WPFolderWindowNew(); 628 502 629 #warning !!!!! This is only for testing !!!!!630 priv->gtkIconView=WPFolderWindow_wpQueryContainerHandle(wpFldrWindow, ev);631 632 503 /* Connect to the "item_activated" signal */ 633 g_signal_connect ( priv->gtkIconView, "item-activated",504 g_signal_connect (WPFolderWindow_wpQueryContainerHandle(wpFldrWindow, NULLHANDLE), "item-activated", 634 505 G_CALLBACK (itemActivated), nomSelf); 635 506 … … 719 590 720 591 592 -
trunk/desktop/class_c/wpfolderwindow.c
r191 r194 36 36 * 37 37 */ 38 #define METHOD_DEBUG 39 38 40 #include <os2.h> 39 41 … … 52 54 #include "wpfolderwindow.ih" 53 55 #include "wpobject.h" 56 #include "exception.h" 54 57 55 58 NOM_Scope PGtkWidget NOMLINK impl_WPFolderWindow_wpQueryContainerHandle(WPFolderWindow* nomSelf, CORBA_Environment *ev) … … 100 103 fldr_handleButtonEvent (GtkWidget *widget, GdkEventButton *event, gpointer user_data) 101 104 { 102 if(fldr_checkContextButton(event)) 103 { 104 PWPFolderWindow pWindow; 105 GtkTreePath* treePath; 106 107 DosBeep(5000, 100); 108 pWindow=(WPFolderWindow*)user_data; 109 110 treePath=gtk_icon_view_get_path_at_pos(GTK_ICON_VIEW(widget), event->x, event->y ); 111 if(NULL==treePath) 112 { 113 /* Click on white space */ 114 WPFolder* wpFolder; 115 wpFolder=(WPFolder*)WPFolderWindow_wpQueryWPObject(pWindow, NULLHANDLE); 116 g_message("%s: %s", __FUNCTION__, wpFolder->mtab->nomClassName); 117 WPObject_wpDisplayMenu((WPObject*)wpFolder, pWindow, NULL, MENU_OPENVIEWPOPUP, 0, NULL); 118 } 119 else 120 { 121 GtkTreeIter iter; 122 GtkTreeModel* model; 123 WPObject *wpObject; 124 /* Click on an icon */ 125 126 g_message("%s: %s", __FUNCTION__, gtk_tree_path_to_string(treePath)); 127 128 model=gtk_icon_view_get_model(GTK_ICON_VIEW(widget)); 129 g_message("%s: model: %x", __FUNCTION__, (UINT)model); 130 131 gtk_tree_model_get_iter(model , &iter, treePath); 132 133 gtk_tree_model_get(model, &iter, 134 0, &wpObject, 135 -1); 136 g_message("%s: %s", __FUNCTION__, wpObject->mtab->nomClassName); 137 WPObject_wpDisplayMenu((WPObject*)wpObject, pWindow, NULL, MENU_OBJECTPOPUP, 0, NULL); 138 } 139 } 105 106 107 TRY(FLDR_BUTTONEVENT) { 108 if(fldr_checkContextButton(event)) 109 { 110 PWPFolderWindow pWindow; 111 GtkTreePath* treePath; 112 DosBeep(5000, 100); 113 pWindow=(WPFolderWindow*)user_data; 114 TST_OBJECT(pWindow); 115 treePath=gtk_icon_view_get_path_at_pos(GTK_ICON_VIEW(widget), event->x, event->y ); 116 if(NULL==treePath) 117 { 118 /* Click on white space */ 119 WPFolder* wpFolder; 120 wpFolder=(WPFolder*)WPFolderWindow_wpQueryWPObject(pWindow, NULLHANDLE); 121 TST_OBJECT(wpFolder); 122 123 if(nomIsObj(wpFolder)) 124 WPObject_wpDisplayMenu((WPObject*)wpFolder, pWindow, NULL, MENU_OPENVIEWPOPUP, 0, NULL); 125 else 126 g_message("%d %s: WPFolder object not valid!", __LINE__, __FUNCTION__); 127 } 128 else 129 { 130 GtkTreeIter iter; 131 GtkTreeModel* model; 132 WPObject *wpObject; 133 /* Click on an icon */ 134 135 g_message("%s: %s", __FUNCTION__, gtk_tree_path_to_string(treePath)); 136 137 model=gtk_icon_view_get_model(GTK_ICON_VIEW(widget)); 138 g_message("%s: model: %x", __FUNCTION__, (UINT)model); 139 140 gtk_tree_model_get_iter(model , &iter, treePath); 141 gtk_tree_model_get(model, &iter, 0, &wpObject, -1); 142 143 TST_OBJECT(wpObject); 144 145 if(nomIsObj(wpObject)){ 146 g_message("%s: %s calling wpDisplayMenu()", __FUNCTION__, wpObject->mtab->nomClassName); 147 WPObject_wpDisplayMenu((WPObject*)wpObject, pWindow, NULL, MENU_OBJECTPOPUP, 0, NULL); 148 } 149 else 150 g_message("%d %s: WPDataFile object not valid!", __LINE__, __FUNCTION__); 151 152 } 153 }/* if() */ 154 }CATCH{ 155 //LOUD; 156 g_message("Line %d: Trap in %s", __LINE__, __FUNCTION__); 157 } END_CATCH(FLDR_BUTTONEVENT); 158 140 159 return FALSE; 141 160 } … … 210 229 /* Create an icon view without model */ 211 230 icon_view = gtk_icon_view_new (); 212 WPFolderWindow_wpSetContainerHandle(nomSelf, icon_view, NULLHANDLE); 213 231 214 232 /* Allow multiple selection in icon view */ 215 233 gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (icon_view), … … 239 257 G_CALLBACK (up_clicked), store); 240 258 #endif 259 260 WPFolderWindow_wpSetContainerHandle(nomSelf, icon_view, NULLHANDLE); 261 241 262 /* Add icon view as child to the scroll window created earlier */ 242 263 gtk_container_add (GTK_CONTAINER (sw), icon_view);
Note:
See TracChangeset
for help on using the changeset viewer.