Skip to content
Permalink
Browse files
2010-02-26 Arno Renevier <arno@renevier.net>
        Reviewed by Gustavo Noronha Silva.

        [Gtk] use geoclue_position_get_position_async to get geolocation position.
        https://bugs.webkit.org/show_bug.cgi?id=35355

        No new tests, behaviour depends on system.

        * platform/gtk/GeolocationServiceGtk.cpp:
        (WebCore::GeolocationServiceGtk::startUpdating):
        (WebCore::GeolocationServiceGtk::get_position):
        * platform/gtk/GeolocationServiceGtk.h:

Canonical link: https://commits.webkit.org/46626@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55325 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eseidel committed Feb 27, 2010
1 parent a635334 commit 3aba448fe4a0699d5aa31082460d0a661a38030b
Showing 3 changed files with 37 additions and 26 deletions.
@@ -1,3 +1,17 @@
2010-02-26 Arno Renevier <arno@renevier.net>

Reviewed by Gustavo Noronha Silva.

[Gtk] use geoclue_position_get_position_async to get geolocation position.
https://bugs.webkit.org/show_bug.cgi?id=35355

No new tests, behaviour depends on system.

* platform/gtk/GeolocationServiceGtk.cpp:
(WebCore::GeolocationServiceGtk::startUpdating):
(WebCore::GeolocationServiceGtk::get_position):
* platform/gtk/GeolocationServiceGtk.h:

2010-02-26 Yaar Schnitman <yaar@chromium.org>

Chromium Win build fix.
@@ -113,12 +113,13 @@ bool GeolocationServiceGtk::startUpdating(PositionOptions* options)
return false;
}

m_geoclueClient = client;

geoclue_position_get_position_async(m_geocluePosition, (GeocluePositionCallback)getPositionCallback, this);

g_signal_connect(G_OBJECT(m_geocluePosition), "position-changed",
G_CALLBACK(position_changed), this);

m_geoclueClient = client;
updateLocationInformation();

return true;
}

@@ -156,28 +157,6 @@ PositionError* GeolocationServiceGtk::lastError() const
return m_lastError.get();
}

void GeolocationServiceGtk::updateLocationInformation()
{
ASSERT(m_geocluePosition);

GOwnPtr<GError> error;
GOwnPtr<GeoclueAccuracy> accuracy;

GeocluePositionFields fields = geoclue_position_get_position(m_geocluePosition, &m_timestamp,
&m_latitude, &m_longitude,
&m_altitude, &accuracy.outPtr(),
&error.outPtr());
if (error) {
setError(PositionError::POSITION_UNAVAILABLE, error->message);
return;
} else if (!(fields & GEOCLUE_POSITION_FIELDS_LATITUDE && fields & GEOCLUE_POSITION_FIELDS_LONGITUDE)) {
setError(PositionError::POSITION_UNAVAILABLE, "Position could not be determined.");
return;
}


}

void GeolocationServiceGtk::updatePosition()
{
m_lastError = 0;
@@ -189,6 +168,24 @@ void GeolocationServiceGtk::updatePosition()
positionChanged();
}

void GeolocationServiceGtk::getPositionCallback(GeocluePosition *position,
GeocluePositionFields fields,
int timestamp,
double latitude,
double longitude,
double altitude,
GeoclueAccuracy* accuracy,
GError* error,
GeolocationServiceGtk* that)
{
if (error) {
that->setError(PositionError::POSITION_UNAVAILABLE, error->message);
g_error_free(error);
return;
}
position_changed(position, fields, timestamp, latitude, longitude, altitude, accuracy, that);
}

void GeolocationServiceGtk::position_changed(GeocluePosition*, GeocluePositionFields fields, int timestamp, double latitude, double longitude, double altitude, GeoclueAccuracy* accuracy, GeolocationServiceGtk* that)
{
if (!(fields & GEOCLUE_POSITION_FIELDS_LATITUDE && fields & GEOCLUE_POSITION_FIELDS_LONGITUDE)) {
@@ -46,11 +46,11 @@ namespace WebCore {
private:
GeolocationServiceGtk(GeolocationServiceClient*);

void updateLocationInformation();
void setError(PositionError::ErrorCode, const char* message);
void updatePosition();

static void position_changed(GeocluePosition*, GeocluePositionFields, int, double, double, double, GeoclueAccuracy*, GeolocationServiceGtk*);
static void getPositionCallback(GeocluePosition*, GeocluePositionFields, int, double, double, double, GeoclueAccuracy*, GError*, GeolocationServiceGtk*);

private:
RefPtr<Geoposition> m_lastPosition;

0 comments on commit 3aba448

Please sign in to comment.