about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-09-22 21:42:00 +0100
committerJames Booth <boothj5@gmail.com>2016-09-22 21:42:00 +0100
commit3983ee1d6be8245901e83d7d06974005000a1721 (patch)
tree6e02792e4fcf2fb2bac09868ab997c29130f7650
parentf683a704ad164796ddd1dc6f49ea48098fc39219 (diff)
downloadprofani-tty-3983ee1d6be8245901e83d7d06974005000a1721.tar.gz
Rename /titlebar -> /wintitle
-rw-r--r--src/command/cmd_ac.c24
-rw-r--r--src/command/cmd_defs.c10
-rw-r--r--src/command/cmd_funcs.c6
-rw-r--r--src/command/cmd_funcs.h2
-rw-r--r--src/config/preferences.c25
-rw-r--r--src/config/preferences.h4
-rw-r--r--src/profanity.c4
-rw-r--r--src/ui/console.c16
-rw-r--r--src/ui/core.c2
-rw-r--r--src/ui/ui.h2
-rw-r--r--tests/unittests/ui/stub_ui.c2
11 files changed, 55 insertions, 42 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 917d9db2..b66fce4d 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -83,7 +83,7 @@ static char* _ban_autocomplete(ProfWin *window, const char *const input);
 static char* _affiliation_autocomplete(ProfWin *window, const char *const input);
 static char* _role_autocomplete(ProfWin *window, const char *const input);
 static char* _resource_autocomplete(ProfWin *window, const char *const input);
-static char* _titlebar_autocomplete(ProfWin *window, const char *const input);
+static char* _wintitle_autocomplete(ProfWin *window, const char *const input);
 static char* _inpblock_autocomplete(ProfWin *window, const char *const input);
 static char* _time_autocomplete(ProfWin *window, const char *const input);
 static char* _receipts_autocomplete(ProfWin *window, const char *const input);
@@ -123,7 +123,7 @@ static Autocomplete autoaway_ac;
 static Autocomplete autoaway_mode_ac;
 static Autocomplete autoaway_presence_ac;
 static Autocomplete autoconnect_ac;
-static Autocomplete titlebar_ac;
+static Autocomplete wintitle_ac;
 static Autocomplete theme_ac;
 static Autocomplete theme_load_ac;
 static Autocomplete account_ac;
@@ -281,9 +281,9 @@ cmd_ac_init(void)
     autocomplete_add(sub_ac, "sent");
     autocomplete_add(sub_ac, "received");
 
-    titlebar_ac = autocomplete_new();
-    autocomplete_add(titlebar_ac, "show");
-    autocomplete_add(titlebar_ac, "goodbye");
+    wintitle_ac = autocomplete_new();
+    autocomplete_add(wintitle_ac, "show");
+    autocomplete_add(wintitle_ac, "goodbye");
 
     log_ac = autocomplete_new();
     autocomplete_add(log_ac, "maxsize");
@@ -965,7 +965,7 @@ cmd_ac_reset(ProfWin *window)
     autocomplete_reset(roster_remove_all_ac);
     autocomplete_reset(roster_private_ac);
     autocomplete_reset(group_ac);
-    autocomplete_reset(titlebar_ac);
+    autocomplete_reset(wintitle_ac);
     autocomplete_reset(bookmark_ac);
     autocomplete_reset(bookmark_property_ac);
     autocomplete_reset(otr_ac);
@@ -1049,7 +1049,7 @@ cmd_ac_uninit(void)
     autocomplete_free(notify_mention_ac);
     autocomplete_free(notify_trigger_ac);
     autocomplete_free(sub_ac);
-    autocomplete_free(titlebar_ac);
+    autocomplete_free(wintitle_ac);
     autocomplete_free(log_ac);
     autocomplete_free(prefs_ac);
     autocomplete_free(autoaway_ac);
@@ -1242,7 +1242,7 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input)
     g_hash_table_insert(ac_funcs, "/affiliation",   _affiliation_autocomplete);
     g_hash_table_insert(ac_funcs, "/role",          _role_autocomplete);
     g_hash_table_insert(ac_funcs, "/resource",      _resource_autocomplete);
-    g_hash_table_insert(ac_funcs, "/titlebar",      _titlebar_autocomplete);
+    g_hash_table_insert(ac_funcs, "/wintitle",      _wintitle_autocomplete);
     g_hash_table_insert(ac_funcs, "/inpblock",      _inpblock_autocomplete);
     g_hash_table_insert(ac_funcs, "/time",          _time_autocomplete);
     g_hash_table_insert(ac_funcs, "/receipts",      _receipts_autocomplete);
@@ -2076,21 +2076,21 @@ _resource_autocomplete(ProfWin *window, const char *const input)
 }
 
 static char*
-_titlebar_autocomplete(ProfWin *window, const char *const input)
+_wintitle_autocomplete(ProfWin *window, const char *const input)
 {
     char *found = NULL;
 
-    found = autocomplete_param_with_func(input, "/titlebar show", prefs_autocomplete_boolean_choice);
+    found = autocomplete_param_with_func(input, "/wintitle show", prefs_autocomplete_boolean_choice);
     if (found) {
         return found;
     }
 
-    found = autocomplete_param_with_func(input, "/titlebar goodbye", prefs_autocomplete_boolean_choice);
+    found = autocomplete_param_with_func(input, "/wintitle goodbye", prefs_autocomplete_boolean_choice);
     if (found) {
         return found;
     }
 
-    found = autocomplete_param_with_ac(input, "/titlebar", titlebar_ac, FALSE);
+    found = autocomplete_param_with_ac(input, "/wintitle", wintitle_ac, FALSE);
     if (found) {
         return found;
     }
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index ffc9e901..52c06ae5 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -1492,15 +1492,15 @@ static struct cmd_t command_defs[] =
         CMD_NOEXAMPLES
     },
 
-    { "/titlebar",
-        parse_args, 2, 2, &cons_titlebar_setting,
+    { "/wintitle",
+        parse_args, 2, 2, &cons_wintitle_setting,
         CMD_NOSUBFUNCS
-        CMD_MAINFUNC(cmd_titlebar)
+        CMD_MAINFUNC(cmd_wintitle)
         CMD_TAGS(
             CMD_TAG_UI)
         CMD_SYN(
-            "/titlebar show on|off",
-            "/titlebar goodbye on|off")
+            "/wintitle show on|off",
+            "/wintitle goodbye on|off")
         CMD_DESC(
             "Allow Profanity to modify the window title bar.")
         CMD_ARGS(
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index d8562194..4f8dc993 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -5057,7 +5057,7 @@ cmd_states(ProfWin *window, const char *const command, gchar **args)
 }
 
 gboolean
-cmd_titlebar(ProfWin *window, const char *const command, gchar **args)
+cmd_wintitle(ProfWin *window, const char *const command, gchar **args)
 {
     if (g_strcmp0(args[0], "show") != 0 && g_strcmp0(args[0], "goodbye") != 0) {
         cons_bad_cmd_usage(command);
@@ -5067,9 +5067,9 @@ cmd_titlebar(ProfWin *window, const char *const command, gchar **args)
         ui_clear_win_title();
     }
     if (g_strcmp0(args[0], "show") == 0) {
-        _cmd_set_boolean_preference(args[1], command, "Titlebar show", PREF_TITLEBAR_SHOW);
+        _cmd_set_boolean_preference(args[1], command, "Window title show", PREF_WINTITLE_SHOW);
     } else {
-        _cmd_set_boolean_preference(args[1], command, "Titlebar goodbye", PREF_TITLEBAR_GOODBYE);
+        _cmd_set_boolean_preference(args[1], command, "Window title goodbye", PREF_WINTITLE_GOODBYE);
     }
 
     return TRUE;
diff --git a/src/command/cmd_funcs.h b/src/command/cmd_funcs.h
index cae68f59..b936de63 100644
--- a/src/command/cmd_funcs.h
+++ b/src/command/cmd_funcs.h
@@ -128,7 +128,7 @@ gboolean cmd_status(ProfWin *window, const char *const command, gchar **args);
 gboolean cmd_sub(ProfWin *window, const char *const command, gchar **args);
 gboolean cmd_theme(ProfWin *window, const char *const command, gchar **args);
 gboolean cmd_tiny(ProfWin *window, const char *const command, gchar **args);
-gboolean cmd_titlebar(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_wintitle(ProfWin *window, const char *const command, gchar **args);
 gboolean cmd_vercheck(ProfWin *window, const char *const command, gchar **args);
 gboolean cmd_who(ProfWin *window, const char *const command, gchar **args);
 gboolean cmd_win(ProfWin *window, const char *const command, gchar **args);
diff --git a/src/config/preferences.c b/src/config/preferences.c
index de75008e..68a132e5 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -143,6 +143,19 @@ prefs_load(void)
         prefs_free_string(value);
     }
 
+    // move pre 0.5.0 titlebar settings to wintitle
+    if (g_key_file_has_key(prefs, PREF_GROUP_UI, "titlebar.show", NULL)) {
+        gboolean show = g_key_file_get_boolean(prefs, PREF_GROUP_UI, "titlebar.show", NULL);
+        g_key_file_set_boolean(prefs, PREF_GROUP_UI, "wintitle.show", show);
+        g_key_file_remove_key(prefs, PREF_GROUP_UI, "titlebar.show", NULL);
+    }
+    if (g_key_file_has_key(prefs, PREF_GROUP_UI, "titlebar.goodbye", NULL)) {
+        gboolean goodbye = g_key_file_get_boolean(prefs, PREF_GROUP_UI, "titlebar.goodbye", NULL);
+        g_key_file_set_boolean(prefs, PREF_GROUP_UI, "wintitle.goodbye", goodbye);
+        g_key_file_remove_key(prefs, PREF_GROUP_UI, "titlebar.goodbye", NULL);
+    }
+
+
     _save_prefs();
 
     boolean_choice_ac = autocomplete_new();
@@ -1162,8 +1175,8 @@ _get_group(preference_t pref)
         case PREF_BEEP:
         case PREF_THEME:
         case PREF_VERCHECK:
-        case PREF_TITLEBAR_SHOW:
-        case PREF_TITLEBAR_GOODBYE:
+        case PREF_WINTITLE_SHOW:
+        case PREF_WINTITLE_GOODBYE:
         case PREF_FLASH:
         case PREF_INTYPE:
         case PREF_HISTORY:
@@ -1282,10 +1295,10 @@ _get_key(preference_t pref)
             return "theme";
         case PREF_VERCHECK:
             return "vercheck";
-        case PREF_TITLEBAR_SHOW:
-            return "titlebar.show";
-        case PREF_TITLEBAR_GOODBYE:
-            return "titlebar.goodbye";
+        case PREF_WINTITLE_SHOW:
+            return "wintitle.show";
+        case PREF_WINTITLE_GOODBYE:
+            return "wintitle.goodbye";
         case PREF_FLASH:
             return "flash";
         case PREF_TRAY:
diff --git a/src/config/preferences.h b/src/config/preferences.h
index 67f3e1e4..ee89bd90 100644
--- a/src/config/preferences.h
+++ b/src/config/preferences.h
@@ -49,8 +49,8 @@ typedef enum {
     PREF_BEEP,
     PREF_VERCHECK,
     PREF_THEME,
-    PREF_TITLEBAR_SHOW,
-    PREF_TITLEBAR_GOODBYE,
+    PREF_WINTITLE_SHOW,
+    PREF_WINTITLE_GOODBYE,
     PREF_FLASH,
     PREF_TRAY,
     PREF_TRAY_READ,
diff --git a/src/profanity.c b/src/profanity.c
index 3cdec902..feedda9a 100644
--- a/src/profanity.c
+++ b/src/profanity.c
@@ -208,8 +208,8 @@ _init(char *log_level)
 static void
 _shutdown(void)
 {
-    if (prefs_get_boolean(PREF_TITLEBAR_SHOW)) {
-        if (prefs_get_boolean(PREF_TITLEBAR_GOODBYE)) {
+    if (prefs_get_boolean(PREF_WINTITLE_SHOW)) {
+        if (prefs_get_boolean(PREF_WINTITLE_GOODBYE)) {
             ui_goodbye_title();
         } else {
             ui_clear_win_title();
diff --git a/src/ui/console.c b/src/ui/console.c
index 3b99e58e..8bc7823f 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -1339,17 +1339,17 @@ cons_vercheck_setting(void)
 }
 
 void
-cons_titlebar_setting(void)
+cons_wintitle_setting(void)
 {
-    if (prefs_get_boolean(PREF_TITLEBAR_SHOW)) {
-        cons_show("Titlebar show (/titlebar)           : ON");
+    if (prefs_get_boolean(PREF_WINTITLE_SHOW)) {
+        cons_show("Window title show (/wintitle)       : ON");
     } else {
-        cons_show("Titlebar show (/titlebar)           : OFF");
+        cons_show("Window title show (/wintitle)       : OFF");
     }
-    if (prefs_get_boolean(PREF_TITLEBAR_GOODBYE)) {
-        cons_show("Titlebar goodbye (/titlebar)        : ON");
+    if (prefs_get_boolean(PREF_WINTITLE_GOODBYE)) {
+        cons_show("Window title goodbye (/wintitle)    : ON");
     } else {
-        cons_show("Titlebar goodbye (/titlebar)        : OFF");
+        cons_show("Window title goodbye (/wintitle)    : OFF");
     }
 }
 
@@ -1544,7 +1544,7 @@ cons_show_ui_prefs(void)
     cons_occupants_setting();
     cons_roster_setting();
     cons_privileges_setting();
-    cons_titlebar_setting();
+    cons_wintitle_setting();
     cons_encwarn_setting();
     cons_presence_setting();
     cons_inpblock_setting();
diff --git a/src/ui/core.c b/src/ui/core.c
index 2dad71fb..6c42c422 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -133,7 +133,7 @@ ui_update(void)
 
     win_update_virtual(current);
 
-    if (prefs_get_boolean(PREF_TITLEBAR_SHOW)) {
+    if (prefs_get_boolean(PREF_WINTITLE_SHOW)) {
         _ui_draw_term_title();
     }
     title_bar_update_virtual();
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 7a2dc95a..ef0d808f 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -299,7 +299,7 @@ void cons_presence_setting(void);
 void cons_wrap_setting(void);
 void cons_winstidy_setting(void);
 void cons_time_setting(void);
-void cons_titlebar_setting(void);
+void cons_wintitle_setting(void);
 void cons_notify_setting(void);
 void cons_show_desktop_prefs(void);
 void cons_states_setting(void);
diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c
index d4c30698..685fa476 100644
--- a/tests/unittests/ui/stub_ui.c
+++ b/tests/unittests/ui/stub_ui.c
@@ -428,7 +428,7 @@ void cons_encwarn_setting(void) {}
 void cons_time_setting(void) {}
 void cons_mouse_setting(void) {}
 void cons_statuses_setting(void) {}
-void cons_titlebar_setting(void) {}
+void cons_wintitle_setting(void) {}
 void cons_notify_setting(void) {}
 void cons_states_setting(void) {}
 void cons_outtype_setting(void) {}