refactor(controller): 拆分回调函数到模块化文件并添加字符串列表访问器

- 将 callbacks.c 拆分为多个按功能分类的文件(callbacks_basic.c、callbacks_nav.c、callbacks_search.c、callbacks_io.c、callbacks_sys.c)
- 新增 callbacks_internal.h 提供内部辅助函数声明,减少代码重复
- 在 string_ext 模块中添加 string_list_get 和 string_list_set 安全访问器函数
- 更新 CMakeLists.txt 和 ui_utils.c 以使用新的模块结构和访问器
- 重构旨在提高代码可维护性和可读性,便于后续功能扩展
This commit is contained in:
2026-04-28 21:54:47 +08:00
parent ea3d678d22
commit 7908bad1f4
11 changed files with 676 additions and 577 deletions
+6
View File
@@ -16,6 +16,12 @@ void init_string_list(StringList *list);
void add_string_list(StringList *list, const char *str);
void clear_string_list(StringList *list);
// 访问器函数 - 安全访问内部数据
// 获取指定索引的字符串(只读),越界返回 NULL
const char *string_list_get(const StringList *list, int index);
// 设置指定索引的字符串(会复制新字符串并释放旧字符串),越界返回 -1,成功返回 0
int string_list_set(StringList *list, int index, const char *str);
// 字符串转换函数
char *wide_to_utf8(const wchar_t *wstr);
wchar_t *utf8_to_wide(const char *str);