Diff of /cbrpager-maemo/branches/MAEMO_0_9_20/src/global.c [r22] .. [r23] Maximize Restore

  Switch to side-by-side view

--- a/cbrpager-maemo/branches/MAEMO_0_9_20/src/global.c
+++ b/cbrpager-maemo/branches/MAEMO_0_9_20/src/global.c
@@ -59,7 +59,6 @@
 
 #define ZONE_SIZE 20
 
-GArray          *pagelist = NULL;
 int		 page_nr = 0,
   timer_id = 0;
 #if USE_HILDON
@@ -208,15 +207,6 @@
 }
 
 
-static void
-clear_pagelist(GArray* pl)
-{
-  int i;
-  for(i = 0; i < pl->len; ++i)
-    g_free(g_array_index(pagelist, gchar*, i));
-  g_array_free(pl, TRUE);
-}
-
 void
 clean_up(void)
 {
@@ -243,15 +233,6 @@
   /* re-sort and re-request the current page */ 
   image_cache_resort();
   show_page(page_nr);
-}
-
-static void
-add_to_pagelist(const gchar* filename, gpointer user_data)
-{
-  GArray* pl = (GArray*)user_data;
-  gchar* duped = g_strdup(filename);
-  
-  g_array_append_val(pl, duped);
 }
 
 void
@@ -330,7 +311,7 @@
   case 0:
     if(page_nr != 0)
       draw_indicators(canvas, -1);
-    if(pagelist && page_nr + pref.nrpages < pagelist->len)
+    if(page_nr + pref.nrpages < image_cache_length())
       draw_indicators(canvas, 1);
     /* set up a timer to remove the arrows after a time */
     if(timeout_id != 0) {
@@ -593,7 +574,7 @@
 void
 next_page(int adv, gboolean show_indicator)
 {
-  int by = adv, nr_pages = pagelist ? pagelist->len : 0;
+  int by = adv, nr_pages = image_cache_length();
 
   if (by == 0) by = pref.nrpages;
   if (page_nr == (nr_pages - by)) {
@@ -650,10 +631,9 @@
 void
 goto_end(void)
 {
-  if(!pagelist)
-    return;
-  page_nr = pagelist->len - pref.nrpages;
-  show_page(page_nr);
+  page_nr = image_cache_length() - pref.nrpages;
+  if(page_nr > 0)
+    show_page(page_nr);
 }
 
 
@@ -971,7 +951,7 @@
 
   if (event->type != GDK_BUTTON_PRESS) return;
 
-  nr_pages = pagelist ? pagelist->len : 0;
+  nr_pages = image_cache_length();
 
   switch (event->button) {
   case 1:				// Left button
@@ -1109,7 +1089,7 @@
 void
 goto_page()
 {
-  int nr_pages = pagelist ? pagelist->len : 0;
+  int nr_pages = image_cache_length();
   int result = invoke_goto_page_dialog(MainWindow, 
 				       page_nr, 
 				       nr_pages - pref.nrpages);