aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ephy-file-helpers.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-01-17 21:58:21 +0800
committerChristian Persch <chpe@src.gnome.org>2006-01-17 21:58:21 +0800
commitf220f9282e63ca352def47b86ec5f9c5c5c57696 (patch)
tree131d1dff90041138a058eaa8e3844f19f5293f3e /lib/ephy-file-helpers.c
parentb89fb9d5a5860e5349115717d48b240cf9715f4b (diff)
downloadgsoc2013-epiphany-f220f9282e63ca352def47b86ec5f9c5c5c57696.tar
gsoc2013-epiphany-f220f9282e63ca352def47b86ec5f9c5c5c57696.tar.gz
gsoc2013-epiphany-f220f9282e63ca352def47b86ec5f9c5c5c57696.tar.bz2
gsoc2013-epiphany-f220f9282e63ca352def47b86ec5f9c5c5c57696.tar.lz
gsoc2013-epiphany-f220f9282e63ca352def47b86ec5f9c5c5c57696.tar.xz
gsoc2013-epiphany-f220f9282e63ca352def47b86ec5f9c5c5c57696.tar.zst
gsoc2013-epiphany-f220f9282e63ca352def47b86ec5f9c5c5c57696.zip
Add event type to the callback.
2006-01-17 Christian Persch <chpe@cvs.gnome.org> * lib/ephy-file-helpers.c: (ephy_file_monitor_timeout_cb), (ephy_file_monitor_cb): * lib/ephy-file-helpers.h: Add event type to the callback. * embed/mozilla/EphyUtils.cpp: * embed/mozilla/EphyUtils.h: New function, like NS_NewFileURI (which we can't use since nsNetUtil.h conflicts with embed strings). * embed/mozilla/mozilla-embed-single.cpp: * embed/mozilla/mozilla-notifiers.cpp: Check that the user CSS file exists before registering it. Also handle file-deleted events. * src/bookmarks/ephy-bookmarks-menu.c: (ephy_bookmarks_menu_build): * src/bookmarks/ephy-topics-palette.c: (ephy_topics_palette_constructor), (ephy_topics_palette_class_init): Build fixes.
Diffstat (limited to 'lib/ephy-file-helpers.c')
-rw-r--r--lib/ephy-file-helpers.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index 60d9a8790..b8acb26fb 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -53,6 +53,9 @@
#define EPHY_UUID_ENVVAR "EPHY_UNIQUE"
#define EPHY_UUID_ENVSTRING EPHY_UUID_ENVVAR "=" EPHY_UUID
+#define DELAY_MAX_TICKS 64
+#define INITIAL_TICKS 2
+
static GHashTable *files = NULL;
static GHashTable *mime_table = NULL;
@@ -955,8 +958,6 @@ ephy_file_launch_handler (const char *mime_type,
return ret;
}
-#define DELAY_MAX_TICKS 64
-
struct _EphyFileMonitor
{
GnomeVFSMonitorHandle *handle;
@@ -967,6 +968,7 @@ struct _EphyFileMonitor
guint delay;
guint timeout_id;
guint ticks;
+ GnomeVFSMonitorEventType type;
};
static gboolean
@@ -991,7 +993,7 @@ ephy_file_monitor_timeout_cb (EphyFileMonitor *monitor)
monitor->timeout_id = 0;
- monitor->callback (monitor, monitor->uri, monitor->user_data);
+ monitor->callback (monitor, monitor->uri, monitor->type, monitor->user_data);
/* don't run again */
return FALSE;
@@ -1009,12 +1011,16 @@ ephy_file_monitor_cb (GnomeVFSMonitorHandle *handle,
switch (event_type)
{
case GNOME_VFS_MONITOR_EVENT_CHANGED:
+ monitor->ticks = INITIAL_TICKS;
+ /* fall-through */
case GNOME_VFS_MONITOR_EVENT_CREATED:
/* We make a lot of assumptions here, but basically we know
* that we just have to reload, by construction.
* Delay the reload a little bit so we don't endlessly
* reload while a file is written.
*/
+ monitor->type = event_type;
+
if (monitor->ticks == 0)
{
monitor->ticks = 1;
@@ -1037,6 +1043,15 @@ ephy_file_monitor_cb (GnomeVFSMonitorHandle *handle,
break;
case GNOME_VFS_MONITOR_EVENT_DELETED:
+ if (monitor->timeout_id != 0)
+ {
+ g_source_remove (monitor->timeout_id);
+ monitor->timeout_id = 0;
+ }
+ monitor->ticks = 0;
+
+ monitor->callback (monitor, monitor->uri, event_type, monitor->user_data);
+ break;
case GNOME_VFS_MONITOR_EVENT_STARTEXECUTING:
case GNOME_VFS_MONITOR_EVENT_STOPEXECUTING:
case GNOME_VFS_MONITOR_EVENT_METADATA_CHANGED: