From 16acb52ca3833c947bed07218caaf918b266fbed Mon Sep 17 00:00:00 2001 From: James Booth <boothj5@gmail.com> Date: Tue, 16 Sep 2014 22:23:59 +0100 Subject: [PATCH] Show indicator when form has unsaved changes --- src/ui/statusbar.c | 9 +-------- src/ui/titlebar.c | 10 +++++++++- src/ui/windows.c | 6 +++++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c index 2d9ea533..0f3267b3 100644 --- a/src/ui/statusbar.c +++ b/src/ui/statusbar.c @@ -103,14 +103,7 @@ create_status_bar(void) void status_bar_update_virtual(void) { - GDateTime *now_time = g_date_time_new_now_local(); - GTimeSpan elapsed = g_date_time_difference(now_time, last_time); - - if (elapsed >= TIME_CHECK) { - _status_bar_draw(); - } - - g_date_time_unref(now_time); + _status_bar_draw(); } void diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c index ad374786..811ac2c2 100644 --- a/src/ui/titlebar.c +++ b/src/ui/titlebar.c @@ -86,10 +86,10 @@ title_bar_update_virtual(void) g_timer_destroy(typing_elapsed); typing_elapsed = NULL; - _title_bar_draw(); } } } + _title_bar_draw(); } void @@ -241,6 +241,14 @@ _title_bar_draw(void) } #endif + // show indicator for unsaved forms + ProfWin *current = wins_get_current(); + if ((current != NULL ) && (current->type == WIN_MUC_CONFIG)) { + if ((current->form != NULL) && (current->form->modified)) { + wprintw(win, " *"); + } + } + // show contact typing if (typing) { wprintw(win, " (typing...)"); diff --git a/src/ui/windows.c b/src/ui/windows.c index 5156684b..ff7fc3e2 100644 --- a/src/ui/windows.c +++ b/src/ui/windows.c @@ -81,7 +81,11 @@ wins_get_console(void) ProfWin * wins_get_current(void) { - return g_hash_table_lookup(windows, GINT_TO_POINTER(current)); + if (windows != NULL) { + return g_hash_table_lookup(windows, GINT_TO_POINTER(current)); + } else { + return NULL; + } } GList *