static void storeData(_Panel *panel) { WMPropList *list; WMPropList *tmp; int i; char *p; list = WMCreatePLArray(NULL, NULL); for (i=0; i<WMGetListNumberOfRows(panel->icoL); i++) { p = WMGetListItem(panel->icoL, i)->text; tmp = WMCreatePLString(p); WMAddToPLArray(list, tmp); } SetObjectForKey(list, "IconPath"); list = WMCreatePLArray(NULL, NULL); for (i=0; i<WMGetListNumberOfRows(panel->pixL); i++) { p = WMGetListItem(panel->pixL, i)->text; tmp = WMCreatePLString(p); WMAddToPLArray(list, tmp); } SetObjectForKey(list, "PixmapPath"); }
void WMRemoveBrowserItem(WMBrowser * bPtr, int column, int row) { WMList *list; if (column < 0 || column >= bPtr->usedColumnCount) return; list = WMGetBrowserListInColumn(bPtr, column); if (row < 0 || row >= WMGetListNumberOfRows(list)) return; removeColumn(bPtr, column + 1); if (bPtr->usedColumnCount < bPtr->maxVisibleColumns) scrollToColumn(bPtr, 0, True); else scrollToColumn(bPtr, bPtr->usedColumnCount - bPtr->maxVisibleColumns, True); WMRemoveListItem(list, row); }
static void browseForFile(WMWidget *w, void *data) { _Panel *panel = (_Panel*)data; WMFilePanel *filePanel; filePanel = WMGetOpenPanel(WMWidgetScreen(w)); WMSetFilePanelCanChooseFiles(filePanel, False); if (WMRunModalFilePanelForDirectory(filePanel, panel->parent, "/", _("Select directory"), NULL) == True) { char *str = WMGetFilePanelFileName(filePanel); if (str) { int len = strlen(str); /* Remove the trailing '/' except if the path is exactly / */ if (len > 1 && str[len-1] == '/') { str[len-1] = '\0'; len--; } if (len > 0) { WMList *lPtr; int i; if (w == panel->icoaB) lPtr = panel->icoL; else if (w == panel->pixaB) lPtr = panel->pixL; i = WMGetListSelectedItemRow(lPtr); if (i >= 0) i++; addPathToList(lPtr, i, str); WMSetListBottomPosition(lPtr, WMGetListNumberOfRows(lPtr)); wfree(str); } } } }