navit  0.5.3-trunk
bookmarks.c File Reference
#include <stdlib.h>
#include <glib.h>
#include <stdio.h>
#include <errno.h>
#include "config.h"
#include "file.h"
#include "debug.h"
#include "projection.h"
#include "coord.h"
#include "transform.h"
#include "callback.h"
#include "map.h"
#include "command.h"
#include "bookmarks.h"
#include "navit.h"
#include "navit_nls.h"
#include "util.h"

Data Structures

struct  bookmarks
 
struct  bookmark_item_priv
 
struct  former_destination
 

Functions

void bookmarks_move_root (struct bookmarks *this_)
 
void bookmarks_move_up (struct bookmarks *this_)
 
int bookmarks_move_down (struct bookmarks *this_, const char *name)
 
void bookmarks_item_rewind (struct bookmarks *this_)
 
struct itembookmarks_get_item (struct bookmarks *this_)
 
int bookmarks_get_bookmark_count (struct bookmarks *this_)
 
const char * bookmarks_item_cwd (struct bookmarks *this_)
 
static void bookmarks_clear_item (struct bookmark_item_priv *b_item)
 
static void bookmarks_clear_hash (struct bookmarks *this_)
 
static void bookmarks_load_hash (struct bookmarks *this_)
 
struct bookmarksbookmarks_new (struct attr *parent, struct attr **attrs, struct transformation *trans)
 
void bookmarks_destroy (struct bookmarks *this_)
 
struct mapbookmarks_get_map (struct bookmarks *this_)
 
enum projection bookmarks_get_projection (struct bookmarks *this_)
 
void bookmarks_add_callback (struct bookmarks *this_, struct callback *cb)
 
static int bookmarks_store_bookmarks_to_file (struct bookmarks *this_, int limit, int replace)
 
char * bookmarks_get_destination_file (gboolean create)
 
char * bookmarks_get_center_file (gboolean create)
 
void bookmarks_set_center_from_file (struct bookmarks *this_, char *file)
 
void bookmarks_write_center_to_file (struct bookmarks *this_, char *file)
 
static void bookmarks_emit_dbus_signal (struct bookmarks *this_, struct pcoord *c, const char *description, int create)
 
int bookmarks_add_bookmark (struct bookmarks *this_, struct pcoord *pc, const char *description)
 
int bookmarks_cut_bookmark (struct bookmarks *this_, const char *label)
 
int bookmarks_copy_bookmark (struct bookmarks *this_, const char *label)
 
int bookmarks_paste_bookmark (struct bookmarks *this_)
 
int bookmarks_delete_bookmark (struct bookmarks *this_, const char *label)
 
int bookmarks_rename_bookmark (struct bookmarks *this_, const char *oldName, const char *newName)
 
static void g_free_helper (void *data, void *user_data)
 
static void free_former_destination (struct former_destination *former_destination, void *unused)
 
static GListread_former_destination_map_as_list (struct map *map)
 
static int destination_equal (struct former_destination *dest1, struct former_destination *dest2, int ignore_descriptions)
 
static GListfind_destination_in_list (struct former_destination *dest_to_remove, GList *former_destinations, int remove_found)
 
static void write_former_destinations (const GList *former_destinations, const char *former_destination_file, enum projection proj)
 Write all former destinations into a text file. More...
 
void bookmarks_append_destinations (struct map *former_destination_map, char *former_destination_file, struct pcoord *c, int count, enum item_type type, const char *description, int limit)
 Append recent destination(s) item to the former destionations map. More...
 

Function Documentation

◆ bookmarks_add_bookmark()

◆ bookmarks_add_callback()

void bookmarks_add_callback ( struct bookmarks this_,
struct callback cb 
)

◆ bookmarks_append_destinations()

void bookmarks_append_destinations ( struct map former_destination_map,
char *  former_destination_file,
struct pcoord c,
int  count,
enum item_type  type,
const char *  description,
int  limit 
)

Append recent destination(s) item to the former destionations map.

Parameters
former_destination_map
former_destination_file
ccoordinates of item point(s). Can be set to NULL when navigation is stopped to remove type_former_itinerary and type_former_itinerary_part items from the file.
countnumber of points in this item. Set to 0 when navigation is stopped.
typetype_former_destination, type_former_itinerary and type_former_itinerary_part are meaningful here
descriptioncharacter string used to identify this destination. If NULL, most recent waypoint at these coordinates will be used to get description.
limitLimits the number of entries in the "backlog". Set to 0 for "infinite"

References _, c, description(), find_destination_in_list(), free_former_destination(), limit, map_projection(), read_former_destination_map_as_list(), transform_from_to(), type, write_former_destinations(), coord::x, pcoord::x, coord::y, and pcoord::y.

Referenced by navit_add_destination_description(), navit_set_destination(), navit_set_destinations(), and navit_vehicle_update_position().

◆ bookmarks_clear_hash()

◆ bookmarks_clear_item()

static void bookmarks_clear_item ( struct bookmark_item_priv b_item)
static

◆ bookmarks_copy_bookmark()

◆ bookmarks_cut_bookmark()

int bookmarks_cut_bookmark ( struct bookmarks this_,
const char *  label 
)

◆ bookmarks_delete_bookmark()

◆ bookmarks_destroy()

◆ bookmarks_emit_dbus_signal()

static void bookmarks_emit_dbus_signal ( struct bookmarks this_,
struct pcoord c,
const char *  description,
int  create 
)
static

◆ bookmarks_get_bookmark_count()

◆ bookmarks_get_center_file()

char* bookmarks_get_center_file ( gboolean  create)

◆ bookmarks_get_destination_file()

char* bookmarks_get_destination_file ( gboolean  create)
Parameters
createcreate the directory where the file is stored if it does not exist
Returns
The name of the file used to store destinations with its full path. Should be freed using g_free.

References navit_get_user_data_directory().

Referenced by navit_add_destination_description(), navit_former_destinations_active(), navit_set_destination(), navit_set_destinations(), navit_vehicle_update_position(), and read_former_destinations_from_file().

◆ bookmarks_get_item()

◆ bookmarks_get_map()

struct map* bookmarks_get_map ( struct bookmarks this_)

References bookmarks::bookmark.

Referenced by navit_get_attr().

◆ bookmarks_get_projection()

enum projection bookmarks_get_projection ( struct bookmarks this_)

◆ bookmarks_item_cwd()

const char* bookmarks_item_cwd ( struct bookmarks this_)

◆ bookmarks_item_rewind()

◆ bookmarks_load_hash()

◆ bookmarks_move_down()

◆ bookmarks_move_root()

◆ bookmarks_move_up()

◆ bookmarks_new()

◆ bookmarks_paste_bookmark()

◆ bookmarks_rename_bookmark()

◆ bookmarks_set_center_from_file()

void bookmarks_set_center_from_file ( struct bookmarks this_,
char *  file 
)

◆ bookmarks_store_bookmarks_to_file()

◆ bookmarks_write_center_to_file()

void bookmarks_write_center_to_file ( struct bookmarks this_,
char *  file 
)

◆ destination_equal()

static int destination_equal ( struct former_destination dest1,
struct former_destination dest2,
int  ignore_descriptions 
)
static

◆ find_destination_in_list()

static GList* find_destination_in_list ( struct former_destination dest_to_remove,
GList former_destinations,
int  remove_found 
)
static

◆ free_former_destination()

static void free_former_destination ( struct former_destination former_destination,
void *  unused 
)
static

◆ g_free_helper()

static void g_free_helper ( void *  data,
void *  user_data 
)
static

References data.

Referenced by free_former_destination().

◆ read_former_destination_map_as_list()

static GList* read_former_destination_map_as_list ( struct map map)
static

◆ write_former_destinations()

static void write_former_destinations ( const GList former_destinations,
const char *  former_destination_file,
enum projection  proj 
)
static

Write all former destinations into a text file.

Parameters
[in]former_destinationsA GList of struct coord data elements containing the list of former destinations
[in]former_destination_fileThe name of the output text file
projThe projection used to represent coordinates in former_destinations' list elements

References c, dbg, startup::dest, escape_mode_quote, item_to_name(), lvl_error, projection_to_name(), str_escape(), pcoord::x, and pcoord::y.

Referenced by bookmarks_append_destinations().