OSDN Git Service

core: Fix external profile remote UUID setting
authorJohan Hedberg <johan.hedberg@intel.com>
Sat, 17 Nov 2012 04:52:46 +0000 (06:52 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Sat, 17 Nov 2012 04:54:37 +0000 (06:54 +0200)
src/profile.c

index b7f876e..79cb6af 100644 (file)
@@ -1586,6 +1586,8 @@ static void ext_set_defaults(struct ext_profile *ext)
        ext->enable_client = true;
        ext->enable_server = true;
 
+       ext->remote_uuids = g_new0(char *, 2);
+
        for (i = 0; i < G_N_ELEMENTS(defaults); i++) {
                struct default_settings *settings = &defaults[i];
                const char *remote_uuid;
@@ -1593,8 +1595,6 @@ static void ext_set_defaults(struct ext_profile *ext)
                if (strcasecmp(ext->uuid, settings->uuid) != 0)
                        continue;
 
-               ext->remote_uuids = g_new0(char *, 2);
-
                if (settings->remote_uuid)
                        remote_uuid = settings->remote_uuid;
                else
@@ -1785,6 +1785,13 @@ static struct ext_profile *create_ext(const char *owner, const char *path,
        if (!ext->name)
                ext->name = g_strdup_printf("%s%s/%s", owner, path, uuid);
 
+       if (!ext->remote_uuids[0]) {
+               if (ext->service)
+                       ext->remote_uuids[0] = g_strdup(ext->service);
+               else
+                       ext->remote_uuids[0] = g_strdup(ext->uuid);
+       }
+
        p = &ext->p;
 
        p->name = ext->name;