Commit 35bf1c26 authored by Jussi Kukkonen's avatar Jussi Kukkonen

refactor client and master

master has no need to connect to accuracy signal if
client just handles sorting providers itself
parent 5557985f
......@@ -370,6 +370,9 @@ gc_iface_master_client_set_requirements (GcMasterClient *client,
require_updates,
allowed_resources,
NULL);
client->position_providers =
g_list_sort (client->position_providers,
(GCompareFunc)gc_master_provider_compare);
g_debug ("client: %d position providers matching requirements found",
g_list_length (client->position_providers));
......@@ -379,9 +382,13 @@ gc_iface_master_client_set_requirements (GcMasterClient *client,
require_updates,
allowed_resources,
NULL);
client->address_providers =
g_list_sort (client->address_providers,
(GCompareFunc)gc_master_provider_compare);
g_debug ("client: %d address providers matching requirements found",
g_list_length (client->address_providers));
/* connect status and accuracy signals */
all_providers = g_list_copy (client->position_providers);
l = client->address_providers;
......
......@@ -99,16 +99,6 @@ gc_master_class_init (GcMasterClass *klass)
&dbus_glib_gc_iface_master_object_info);
}
static void
accuracy_changed (GcMasterProvider *provider,
GeoclueAccuracyLevel level,
GcMaster *master)
{
g_debug ("master: provider accuracy changed, sorting list");
providers = g_list_sort (providers,
(GCompareFunc)gc_master_provider_compare);
}
/* Load the provider details out of a keyfile */
static void
gc_master_add_new_provider (GcMaster *master,
......@@ -124,14 +114,7 @@ gc_master_add_new_provider (GcMaster *master,
return;
}
providers = g_list_insert_sorted
(providers, provider,
(GCompareFunc)gc_master_provider_compare);
g_signal_connect (G_OBJECT (provider),
"accuracy-changed",
G_CALLBACK (accuracy_changed),
master);
providers = g_list_prepend (providers, provider);
}
/* Scan a directory for .provider files */
......@@ -227,6 +210,5 @@ gc_master_get_providers (GcInterfaceFlags iface_type,
}
}
/* return most accurate first */
return g_list_reverse (p);
return p;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment