changeset 328:6a5b6bbf9836

- Fixed the "Load Images" menu item in the page popup.
author jcid
date Mon, 08 Sep 2008 17:02:16 +0200
parents 7d83c41d52b9
children c0f8ecf018e1
files src/html.cc src/html_common.hh src/menu.cc src/menu.hh src/uicmd.cc src/uicmd.hh
diffstat 6 files changed, 20 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/html.cc	Mon Sep 08 16:50:15 2008 +0200
+++ b/src/html.cc	Mon Sep 08 17:02:16 2008 +0200
@@ -701,6 +701,16 @@
    return forms->get (forms->size() - 1);
 }
 
+bool_t DilloHtml::unloadedImages()
+{
+   for (int i = 0; i < images->size(); i++) {
+      if (images->get(i)->image != NULL) {
+         return TRUE;
+      }
+   }
+   return FALSE;
+}
+
 /*
  * Load images if they were disabled.
  */
@@ -756,7 +766,7 @@
          if (link == -1) {
             a_UIcmd_page_popup(bw, a_History_get_url(NAV_TOP_UIDX(bw)),
                                bw->num_page_bugs ? bw->page_bugs->str:NULL,
-                               prefs.load_images);
+                               html->unloadedImages());
             ret = true;
          } else {
             a_UIcmd_link_popup(bw, html->links->get(link));
--- a/src/html_common.hh	Mon Sep 08 16:50:15 2008 +0200
+++ b/src/html_common.hh	Mon Sep 08 17:02:16 2008 +0200
@@ -221,6 +221,7 @@
    int formNew(DilloHtmlMethod method, const DilloUrl *action,
                DilloHtmlEnc enc, const char *charset);
    DilloHtmlForm *getCurrentForm ();
+   bool_t unloadedImages();
    void loadImages (const DilloUrl *pattern);
 };
 
--- a/src/menu.cc	Mon Sep 08 16:50:15 2008 +0200
+++ b/src/menu.cc	Mon Sep 08 17:02:16 2008 +0200
@@ -232,7 +232,7 @@
  * Page popup menu (construction & popup)
  */
 void a_Menu_page_popup(BrowserWindow *bw, const DilloUrl *url, 
-                       const char *bugs_txt, int prefs_load_images)
+                       const char *bugs_txt, bool_t unloaded_imgs)
 {
    // One menu for every browser window
    static PopupMenu *pm = 0;
@@ -275,10 +275,10 @@
    else
       view_page_bugs_item->activate();
 
-   if (prefs_load_images == 1)
+   if (unloaded_imgs == TRUE)
+      load_images_item->activate();
+   else
       load_images_item->deactivate();
-   else
-      load_images_item->activate();
 
    // NULL is wildcard
    load_images_item->user_data(NULL);
--- a/src/menu.hh	Mon Sep 08 16:50:15 2008 +0200
+++ b/src/menu.hh	Mon Sep 08 17:02:16 2008 +0200
@@ -8,7 +8,7 @@
 #endif /* __cplusplus */
 
 void a_Menu_page_popup(BrowserWindow *bw, const DilloUrl *url,
-                       const char *bugs_txt, int prefs_load_images);
+                       const char *bugs_txt, bool_t unloaded_imgs);
 void a_Menu_link_popup(BrowserWindow *bw, const DilloUrl *url);
 void a_Menu_image_popup(BrowserWindow *bw, const DilloUrl *url,
                         DilloUrl *link_url);
--- a/src/uicmd.cc	Mon Sep 08 16:50:15 2008 +0200
+++ b/src/uicmd.cc	Mon Sep 08 17:02:16 2008 +0200
@@ -456,9 +456,9 @@
  * Popup the page menu
  */
 void a_UIcmd_page_popup(void *vbw, const DilloUrl *url,
-                        const char *bugs_txt, int prefs_load_images)
+                        const char *bugs_txt, bool_t unloaded_imgs)
 {
-   a_Menu_page_popup((BrowserWindow*)vbw, url, bugs_txt, prefs_load_images);
+   a_Menu_page_popup((BrowserWindow*)vbw, url, bugs_txt, unloaded_imgs);
 }
 
 /*
--- a/src/uicmd.hh	Mon Sep 08 16:50:15 2008 +0200
+++ b/src/uicmd.hh	Mon Sep 08 17:02:16 2008 +0200
@@ -32,7 +32,7 @@
 void a_UIcmd_findtext_search(BrowserWindow *bw, const char *key, int case_sens);
 void a_UIcmd_findtext_reset(BrowserWindow *bw);
 void a_UIcmd_page_popup(void *vbw, const DilloUrl *url,
-                        const char *bugs_txt, int prefs_load_images);
+                        const char *bugs_txt, bool_t unloaded_imgs);
 void a_UIcmd_link_popup(void *vbw, const DilloUrl *url);
 void a_UIcmd_image_popup(void *vbw, const DilloUrl *url, DilloUrl *link_url);
 void a_UIcmd_copy_urlstr(BrowserWindow *bw, const char *urlstr);