about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-11-22 02:34:49 +0000
committerJames Booth <boothj5@gmail.com>2012-11-22 02:34:49 +0000
commit45a26b111f8bdfe9fb534368eb29bb8963353d8a (patch)
treeff46ad69af2a42c17438c2dc6fb801384d2df444 /src
parentc5b4fc4a80563390610938e36c6e9dc71337c754 (diff)
downloadprofani-tty-45a26b111f8bdfe9fb534368eb29bb8963353d8a.tar.gz
Added time to themes, and some example themes
Diffstat (limited to 'src')
-rw-r--r--src/theme.c5
-rw-r--r--src/theme.h1
-rw-r--r--src/windows.c6
3 files changed, 12 insertions, 0 deletions
diff --git a/src/theme.c b/src/theme.c
index b6e18afa..aafbd859 100644
--- a/src/theme.c
+++ b/src/theme.c
@@ -70,6 +70,7 @@ static struct colours_t {
         NCURSES_COLOR_T statusbarnew;
         NCURSES_COLOR_T maintext;
         NCURSES_COLOR_T inputtext;
+        NCURSES_COLOR_T timetext;
         NCURSES_COLOR_T splashtext;
         NCURSES_COLOR_T online;
         NCURSES_COLOR_T away;
@@ -158,6 +159,7 @@ theme_init_colours(void)
     init_pair(3, colour_prefs.error, colour_prefs.bkgnd);
     init_pair(4, colour_prefs.incoming, colour_prefs.bkgnd);
     init_pair(5, colour_prefs.inputtext, colour_prefs.bkgnd);
+    init_pair(6, colour_prefs.timetext, colour_prefs.bkgnd);
 
     // title bar
     init_pair(10, colour_prefs.titlebartext, colour_prefs.titlebar);
@@ -257,6 +259,9 @@ _load_colours(void)
     gchar *inputtext_val = g_key_file_get_string(theme, "colours", "inputtext", NULL);
     _set_colour(inputtext_val, &colour_prefs.inputtext, COLOR_WHITE);
 
+    gchar *timetext_val = g_key_file_get_string(theme, "colours", "timetext", NULL);
+    _set_colour(timetext_val, &colour_prefs.timetext, COLOR_WHITE);
+
     gchar *online_val = g_key_file_get_string(theme, "colours", "online", NULL);
     _set_colour(online_val, &colour_prefs.online, COLOR_GREEN);
 
diff --git a/src/theme.h b/src/theme.h
index 459135d6..ca1c2245 100644
--- a/src/theme.h
+++ b/src/theme.h
@@ -39,6 +39,7 @@
 #define COLOUR_ERROR            COLOR_PAIR(3)
 #define COLOUR_INCOMING         COLOR_PAIR(4)
 #define COLOUR_INPUT_TEXT       COLOR_PAIR(5)
+#define COLOUR_TIME             COLOR_PAIR(6)
 #define COLOUR_TITLE_TEXT       COLOR_PAIR(10)
 #define COLOUR_TITLE_BRACKET    COLOR_PAIR(11)
 #define COLOUR_STATUS_TEXT      COLOR_PAIR(20)
diff --git a/src/windows.c b/src/windows.c
index 27c73cb4..e87109c8 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -393,7 +393,9 @@ win_show_incomming_msg(const char * const from, const char * const message,
         } else {
             GDateTime *time = g_date_time_new_from_timeval_utc(tv_stamp);
             gchar *date_fmt = g_date_time_format(time, "%H:%M:%S");
+            wattron(win, COLOUR_TIME);
             wprintw(win, "%s - ", date_fmt);
+            wattroff(win, COLOUR_TIME);
             g_date_time_unref(time);
             g_free(date_fmt);
         }
@@ -430,7 +432,9 @@ win_show_incomming_msg(const char * const from, const char * const message,
         } else {
             GDateTime *time = g_date_time_new_from_timeval_utc(tv_stamp);
             gchar *date_fmt = g_date_time_format(time, "%H:%M:%S");
+            wattron(win, COLOUR_TIME);
             wprintw(win, "%s - ", date_fmt);
+            wattroff(win, COLOUR_TIME);
             g_date_time_unref(time);
             g_free(date_fmt);
         }
@@ -1521,7 +1525,9 @@ _win_show_time(WINDOW *win)
 {
     GDateTime *time = g_date_time_new_now_local();
     gchar *date_fmt = g_date_time_format(time, "%H:%M:%S");
+    wattron(win, COLOUR_TIME);
     wprintw(win, "%s - ", date_fmt);
+    wattroff(win, COLOUR_TIME);
     g_date_time_unref(time);
     g_free(date_fmt);
 }