about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-07-21 00:11:38 +0100
committerJames Booth <boothj5@gmail.com>2014-07-21 00:11:38 +0100
commitdb9028d9c3ab0186b8fa208b1c328b40e7616cb8 (patch)
tree39d81b6b71c52da7409013ae96c9784a3e4d145a /src
parentf4fa0bc2dd742083f00ef98051e98d892a906dd6 (diff)
downloadprofani-tty-db9028d9c3ab0186b8fa208b1c328b40e7616cb8.tar.gz
Added win_save_println
Diffstat (limited to 'src')
-rw-r--r--src/ui/console.c34
-rw-r--r--src/ui/core.c4
-rw-r--r--src/ui/window.c6
-rw-r--r--src/ui/window.h1
4 files changed, 26 insertions, 19 deletions
diff --git a/src/ui/console.c b/src/ui/console.c
index bec7e1b7..ebd876bd 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -81,7 +81,7 @@ _cons_debug(const char * const msg, ...)
         va_start(arg, msg);
         GString *fmt_msg = g_string_new(NULL);
         g_string_vprintf(fmt_msg, msg, arg);
-        win_save_print(console, '-', NULL, 0, 0, "", fmt_msg->str);
+        win_save_println(console, fmt_msg->str);
         g_string_free(fmt_msg, TRUE);
         va_end(arg);
 
@@ -103,7 +103,7 @@ _cons_show(const char * const msg, ...)
     va_start(arg, msg);
     GString *fmt_msg = g_string_new(NULL);
     g_string_vprintf(fmt_msg, msg, arg);
-    win_save_print(console, '-', NULL, 0, 0, "", fmt_msg->str);
+    win_save_println(console, fmt_msg->str);
     g_string_free(fmt_msg, TRUE);
     va_end(arg);
 
@@ -193,13 +193,13 @@ _cons_about(void)
     }
 
     win_save_vprint(console, '-', NULL, 0, 0, "", "Copyright (C) 2012 - 2014 James Booth <%s>.", PACKAGE_BUGREPORT);
-    win_save_print(console, '-', NULL, 0, 0, "", "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>");
-    win_save_print(console, '-', NULL, 0, 0, "", "");
-    win_save_print(console, '-', NULL, 0, 0, "", "This is free software; you are free to change and redistribute it.");
-    win_save_print(console, '-', NULL, 0, 0, "", "There is NO WARRANTY, to the extent permitted by law.");
-    win_save_print(console, '-', NULL, 0, 0, "", "");
-    win_save_print(console, '-', NULL, 0, 0, "", "Type '/help' to show complete help.");
-    win_save_print(console, '-', NULL, 0, 0, "", "");
+    win_save_println(console, "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>");
+    win_save_println(console, "");
+    win_save_println(console, "This is free software; you are free to change and redistribute it.");
+    win_save_println(console, "There is NO WARRANTY, to the extent permitted by law.");
+    win_save_println(console, "");
+    win_save_println(console, "Type '/help' to show complete help.");
+    win_save_println(console, "");
 
     if (prefs_get_boolean(PREF_VERCHECK)) {
         cons_check_version(FALSE);
@@ -226,13 +226,13 @@ _cons_check_version(gboolean not_available_msg)
         if (relase_valid) {
             if (release_is_new(latest_release)) {
                 win_save_vprint(console, '-', NULL, 0, 0, "", "A new version of Profanity is available: %s", latest_release);
-                win_save_print(console, '-', NULL, 0, 0, "", "Check <http://www.profanity.im> for details.");
+                win_save_println(console, "Check <http://www.profanity.im> for details.");
                 free(latest_release);
-                win_save_print(console, '-', NULL, 0, 0, "", "");
+                win_save_println(console, "");
             } else {
                 if (not_available_msg) {
-                    win_save_print(console, '-', NULL, 0, 0, "", "No new version available.");
-                    win_save_print(console, '-', NULL, 0, 0, "", "");
+                    win_save_println(console, "No new version available.");
+                    win_save_println(console, "");
                 }
             }
 
@@ -275,7 +275,7 @@ _cons_show_wins(void)
 
     GSList *curr = window_strings;
     while (curr != NULL) {
-        win_save_print(console, '-', NULL, 0, 0, "", curr->data);
+        win_save_println(console, curr->data);
         curr = g_slist_next(curr);
     }
 
@@ -374,7 +374,7 @@ _cons_show_caps(const char * const contact, Resource *resource)
             }
 
             if (caps->features != NULL) {
-                win_save_print(console, '-', NULL, 0, 0, "", "Features:");
+                win_save_println(console, "Features:");
                 GSList *feature = caps->features;
                 while (feature != NULL) {
                     win_save_vprint(console, '-', NULL, 0, 0, "", " %s", feature->data);
@@ -781,7 +781,7 @@ _cons_show_account(ProfAccount *account)
         GList *ordered_resources = NULL;
 
         if (resources != NULL) {
-            win_save_print(console, '-', NULL, 0, 0, "", "Resources:");
+            win_save_println(console, "Resources:");
 
             // sort in order of availabiltiy
             while (resources != NULL) {
@@ -1521,7 +1521,7 @@ static void
 _cons_splash_logo(void)
 {
     ProfWin *console = wins_get_console();
-    win_save_print(console, '-', NULL, 0, 0, "", "Welcome to");
+    win_save_println(console, "Welcome to");
 
     win_save_print(console, '-', NULL, 0, COLOUR_SPLASH, "", "                   ___            _           ");
     win_save_print(console, '-', NULL, 0, COLOUR_SPLASH, "", "                  / __)          (_)_         ");
diff --git a/src/ui/core.c b/src/ui/core.c
index 32dfaf11..7afd0e44 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -1320,7 +1320,7 @@ _ui_create_duck_win(void)
     ProfWin *window = wins_new("DuckDuckGo search", WIN_DUCK);
     int num = wins_get_num(window);
     ui_switch_win(num);
-    win_save_print(window, '-', NULL, 0, 0, "", "Type ':help' to find out more.");
+    win_save_println(window, "Type ':help' to find out more.");
 }
 
 static void
@@ -1356,7 +1356,7 @@ _ui_duck(const char * const query)
 {
     ProfWin *window = wins_get_by_recipient("DuckDuckGo search");
     if (window != NULL) {
-        win_save_print(window, '-', NULL, 0, 0, "", "");
+        win_save_println(window, "");
         win_save_print(window, '-', NULL, NO_EOL, COLOUR_ME, "", "Query  : ");
         win_save_print(window, '-', NULL, NO_DATE, 0, "", query);
     }
diff --git a/src/ui/window.c b/src/ui/window.c
index 23a517af..6ae336e5 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -367,6 +367,12 @@ win_save_print(ProfWin *window, const char show_char, GTimeVal *tstamp,
 }
 
 void
+win_save_println(ProfWin *window, const char * const message)
+{
+    win_save_print(window, '-', NULL, 0, 0, "", message);
+}
+
+void
 win_save_newline(ProfWin *window)
 {
     win_save_print(window, '-', NULL, NO_DATE, 0, "", "");
diff --git a/src/ui/window.h b/src/ui/window.h
index d6dc9e6a..e0d2737f 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -79,6 +79,7 @@ void win_print_incoming_message(ProfWin *window, GTimeVal *tv_stamp,
 void win_show_info(ProfWin *window, PContact contact);
 void win_save_vprint(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags, int attrs, const char * const from, const char * const message, ...);
 void win_save_print(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags, int attrs, const char * const from, const char * const message);
+void win_save_println(ProfWin *window, const char * const message);
 void win_save_newline(ProfWin *window);
 void win_redraw(ProfWin *window);