*/
#include "config.h"
-
-#include <string.h>
-#include <time.h>
-
-#include <glib/gi18n-lib.h>
-
-#include <telepathy-glib/account-manager.h>
-#include <telepathy-glib/util.h>
+#include "empathy-location-manager.h"
#include <geoclue/geoclue-master.h>
-#include <extensions/extensions.h>
-
-#include "empathy-location-manager.h"
-
-#include "libempathy/empathy-enum-types.h"
-#include "libempathy/empathy-gsettings.h"
-#include "libempathy/empathy-location.h"
-#include "libempathy/empathy-utils.h"
-#include "libempathy/empathy-time.h"
+#include "empathy-gsettings.h"
+#include "empathy-location.h"
+#include "empathy-time.h"
#define DEBUG_FLAG EMPATHY_DEBUG_LOCATION
-#include "libempathy/empathy-debug.h"
+#include "empathy-debug.h"
/* Seconds before updating the location */
#define TIMEOUT 10
goto out;
}
- accounts = tp_account_manager_get_valid_accounts (manager);
+ accounts = tp_account_manager_dup_valid_accounts (manager);
for (l = accounts; l; l = l->next)
{
TpConnection *conn = tp_account_get_connection (TP_ACCOUNT (l->data));
if (conn != NULL)
publish_location (data->self, conn, data->force_publication);
}
- g_list_free (accounts);
+ g_list_free_full (accounts, g_object_unref);
out:
g_object_unref (data->self);
if (error != NULL)
{
DEBUG ("set_requirements failed: %s", error->message);
+ g_error_free (error);
return;
}
set_requirements (self, update_resources_set_requirements_cb);
}
+static void
+create_address_cb (GeoclueMasterClient *client,
+ GeoclueAddress *address,
+ GError *error,
+ gpointer userdata)
+{
+ EmpathyLocationManager *self = userdata;
+
+ if (error != NULL)
+ {
+ DEBUG ("Failed to create GeoclueAddress: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ self->priv->gc_address = address;
+
+ g_signal_connect (G_OBJECT (self->priv->gc_address), "address-changed",
+ G_CALLBACK (address_changed_cb), self);
+
+ self->priv->geoclue_is_setup = TRUE;
+}
+
static void
create_position_cb (GeoclueMasterClient *client,
GeocluePosition *position,
if (error != NULL)
{
DEBUG ("Failed to create GeocluePosition: %s", error->message);
+ g_error_free (error);
return;
}
G_CALLBACK (position_changed_cb), self);
/* Get updated when the address changes */
- self->priv->gc_address = geoclue_master_client_create_address (
- self->priv->gc_client, &error);
- if (self->priv->gc_address == NULL)
- {
- DEBUG ("Failed to create GeoclueAddress: %s", error->message);
- g_error_free (error);
- return;
- }
-
- g_signal_connect (G_OBJECT (self->priv->gc_address), "address-changed",
- G_CALLBACK (address_changed_cb), self);
-
- self->priv->geoclue_is_setup = TRUE;
+ geoclue_master_client_create_address_async (self->priv->gc_client,
+ create_address_cb, self);
}
static void
if (error != NULL)
{
DEBUG ("Failed to create GeoclueMasterClient: %s", error->message);
+ g_error_free (error);
return;
}
return;
}
- accounts = tp_account_manager_get_valid_accounts (account_manager);
+ accounts = tp_account_manager_dup_valid_accounts (account_manager);
for (l = accounts; l != NULL; l = l->next)
{
TpAccount *account = TP_ACCOUNT (l->data);
tp_g_signal_connect_object (account, "status-changed",
G_CALLBACK (new_connection_cb), self, 0);
}
- g_list_free (accounts);
+ g_list_free_full (accounts, g_object_unref);
}
static void