From ba82c09a4fad2c258eee6198c2c460fce28afd7b Mon Sep 17 00:00:00 2001 From: Diego Escalante Urrelo Date: Wed, 3 Jan 2007 08:08:12 +0000 Subject: Utilize GLib's new g_timeout_add_seconds to reduce context switches and 2007-01-03 Diego Escalante Urrelo * 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. svn path=/trunk/; revision=6783 --- src/bookmarks/ephy-bookmarks.c | 5 +++-- src/ephy-dbus.c | 7 ++++--- src/ephy-extensions-manager.c | 6 ++++-- src/ephy-session.c | 3 ++- 4 files changed, 13 insertions(+), 8 deletions(-) (limited to 'src') 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 #include @@ -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 #include #include @@ -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 #include @@ -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; -- cgit