return TRUE;
}
+gboolean menu_cb_goto_home(GtkAction * action)
+{
+ guint unitx, unity;
+
+ printf("%s()\n", __PRETTY_FUNCTION__);
+
+ if (_center_mode > 0)
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
+ (_menu_ac_none_item), TRUE);
+
+ latlon2unit(_home.lat, _home.lon, unitx, unity);
+ map_center_unit(unitx, unity);
+
+ vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
+ return TRUE;
+}
+
gboolean menu_cb_goto_gps(GtkAction * action)
{
printf("%s()\n", __PRETTY_FUNCTION__);
return TRUE;
}
+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);
+
+ vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
+ return TRUE;
+}
+
gboolean cmenu_cb_loc_set_gps(GtkAction * action)
{
printf("%s()\n", __PRETTY_FUNCTION__);
/* Callbacks for the "Go to" submenu. */
gboolean menu_cb_goto_latlon(GtkAction * action);
gboolean menu_cb_goto_gps(GtkAction * action);
+gboolean menu_cb_goto_home(GtkAction * action);
gboolean menu_cb_goto_nextway(GtkAction * action);
gboolean menu_cb_goto_nearpoi(GtkAction * action);
gboolean cmenu_cb_loc_add_way(GtkAction * action);
gboolean cmenu_cb_loc_add_poi(GtkAction * action);
gboolean cmenu_cb_loc_set_gps(GtkAction * action);
+gboolean cmenu_cb_loc_set_home(GtkAction * action);
gboolean cb_add_poi(GtkAction * action);
GCONF_KEY_INFO_FONT_SIZE,
INFO_FONT_TEXT[_info_font_size], NULL);
- /* Save last saved latitude. */
+ /* Save last saved latitude/longiture. */
gconf_client_set_float(gconf_client, GCONF_KEY_LAT, _gps.lat, NULL);
-
- /* Save last saved longitude. */
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;
_gps.lat = gconf_client_get_float(gconf_client, GCONF_KEY_LAT, NULL);
_gps.lon = gconf_client_get_float(gconf_client, GCONF_KEY_LON, NULL);
if (_gps.lat==0.0) _gps.lat=64.0;
- if (_gps.lon==0.0) _gps.lon=24.0;
+ if (_gps.lon==0.0) _gps.lon=22.0;
+
+ /* Home */
+ _home.lat = gconf_client_get_float(gconf_client, GCONF_KEY_HOME_LAT, NULL);
+ _home.lon = gconf_client_get_float(gconf_client, GCONF_KEY_HOME_LON, NULL);
+ if (_home.lat==0.0) _home.lat=64.0;
+ if (_home.lon==0.0) _home.lon=22.0;
/* Get last center point. */
{
} SpeedLocation;
gchar *SPEED_LOCATION_TEXT[SPEED_LOCATION_ENUM_COUNT];
-/** A general definition of a point in the Maemo Mapper unit system. */
+/** A lat/lon/alt position */
+typedef struct _Position Position;
+struct _Position {
+ gfloat lat;
+ gfloat lon;
+ gfloat altitude;
+};
+
+/** A general definition of a point in the Mapper unit system. */
typedef struct _Point Point;
struct _Point {
guint unitx;
};
Point _point_null;
+Position _home;
#endif
#define GCONF_KEY_CENTER_LON GCONF_KEY_PREFIX"/center_longitude"
#define GCONF_KEY_ZOOM GCONF_KEY_PREFIX"/zoom"
+#define GCONF_KEY_HOME_LAT GCONF_KEY_PREFIX"/home_latitude"
+#define GCONF_KEY_HOME_LON GCONF_KEY_PREFIX"/home_longitude"
+
/* Display features */
#define GCONF_KEY_SHOWSCALE GCONF_KEY_PREFIX"/show_scale"
#define GCONF_KEY_SHOWTRACKS GCONF_KEY_PREFIX"/show_tracks"
= gtk_menu_item_new_with_label(_("Add POI...")));
gtk_widget_set_sensitive(_cmenu_loc_add_poi, _db != NULL);
gtk_menu_append(submenu, gtk_separator_menu_item_new());
- gtk_menu_append(submenu, _cmenu_loc_set_gps
- =
+ gtk_menu_append(submenu, _cmenu_loc_set_gps =
gtk_menu_item_new_with_label(_("Set as GPS Location")));
+ gtk_menu_append(submenu, _cmenu_loc_set_home =
+ gtk_menu_item_new_with_label(_("Set as Home Location")));
/* Setup the waypoint context menu. */
gtk_menu_append(menu, menu_item
G_CALLBACK(cmenu_cb_loc_add_poi), NULL);
g_signal_connect(G_OBJECT(_cmenu_loc_set_gps), "activate",
G_CALLBACK(cmenu_cb_loc_set_gps), NULL);
+ g_signal_connect(G_OBJECT(_cmenu_loc_set_home), "activate",
+ G_CALLBACK(cmenu_cb_loc_set_home), NULL);
g_signal_connect(G_OBJECT(_cmenu_way_show_latlon_item), "activate",
G_CALLBACK(cmenu_cb_way_show_latlon), NULL);
item = gtk_tool_button_new_from_stock (GTK_STOCK_HOME);
gtk_toolbar_insert (GTK_TOOLBAR (_toolbar), item, -1);
-/* g_signal_connect (item, "clicked", G_CALLBACK (cb_jump_to_home), NULL); */
+g_signal_connect (item, "clicked", G_CALLBACK (menu_cb_goto_home), NULL);
item = gtk_tool_button_new_from_stock (GTK_STOCK_JUMP_TO);
gtk_toolbar_insert (GTK_TOOLBAR (_toolbar), item, -1);
GtkWidget *_cmenu_loc_add_way;
GtkWidget *_cmenu_loc_add_poi;
GtkWidget *_cmenu_loc_set_gps;
+GtkWidget *_cmenu_loc_set_home;
/* Menu items for the "Waypoint" context menu. */
GtkWidget *_cmenu_way_show_latlon_item;