[evolution-data-server/gnome-3-22] Correct new module detection when installed by file rename



commit 71d6c7834f2dd263b9eaff58ee85c2a4014acbd2
Author: Milan Crha <mcrha redhat com>
Date:   Tue Dec 20 18:39:02 2016 +0100

    Correct new module detection when installed by file rename
    
    When a package manager installs a module file by copying it with a different
    name first, then renaming it to the correct name, then this was not properly
    recognized and the module addition had been ignored, which resulted in
    the opposite than this module-auto-load had been created.

 libebackend/e-dbus-server.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/libebackend/e-dbus-server.c b/libebackend/e-dbus-server.c
index 313ee78..8007512 100644
--- a/libebackend/e-dbus-server.c
+++ b/libebackend/e-dbus-server.c
@@ -540,11 +540,22 @@ dbus_server_module_directory_changed_cb (GFileMonitor *monitor,
        if (event_type == G_FILE_MONITOR_EVENT_CREATED ||
            event_type == G_FILE_MONITOR_EVENT_DELETED ||
            event_type == G_FILE_MONITOR_EVENT_MOVED_IN ||
-           event_type == G_FILE_MONITOR_EVENT_MOVED_OUT) {
+           event_type == G_FILE_MONITOR_EVENT_MOVED_OUT ||
+           event_type == G_FILE_MONITOR_EVENT_RENAMED) {
                gchar *filename;
 
                filename = g_file_get_path (file);
 
+               if (event_type == G_FILE_MONITOR_EVENT_RENAMED && other_file) {
+                       G_LOCK (loaded_modules);
+                       if (!g_hash_table_contains (loaded_modules, filename)) {
+                               g_free (filename);
+                               filename = g_file_get_path (other_file);
+                               event_type = G_FILE_MONITOR_EVENT_CREATED;
+                       }
+                       G_UNLOCK (loaded_modules);
+               }
+
                if (filename && g_str_has_suffix (filename, "." G_MODULE_SUFFIX)) {
                        gboolean any_loaded = FALSE;
 


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