1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-16 15:04:37 -04:00

Merge with master

This commit is contained in:
Witold Filipczyk 2006-12-30 13:45:33 +01:00 committed by Witold Filipczyk
commit 7a424fca7a
2 changed files with 12 additions and 10 deletions

View File

@ -9,8 +9,9 @@
#include "elinks.h"
#include "cache/cache.h"
#include "document/document.h"
#include "document/view.h"
#include "scripting/python/core.h"
#include "session/location.h"
#include "session/session.h"
/* Python interface to get the current document's body. */
@ -23,8 +24,9 @@ If a document is being viewed, return its body; otherwise return None.\n");
static PyObject *
python_current_document(PyObject *self, PyObject *args)
{
if (python_ses && have_location(python_ses)) {
struct cache_entry *cached = find_in_cache(cur_loc(python_ses)->vs.uri);
if (python_ses && python_ses->doc_view
&& python_ses->doc_view->document) {
struct cache_entry *cached = python_ses->doc_view->document->cached;
struct fragment *f = cached ? cached->frag.next : NULL;
if (f) return PyString_FromStringAndSize(f->data, f->length);
@ -45,8 +47,9 @@ otherwise return None.\n");
static PyObject *
python_current_header(PyObject *self, PyObject *args)
{
if (python_ses && have_location(python_ses)) {
struct cache_entry *cached = find_in_cache(cur_loc(python_ses)->vs.uri);
if (python_ses && python_ses->doc_view
&& python_ses->doc_view->document) {
struct cache_entry *cached = python_ses->doc_view->document->cached;
if (cached && cached->head)
return PyString_FromString(cached->head);

View File

@ -1028,7 +1028,8 @@ activate_link(struct session *ses, struct document_view *doc_view,
* buttons in the group. Do it in this order because
* further @find_form_state calls may reallocate
* @doc_view->vs->form_info[] and thereby make the @fs
* pointer invalid. */
* pointer invalid. This also allows us to re-use
* @fs in the loop. */
fs->state = 1;
foreach (form, doc_view->document->forms) {
struct form_control *fc;
@ -1040,10 +1041,8 @@ activate_link(struct session *ses, struct document_view *doc_view,
if (fc->type == FC_RADIO
&& !xstrcmp(fc->name, link_fc->name)
&& fc != link_fc) {
struct form_state *frm_st;
frm_st = find_form_state(doc_view, fc);
if (frm_st) frm_st->state = 0;
fs = find_form_state(doc_view, fc);
if (fs) fs->state = 0;
}
}
}