diff options
| -rw-r--r-- | src/xplorer.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/xplorer.c b/src/xplorer.c index db9cf7d..c03a16e 100644 --- a/src/xplorer.c +++ b/src/xplorer.c | |||
| @@ -138,14 +138,12 @@ bool OnFileTableClick( | |||
| 138 | // TODO: Think more about uiPtr. Do we need uiConstPtr? | 138 | // TODO: Think more about uiPtr. Do we need uiConstPtr? |
| 139 | // Ideally: const uiLabel* label = uiGetPtr(uiTableGet(...)); | 139 | // Ideally: const uiLabel* label = uiGetPtr(uiTableGet(...)); |
| 140 | // i.e., no checks on the client code; all checks in library code. | 140 | // i.e., no checks on the client code; all checks in library code. |
| 141 | const uiLabel* label = | 141 | const char* text = uiTableGet(table, event->row, event->col); |
| 142 | (const uiLabel*)uiTableGet(table, event->row, event->col); | ||
| 143 | assert(uiWidgetGetType((const uiWidget*)label) == uiTypeLabel); | ||
| 144 | 142 | ||
| 145 | printf("Click: %d,%d: %s\n", event->row, event->col, uiLabelGetText(label)); | 143 | printf("Click: %d,%d: %s\n", event->row, event->col, text); |
| 146 | 144 | ||
| 147 | // TODO: Handle '.' and '..' better. Define a path concatenation function. | 145 | // TODO: Handle '.' and '..' better. Define a path concatenation function. |
| 148 | path child_dir = path_new(uiLabelGetText(label)); | 146 | path child_dir = path_new(text); |
| 149 | path new_dir = path_concat(state->current_dir, child_dir); | 147 | path new_dir = path_concat(state->current_dir, child_dir); |
| 150 | const bool result = SetDirectory(state, new_dir); | 148 | const bool result = SetDirectory(state, new_dir); |
| 151 | if (!result) { | 149 | if (!result) { |
