2 * This file is part of mapper
4 * Copyright (C) 2007 Kaj-Michael Lang
5 * Copyright (C) 2006-2007 John Costigan.
7 * POI and GPS-Info code originally written by Cezary Jackiewicz.
9 * Default map data provided by http://www.openstreetmap.org/
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * Maemo hardware specific functions
40 #include <osso-ic-dbus.h>
45 #include "mapper-types.h"
47 #include "settings-gconf.h"
49 #include "config-gconf.h"
50 #include "ui-common.h"
53 dbus_cb_default(const gchar *interface, const gchar *method, GArray *arguments, gpointer data, osso_rpc_t *retval)
55 if(!strcmp(method, "top_application"))
56 gtk_idle_add((GSourceFunc)window_present, NULL);
57 retval->type = DBUS_TYPE_INVALID;
63 osso_cb_hw_state(osso_hw_state_t *state, gpointer data)
65 static gboolean _must_save_data = FALSE;
67 if (state->system_inactivity_ind) {
69 _must_save_data = FALSE;
71 if (_gps->io.conn > RCVR_OFF) {
72 if (gconf_client_get_bool(gconf_client, GCONF_KEY_DISCONNECT_ON_COVER, NULL)) {
73 gconf_client_clear_cache(gconf_client);
74 gps_conn_set_state(_gps, RCVR_OFF);
76 track_add(_track, NULL);
77 /* Pretend autoroute is in progress to avoid download. */
78 if (_autoroute_data.enabled)
79 _autoroute_data.in_progress = TRUE;
83 g_source_remove(_curl_sid);
87 } else if (state->save_unsaved_data_ind) {
89 _must_save_data = TRUE;
90 } else if (state->memory_low_ind) {
91 poi_icon_hash_clear();
93 if (_gps->io.conn == RCVR_OFF && _enable_gps) {
94 gps_conn_set_state(_gps, RCVR_DOWN);
95 gps_connect_later(_gps);
96 if (_autoroute_data.enabled)
97 _autoroute_data.in_progress = TRUE;
100 /* Start curl in case there are downloads pending. */
101 if (iap_is_connected() && !_curl_sid)
102 _curl_sid = g_timeout_add(100, (GSourceFunc)map_download_timeout, NULL);
109 osso_cb_hw_state(void *state, gpointer data)