summaryrefslogtreecommitdiff
path: root/src/remote-exec.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-11-17 13:21:27 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-11-17 13:21:27 +0000
commit57cb76cd8486a7cd4ca7de039dd874c6fe32ce94 (patch)
tree2f5955a8f200a9179a1ebe05be9a4150911b2ce7 /src/remote-exec.c
parent5bb75c2cc4c5ad23eebef9832fb74a9eaf632b51 (diff)
allow remote session variables to be used in actions
Diffstat (limited to 'src/remote-exec.c')
-rw-r--r--src/remote-exec.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/remote-exec.c b/src/remote-exec.c
index 0e3c4e9..30627b2 100644
--- a/src/remote-exec.c
+++ b/src/remote-exec.c
@@ -83,8 +83,10 @@ static gchar *dump_json_value(JsonNode * node) {
return g_string_free(buffer, FALSE);
}
-gchar *build_remote_exec_cmd(TrgPrefs *prefs, GtkTreeModel *model, GList *selection,
+gchar *build_remote_exec_cmd(TrgClient *tc, GtkTreeModel *model, GList *selection,
const gchar * input) {
+ TrgPrefs *prefs = trg_client_get_prefs(tc);
+ JsonObject *session = trg_client_get_session(tc);
JsonObject *profile = trg_prefs_get_connection(prefs);
gchar *work;
GRegex *regex, *replacerx;
@@ -110,10 +112,14 @@ gchar *build_remote_exec_cmd(TrgPrefs *prefs, GtkTreeModel *model, GList *select
replacerx = g_regex_new(wholeEscaped, 0, 0, NULL);
valuestr = NULL;
- if (json_object_has_member(profile, id)) {
+ if (profile && json_object_has_member(profile, id)) {
replacement = json_object_get_member(profile, id);
if (JSON_NODE_HOLDS_VALUE(replacement))
valuestr = dump_json_value(replacement);
+ } else if (session && json_object_has_member(session, id)) {
+ replacement = json_object_get_member(session, id);
+ if (JSON_NODE_HOLDS_VALUE(replacement))
+ valuestr = dump_json_value(replacement);
} else {
GString *gs = g_string_new ("");
GList *li;