r2873 bursa - in /trunk/netsurf/utils: hashtable.c hashtable.h
by netsurf@semichrome.net
Author: bursa
Date: Sun Aug 20 17:02:22 2006
New Revision: 2873
URL: http://svn.semichrome.net?rev=2873&view=rev
Log:
Check for malloc failing in hash_add(). Remove unnecessary casts.
Modified:
trunk/netsurf/utils/hashtable.c
trunk/netsurf/utils/hashtable.h
Modified: trunk/netsurf/utils/hashtable.c
URL: http://svn.semichrome.net/trunk/netsurf/utils/hashtable.c?rev=2873&r1=287...
==============================================================================
--- trunk/netsurf/utils/hashtable.c (original)
+++ trunk/netsurf/utils/hashtable.c Sun Aug 20 17:02:22 2006
@@ -5,7 +5,8 @@
* Copyright 2006 Rob Kendrick <rjek(a)rjek.com>
*/
-/** Write-Once hash table for string to string mappings */
+/** \file
+ * Write-Once hash table for string to string mappings */
#include <stdlib.h>
#include <string.h>
@@ -19,8 +20,7 @@
struct hash_table *hash_create(unsigned int chains)
{
- struct hash_table *r = (struct hash_table *)malloc(
- sizeof(struct hash_table));
+ struct hash_table *r = malloc(sizeof(struct hash_table));
if (r == NULL) {
LOG(("Not enough memory for hash table."));
@@ -28,8 +28,7 @@
}
r->nchains = chains;
- r->chain = (struct hash_entry **)
- calloc(chains, sizeof(struct hash_entry));
+ r->chain = calloc(chains, sizeof(struct hash_entry));
if (r->chain == NULL) {
LOG(("Not enough memory for %d hash table chains.", chains));
@@ -42,7 +41,7 @@
void hash_destroy(struct hash_table *ht)
{
- int i;
+ unsigned int i;
for (i = 0; i < ht->nchains; i++) {
if (ht->chain[i] != NULL) {
@@ -65,8 +64,11 @@
{
unsigned int h = hash_string_fnv(key);
unsigned int c = h % ht->nchains;
- struct hash_entry *e = (struct hash_entry *)malloc(
- sizeof(struct hash_entry));
+ struct hash_entry *e = malloc(sizeof(struct hash_entry));
+ if (e == NULL) {
+ LOG(("Not enough memory for hash entry."));
+ return false;
+ }
e->key = strdup(key);
if (e->key == NULL) {
Modified: trunk/netsurf/utils/hashtable.h
URL: http://svn.semichrome.net/trunk/netsurf/utils/hashtable.h?rev=2873&r1=287...
==============================================================================
--- trunk/netsurf/utils/hashtable.h (original)
+++ trunk/netsurf/utils/hashtable.h Sun Aug 20 17:02:22 2006
@@ -5,10 +5,11 @@
* Copyright 2006 Rob Kendrick <rjek(a)rjek.com>
*/
-/** Write-Once hash table for string to string mappings */
+/** \file
+ * Write-Once hash table for string to string mappings */
-#ifndef _NETSURF_HASH_H_
-#define _NETSURF_HASH_H_
+#ifndef _NETSURF_UTILS_HASHTABLE_H_
+#define _NETSURF_UTILS_HASHTABLE_H_
#include <stdbool.h>
16 years, 9 months
r2872 rjek - in /trunk/netsurf/utils: hashtable.c hashtable.h
by netsurf@semichrome.net
Author: rjek
Date: Sun Aug 20 14:46:30 2006
New Revision: 2872
URL: http://svn.semichrome.net?rev=2872&view=rev
Log:
Make hash_add() return success/failure bool
Modified:
trunk/netsurf/utils/hashtable.c
trunk/netsurf/utils/hashtable.h
Modified: trunk/netsurf/utils/hashtable.c
URL: http://svn.semichrome.net/trunk/netsurf/utils/hashtable.c?rev=2872&r1=287...
==============================================================================
--- trunk/netsurf/utils/hashtable.c (original)
+++ trunk/netsurf/utils/hashtable.c Sun Aug 20 14:46:30 2006
@@ -9,6 +9,7 @@
#include <stdlib.h>
#include <string.h>
+#include <stdbool.h>
#ifdef TEST_RIG
#include <assert.h>
#include <stdio.h>
@@ -60,7 +61,7 @@
free(ht);
}
-void hash_add(struct hash_table *ht, const char *key, const char *value)
+bool hash_add(struct hash_table *ht, const char *key, const char *value)
{
unsigned int h = hash_string_fnv(key);
unsigned int c = h % ht->nchains;
@@ -68,9 +69,24 @@
sizeof(struct hash_entry));
e->key = strdup(key);
+ if (e->key == NULL) {
+ LOG(("Unable to strdup() key for hash table."));
+ free(e);
+ return false;
+ }
+
e->value = strdup(value);
+ if (e->value == NULL) {
+ LOG(("Unable to strdup() value for hash table."));
+ free(e->key);
+ free(e);
+ return false;
+ }
+
e->next = ht->chain[c];
ht->chain[c] = e;
+
+ return true;
}
const char *hash_get(struct hash_table *ht, const char *key)
Modified: trunk/netsurf/utils/hashtable.h
URL: http://svn.semichrome.net/trunk/netsurf/utils/hashtable.h?rev=2872&r1=287...
==============================================================================
--- trunk/netsurf/utils/hashtable.h (original)
+++ trunk/netsurf/utils/hashtable.h Sun Aug 20 14:46:30 2006
@@ -9,6 +9,8 @@
#ifndef _NETSURF_HASH_H_
#define _NETSURF_HASH_H_
+
+#include <stdbool.h>
struct hash_entry {
char *key;
@@ -23,7 +25,7 @@
struct hash_table *hash_create(unsigned int chains);
void hash_destroy(struct hash_table *ht);
-void hash_add(struct hash_table *ht, const char *key, const char *value);
+bool hash_add(struct hash_table *ht, const char *key, const char *value);
const char *hash_get(struct hash_table *ht, const char *key);
unsigned int hash_string_fnv(const char *datum);
16 years, 9 months
r2871 rjek - in /trunk/netsurf/utils: hashtable.c hashtable.h
by netsurf@semichrome.net
Author: rjek
Date: Sun Aug 20 13:25:41 2006
New Revision: 2871
URL: http://svn.semichrome.net?rev=2871&view=rev
Log:
Implement simple reusable write-once hash table for use in new Messages file handling.
Added:
trunk/netsurf/utils/hashtable.c
trunk/netsurf/utils/hashtable.h
Added: trunk/netsurf/utils/hashtable.c
URL: http://svn.semichrome.net/trunk/netsurf/utils/hashtable.c?rev=2871&view=auto
==============================================================================
--- trunk/netsurf/utils/hashtable.c (added)
+++ trunk/netsurf/utils/hashtable.c Sun Aug 20 13:25:41 2006
@@ -1,0 +1,186 @@
+/*
+ * This file is part of NetSurf, http://netsurf.sourceforge.net/
+ * Licensed under the GNU General Public License,
+ * http://www.opensource.org/licenses/gpl-license
+ * Copyright 2006 Rob Kendrick <rjek(a)rjek.com>
+ */
+
+/** Write-Once hash table for string to string mappings */
+
+#include <stdlib.h>
+#include <string.h>
+#ifdef TEST_RIG
+#include <assert.h>
+#include <stdio.h>
+#endif
+#include "netsurf/utils/hashtable.h"
+#include "netsurf/utils/log.h"
+
+struct hash_table *hash_create(unsigned int chains)
+{
+ struct hash_table *r = (struct hash_table *)malloc(
+ sizeof(struct hash_table));
+
+ if (r == NULL) {
+ LOG(("Not enough memory for hash table."));
+ return NULL;
+ }
+
+ r->nchains = chains;
+ r->chain = (struct hash_entry **)
+ calloc(chains, sizeof(struct hash_entry));
+
+ if (r->chain == NULL) {
+ LOG(("Not enough memory for %d hash table chains.", chains));
+ free(r);
+ return NULL;
+ }
+
+ return r;
+}
+
+void hash_destroy(struct hash_table *ht)
+{
+ int i;
+
+ for (i = 0; i < ht->nchains; i++) {
+ if (ht->chain[i] != NULL) {
+ struct hash_entry *e = ht->chain[i];
+ while (e) {
+ struct hash_entry *n = e->next;
+ free(e->key);
+ free(e->value);
+ free(e);
+ e = n;
+ }
+ }
+ }
+
+ free(ht->chain);
+ free(ht);
+}
+
+void hash_add(struct hash_table *ht, const char *key, const char *value)
+{
+ unsigned int h = hash_string_fnv(key);
+ unsigned int c = h % ht->nchains;
+ struct hash_entry *e = (struct hash_entry *)malloc(
+ sizeof(struct hash_entry));
+
+ e->key = strdup(key);
+ e->value = strdup(value);
+ e->next = ht->chain[c];
+ ht->chain[c] = e;
+}
+
+const char *hash_get(struct hash_table *ht, const char *key)
+{
+ unsigned int h = hash_string_fnv(key);
+ unsigned int c = h % ht->nchains;
+ struct hash_entry *e = ht->chain[c];
+
+ while (e) {
+ if (!strcmp(key, e->key))
+ return e->value;
+ e = e->next;
+ }
+
+ return NULL;
+
+}
+
+unsigned int hash_string_fnv(const char *datum)
+{
+ unsigned int z = 0x01000193, i = 0;
+
+ while (datum[i]) {
+ z *= 0x01000193;
+ z ^= datum[i];
+ datum++;
+ }
+
+ return z;
+}
+
+#ifdef TEST_RIG
+
+int main(int argc, char *argv[])
+{
+ struct hash_table *a, *b;
+ FILE *dict;
+ char keybuf[BUFSIZ], valbuf[BUFSIZ];
+
+ a = hash_create(79);
+ assert(a != NULL);
+
+ b = hash_create(103);
+ assert(b != NULL);
+
+ hash_add(a, "cow", "moo");
+ hash_add(b, "moo", "cow");
+
+ hash_add(a, "pig", "oink");
+ hash_add(b, "oink", "pig");
+
+ hash_add(a, "chicken", "cluck");
+ hash_add(b, "cluck", "chicken");
+
+ hash_add(a, "dog", "woof");
+ hash_add(b, "woof", "dog");
+
+ hash_add(a, "cat", "meow");
+ hash_add(b, "meow", "cat");
+
+#define MATCH(x,y) assert(!strcmp(hash_get(a, x), y)); assert(!strcmp(hash_get(b, y), x))
+ MATCH("cow", "moo");
+ MATCH("pig", "oink");
+ MATCH("chicken", "cluck");
+ MATCH("dog", "woof");
+ MATCH("cat", "meow");
+
+ hash_destroy(a);
+ hash_destroy(b);
+
+ /* this test requires /usr/share/dict/words - a large list of English
+ * words. We load the entire file - odd lines are used as keys, and
+ * even lines are used as the values for the previous line. we then
+ * work through it again making sure everything matches.
+ *
+ * We do this twice - once in a hash table with many chains, and once
+ * with a hash table with fewer chains.
+ */
+
+ a = hash_create(1031);
+ b = hash_create(7919);
+
+ dict = fopen("/usr/share/dict/words", "r");
+ if (dict == NULL) {
+ fprintf(stderr, "Unable to open /usr/share/dict/words - extensive testing skipped.\n");
+ exit(0);
+ }
+
+ while (!feof(dict)) {
+ fscanf(dict, "%s", keybuf);
+ fscanf(dict, "%s", valbuf);
+ hash_add(a, keybuf, valbuf);
+ hash_add(b, keybuf, valbuf);
+ }
+
+ fseek(dict, 0, SEEK_SET);
+
+ while (!feof(dict)) {
+ fscanf(dict, "%s", keybuf);
+ fscanf(dict, "%s", valbuf);
+ assert(strcmp(hash_get(a, keybuf), valbuf) == 0);
+ assert(strcmp(hash_get(b, keybuf), valbuf) == 0);
+ }
+
+ hash_destroy(a);
+ hash_destroy(b);
+
+ fclose(dict);
+
+ return 0;
+}
+
+#endif
Added: trunk/netsurf/utils/hashtable.h
URL: http://svn.semichrome.net/trunk/netsurf/utils/hashtable.h?rev=2871&view=auto
==============================================================================
--- trunk/netsurf/utils/hashtable.h (added)
+++ trunk/netsurf/utils/hashtable.h Sun Aug 20 13:25:41 2006
@@ -1,0 +1,30 @@
+/*
+ * This file is part of NetSurf, http://netsurf.sourceforge.net/
+ * Licensed under the GNU General Public License,
+ * http://www.opensource.org/licenses/gpl-license
+ * Copyright 2006 Rob Kendrick <rjek(a)rjek.com>
+ */
+
+/** Write-Once hash table for string to string mappings */
+
+#ifndef _NETSURF_HASH_H_
+#define _NETSURF_HASH_H_
+
+struct hash_entry {
+ char *key;
+ char *value;
+ struct hash_entry *next;
+};
+
+struct hash_table {
+ unsigned int nchains;
+ struct hash_entry **chain;
+};
+
+struct hash_table *hash_create(unsigned int chains);
+void hash_destroy(struct hash_table *ht);
+void hash_add(struct hash_table *ht, const char *key, const char *value);
+const char *hash_get(struct hash_table *ht, const char *key);
+unsigned int hash_string_fnv(const char *datum);
+
+#endif
16 years, 9 months
r2870 rjek - /trunk/netsurf/utils/messages.c
by netsurf@semichrome.net
Author: rjek
Date: Sun Aug 20 00:37:58 2006
New Revision: 2870
URL: http://svn.semichrome.net?rev=2870&view=rev
Log:
Slightly improve hash table for Messages file. Paves way for more generic use of it, as well as more constant performance.
Modified:
trunk/netsurf/utils/messages.c
Modified: trunk/netsurf/utils/messages.c
URL: http://svn.semichrome.net/trunk/netsurf/utils/messages.c?rev=2870&r1=2869...
==============================================================================
--- trunk/netsurf/utils/messages.c (original)
+++ trunk/netsurf/utils/messages.c Sun Aug 20 00:37:58 2006
@@ -21,7 +21,7 @@
#include "netsurf/utils/utils.h"
/** We store the messages in a fixed-size hash table. */
-#define HASH_SIZE 77
+#define HASH_SIZE 101
/** Maximum length of a key. */
#define MAX_KEY_LENGTH 24
@@ -126,13 +126,22 @@
* Hash function for keys.
*/
+/* This is Fowler Noll Vo - a very fast and simple hash ideal for short
+ * strings. See http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash for more
+ * details.
+ */
unsigned int messages_hash(const char *s)
{
- unsigned int i, z = 0;
- if (!s)
+ unsigned int z = 0x01000193, i;
+
+ if (s == NULL)
return 0;
- for (i = 0; i != MAX_KEY_LENGTH && s[i]; i++)
- z += s[i] & 0x1f; /* lower 5 bits, case insensitive */
+
+ for (i = 0; i != MAX_KEY_LENGTH && s[i]; i++) {
+ z *= 0x01000193;
+ z ^= (s[i] & 0x1f); /* lower 5 bits, case insensitive */
+ }
+
return z % HASH_SIZE;
}
16 years, 9 months
r2869 adrianl - in /trunk/netsurf: desktop/knockout.c desktop/plotters.h riscos/artworks.c riscos/draw.c riscos/plotters.c riscos/print.c riscos/save_draw.c riscos/sprite.c
by netsurf@semichrome.net
Author: adrianl
Date: Sat Aug 19 20:31:07 2006
New Revision: 2869
URL: http://svn.semichrome.net?rev=2869&view=rev
Log:
Fix for knockout rendering of native formats
Modified:
trunk/netsurf/desktop/knockout.c
trunk/netsurf/desktop/plotters.h
trunk/netsurf/riscos/artworks.c
trunk/netsurf/riscos/draw.c
trunk/netsurf/riscos/plotters.c
trunk/netsurf/riscos/print.c
trunk/netsurf/riscos/save_draw.c
trunk/netsurf/riscos/sprite.c
Modified: trunk/netsurf/desktop/knockout.c
URL: http://svn.semichrome.net/trunk/netsurf/desktop/knockout.c?rev=2869&r1=28...
==============================================================================
--- trunk/netsurf/desktop/knockout.c (original)
+++ trunk/netsurf/desktop/knockout.c Sat Aug 19 20:31:07 2006
@@ -70,7 +70,8 @@
knockout_plot_bitmap,
knockout_plot_bitmap_tile,
knockout_plot_group_start,
- knockout_plot_group_end
+ knockout_plot_group_end,
+ knockout_plot_flush
};
Modified: trunk/netsurf/desktop/plotters.h
URL: http://svn.semichrome.net/trunk/netsurf/desktop/plotters.h?rev=2869&r1=28...
==============================================================================
--- trunk/netsurf/desktop/plotters.h (original)
+++ trunk/netsurf/desktop/plotters.h Sat Aug 19 20:31:07 2006
@@ -41,6 +41,7 @@
bool repeat_x, bool repeat_y);
bool (*group_start)(const char *name); /** optional */
bool (*group_end)(void); /** optional */
+ bool (*flush)(void);
};
/** Current plotters, must be assigned before use. */
Modified: trunk/netsurf/riscos/artworks.c
URL: http://svn.semichrome.net/trunk/netsurf/riscos/artworks.c?rev=2869&r1=286...
==============================================================================
--- trunk/netsurf/riscos/artworks.c (original)
+++ trunk/netsurf/riscos/artworks.c Sat Aug 19 20:31:07 2006
@@ -18,6 +18,7 @@
#include "oslib/os.h"
#include "oslib/wimp.h"
#include "netsurf/utils/config.h"
+#include "netsurf/desktop/plotters.h"
#include "netsurf/content/content.h"
#include "netsurf/riscos/artworks.h"
#include "netsurf/riscos/gui.h"
@@ -214,6 +215,9 @@
os_trfm matrix;
int vals[24];
+ if (plot.flush && !plot.flush())
+ return false;
+
/* Scaled image. Transform units (65536*OS units) */
matrix.entries[0][0] = width * 65536 / c->width;
matrix.entries[0][1] = 0;
Modified: trunk/netsurf/riscos/draw.c
URL: http://svn.semichrome.net/trunk/netsurf/riscos/draw.c?rev=2869&r1=2868&r2...
==============================================================================
--- trunk/netsurf/riscos/draw.c (original)
+++ trunk/netsurf/riscos/draw.c Sat Aug 19 20:31:07 2006
@@ -15,6 +15,7 @@
#include <stdlib.h>
#include "oslib/drawfile.h"
#include "netsurf/utils/config.h"
+#include "netsurf/desktop/plotters.h"
#include "netsurf/content/content.h"
#include "netsurf/riscos/draw.h"
#include "netsurf/riscos/gui.h"
@@ -86,6 +87,9 @@
os_error *error;
os_trfm matrix;
+ if (plot.flush && !plot.flush())
+ return false;
+
/* Scaled image. Transform units (65536*OS units) */
matrix.entries[0][0] = width * 65536 / c->width;
matrix.entries[0][1] = 0;
Modified: trunk/netsurf/riscos/plotters.c
URL: http://svn.semichrome.net/trunk/netsurf/riscos/plotters.c?rev=2869&r1=286...
==============================================================================
--- trunk/netsurf/riscos/plotters.c (original)
+++ trunk/netsurf/riscos/plotters.c Sat Aug 19 20:31:07 2006
@@ -19,6 +19,7 @@
#include "netsurf/riscos/image.h"
#include "netsurf/riscos/gui.h"
#include "netsurf/utils/log.h"
+
static bool ro_plot_clg(colour c);
@@ -59,6 +60,7 @@
ro_plot_bitmap,
ro_plot_bitmap_tile,
NULL,
+ NULL,
NULL
};
Modified: trunk/netsurf/riscos/print.c
URL: http://svn.semichrome.net/trunk/netsurf/riscos/print.c?rev=2869&r1=2868&r...
==============================================================================
--- trunk/netsurf/riscos/print.c (original)
+++ trunk/netsurf/riscos/print.c Sat Aug 19 20:31:07 2006
@@ -129,7 +129,8 @@
print_fonts_plot_bitmap,
print_fonts_plot_bitmap_tile,
print_fonts_plot_group_start,
- print_fonts_plot_group_end
+ print_fonts_plot_group_end,
+ NULL
};
Modified: trunk/netsurf/riscos/save_draw.c
URL: http://svn.semichrome.net/trunk/netsurf/riscos/save_draw.c?rev=2869&r1=28...
==============================================================================
--- trunk/netsurf/riscos/save_draw.c (original)
+++ trunk/netsurf/riscos/save_draw.c Sat Aug 19 20:31:07 2006
@@ -63,7 +63,8 @@
ro_save_draw_bitmap,
ro_save_draw_bitmap_tile,
ro_save_draw_group_start,
- ro_save_draw_group_end
+ ro_save_draw_group_end,
+ NULL
};
struct pencil_diagram *ro_save_draw_diagram;
Modified: trunk/netsurf/riscos/sprite.c
URL: http://svn.semichrome.net/trunk/netsurf/riscos/sprite.c?rev=2869&r1=2868&...
==============================================================================
--- trunk/netsurf/riscos/sprite.c (original)
+++ trunk/netsurf/riscos/sprite.c Sat Aug 19 20:31:07 2006
@@ -19,6 +19,7 @@
#include <stdlib.h>
#include "oslib/osspriteop.h"
#include "netsurf/utils/config.h"
+#include "netsurf/desktop/plotters.h"
#include "netsurf/content/content.h"
#include "netsurf/riscos/gui.h"
#include "netsurf/riscos/image.h"
@@ -98,6 +99,9 @@
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
float scale, colour background_colour)
{
+ if (plot.flush && !plot.flush())
+ return false;
+
return image_redraw(c->data.sprite.data,
ro_plot_origin_x + x * 2,
ro_plot_origin_y - y * 2,
16 years, 9 months
r2868 adrianl - /trunk/netsurf/desktop/browser.c
by netsurf@semichrome.net
Author: adrianl
Date: Sat Aug 19 20:27:59 2006
New Revision: 2868
URL: http://svn.semichrome.net?rev=2868&view=rev
Log:
Give Adjust precedence over Select
Modified:
trunk/netsurf/desktop/browser.c
Modified: trunk/netsurf/desktop/browser.c
URL: http://svn.semichrome.net/trunk/netsurf/desktop/browser.c?rev=2868&r1=286...
==============================================================================
--- trunk/netsurf/desktop/browser.c (original)
+++ trunk/netsurf/desktop/browser.c Sat Aug 19 20:27:59 2006
@@ -1565,10 +1565,10 @@
/* find icon in scrollbar and calculate scroll */
if (z < w) {
status = messages_get(vert ? "ScrollUp" : "ScrollLeft");
- if (mouse & but1)
+ if (mouse & but2)
+ scroll += 16;
+ else if (mouse & but1)
scroll -= 16;
- else if (mouse & but2)
- scroll += 16;
} else if (z < w + bar_start + w / 4) {
status = messages_get(vert ? "ScrollPUp" : "ScrollPLeft");
if (mouse & BROWSER_MOUSE_CLICK_1)
@@ -1611,10 +1611,10 @@
scroll -= page;
} else {
status = messages_get(vert ? "ScrollDown" : "ScrollRight");
- if (mouse & but1)
+ if (mouse & but2)
+ scroll -= 16;
+ else if (mouse & but1)
scroll += 16;
- else if (mouse & but2)
- scroll -= 16;
}
/* update box and redraw */
16 years, 9 months
r2867 rjek - in /trunk/netsurf: gtk/gtk_gui.c gtk/gtk_history.c gtk/gtk_history.h gtk/gtk_window.c gtk/netsurf.glade makefile
by netsurf@semichrome.net
Author: rjek
Date: Fri Aug 18 12:44:24 2006
New Revision: 2867
URL: http://svn.semichrome.net?rev=2867&view=rev
Log:
Very simple global history implementation for nsgtk, misc fixes
Added:
trunk/netsurf/gtk/gtk_history.c
trunk/netsurf/gtk/gtk_history.h
Modified:
trunk/netsurf/gtk/gtk_gui.c
trunk/netsurf/gtk/gtk_window.c
trunk/netsurf/gtk/netsurf.glade
trunk/netsurf/makefile
Modified: trunk/netsurf/gtk/gtk_gui.c
URL: http://svn.semichrome.net/trunk/netsurf/gtk/gtk_gui.c?rev=2867&r1=2866&r2...
==============================================================================
--- trunk/netsurf/gtk/gtk_gui.c (original)
+++ trunk/netsurf/gtk/gtk_gui.c Fri Aug 18 12:44:24 2006
@@ -31,6 +31,7 @@
#include "netsurf/gtk/gtk_completion.h"
#include "netsurf/gtk/options.h"
#include "netsurf/gtk/gtk_throbber.h"
+#include "netsurf/gtk/gtk_history.h"
#include "netsurf/render/box.h"
#include "netsurf/render/form.h"
#include "netsurf/render/html.h"
@@ -157,6 +158,8 @@
urldb_load(option_url_file);
urldb_load_cookies(option_cookie_file);
+
+ nsgtk_history_init();
}
@@ -309,8 +312,6 @@
void gui_cert_verify(struct browser_window *bw, struct content *c,
const struct ssl_cert_info *certs, unsigned long num) {}
-void global_history_add(const char *url) {}
-
utf8_convert_ret utf8_to_local_encoding(const char *string, size_t len,
char **result)
{
Added: trunk/netsurf/gtk/gtk_history.c
URL: http://svn.semichrome.net/trunk/netsurf/gtk/gtk_history.c?rev=2867&view=auto
==============================================================================
--- trunk/netsurf/gtk/gtk_history.c (added)
+++ trunk/netsurf/gtk/gtk_history.c Fri Aug 18 12:44:24 2006
@@ -1,0 +1,149 @@
+/*
+ * This file is part of NetSurf, http://netsurf.sourceforge.net/
+ * Licensed under the GNU General Public License,
+ * http://www.opensource.org/licenses/gpl-license
+ * Copyright 2006 Rob Kendrick <rjek(a)rjek.com>
+ */
+
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+#include "netsurf/utils/log.h"
+#include "netsurf/content/urldb.h"
+#include "netsurf/gtk/gtk_history.h"
+#include "netsurf/gtk/gtk_gui.h"
+
+enum
+{
+ COL_TITLE = 0,
+ COL_ADDRESS,
+ COL_LASTVISIT,
+ COL_TOTALVISITS,
+ COL_THUMBNAIL,
+ COL_NCOLS
+};
+
+GtkWindow *wndHistory;
+static GtkTreeView *treeview;
+static GtkTreeStore *history_tree;
+static GtkTreeSelection *selection;
+
+static bool nsgtk_history_add_internal(const char *, const struct url_data *);
+static void nsgtk_history_selection_changed(GtkTreeSelection *, gpointer);
+
+void nsgtk_history_init(void)
+{
+ GtkCellRenderer *renderer;
+
+ wndHistory = GTK_WINDOW(glade_xml_get_widget(gladeWindows,
+ "wndHistory"));
+ treeview = GTK_TREE_VIEW(glade_xml_get_widget(gladeWindows,
+ "treeHistory"));
+ history_tree = gtk_tree_store_new(COL_NCOLS,
+ G_TYPE_STRING, /* title */
+ G_TYPE_STRING, /* address */
+ G_TYPE_STRING, /* last visit */
+ G_TYPE_INT, /* nr. visits */
+ GDK_TYPE_PIXBUF); /* thumbnail */
+
+ selection = gtk_tree_view_get_selection(treeview);
+ gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
+ g_signal_connect(G_OBJECT(selection), "changed",
+ G_CALLBACK(nsgtk_history_selection_changed), NULL);
+
+ renderer = gtk_cell_renderer_text_new();
+ gtk_tree_view_insert_column_with_attributes(treeview, -1, "Title",
+ renderer,
+ "text",
+ COL_TITLE,
+ NULL);
+
+ gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(history_tree));
+
+ nsgtk_history_update();
+}
+
+void nsgtk_history_update(void)
+{
+ gtk_tree_store_clear(history_tree);
+ urldb_iterate_entries(nsgtk_history_add_internal);
+}
+
+bool nsgtk_history_add_internal(const char *url, const struct url_data *data)
+{
+ GtkTreeIter iter;
+
+ if (data->visits > 0)
+ {
+ gtk_tree_store_append(history_tree, &iter, NULL);
+ gtk_tree_store_set(history_tree, &iter,
+ COL_TITLE, data->title,
+ COL_ADDRESS, url,
+ COL_LASTVISIT, "Unknown",
+ COL_TOTALVISITS, data->visits,
+ -1);
+ }
+
+ return true;
+}
+
+void nsgtk_history_selection_changed(GtkTreeSelection *treesel, gpointer g)
+{
+ GtkTreeIter iter;
+
+ if (gtk_tree_selection_get_selected(treesel, &history_tree, &iter))
+ {
+ gchar *b;
+ gint i;
+ char buf[20];
+
+ gtk_tree_model_get(history_tree, &iter, COL_ADDRESS, &b, -1);
+ gtk_label_set_text(GTK_LABEL(glade_xml_get_widget(gladeWindows,
+ "labelHistoryAddress")), b);
+
+ gtk_tree_model_get(history_tree, &iter, COL_LASTVISIT, &b, -1);
+ gtk_label_set_text(GTK_LABEL(glade_xml_get_widget(gladeWindows,
+ "labelHistoryLastVisit")), b);
+
+ gtk_tree_model_get(history_tree, &iter, COL_TOTALVISITS,
+ &i, -1);
+ snprintf(buf, 20, "%d", i);
+ gtk_label_set_text(GTK_LABEL(glade_xml_get_widget(gladeWindows,
+ "labelHistoryVisits")), buf);
+
+
+
+ }
+ else
+ {
+
+ }
+}
+
+void nsgtk_history_row_activated(GtkTreeView *tv, GtkTreePath *path,
+ GtkTreeViewColumn *column, gpointer g)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ model = gtk_tree_view_get_model(tv);
+ if (gtk_tree_model_get_iter(model, &iter, path))
+ {
+ gchar *b;
+
+ gtk_tree_model_get(model, &iter, COL_ADDRESS, &b, -1);
+
+ browser_window_create((const char *)b, NULL, NULL, true);
+ }
+}
+
+void global_history_add(const char *url)
+{
+ const struct url_data *data;
+
+ data = urldb_get_url_data(url);
+ if (!data)
+ return;
+
+ nsgtk_history_add_internal(url, data);
+
+}
Added: trunk/netsurf/gtk/gtk_history.h
URL: http://svn.semichrome.net/trunk/netsurf/gtk/gtk_history.h?rev=2867&view=auto
==============================================================================
--- trunk/netsurf/gtk/gtk_history.h (added)
+++ trunk/netsurf/gtk/gtk_history.h Fri Aug 18 12:44:24 2006
@@ -1,0 +1,20 @@
+/*
+ * This file is part of NetSurf, http://netsurf.sourceforge.net/
+ * Licensed under the GNU General Public License,
+ * http://www.opensource.org/licenses/gpl-license
+ * Copyright 2006 Rob Kendrick <rjek(a)rjek.com>
+ */
+
+#ifndef __NSGTK_HISTORY_H__
+#define __NSGTK_HISTORY_H__
+
+#include <gtk/gtk.h>
+
+extern GtkWindow *wndHistory;
+
+void nsgtk_history_init(void);
+void nsgtk_history_update(void);
+void nsgtk_history_row_activated(GtkTreeView *, GtkTreePath *,
+ GtkTreeViewColumn *, gpointer);
+
+#endif /* __NSGTK_HISTORY_H__ */
Modified: trunk/netsurf/gtk/gtk_window.c
URL: http://svn.semichrome.net/trunk/netsurf/gtk/gtk_window.c?rev=2867&r1=2866...
==============================================================================
--- trunk/netsurf/gtk/gtk_window.c (original)
+++ trunk/netsurf/gtk/gtk_window.c Fri Aug 18 12:44:24 2006
@@ -27,6 +27,7 @@
#include "netsurf/gtk/gtk_options.h"
#include "netsurf/gtk/gtk_completion.h"
#include "netsurf/gtk/gtk_throbber.h"
+#include "netsurf/gtk/gtk_history.h"
#include "netsurf/render/box.h"
#include "netsurf/render/font.h"
#include "netsurf/render/form.h"
@@ -151,6 +152,7 @@
MENUPROTO(forward);
MENUPROTO(home);
MENUPROTO(local_history);
+MENUPROTO(global_history);
/* help menu */
MENUPROTO(about);
@@ -179,6 +181,7 @@
MENUEVENT(forward),
MENUEVENT(home),
MENUEVENT(local_history),
+ MENUEVENT(global_history),
/* help menu */
MENUEVENT(about),
@@ -605,6 +608,14 @@
gtk_widget_show(GTK_WIDGET(gw->history_window->window));
gdk_window_raise(GDK_WINDOW(gw->history_window->window));
+
+ return TRUE;
+}
+
+MENUHANDLER(global_history)
+{
+ gtk_widget_show(GTK_WIDGET(wndHistory));
+ gdk_window_raise(GDK_WINDOW(wndHistory));
return TRUE;
}
Modified: trunk/netsurf/gtk/netsurf.glade
URL: http://svn.semichrome.net/trunk/netsurf/gtk/netsurf.glade?rev=2867&r1=286...
==============================================================================
--- trunk/netsurf/gtk/netsurf.glade (original)
+++ trunk/netsurf/gtk/netsurf.glade Fri Aug 18 12:44:24 2006
@@ -707,9 +707,8 @@
</child>
<child>
- <widget class="GtkMenuItem" id="global_history1">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
+ <widget class="GtkMenuItem" id="global_history">
+ <property name="visible">True</property>
<property name="tooltip" translatable="yes">Show the history tree for all windows.</property>
<property name="label" translatable="yes">_Global history...</property>
<property name="use_underline">True</property>
@@ -4374,4 +4373,304 @@
</child>
</widget>
+<widget class="GtkWindow" id="wndHistory">
+ <property name="width_request">400</property>
+ <property name="height_request">500</property>
+ <property name="title" translatable="yes">NetSurf Global History</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_UTILITY</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
+ <signal name="delete_event" handler="gtk_widget_hide" last_modification_time="Fri, 18 Aug 2006 10:17:39 GMT"/>
+
+ <child>
+ <widget class="GtkVBox" id="vbox28">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="treeHistory">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
+ <property name="hover_selection">False</property>
+ <property name="hover_expand">False</property>
+ <signal name="row_activated" handler="nsgtk_history_row_activated" last_modification_time="Fri, 18 Aug 2006 11:33:42 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkExpander" id="expander1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="expanded">True</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox25">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkImage" id="image400">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0</property>
+ <property name="xpad">5</property>
+ <property name="ypad">5</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table11">
+ <property name="border_width">2</property>
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">0</property>
+ <property name="column_spacing">4</property>
+
+ <child>
+ <widget class="GtkLabel" id="label117">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Address</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label118">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Last visited</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label119">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Number of visits</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="labelHistoryVisits">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">2</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="labelHistoryLastVisit">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Fri Aug 09 00:00:00 2006</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="labelHistoryAddress">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">http://netsurf.sf.net/</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_MIDDLE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label116">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Details</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
</glade-interface>
Modified: trunk/netsurf/makefile
URL: http://svn.semichrome.net/trunk/netsurf/makefile?rev=2867&r1=2866&r2=2867...
==============================================================================
--- trunk/netsurf/makefile (original)
+++ trunk/netsurf/makefile Fri Aug 18 12:44:24 2006
@@ -69,7 +69,8 @@
OBJECTS_GTK += font_pango.o gtk_bitmap.o gtk_gui.o \
gtk_schedule.o gtk_thumbnail.o gtk_options.o \
gtk_plotters.o gtk_treeview.o gtk_window.o \
- gtk_completion.o gtk_login.o gtk_throbber.o # gtk/
+ gtk_completion.o gtk_login.o gtk_throbber.o \
+ gtk_history.o # gtk/
OBJDIR_RISCOS = arm-riscos-aof
@@ -122,7 +123,7 @@
CFLAGS_DEBUG = -std=c9x -D_BSD_SOURCE -DDEBUG_BUILD $(WARNFLAGS) -I.. \
$(PLATFORM_CFLAGS_DEBUG) -g
CFLAGS_GTK = -Dnsgtk -std=c9x -D_BSD_SOURCE -D_POSIX_C_SOURCE -Dgtk \
- $(WARNFLAGS) -I.. -g -O2 -Wformat=2 \
+ $(WARNFLAGS) -I.. -g -O0 -Wformat=2 \
`pkg-config --cflags libglade-2.0 gtk+-2.0` `xml2-config --cflags`
# Stop GCC under Cygwin throwing a fit
16 years, 9 months
r2866 adrianl - /trunk/netsurf/riscos/window.c
by netsurf@semichrome.net
Author: adrianl
Date: Fri Aug 18 06:39:53 2006
New Revision: 2866
URL: http://svn.semichrome.net?rev=2866&view=rev
Log:
Map Ctrl-S/F to Save/Search for Windows compatibility since they were unused
Modified:
trunk/netsurf/riscos/window.c
Modified: trunk/netsurf/riscos/window.c
URL: http://svn.semichrome.net/trunk/netsurf/riscos/window.c?rev=2866&r1=2865&...
==============================================================================
--- trunk/netsurf/riscos/window.c (original)
+++ trunk/netsurf/riscos/window.c Fri Aug 18 06:39:53 2006
@@ -1924,6 +1924,7 @@
browser_window_destroy(g->bw);
return true;
+ case 19: /* Ctrl + S */
case IS_WIMP_KEY + wimp_KEY_F3:
return ro_gui_menu_handle_action(g->window,
BROWSER_SAVE, false);
@@ -1941,6 +1942,7 @@
BROWSER_EXPORT_DRAW, false);
#ifdef WITH_SEARCH
+ case 6: /* Ctrl + F */
case IS_WIMP_KEY + wimp_KEY_F4: /* Search */
return ro_gui_menu_handle_action(g->window,
BROWSER_FIND_TEXT, false);
16 years, 9 months
r2865 rjek - in /trunk/netsurf/gtk: gtk_options.c netsurf.glade
by netsurf@semichrome.net
Author: rjek
Date: Fri Aug 18 01:38:35 2006
New Revision: 2865
URL: http://svn.semichrome.net?rev=2865&view=rev
Log:
Further Choices improvements in nsgtk; most of them now work correctly.
Modified:
trunk/netsurf/gtk/gtk_options.c
trunk/netsurf/gtk/netsurf.glade
Modified: trunk/netsurf/gtk/gtk_options.c
URL: http://svn.semichrome.net/trunk/netsurf/gtk/gtk_options.c?rev=2865&r1=286...
==============================================================================
--- trunk/netsurf/gtk/gtk_options.c (original)
+++ trunk/netsurf/gtk/gtk_options.c Fri Aug 18 01:38:35 2006
@@ -113,25 +113,25 @@
SET_ENTRY(entryHomePageURL, option_homepage_url);
SET_CHECK(checkHideAdverts, option_block_ads);
- /* TODO: rest of "General" tab here */
SET_CHECK(checkDisplayRecentURLs, option_url_suggestion);
SET_CHECK(checkSendReferer, option_send_referer);
+ SET_COMBO(comboProxyType, option_http_proxy_auth);
SET_ENTRY(entryProxyHost, option_http_proxy_host);
snprintf(b, 20, "%d", option_http_proxy_port);
SET_ENTRY(entryProxyPort, b);
SET_ENTRY(entryProxyUser, option_http_proxy_auth_user);
SET_ENTRY(entryProxyPassword, option_http_proxy_auth_pass);
+
SET_SPIN(spinMaxFetchers, option_max_fetchers);
SET_SPIN(spinFetchesPerHost, option_max_fetchers_per_host);
SET_SPIN(spinCachedConnections, option_max_cached_fetch_handles);
- /* TODO: set checkResampleImages here */
SET_CHECK(checkUseCairo, option_render_cairo);
+ SET_CHECK(checkResampleImages, option_render_resample);
SET_SPIN(spinAnimationSpeed, option_minimum_gif_delay);
SET_CHECK(checkDisableAnimations, !option_animate_images);
- /* TODO: set all font name widgets here */
SET_FONT(fontSansSerif, option_font_sans);
SET_FONT(fontSerif, option_font_serif);
SET_FONT(fontMonospace, option_font_mono);
@@ -154,11 +154,46 @@
(y) = strdup(gtk_font_button_get_font_name(GTK_FONT_BUTTON((x))))
void nsgtk_options_save(void) {
+ char *b = NULL;
+ int i;
+
GET_ENTRY(entryHomePageURL, option_homepage_url);
GET_CHECK(checkDisplayRecentURLs, option_url_suggestion);
+ GET_COMBO(comboProxyType, i);
+ option_http_proxy = (i > 0) ? true : false;
+ switch (i)
+ {
+ case 0:
+ case 1:
+ option_http_proxy_auth = OPTION_HTTP_PROXY_AUTH_NONE;
+ break;
+ case 2:
+ option_http_proxy_auth = OPTION_HTTP_PROXY_AUTH_BASIC;
+ break;
+ case 3:
+ option_http_proxy_auth = OPTION_HTTP_PROXY_AUTH_NTLM;
+ break;
+ default:
+ option_http_proxy_auth = OPTION_HTTP_PROXY_AUTH_NONE;
+ break;
+ }
+
+ GET_ENTRY(entryProxyHost, option_http_proxy_host);
+ GET_ENTRY(entryProxyPort, b);
+ option_http_proxy_port = atoi(b);
+ free(b);
+ GET_ENTRY(entryProxyUser, option_http_proxy_auth_user);
+ GET_ENTRY(entryProxyPassword, option_http_proxy_auth_pass);
+
+ GET_SPIN(spinMaxFetchers, option_max_fetchers);
+ GET_SPIN(spinFetchesPerHost, option_max_fetchers_per_host);
+ GET_SPIN(spinCachedConnections, option_max_cached_fetch_handles);
+
GET_CHECK(checkUseCairo, option_render_cairo);
GET_CHECK(checkResampleImages, option_render_resample);
+ GET_SPIN(spinAnimationSpeed, option_minimum_gif_delay);
+ option_minimum_gif_delay *= 10;
GET_FONT(fontSansSerif, option_font_sans);
GET_FONT(fontSerif, option_font_serif);
@@ -172,8 +207,6 @@
option_font_size *= 10;
GET_SPIN(spinMinimumSize, option_font_min_size);
option_font_min_size *= 10;
-
- /* TODO: save the other options */
options_write(options_file_location);
nsgtk_reflow_all_windows();
Modified: trunk/netsurf/gtk/netsurf.glade
URL: http://svn.semichrome.net/trunk/netsurf/gtk/netsurf.glade?rev=2865&r1=286...
==============================================================================
--- trunk/netsurf/gtk/netsurf.glade (original)
+++ trunk/netsurf/gtk/netsurf.glade Fri Aug 18 01:38:35 2006
@@ -2454,11 +2454,10 @@
<child>
<widget class="GtkComboBox" id="comboProxyType">
<property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="items" translatable="yes">None
+ <property name="items" translatable="yes">No proxy
Simple proxy
Basic authentication
-NTML authentication</property>
+NTLM authentication</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
</widget>
@@ -2671,11 +2670,11 @@
<property name="tooltip" translatable="yes">If your proxy server requires authentication, enter your password here.</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
- <property name="visibility">True</property>
+ <property name="visibility">False</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
- <property name="invisible_char">â</property>
+ <property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
@@ -3130,12 +3129,12 @@
<property name="tooltip" translatable="yes">Do not update animations any more often than this.</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
- <property name="digits">0</property>
+ <property name="digits">1</property>
<property name="numeric">True</property>
- <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="update_policy">GTK_UPDATE_IF_VALID</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0.10000000149 0 100 0.10000000149 10 10</property>
+ <property name="adjustment">0 0 100 0.10000000149 1 1</property>
</widget>
<packing>
<property name="padding">0</property>
16 years, 9 months
r2864 jmb - /trunk/netsurf/riscos/wimp.c
by netsurf@semichrome.net
Author: jmb
Date: Fri Aug 18 00:41:29 2006
New Revision: 2864
URL: http://svn.semichrome.net?rev=2864&view=rev
Log:
Fix buffer overrun & squash compiler warning.
Modified:
trunk/netsurf/riscos/wimp.c
Modified: trunk/netsurf/riscos/wimp.c
URL: http://svn.semichrome.net/trunk/netsurf/riscos/wimp.c?rev=2864&r1=2863&r2...
==============================================================================
--- trunk/netsurf/riscos/wimp.c (original)
+++ trunk/netsurf/riscos/wimp.c Fri Aug 18 00:41:29 2006
@@ -949,7 +949,9 @@
* \return pointer to family name
*/
-void ro_gui_wimp_desktop_font(char *family, size_t bufsize, int *psize, rufl_style *pstyle) {
+void ro_gui_wimp_desktop_font(char *family, size_t bufsize,
+ int *psize, rufl_style *pstyle)
+{
rufl_style style = rufl_WEIGHT_400;
bool got_family = false;
char *buf = NULL;
@@ -981,7 +983,8 @@
}
if (psize) {
- error = xfont_read_defn(fh, buf, &ptx, &pty, NULL, NULL, NULL, NULL);
+ error = xfont_read_defn(fh, buf,
+ &ptx, &pty, NULL, NULL, NULL, NULL);
if (error) {
LOG(("xfont_read_defn: 0x%x: %s",
error->errnum, error->errmess));
@@ -990,7 +993,7 @@
*psize = max(ptx, pty);
}
- error = xfont_read_identifier(fh, buf, &used);
+ error = xfont_read_identifier(fh, buf, NULL);
if (error) {
LOG(("xfont_read_identifier: 0x%x: %s",
error->errnum, error->errmess));
@@ -1022,7 +1025,7 @@
p = q;
while (*p > ' ' && *p != '\\') {
char *q;
- int m = 0;
+ unsigned int m = 0;
if (*p == '.') p++;
q = p; while (*q > ' ' && *q != '.' && *q != '\\') q++;
@@ -1045,9 +1048,8 @@
while (*p > ' ' && *p != '\\') p++;
}
- free(buf);
-
if (got_family) {
+ free(buf);
if (pstyle) *pstyle = style;
return;
}
@@ -1055,7 +1057,12 @@
failsafe:
free(buf);
- memcpy(family, "Homerton", 9);
+ if (bufsize >= 9) {
+ memcpy(family, "Homerton", 9);
+ } else {
+ /** \todo what to do here? */
+ assert(0);
+ }
if (psize) *psize = 12*16;
if (pstyle) *pstyle = rufl_WEIGHT_400;
16 years, 9 months