[gnome-settings-daemon] sound: Avoid polling for non-existent directory



commit bdbe6dbb09189da0dceaac70aa6c1aadf8b779b5
Author: Arjan van de Ven <arjanvandeven gmail com>
Date:   Mon Feb 18 23:26:00 2013 +0000

    sound: Avoid polling for non-existent directory
    
    Create the user sound theme directory if it doesn't exist,
    to avoid GLib polling. Also make sure that the system directories
    exist before monitoring them for the same reason
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694134

 plugins/sound/gsd-sound-manager.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/plugins/sound/gsd-sound-manager.c b/plugins/sound/gsd-sound-manager.c
index 0cafaf7..a3c7704 100644
--- a/plugins/sound/gsd-sound-manager.c
+++ b/plugins/sound/gsd-sound-manager.c
@@ -268,14 +268,16 @@ gsd_sound_manager_start (GsdSoundManager *manager,
         /* ... and we listen to changes of the theme base directories
          * in $HOME ...*/
         p = g_build_filename (g_get_user_data_dir (), "sounds", NULL);
-        register_directory_callback (manager, p, NULL);
+        if (g_mkdir_with_parents(p, 0600) == 0)
+                register_directory_callback (manager, p, NULL);
         g_free (p);
 
         /* ... and globally. */
         dirs = g_get_system_data_dirs ();
         for (i = 0; dirs[i] != NULL; i++) {
                 p = g_build_filename (dirs[i], "sounds", NULL);
-                register_directory_callback (manager, p, NULL);
+                if (g_file_test (p, G_FILE_TEST_IS_DIR))
+                        register_directory_callback (manager, p, NULL);
                 g_free (p);
         }
 


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