[evolution-data-server] [EDBusServer] Reload the server only if a new module was added



commit 275af181502ddab17df5a10804b426a6c822c705
Author: Milan Crha <mcrha redhat com>
Date:   Wed Dec 2 22:22:51 2015 +0100

    [EDBusServer] Reload the server only if a new module was added
    
    There is no need to reload the server when any of the already loaded
    modules was changed or removed, because only newly added modules can
    be loaded on the fly, thus avoid the useless reload. That means that
    software update still requires manual background processes restart,
    while any 3rd-party module installation does not.

 libebackend/e-dbus-server.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/libebackend/e-dbus-server.c b/libebackend/e-dbus-server.c
index 9e86e25..313ee78 100644
--- a/libebackend/e-dbus-server.c
+++ b/libebackend/e-dbus-server.c
@@ -546,6 +546,8 @@ dbus_server_module_directory_changed_cb (GFileMonitor *monitor,
                filename = g_file_get_path (file);
 
                if (filename && g_str_has_suffix (filename, "." G_MODULE_SUFFIX)) {
+                       gboolean any_loaded = FALSE;
+
                        if (event_type == G_FILE_MONITOR_EVENT_CREATED ||
                            event_type == G_FILE_MONITOR_EVENT_MOVED_IN) {
                                G_LOCK (loaded_modules);
@@ -556,14 +558,18 @@ dbus_server_module_directory_changed_cb (GFileMonitor *monitor,
                                        g_hash_table_add (loaded_modules, g_strdup (filename));
 
                                        module = e_module_load_file (filename);
-                                       if (module)
+                                       if (module) {
+                                               any_loaded = TRUE;
+
                                                g_type_module_unuse ((GTypeModule *) module);
+                                       }
                                }
 
                                G_UNLOCK (loaded_modules);
                        }
 
-                       e_dbus_server_quit (server, E_DBUS_SERVER_EXIT_RELOAD);
+                       if (any_loaded)
+                               e_dbus_server_quit (server, E_DBUS_SERVER_EXIT_RELOAD);
                }
 
                g_free (filename);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]