summaryrefslogtreecommitdiff
path: root/amiga/gui.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2014-10-26 15:41:44 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2014-10-26 15:41:44 +0000
commit0c77d85f8976046b0c5cf2915f0618e1522099ac (patch)
tree5ea4da05ae8c4b57e306d3f61867c5670e3d7130 /amiga/gui.c
parentb751513d6f1515976238adf68598729b9021160f (diff)
downloadnetsurf-0c77d85f8976046b0c5cf2915f0618e1522099ac.tar.gz
netsurf-0c77d85f8976046b0c5cf2915f0618e1522099ac.tar.bz2
Make window counting a generic function
Diffstat (limited to 'amiga/gui.c')
-rw-r--r--amiga/gui.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index c63833ad8..76e484933 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -3229,6 +3229,38 @@ static void ami_gui_search_ico_refresh(void *p)
search_web_select_provider(-1);
}
+/**
+ * Count windows, and optionally tabs.
+ *
+ * \param window window to count tabs of
+ * \param tabs if window > 0, contains the number of tabs in that window,
+ * unchanged otherwise
+ * \return number of windows currently open
+ */
+int ami_gui_count_windows(int window, int *tabs)
+{
+ int windows = 0;
+ struct nsObject *node, *nnode;
+ struct gui_window_2 *gwin;
+
+ if(!IsMinListEmpty(window_list)) {
+ node = (struct nsObject *)GetHead((struct List *)window_list);
+ do {
+ nnode=(struct nsObject *)GetSucc((struct Node *)node);
+
+ gwin = node->objstruct;
+
+ if(node->Type == AMINS_WINDOW) {
+ windows++;
+ if(window == windows) *tabs = gwin->tabs;
+ }
+ } while((node = nnode));
+ }
+ return windows;
+}
+
+
+
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin)
{
nsurl *url;