about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorWill Song <incertia9474@gmail.com>2015-01-08 10:18:29 -0600
committerWill Song <incertia9474@gmail.com>2015-01-08 10:18:29 -0600
commite57fa1633a6d33583454638d43cc84167a40c19b (patch)
tree0f514cbf797b31853cbc4530ac649b722eb8c9bb /src/command
parent22a8d7a8a3b340b0a371b27727a684d942a8c369 (diff)
downloadprofani-tty-e57fa1633a6d33583454638d43cc84167a40c19b.tar.gz
add exit title preference to group and add command for setting the preference
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c15
-rw-r--r--src/command/commands.c6
-rw-r--r--src/command/commands.h3
3 files changed, 22 insertions, 2 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 5c1f858d..2cabc257 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -726,6 +726,14 @@ static struct cmd_t command_defs[] =
           "Show information in the window title bar.",
           NULL  } } },
 
+    { "/exittitle",
+        cmd_exittitle, parse_args, 1, 1, &cons_exittitle_setting,
+        { "/exittitle on|off", "Print a nice message upon exiting Profanity",
+        { "/exittitle on|off",
+          "----------------",
+          "Print a nice message upon exiting Profanity",
+          NULL  } } },
+
     { "/mouse",
         cmd_mouse, parse_args, 1, 1, &cons_mouse_setting,
         { "/mouse on|off", "Use profanity mouse handling.",
@@ -1074,6 +1082,7 @@ static Autocomplete autoaway_ac;
 static Autocomplete autoaway_mode_ac;
 static Autocomplete autoconnect_ac;
 static Autocomplete titlebar_ac;
+static Autocomplete exittitle_ac;
 static Autocomplete theme_ac;
 static Autocomplete theme_load_ac;
 static Autocomplete account_ac;
@@ -1206,6 +1215,9 @@ cmd_init(void)
     titlebar_ac = autocomplete_new();
     autocomplete_add(titlebar_ac, "version");
 
+    exittitle_ac = autocomplete_new();
+    autocomplete_add(exittitle_ac, "version");
+
     log_ac = autocomplete_new();
     autocomplete_add(log_ac, "maxsize");
     autocomplete_add(log_ac, "rotate");
@@ -1472,6 +1484,7 @@ cmd_uninit(void)
     autocomplete_free(notify_typing_ac);
     autocomplete_free(sub_ac);
     autocomplete_free(titlebar_ac);
+    autocomplete_free(exittitle_ac);
     autocomplete_free(log_ac);
     autocomplete_free(prefs_ac);
     autocomplete_free(autoaway_ac);
@@ -1892,7 +1905,7 @@ _cmd_complete_parameters(char *input, int *size)
     // autocomplete boolean settings
     gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype",
         "/flash", "/splash", "/chlog", "/grlog", "/mouse", "/history", "/titlebar",
-        "/vercheck", "/privileges", "/presence", "/wrap" };
+        "/vercheck", "/privileges", "/presence", "/wrap", "/exittitle", };
 
     for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
         result = autocomplete_param_with_func(input, size, boolean_choices[i],
diff --git a/src/command/commands.c b/src/command/commands.c
index 5b5bd95e..0da93038 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -3255,6 +3255,12 @@ cmd_titlebar(gchar **args, struct cmd_help_t help)
 }
 
 gboolean
+cmd_exittitle(gchar **args, struct cmd_help_t help)
+{
+    return _cmd_set_boolean_preference(args[0], help, "Exit title", PREF_EXIT_TITLE);
+}
+
+gboolean
 cmd_outtype(gchar **args, struct cmd_help_t help)
 {
     gboolean result = _cmd_set_boolean_preference(args[0], help,
diff --git a/src/command/commands.h b/src/command/commands.h
index dd09fae0..c8cbd9e3 100644
--- a/src/command/commands.h
+++ b/src/command/commands.h
@@ -116,6 +116,7 @@ gboolean cmd_sub(gchar **args, struct cmd_help_t help);
 gboolean cmd_theme(gchar **args, struct cmd_help_t help);
 gboolean cmd_tiny(gchar **args, struct cmd_help_t help);
 gboolean cmd_titlebar(gchar **args, struct cmd_help_t help);
+gboolean cmd_exittitle(gchar **args, struct cmd_help_t help);
 gboolean cmd_vercheck(gchar **args, struct cmd_help_t help);
 gboolean cmd_who(gchar **args, struct cmd_help_t help);
 gboolean cmd_win(gchar **args, struct cmd_help_t help);
@@ -140,4 +141,4 @@ gboolean cmd_inpblock(gchar **args, struct cmd_help_t help);
 
 gboolean cmd_form_field(char *tag, gchar **args);
 
-#endif
\ No newline at end of file
+#endif