summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rygel/rygel-user-config.vala42
1 files changed, 38 insertions, 4 deletions
diff --git a/src/rygel/rygel-user-config.vala b/src/rygel/rygel-user-config.vala
index be31a233..7998c1fd 100644
--- a/src/rygel/rygel-user-config.vala
+++ b/src/rygel/rygel-user-config.vala
@@ -61,6 +61,9 @@ public class Rygel.UserConfig : GLib.Object, Configuration {
// Our singleton
private static UserConfig config;
+ private uint system_config_timer_id = 0;
+ private uint local_config_timer_id = 0;
+
private class ConfigPair {
public ConfigurationEntry entry;
public EntryType type;
@@ -724,7 +727,6 @@ public class Rygel.UserConfig : GLib.Object, Configuration {
sys_key_file.load_from_file (system.get_path (),
KeyFileFlags.KEEP_COMMENTS |
KeyFileFlags.KEEP_TRANSLATIONS);
-
} catch (GLib.Error e) {}
this.compare_and_notify (this.key_file, sys_key_file);
@@ -737,7 +739,6 @@ public class Rygel.UserConfig : GLib.Object, Configuration {
key_file.load_from_file (local.get_path (),
KeyFileFlags.KEEP_COMMENTS |
KeyFileFlags.KEEP_TRANSLATIONS);
-
} catch (GLib.Error e) {}
this.compare_and_notify (key_file, this.sys_key_file);
@@ -747,13 +748,46 @@ public class Rygel.UserConfig : GLib.Object, Configuration {
File file,
File? other_file,
FileMonitorEvent event_type) {
- this.reload_compare_and_notify_system (file);
+ if (event_type == FileMonitorEvent.CHANGES_DONE_HINT) {
+ if (this.system_config_timer_id != 0) {
+ Source.remove (this.system_config_timer_id);
+ this.system_config_timer_id = 0;
+ }
+ this.reload_compare_and_notify_system (file);
+ } else {
+ if (this.system_config_timer_id != 0) {
+ Source.remove (this.system_config_timer_id);
+ }
+ this.system_config_timer_id = Timeout.add (500, () => {
+ this.system_config_timer_id = 0;
+ this.reload_compare_and_notify_system (file);
+
+ return false;
+ });
+ }
}
private void on_local_config_changed (FileMonitor monitor,
File file,
File? other_file,
FileMonitorEvent event_type) {
- this.reload_compare_and_notify_local (file);
+ if (event_type == FileMonitorEvent.CHANGES_DONE_HINT) {
+ if (this.local_config_timer_id != 0) {
+ Source.remove (this.local_config_timer_id);
+ this.local_config_timer_id = 0;
+ }
+ this.reload_compare_and_notify_local (file);
+ } else {
+ if (this.local_config_timer_id != 0) {
+ Source.remove (this.local_config_timer_id);
+ }
+
+ this.local_config_timer_id = Timeout.add (500, () => {
+ this.local_config_timer_id = 0;
+ this.reload_compare_and_notify_local (file);
+
+ return false;
+ });
+ }
}
}