From f503b2034233aa26c58cae4f8b02c0388b1efca0 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Tue, 31 Jul 2007 00:06:52 +0300 Subject: [PATCH] Save home location directly when setting it. --- src/cb.c | 27 +++++++++++---------------- src/config.c | 18 ++++++++++++++---- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/cb.c b/src/cb.c index 21e7870..e12efcc 100644 --- a/src/cb.c +++ b/src/cb.c @@ -1247,29 +1247,24 @@ gboolean cb_add_poi(GtkAction * action) gboolean cmenu_cb_loc_set_home(GtkAction * action) { - printf("%s()\n", __PRETTY_FUNCTION__); - - _pos.unitx = x2unit(_cmenu_position_x); - _pos.unity = y2unit(_cmenu_position_y); - unit2latlon(_pos.unitx, _pos.unity, _home.lat, _home.lon); +_pos.unitx = x2unit(_cmenu_position_x); +_pos.unity = y2unit(_cmenu_position_y); +unit2latlon(_pos.unitx, _pos.unity, _home.lat, _home.lon); - vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__); - return TRUE; +config_save_home(); +return TRUE; } gboolean cmenu_cb_loc_set_gps(GtkAction * action) { - printf("%s()\n", __PRETTY_FUNCTION__); - - _pos.unitx = x2unit(_cmenu_position_x); - _pos.unity = y2unit(_cmenu_position_y); - unit2latlon(_pos.unitx, _pos.unity, _gps.lat, _gps.lon); +_pos.unitx = x2unit(_cmenu_position_x); +_pos.unity = y2unit(_cmenu_position_y); +unit2latlon(_pos.unitx, _pos.unity, _gps.lat, _gps.lon); - /* Move mark to new location. */ - refresh_mark(); +/* Move mark to new location. */ +refresh_mark(); - vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__); - return TRUE; +return TRUE; } gboolean cmenu_cb_way_show_latlon(GtkAction * action) diff --git a/src/config.c b/src/config.c index bc183ca..81428a3 100644 --- a/src/config.c +++ b/src/config.c @@ -188,6 +188,20 @@ if (_repo_list == NULL) { return TRUE; } +config_save_home(void) +{ +GConfClient *gconf_client = gconf_client_get_default(); + +if (!gconf_client) + return FALSE; + +/* Save home lat/lon. */ +gconf_client_set_float(gconf_client, GCONF_KEY_HOME_LAT, _home.lat, NULL); +gconf_client_set_float(gconf_client, GCONF_KEY_HOME_LON, _home.lon, NULL); + +return TRUE; +} + /** * Save all configuration data to GCONF. */ @@ -282,10 +296,6 @@ config_save() gconf_client_set_float(gconf_client, GCONF_KEY_LAT, _gps.lat, NULL); gconf_client_set_float(gconf_client, GCONF_KEY_LON, _gps.lon, NULL); - /* Save home lat/lon. */ - gconf_client_set_float(gconf_client, GCONF_KEY_HOME_LAT, _home.lat, NULL); - gconf_client_set_float(gconf_client, GCONF_KEY_HOME_LON, _home.lon, NULL); - /* Save last center point. */ { gfloat center_lat, center_lon; -- 2.39.5