about summary refs log tree commit diff stats
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
parent22a8d7a8a3b340b0a371b27727a684d942a8c369 (diff)
downloadprofani-tty-e57fa1633a6d33583454638d43cc84167a40c19b.tar.gz
add exit title preference to group and add command for setting the preference
-rw-r--r--src/command/command.c15
-rw-r--r--src/command/commands.c6
-rw-r--r--src/command/commands.h3
-rw-r--r--src/config/preferences.c1
-rw-r--r--src/ui/console.c10
-rw-r--r--src/ui/ui.h1
6 files changed, 34 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
diff --git a/src/config/preferences.c b/src/config/preferences.c
index c1e76f4a..b709ecd3 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -497,6 +497,7 @@ _get_group(preference_t pref)
         case PREF_THEME:
         case PREF_VERCHECK:
         case PREF_TITLEBAR:
+        case PREF_EXIT_TITLE:
         case PREF_FLASH:
         case PREF_INTYPE:
         case PREF_HISTORY:
diff --git a/src/ui/console.c b/src/ui/console.c
index 3d3a5d8b..1e69ab5c 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -959,6 +959,16 @@ cons_titlebar_setting(void)
 }
 
 void
+cons_exittitle_setting(void)
+{
+    if (prefs_get_boolean(PREF_EXIT_TITLE)) {
+        cons_show("Exit title display (/exittitle)  : ON");
+    } else {
+        cons_show("Exit title display (/exittitle)  : OFF");
+    }
+}
+
+void
 cons_roster_setting(void)
 {
     if (prefs_get_boolean(PREF_ROSTER))
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 4f78974c..b2e78702 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -300,6 +300,7 @@ void cons_time_setting(void);
 void cons_mouse_setting(void);
 void cons_statuses_setting(void);
 void cons_titlebar_setting(void);
+void cons_exittitle_setting(void);
 void cons_notify_setting(void);
 void cons_show_desktop_prefs(void);
 void cons_states_setting(void);