Introduce MIDORI_PARAM_DELAYED_SAVING mechanism

The flag says which properties don't trigger saving
to avoid disk I/O.
This commit is contained in:
Christian Dywan 2011-11-17 00:02:06 +01:00
parent d809cd6040
commit 040a1670e4
3 changed files with 10 additions and 11 deletions

View file

@ -615,10 +615,7 @@ settings_notify_cb (MidoriWebSettings* settings,
gchar* config_file; gchar* config_file;
/* Skip state related properties to avoid disk IO */ /* Skip state related properties to avoid disk IO */
if ((pspec && g_str_has_prefix (pspec->name, "last-window-")) if (pspec && pspec->flags & MIDORI_PARAM_DELAY_SAVING)
|| (pspec && g_str_has_prefix (pspec->name, "user-stylesheet-uri"))
|| (pspec && g_str_equal (pspec->name, "search-width"))
|| (pspec && g_str_has_prefix (pspec->name, "last-panel-")))
return; return;
config_file = build_config_filename ("config"); config_file = build_config_filename ("config");

View file

@ -369,7 +369,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
_("Last window width"), _("Last window width"),
_("The last saved window width"), _("The last saved window width"),
0, G_MAXINT, 0, 0, G_MAXINT, 0,
flags)); flags | MIDORI_PARAM_DELAY_SAVING));
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_LAST_WINDOW_HEIGHT, PROP_LAST_WINDOW_HEIGHT,
@ -378,7 +378,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
_("Last window height"), _("Last window height"),
_("The last saved window height"), _("The last saved window height"),
0, G_MAXINT, 0, 0, G_MAXINT, 0,
flags)); flags | MIDORI_PARAM_DELAY_SAVING));
/** /**
* MidoriWebSettings:last-window-state: * MidoriWebSettings:last-window-state:
@ -395,7 +395,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
"The last saved window state", "The last saved window state",
MIDORI_TYPE_WINDOW_STATE, MIDORI_TYPE_WINDOW_STATE,
MIDORI_WINDOW_NORMAL, MIDORI_WINDOW_NORMAL,
flags)); flags | MIDORI_PARAM_DELAY_SAVING));
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_LAST_PANEL_POSITION, PROP_LAST_PANEL_POSITION,
@ -404,7 +404,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
_("Last panel position"), _("Last panel position"),
_("The last saved panel position"), _("The last saved panel position"),
0, G_MAXINT, 0, 0, G_MAXINT, 0,
flags)); flags | MIDORI_PARAM_DELAY_SAVING));
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_LAST_PANEL_PAGE, PROP_LAST_PANEL_PAGE,
@ -414,7 +414,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
_("Last panel page"), _("Last panel page"),
_("The last saved panel page"), _("The last saved panel page"),
0, G_MAXINT, 0, 0, G_MAXINT, 0,
flags)); flags | MIDORI_PARAM_DELAY_SAVING));
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_LAST_WEB_SEARCH, PROP_LAST_WEB_SEARCH,
@ -1079,7 +1079,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
"User stylesheet URI", "User stylesheet URI",
"Load stylesheets from a local URI", "Load stylesheets from a local URI",
NULL, NULL,
flags)); flags | MIDORI_PARAM_DELAY_SAVING));
/** /**
* MidoriWebSettings:search-entry-width: * MidoriWebSettings:search-entry-width:
@ -1095,7 +1095,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
"Search action width", "Search action width",
"Search action width in pixels", "Search action width in pixels",
10, G_MAXINT, 200, 10, G_MAXINT, 200,
flags)); flags | MIDORI_PARAM_DELAY_SAVING));
} }
static void static void

View file

@ -34,6 +34,8 @@ G_BEGIN_DECLS
typedef struct _MidoriWebSettings MidoriWebSettings; typedef struct _MidoriWebSettings MidoriWebSettings;
typedef struct _MidoriWebSettingsClass MidoriWebSettingsClass; typedef struct _MidoriWebSettingsClass MidoriWebSettingsClass;
#define MIDORI_PARAM_DELAY_SAVING (1 << 8)
enum enum
{ {
MIDORI_CLEAR_NONE = 0, MIDORI_CLEAR_NONE = 0,