[Telepathy-commits] [telepathy-mission-control/master] Dispatcher: parsing .client file: also use g_get_user_data_dir()

Alban Crequy alban.crequy at collabora.co.uk
Mon Nov 24 07:55:16 PST 2008


---
 src/mcd-dispatcher.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 9ca7b6c..cb88af3 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -2237,6 +2237,7 @@ create_mcd_client (McdDispatcher *self,
      * D-Bus properties.
      * 
      * The full path is $XDG_DATA_DIRS/telepathy/clients/clientname.client
+     * or $XDG_DATA_HOME/telepathy/clients/clientname.client
      * For testing purposes, we also look for $MC_CLIENTS_DIR/clientname.client
      * if $MC_CLIENTS_DIR is set.
      */
@@ -2258,14 +2259,31 @@ create_mcd_client (McdDispatcher *self,
         g_free (absolute_filepath);
     }
 
-    dirs = g_get_system_data_dirs();
+    dirname = g_get_user_data_dir ();
+    if (!file_found && dirname)
+    {
+        GError *error = NULL;
+        gchar *absolute_filepath;
+        absolute_filepath = g_build_filename (dirname, "telepathy/clients",
+                                              filename, NULL);
+        g_key_file_load_from_file (file, absolute_filepath, 0, &error);
+
+        if (!error)
+        {
+            g_debug ("File found for %s: %s", name, absolute_filepath);
+            file_found = TRUE;
+        }
+        g_free (absolute_filepath);
+    }
+
+    dirs = g_get_system_data_dirs ();
     for (dirname = *dirs; dirname != NULL && !file_found;
          dirs++, dirname = *dirs)
     {
         GError *error = NULL;
         gchar *absolute_filepath;
         absolute_filepath = g_build_filename (dirname, "telepathy/clients",
-            filename, NULL);
+                                              filename, NULL);
         g_key_file_load_from_file (file, absolute_filepath, 0, &error);
 
         if (!error)
@@ -2275,6 +2293,7 @@ create_mcd_client (McdDispatcher *self,
         }
         g_free (absolute_filepath);
     }
+
     g_free (filename);
 
     if (file_found)
-- 
1.5.6.5




More information about the Telepathy-commits mailing list