]> err.no Git - mapper/commitdiff
Confirm Route clear operation.
authorKaj-Michael Lang <milang@angel.tal.org>
Fri, 10 Aug 2007 07:05:32 +0000 (10:05 +0300)
committerKaj-Michael Lang <milang@angel.tal.org>
Fri, 10 Aug 2007 07:05:32 +0000 (10:05 +0300)
Formating.

src/cb.c
src/route.c
src/route.h
src/track.c

index e5a1d1b60e9892dee4444f44523c2695cfab606b..72a87746dab64fefaa6cd127c2ce1bf2966342d9 100644 (file)
--- a/src/cb.c
+++ b/src/cb.c
@@ -118,11 +118,7 @@ gboolean menu_cb_route_clear(GtkAction * action)
 {
        printf("%s()\n", __PRETTY_FUNCTION__);
 
-       cancel_autoroute(FALSE);
-       MACRO_PATH_FREE(_route);
-       MACRO_PATH_INIT(_route);
-       route_find_nearest_point();
-       map_force_redraw();
+       route_clear();
 
        vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
        return TRUE;
index daf865e056a8027250ceaf2d93d6376d8bec9054..e33920d39d285d1a85e97b50c8f852721e406112 100644 (file)
@@ -41,7 +41,25 @@ struct _OriginToggleInfo {
        GtkWidget *txt_to;
 };
 
-gboolean route_open_file()
+void
+route_clear(void)
+{
+GtkWidget *confirm;
+
+confirm = hildon_note_new_confirmation(GTK_WINDOW(_window), _("Really clear the route?"));
+
+if (GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm))) {
+       cancel_autoroute(FALSE);
+       MACRO_PATH_FREE(_route);
+       MACRO_PATH_INIT(_route);
+       route_find_nearest_point();
+       map_force_redraw();
+}
+gtk_widget_destroy(confirm);
+}
+
+gboolean 
+route_open_file()
 {
 gchar *buffer;
 gint size;
@@ -83,7 +101,8 @@ if (file_save(&_route_dir_uri, &_route_dir_uri, &handle)) {
 return FALSE;
 }
 
-gboolean origin_type_selected(GtkWidget * toggle, OriginToggleInfo * oti)
+gboolean 
+origin_type_selected(GtkWidget * toggle, OriginToggleInfo * oti)
 {
        printf("%s()\n", __PRETTY_FUNCTION__);
 
@@ -128,7 +147,8 @@ gboolean origin_type_selected(GtkWidget * toggle, OriginToggleInfo * oti)
 /**
  * Cancel the current auto-route.
  */
-void cancel_autoroute(gboolean temporary)
+void 
+cancel_autoroute(gboolean temporary)
 {
        printf("%s()\n", __PRETTY_FUNCTION__);
 
@@ -180,7 +200,8 @@ route_dl_cb_read(void *ptr, size_t size, size_t nmemb,
        return (size * nmemb);
 }
 
-gboolean auto_route_dl_idle()
+gboolean 
+auto_route_dl_idle()
 {
        gchar latstr[32], lonstr[32], *latlonstr;
        printf("%s(%f, %f, %s)\n", __PRETTY_FUNCTION__,
@@ -232,7 +253,8 @@ gboolean auto_route_dl_idle()
  * None of the passed strings are freed - that is left to the caller, and it is
  * safe to free either string as soon as this function returns.
  */
-gboolean route_download(gchar * to)
+gboolean 
+route_download(gchar * to)
 {
        GtkWidget *dialog;
        GtkWidget *table;
@@ -486,7 +508,8 @@ gboolean route_download(gchar * to)
        return TRUE;
 }
 
-WayPoint *find_nearest_waypoint(guint unitx, guint unity)
+WayPoint *
+find_nearest_waypoint(guint unitx, guint unity)
 {
        WayPoint *wcurr;
        WayPoint *wnear;
@@ -530,7 +553,8 @@ WayPoint *find_nearest_waypoint(guint unitx, guint unity)
  * the entire list (starting from _near_point) is searched.  Otherwise, we
  * stop searching when we find a point that is farther away.
  */
-gboolean route_update_nears(gboolean quick)
+gboolean 
+route_update_nears(gboolean quick)
 {
        gboolean ret = FALSE;
        Point *curr, *near;
@@ -641,7 +665,8 @@ gboolean route_update_nears(gboolean quick)
  * Reset the _near_point data by searching the entire route for the nearest
  * route point and waypoint.
  */
-void route_find_nearest_point()
+void 
+route_find_nearest_point()
 {
        printf("%s()\n", __PRETTY_FUNCTION__);
 
@@ -674,7 +699,8 @@ void route_find_nearest_point()
  * following the route.  If point is NULL, then the distance is shown to the
  * next waypoint.
  */
-gboolean route_show_distance_to(Point * point)
+gboolean 
+route_show_distance_to(Point * point)
 {
        gchar buffer[80];
        gfloat lat1, lon1, lat2, lon2;
@@ -730,7 +756,8 @@ gboolean route_show_distance_to(Point * point)
        printf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
 }
 
-void route_show_distance_to_next()
+void 
+route_show_distance_to_next()
 {
        printf("%s()\n", __PRETTY_FUNCTION__);
 
@@ -741,7 +768,8 @@ void route_show_distance_to_next()
        printf("%s(): return\n", __PRETTY_FUNCTION__);
 }
 
-void route_show_distance_to_last()
+void 
+route_show_distance_to_last()
 {
        printf("%s()\n", __PRETTY_FUNCTION__);
 
index 448a29bd33ebd8a30805fceb0fd8b8382b73bfe1..fb4082f561878e70f1039dcde1314b054be1e713 100644 (file)
@@ -45,9 +45,12 @@ AutoRouteDownloadData _autoroute_data;
 
 gboolean route_open_file();
 gboolean route_save(void);
+void route_clear(void);
 gboolean auto_route_dl_idle();
 gboolean route_download(gchar * to);
 WayPoint *find_nearest_waypoint(guint unitx, guint unity);
 gboolean route_update_nears(gboolean quick);
-
+void route_show_distance_to_last();
+void route_show_distance_to_next();
+gboolean route_show_distance_to(Point * point);
 #endif
index c2554703c3b5ab9a14c8b8a6a437438cedc61efd..c667f7603036a6bd2e639aa309371cb242bbccfe 100644 (file)
@@ -28,8 +28,7 @@ track_clear(void)
 {
        GtkWidget *confirm;
 
-       confirm = hildon_note_new_confirmation(GTK_WINDOW(_window),
-                                              _("Really clear the track?"));
+       confirm = hildon_note_new_confirmation(GTK_WINDOW(_window), _("Really clear the track?"));
 
        if (GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm))) {
                _track.tail = _track.head;