summaryrefslogtreecommitdiff
path: root/fluid/app/shell_command.cxx
diff options
context:
space:
mode:
authormaxim nikonov <maxim.nikonov@hqo.co>2026-02-05 22:05:41 +0500
committermaxim nikonov <maxim.nikonov@hqo.co>2026-02-05 22:05:41 +0500
commit57860e277f2298ad6c0830b1492087cfa124c862 (patch)
tree50e9a7082c4143483fe01afc83293fb4ecbb4c22 /fluid/app/shell_command.cxx
parentdc39575fb3ef90e5a2689babe7fb335cd88f6727 (diff)
wip
Diffstat (limited to 'fluid/app/shell_command.cxx')
-rw-r--r--fluid/app/shell_command.cxx25
1 files changed, 16 insertions, 9 deletions
diff --git a/fluid/app/shell_command.cxx b/fluid/app/shell_command.cxx
index bd53a28af..a4b664fda 100644
--- a/fluid/app/shell_command.cxx
+++ b/fluid/app/shell_command.cxx
@@ -564,26 +564,31 @@ bool Fd_Shell_Command::is_active() {
void Fd_Shell_Command::read(Fl_Preferences &prefs) {
int tmp;
- prefs.get("name", name, "<unnamed>");
- prefs.get("label", label, "<no label>");
+ char *str_ptr = 0;
+ prefs.get("name", str_ptr, "<unnamed>");
+ if (str_ptr) { name = str_ptr; free(str_ptr); str_ptr = 0; }
+ prefs.get("label", str_ptr, "<no label>");
+ if (str_ptr) { label = str_ptr; free(str_ptr); str_ptr = 0; }
prefs.get("shortcut", tmp, 0);
shortcut = (Fl_Shortcut)tmp;
prefs.get("storage", tmp, -1);
if (tmp != -1) storage = (fld::Tool_Store)tmp;
prefs.get("condition", condition, ALWAYS);
- prefs.get("condition_data", condition_data, "");
- prefs.get("command", command, "");
+ prefs.get("condition_data", str_ptr, "");
+ if (str_ptr) { condition_data = str_ptr; free(str_ptr); str_ptr = 0; }
+ prefs.get("command", str_ptr, "");
+ if (str_ptr) { command = str_ptr; free(str_ptr); str_ptr = 0; }
prefs.get("flags", flags, 0);
}
void Fd_Shell_Command::write(Fl_Preferences &prefs, bool save_location) {
- prefs.set("name", name);
- prefs.set("label", label);
+ prefs.set("name", name.c_str());
+ prefs.set("label", label.c_str());
if (shortcut != 0) prefs.set("shortcut", (int)shortcut);
if (save_location) prefs.set("storage", (int)storage);
if (condition != ALWAYS) prefs.set("condition", condition);
- if (!condition_data.empty()) prefs.set("condition_data", condition_data);
- if (!command.empty()) prefs.set("command", command);
+ if (!condition_data.empty()) prefs.set("condition_data", condition_data.c_str());
+ if (!command.empty()) prefs.set("command", command.c_str());
if (flags != 0) prefs.set("flags", flags);
}
@@ -695,7 +700,9 @@ void Fd_Shell_Command_List::read(Fl_Preferences &prefs, fld::Tool_Store storage)
cmd->name = "Sample Shell Command";
cmd->label = "Sample Shell Command";
cmd->shortcut = FL_ALT+'g';
- Fluid.preferences.get("shell_command", cmd->command, "echo \"Sample Shell Command\"");
+ char *cmd_str = 0;
+ Fluid.preferences.get("shell_command", cmd_str, "echo \"Sample Shell Command\"");
+ if (cmd_str) { cmd->command = cmd_str; free(cmd_str); }
Fluid.preferences.get("shell_savefl", save_fl, 1);
Fluid.preferences.get("shell_writecode", save_code, 1);
Fluid.preferences.get("shell_writemsgs", save_strings, 0);