about summary refs log tree commit diff stats
path: root/src/command/command.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-01-22 01:06:28 +0000
committerJames Booth <boothj5@gmail.com>2016-01-22 01:06:28 +0000
commit53fc89f71120a7ceba494cb1eed18667c24d1775 (patch)
tree5564e45185ba286f8ae5860bdf84145fbb2e4b3c /src/command/command.c
parent72bbb5c2b9953237c39c4003cabb95ad420afe64 (diff)
downloadprofani-tty-53fc89f71120a7ceba494cb1eed18667c24d1775.tar.gz
Added account theme property
Diffstat (limited to 'src/command/command.c')
-rw-r--r--src/command/command.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 3f4e4a7d..ca84591f 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -1644,6 +1644,7 @@ static struct cmd_t command_defs[] =
             "/account set <account> pgpkeyid <pgpkeyid>",
             "/account set <account> startscript <script>",
             "/account set <account> tls force|allow|disable",
+            "/account set <account> theme <theme>",
             "/account clear <account> password",
             "/account clear <account> eval_password",
             "/account clear <account> server",
@@ -1681,13 +1682,15 @@ static struct cmd_t command_defs[] =
             { "set <account> tls force",                "Force TLS connection, and fail if one cannot be established, this is default behaviour." },
             { "set <account> tls allow",                "Use TLS for the connection if it is available." },
             { "set <account> tls disable",              "Disable TLS for the connection." },
+            { "set <account> <theme>",                  "Set the UI theme for the account." },
             { "clear <account> server",                 "Remove the server setting for this account." },
             { "clear <account> port",                   "Remove the port setting for this account." },
             { "clear <account> password",               "Remove the password setting for this account." },
             { "clear <account> eval_password",          "Remove the eval_password setting for this account." },
             { "clear <account> otr",                    "Remove the OTR policy setting for this account." },
             { "clear <account> pgpkeyid",               "Remove pgpkeyid associated with this account." },
-            { "clear <account> startscript",            "Remove startscript associated with this account." })
+            { "clear <account> startscript",            "Remove startscript associated with this account." },
+            { "clear <account> theme",                  "Clear the theme setting for the account, the global theme will be used." })
         CMD_EXAMPLES(
             "/account add me",
             "/account set me jid me@chatty",
@@ -2145,6 +2148,7 @@ cmd_init(void)
     autocomplete_add(account_set_ac, "pgpkeyid");
     autocomplete_add(account_set_ac, "startscript");
     autocomplete_add(account_set_ac, "tls");
+    autocomplete_add(account_set_ac, "theme");
 
     account_clear_ac = autocomplete_new();
     autocomplete_add(account_clear_ac, "password");
@@ -2154,6 +2158,7 @@ cmd_init(void)
     autocomplete_add(account_clear_ac, "otr");
     autocomplete_add(account_clear_ac, "pgpkeyid");
     autocomplete_add(account_clear_ac, "startscript");
+    autocomplete_add(account_clear_ac, "theme");
 
     account_default_ac = autocomplete_new();
     autocomplete_add(account_default_ac, "set");
@@ -4442,6 +4447,25 @@ _account_autocomplete(ProfWin *window, const char *const input)
                 g_strfreev(args);
                 return found;
             }
+        } else if ((g_strv_length(args) > 3) && (g_strcmp0(args[2], "theme")) == 0) {
+            g_string_append(beginning, " ");
+            g_string_append(beginning, args[2]);
+            if (theme_load_ac == NULL) {
+                theme_load_ac = autocomplete_new();
+                GSList *themes = theme_list();
+                GSList *curr = themes;
+                while (curr) {
+                    autocomplete_add(theme_load_ac, curr->data);
+                    curr = g_slist_next(curr);
+                }
+                g_slist_free_full(themes, g_free);
+                autocomplete_add(theme_load_ac, "default");
+            }
+            found = autocomplete_param_with_ac(input, beginning->str, theme_load_ac, TRUE);
+            g_string_free(beginning, TRUE);
+            if (found) {
+                return found;
+            }
 #ifdef HAVE_LIBGPGME
         } else if ((g_strv_length(args) > 3) && (g_strcmp0(args[2], "pgpkeyid")) == 0) {
             g_string_append(beginning, " ");