about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-09-16 22:23:59 +0100
committerJames Booth <boothj5@gmail.com>2014-09-16 22:23:59 +0100
commit16acb52ca3833c947bed07218caaf918b266fbed (patch)
treefceabfd4383c92e135334fb6319009784930f1ab /src/ui
parentef8b8e637d36058c948aeac6837ccb555b993f31 (diff)
downloadprofani-tty-16acb52ca3833c947bed07218caaf918b266fbed.tar.gz
Show indicator when form has unsaved changes
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/statusbar.c9
-rw-r--r--src/ui/titlebar.c10
-rw-r--r--src/ui/windows.c6
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 *