aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--embed/ephy-favicon-cache.c13
-rw-r--r--embed/ephy-history.c7
-rw-r--r--lib/Makefile.am1
-rw-r--r--src/bookmarks/ephy-bookmarks.c5
-rw-r--r--src/ephy-dbus.c7
-rw-r--r--src/ephy-extensions-manager.c6
-rw-r--r--src/ephy-session.c3
8 files changed, 40 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 29993eac2..ebb1ea5c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2007-01-03 Diego Escalante Urrelo <diegoe@svn.gnome.org>
+
+ * embed/ephy-favicon-cache.c: (ephy_favicon_cache_init):
+ * embed/ephy-history.c: (ephy_history_init):
+ * lib/Makefile.am:
+ * lib/ephy-glib-compat.h:
+ * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_save_delayed):
+ * src/ephy-dbus.c: (session_filter_func), (system_filter_func):
+ * src/ephy-extensions-manager.c: (reload_cb):
+ * src/ephy-session.c: (confirm_shutdown_cb):
+
+ Utilize GLib's new g_timeout_add_seconds to reduce context switches
+ and improve CPU/power efficiency. Patch by Chris Wilson.
+
+
2007-01-03 Diego Escalante Urrelo <diegoe@svn.gnome.org>
* data/glade/prefs-dialog.glade:
diff --git a/embed/ephy-favicon-cache.c b/embed/ephy-favicon-cache.c
index 5d6d62fe3..2892fb496 100644
--- a/embed/ephy-favicon-cache.c
+++ b/embed/ephy-favicon-cache.c
@@ -36,6 +36,7 @@
#include "ephy-node-common.h"
#include "ephy-node.h"
#include "ephy-debug.h"
+#include "ephy-glib-compat.h"
#include <glib/gstdio.h>
#include <libgnomeui/libgnomeui.h>
@@ -47,11 +48,11 @@
#define EPHY_FAVICON_CACHE_OBSOLETE_DAYS 30
-/* how often to save the cache, in milliseconds */
-#define CACHE_SAVE_INTERVAL 10 * 60 * 1000 /* ms */
+/* how often to save the cache, in seconds */
+#define CACHE_SAVE_INTERVAL (10 * 60) /* seconds */
-/* how often to delete old pixbufs from the cache, in milliseconds */
-#define CACHE_CLEANUP_INTERVAL 5 * 60 * 1000 /* ms */
+/* how often to delete old pixbufs from the cache, in seconds */
+#define CACHE_CLEANUP_INTERVAL (5 * 60) /* seconds */
/* how long to keep pixbufs in cache, in seconds. This should be longer than CACHE_CLEANUP_INTERVAL */
#define PIXBUF_CACHE_KEEP_TIME 10 * 60 /* s */
@@ -395,10 +396,10 @@ ephy_favicon_cache_init (EphyFaviconCache *cache)
g_signal_connect_object (embed_shell, "prepare-close",
G_CALLBACK (prepare_close_cb), cache, 0);
- priv->autosave_timeout = g_timeout_add (CACHE_SAVE_INTERVAL,
+ priv->autosave_timeout = g_timeout_add_seconds (CACHE_SAVE_INTERVAL,
(GSourceFunc) periodic_save_cb,
cache);
- priv->cleanup_timeout = g_timeout_add (CACHE_CLEANUP_INTERVAL,
+ priv->cleanup_timeout = g_timeout_add_seconds (CACHE_CLEANUP_INTERVAL,
(GSourceFunc) periodic_cleanup_cb,
cache);
}
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
index 494c1e00d..4b2876665 100644
--- a/embed/ephy-history.c
+++ b/embed/ephy-history.c
@@ -29,6 +29,7 @@
#include "ephy-node-common.h"
#include "eel-gconf-extensions.h"
#include "ephy-prefs.h"
+#include "ephy-glib-compat.h"
#include <time.h>
#include <string.h>
@@ -38,8 +39,8 @@
#define EPHY_HISTORY_XML_ROOT (const xmlChar *)"ephy_history"
#define EPHY_HISTORY_XML_VERSION (const xmlChar *)"1.0"
-/* how often to save the history, in milliseconds */
-#define HISTORY_SAVE_INTERVAL (5 * 60 * 1000)
+/* how often to save the history, in seconds */
+#define HISTORY_SAVE_INTERVAL (5 * 60)
/* if you change this remember to change also the user interface description */
#define HISTORY_PAGE_OBSOLETE_DAYS 10
@@ -606,7 +607,7 @@ ephy_history_init (EphyHistory *eb)
/* setup the periodic history saving callback */
eb->priv->autosave_timeout =
- g_timeout_add (HISTORY_SAVE_INTERVAL,
+ g_timeout_add_seconds (HISTORY_SAVE_INTERVAL,
(GSourceFunc)periodic_save_cb,
eb);
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 926411f50..90841f14a 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -13,6 +13,7 @@ NOINST_H_FILES = \
ephy-dnd.h \
ephy-file-chooser.h \
ephy-file-helpers.h \
+ ephy-glib-compat.h \
ephy-gui.h \
ephy-langs.h \
ephy-module.h \
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 51c234627..6c36c08f1 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -38,6 +38,7 @@
#include "ephy-marshal.h"
#include "ephy-signal-accumulator.h"
#include "ephy-stock-icons.h"
+#include "ephy-glib-compat.h"
#include "eel-gconf-extensions.h"
@@ -50,7 +51,7 @@
#define EPHY_BOOKMARKS_XML_ROOT "ephy_bookmarks"
#define EPHY_BOOKMARKS_XML_VERSION "1.03"
-#define BOOKMARKS_SAVE_DELAY (3 * 1000) /* ms */
+#define BOOKMARKS_SAVE_DELAY 3 /* seconds */
#define MAX_FAVORITES_NUM 10
#define UPDATE_URI_DATA_KEY "updated-uri"
#define SD_RESOLVE_TIMEOUT 0 /* ms; 0 means no timeout */
@@ -289,7 +290,7 @@ ephy_bookmarks_save_delayed (EphyBookmarks *bookmarks, int delay)
if (delay > 0)
{
bookmarks->priv->save_timeout_id =
- g_timeout_add (BOOKMARKS_SAVE_DELAY,
+ g_timeout_add_seconds (BOOKMARKS_SAVE_DELAY,
(GSourceFunc) save_bookmarks_delayed,
bookmarks);
}
diff --git a/src/ephy-dbus.c b/src/ephy-dbus.c
index eb68dd049..c365d02d1 100644
--- a/src/ephy-dbus.c
+++ b/src/ephy-dbus.c
@@ -27,6 +27,7 @@
#include "ephy-debug.h"
#include "ephy-activation.h"
#include "ephy-dbus-server-bindings.h"
+#include "ephy-glib-compat.h"
#include <string.h>
#include <dbus/dbus-glib-bindings.h>
@@ -46,7 +47,7 @@
#define DBUS_EPHY_PATH "/org/gnome/Epiphany"
#define DBUS_EPHY_INTERFACE "org.gnome.Epiphany"
-#define RECONNECT_DELAY 3000
+#define RECONNECT_DELAY 3 /* seconds */
#define EPHY_DBUS_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_DBUS, EphyDbusPrivate))
@@ -149,7 +150,7 @@ session_filter_func (DBusConnection *connection,
/* try to reconnect later ... */
priv->session_reconnect_timeout_id =
- g_timeout_add (RECONNECT_DELAY,
+ g_timeout_add_seconds (RECONNECT_DELAY,
(GSourceFunc) ephy_dbus_connect_to_session_bus_cb,
ephy_dbus);
@@ -182,7 +183,7 @@ system_filter_func (DBusConnection *connection,
/* try to reconnect later ... */
priv->system_reconnect_timeout_id =
- g_timeout_add (RECONNECT_DELAY,
+ g_timeout_add_seconds (RECONNECT_DELAY,
(GSourceFunc) ephy_dbus_connect_to_system_bus_cb,
ephy_dbus);
diff --git a/src/ephy-extensions-manager.c b/src/ephy-extensions-manager.c
index bd8ca8e00..23ca87996 100644
--- a/src/ephy-extensions-manager.c
+++ b/src/ephy-extensions-manager.c
@@ -35,6 +35,8 @@
#include "ephy-object-helpers.h"
#include "ephy-debug.h"
+#include "ephy-glib-compat.h"
+
#include <libxml/tree.h>
#include <libxml/xmlreader.h>
#include <libxml/globals.h>
@@ -62,7 +64,7 @@
#define EE_GROUP "Epiphany Extension"
#define DOT_INI ".ephy-extension"
#define RELOAD_DELAY 333 /* ms */
-#define RELOAD_SYNC_DELAY 1000 /* ms */
+#define RELOAD_SYNC_DELAY 1 /* seconds */
#define ENABLE_LEGACY_FORMAT
@@ -940,7 +942,7 @@ reload_cb (gpointer *data)
g_source_remove (priv->sync_timeout_id);
}
- priv->sync_timeout_id = g_timeout_add (RELOAD_SYNC_DELAY,
+ priv->sync_timeout_id = g_timeout_add_seconds (RELOAD_SYNC_DELAY,
(GSourceFunc) reload_sync_cb,
manager);
return FALSE;
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 1214d9e07..b8493abdd 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -35,6 +35,7 @@
#include "ephy-gui.h"
#include "ephy-debug.h"
#include "ephy-stock-icons.h"
+#include "ephy-glib-compat.h"
#include <glib/gi18n.h>
#include <gtk/gtkmain.h>
@@ -293,7 +294,7 @@ confirm_shutdown_cb (GnomeClient *client,
data->key = key;
/* This isn't very exact, but it's good enough here */
- data->timeout_id = g_timeout_add (1000,
+ data->timeout_id = g_timeout_add_seconds (1,
(GSourceFunc) confirm_shutdown_dialog_tick_cb,
data);
data->ticks = 60;