about summary refs log tree commit diff stats
path: root/src/ui/core.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-09-26 00:25:04 +0100
committerJames Booth <boothj5@gmail.com>2013-09-26 00:25:04 +0100
commit2625630ff367eeab566065e92258d4724bfeefed (patch)
tree1831207eca3dd0f3a837b0414d1ed1aef83b1863 /src/ui/core.c
parent8be4cd1f2731ebec069c5848148b6748f318ea98 (diff)
downloadprofani-tty-2625630ff367eeab566065e92258d4724bfeefed.tar.gz
Next and previous windows, handle KEY_CODE_YES terms, jump empty wins
Diffstat (limited to 'src/ui/core.c')
-rw-r--r--src/ui/core.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index 6b415a2b..86d216ad 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -616,6 +616,68 @@ ui_switch_win(const int i)
 }
 
 void
+ui_next_win(void)
+{
+    ui_current_page_off();
+    ProfWin *new_current = wins_get_next();
+    int i = wins_get_num(new_current);
+    wins_set_current_by_num(i);
+    ui_current_page_off();
+
+    new_current->unread = 0;
+
+    if (i == 1) {
+        title_bar_title();
+        status_bar_active(1);
+    } else {
+        PContact contact = roster_get_contact(new_current->from);
+        if (contact != NULL) {
+            if (p_contact_name(contact) != NULL) {
+                title_bar_set_recipient(p_contact_name(contact));
+            } else {
+                title_bar_set_recipient(new_current->from);
+            }
+        } else {
+            title_bar_set_recipient(new_current->from);
+        }
+        title_bar_draw();;
+        status_bar_active(i);
+    }
+    wins_refresh_current();
+}
+
+void
+ui_previous_win(void)
+{
+    ui_current_page_off();
+    ProfWin *new_current = wins_get_previous();
+    int i = wins_get_num(new_current);
+    wins_set_current_by_num(i);
+    ui_current_page_off();
+
+    new_current->unread = 0;
+
+    if (i == 1) {
+        title_bar_title();
+        status_bar_active(1);
+    } else {
+        PContact contact = roster_get_contact(new_current->from);
+        if (contact != NULL) {
+            if (p_contact_name(contact) != NULL) {
+                title_bar_set_recipient(p_contact_name(contact));
+            } else {
+                title_bar_set_recipient(new_current->from);
+            }
+        } else {
+            title_bar_set_recipient(new_current->from);
+        }
+        title_bar_draw();;
+        status_bar_active(i);
+    }
+    wins_refresh_current();
+}
+
+void
 ui_clear_current(void)
 {
     wins_clear_current();