summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-06-09 13:10:56 +0100
committerVincent Sanders <vince@kyllikki.org>2014-06-09 13:13:59 +0100
commit8e29e517d59f0d04dd2d09c6b8760aa1236a1abf (patch)
treefc126b0fb960def166be113827733d367f6fc9bb
parente687a359c702e13a7f3e7bb5ba8e7b76d32283b1 (diff)
downloadnetsurf-8e29e517d59f0d04dd2d09c6b8760aa1236a1abf.tar.gz
netsurf-8e29e517d59f0d04dd2d09c6b8760aa1236a1abf.tar.bz2
fix disc cache size option to be unsigned
-rwxr-xr-xamiga/gui_options.c6
-rw-r--r--desktop/netsurf.c2
-rw-r--r--desktop/options.h2
-rw-r--r--gtk/dialogs/preferences.c23
-rw-r--r--gtk/res/options.gtk2.ui8
-rw-r--r--gtk/res/options.gtk3.ui6
-rw-r--r--utils/nsoption.h3
7 files changed, 37 insertions, 13 deletions
diff --git a/amiga/gui_options.c b/amiga/gui_options.c
index 0b01a93d4..3a6451b97 100755
--- a/amiga/gui_options.c
+++ b/amiga/gui_options.c
@@ -1157,7 +1157,7 @@ void ami_gui_opts_open(void)
LAYOUT_AddChild, gow->objects[GID_OPTS_CACHE_DISC] = IntegerObject,
GA_ID, GID_OPTS_CACHE_DISC,
GA_RelVerify, TRUE,
- INTEGER_Number, nsoption_int(disc_cache_size) / 1048576,
+ INTEGER_Number, nsoption_uint(disc_cache_size) / 1048576,
INTEGER_Minimum, 0,
INTEGER_Maximum, 4096,
INTEGER_Arrows, TRUE,
@@ -1750,8 +1750,8 @@ void ami_gui_opts_use(bool save)
GetAttr(INTEGER_Number,gow->objects[GID_OPTS_CACHE_MEM],(ULONG *)&nsoption_int(memory_cache_size));
nsoption_set_int(memory_cache_size, nsoption_int(memory_cache_size) * 1048576);
- GetAttr(INTEGER_Number,gow->objects[GID_OPTS_CACHE_DISC],(ULONG *)&nsoption_int(disc_cache_size));
- nsoption_set_int(disc_cache_size, nsoption_int(disc_cache_size) * 1048576);
+ GetAttr(INTEGER_Number,gow->objects[GID_OPTS_CACHE_DISC],(ULONG *)&nsoption_uint(disc_cache_size));
+ nsoption_set_uint(disc_cache_size, nsoption_uint(disc_cache_size) * 1048576);
GetAttr(GA_Selected,gow->objects[GID_OPTS_OVERWRITE],(ULONG *)&data);
if (data) {
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index 153810705..a1bc42b93 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -191,7 +191,7 @@ nserror netsurf_init(const char *messages, const char *store_path)
hlcache_parameters.llcache.limit -= image_cache_parameters.limit;
/* set backing store target limit */
- hlcache_parameters.llcache.store.limit = nsoption_int(disc_cache_size);
+ hlcache_parameters.llcache.store.limit = nsoption_uint(disc_cache_size);
/* set backing store hysterissi to 20% */
hlcache_parameters.llcache.store.hysteresis = (hlcache_parameters.llcache.store.limit * 20) / 100;;
diff --git a/desktop/options.h b/desktop/options.h
index 391dfbc08..33ecb7554 100644
--- a/desktop/options.h
+++ b/desktop/options.h
@@ -89,7 +89,7 @@ NSOPTION_STRING(accept_charset, NULL)
NSOPTION_INTEGER(memory_cache_size, 12 * 1024 * 1024)
/** Preferred expiry size of disc cache / bytes. */
-NSOPTION_INTEGER(disc_cache_size, 1024 * 1024 * 1024)
+NSOPTION_UINT(disc_cache_size, 1024 * 1024 * 1024)
/** Preferred expiry age of disc cache / days. */
NSOPTION_INTEGER(disc_cache_age, 28)
diff --git a/gtk/dialogs/preferences.c b/gtk/dialogs/preferences.c
index f80500dfa..58bb8b4d9 100644
--- a/gtk/dialogs/preferences.c
+++ b/gtk/dialogs/preferences.c
@@ -108,6 +108,27 @@ nsgtk_preferences_##WIDGET##_realize(GtkWidget *widget, struct ppref *priv) \
((gdouble)nsoption_int(OPTION)) / MULTIPLIER); \
}
+#define SPINBUTTON_UINT_SIGNALS(WIDGET, OPTION, MULTIPLIER) \
+G_MODULE_EXPORT void \
+nsgtk_preferences_##WIDGET##_valuechanged(GtkSpinButton *spinbutton, \
+ struct ppref *priv); \
+G_MODULE_EXPORT void \
+nsgtk_preferences_##WIDGET##_valuechanged(GtkSpinButton *spinbutton, \
+ struct ppref *priv) \
+{ \
+ nsoption_set_uint(OPTION, \
+ round(gtk_spin_button_get_value(spinbutton) * MULTIPLIER)); \
+} \
+ \
+G_MODULE_EXPORT void \
+nsgtk_preferences_##WIDGET##_realize(GtkWidget *widget, struct ppref *priv); \
+G_MODULE_EXPORT void \
+nsgtk_preferences_##WIDGET##_realize(GtkWidget *widget, struct ppref *priv) \
+{ \
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), \
+ ((gdouble)nsoption_uint(OPTION)) / MULTIPLIER); \
+}
+
#define ENTRY_SIGNALS(WIDGET, OPTION) \
G_MODULE_EXPORT void \
nsgtk_preferences_##WIDGET##_changed(GtkEditable *editable, struct ppref *priv); \
@@ -372,7 +393,7 @@ SPINBUTTON_SIGNALS(spinHistoryAge, history_age, 1.0)
SPINBUTTON_SIGNALS(spinMemoryCacheSize, memory_cache_size, (1024*1024))
/* disc cache size */
-SPINBUTTON_SIGNALS(spinDiscCacheSize, disc_cache_size, (1024*1024))
+SPINBUTTON_UINT_SIGNALS(spinDiscCacheSize, disc_cache_size, (1024*1024))
/* disc cache age */
diff --git a/gtk/res/options.gtk2.ui b/gtk/res/options.gtk2.ui
index ebe7b91f5..b0d45bb2f 100644
--- a/gtk/res/options.gtk2.ui
+++ b/gtk/res/options.gtk2.ui
@@ -2653,10 +2653,10 @@
<property name="page_increment">16</property>
</object>
<object class="GtkAdjustment" id="adjustment_cache_disc_size">
- <property name="value">16</property>
- <property name="upper">2048</property>
- <property name="step_increment">4</property>
- <property name="page_increment">16</property>
+ <property name="value">1024</property>
+ <property name="upper">4096</property>
+ <property name="step_increment">32</property>
+ <property name="page_increment">256</property>
</object>
<object class="GtkAdjustment" id="adjustment_disc_cache_age">
<property name="value">28</property>
diff --git a/gtk/res/options.gtk3.ui b/gtk/res/options.gtk3.ui
index a795c2bf5..02e4df47c 100644
--- a/gtk/res/options.gtk3.ui
+++ b/gtk/res/options.gtk3.ui
@@ -9,13 +9,13 @@
<property name="page_increment">1</property>
</object>
<object class="GtkAdjustment" id="adjustment_cache_disc_size">
- <property name="upper">2048</property>
- <property name="value">16</property>
+ <property name="upper">4096</property>
+ <property name="value">1024</property>
<property name="step_increment">4</property>
<property name="page_increment">16</property>
</object>
<object class="GtkAdjustment" id="adjustment_cache_memory_size">
- <property name="upper">2048</property>
+ <property name="upper">1024</property>
<property name="value">16</property>
<property name="step_increment">4</property>
<property name="page_increment">16</property>
diff --git a/utils/nsoption.h b/utils/nsoption.h
index d111729aa..134223aa5 100644
--- a/utils/nsoption.h
+++ b/utils/nsoption.h
@@ -308,6 +308,9 @@ int nsoption_snoptionf(char *string, size_t size, enum nsoption_e option, const
/** set an integer option in the default table */
#define nsoption_set_int(OPTION, VALUE) nsoptions[NSOPTION_##OPTION].value.i = VALUE
+/** set an unsigned integer option in the default table */
+#define nsoption_set_uint(OPTION, VALUE) nsoptions[NSOPTION_##OPTION].value.u = VALUE
+
/** set a colour option in the default table */
#define nsoption_set_colour(OPTION, VALUE) nsoptions[NSOPTION_##OPTION].value.c = VALUE