]> err.no Git - mapper/commitdiff
Fix POI db handling so it works.
authorKaj-Michael Lang <milang@onion.tal.org>
Mon, 4 Jun 2007 06:49:48 +0000 (09:49 +0300)
committerKaj-Michael Lang <milang@onion.tal.org>
Mon, 4 Jun 2007 06:49:48 +0000 (09:49 +0300)
Use status bar for message in !hildon mode. Timeout messages in 5 seconds.
Misc other changes.

15 files changed:
src/cb.c
src/cb.h
src/config.c
src/db.c
src/file.c
src/hildon-wrappers.c
src/map.c
src/mapper.c
src/poi.h
src/route.c
src/settings-gui.c
src/track.c
src/ui-common.c
src/ui-common.h
src/utils.h

index 0c3287519bdcfedc238507cc41e99ac4c33a9676..8b617bd610b78da479433bda2fe0564df8ef2b5c 100644 (file)
--- a/src/cb.c
+++ b/src/cb.c
@@ -702,8 +702,8 @@ gboolean menu_cb_about(GtkAction * action)
 #ifdef WITH_HILDON
        ossohelp_show(_osso, HELP_ID_ABOUT, OSSO_HELP_SHOW_DIALOG);
 #else
-       gtk_show_about_dialog(GTK_WINDOW(_window), "name", "OSM-Mapper",
-                             "version", "0.1", NULL);
+       gtk_show_about_dialog(GTK_WINDOW(_window), "name", "Mapper",
+                             "version", VERSION, NULL);
 #endif
 
        vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
@@ -947,6 +947,8 @@ void cmenu_show_latlon(guint unitx, guint unity)
        gchar buffer[80], tmp1[16], tmp2[16];
        printf("%s()\n", __PRETTY_FUNCTION__);
 
+       g_printf("S: %d %d\n", unitx, unity);
+
        unit2latlon(unitx, unity, lat, lon);
        lat_format(lat, tmp1);
        lon_format(lon, tmp2);
index 5070e1a3bac7a4bf7737fcb901ade6c8fa356a35..92c680d8b8a6facc0f753ec01234179d8b1cd7db 100644 (file)
--- a/src/cb.h
+++ b/src/cb.h
@@ -20,12 +20,9 @@ gboolean heading_panel_expose(GtkWidget * widget, GdkEventExpose * event);
 gboolean sat_panel_expose(GtkWidget * widget, GdkEventExpose * event);
 gboolean sat_details_panel_expose(GtkWidget * widget, GdkEventExpose * event);
 
-gboolean
-channel_cb_error(GIOChannel * src, GIOCondition condition, gpointer data);
-gboolean
-channel_cb_connect(GIOChannel * src, GIOCondition condition, gpointer data);
-gboolean
-channel_cb_input(GIOChannel * src, GIOCondition condition, gpointer data);
+gboolean channel_cb_error(GIOChannel * src, GIOCondition condition, gpointer data);
+gboolean channel_cb_connect(GIOChannel * src, GIOCondition condition, gpointer data);
+gboolean channel_cb_input(GIOChannel * src, GIOCondition condition, gpointer data);
 
 /* Callbacks for the "Route" submenu. */
 gboolean menu_cb_route_download(GtkAction * action);
index 209cf5f3cdba90952a2b90ae4c4c8dbcda1eeb69..d13ee6ad9d18391dec9384bccb5f3050d7f151cf 100644 (file)
@@ -22,6 +22,7 @@
 #include "mapper-types.h"
 #include "map.h"
 #include "route.h"
+#include "db.h"
 #include "poi.h"
 #include "gps.h"
 #include "ui-common.h"
@@ -744,7 +745,7 @@ void config_init()
                    gnome_vfs_uri_make_full_from_relative(poi_base, "poi.db");
                g_free(poi_base);
        }
-       db_connect(_db, _poi_db);
+       db_connect(&_db, _poi_db);
 
        _poi_zoom = gconf_client_get_int(gconf_client,
                                         GCONF_KEY_POI_ZOOM, NULL);
index 2e4a78ff53c925e76b465f679d700a36f3595ee4..9fc62d110d7d05004582c915b9e9893de6d5de17 100644 (file)
--- a/src/db.c
+++ b/src/db.c
@@ -1,3 +1,5 @@
+#include "config.h"
+
 #include <gtk/gtk.h>
 #include <sqlite3.h>
 
@@ -6,29 +8,55 @@
 #include <libintl.h>
 #include <locale.h>
 
-static sqlite3_stmt *_stmt_select_poi = NULL;
-static sqlite3_stmt *_stmt_select_nearest_poi = NULL;
-static sqlite3_stmt *_stmt_insert_poi = NULL;
-static sqlite3_stmt *_stmt_update_poi = NULL;
-static sqlite3_stmt *_stmt_delete_poi = NULL;
-static sqlite3_stmt *_stmt_delete_poi_by_catid = NULL;
-static sqlite3_stmt *_stmt_nextlabel_poi = NULL;
-
-static sqlite3_stmt *_stmt_select_cat = NULL;
-static sqlite3_stmt *_stmt_insert_cat = NULL;
-static sqlite3_stmt *_stmt_update_cat = NULL;
-static sqlite3_stmt *_stmt_delete_cat = NULL;
-static sqlite3_stmt *_stmt_toggle_cat = NULL;
-static sqlite3_stmt *_stmt_selall_cat = NULL;
-
-gboolean db_connect(sqlite3 * db, gchar * poi_db)
+#include "utils.h"
+#include "ui-common.h"
+#include "poi.h"
+
+sqlite3_stmt *_stmt_select_poi = NULL;
+sqlite3_stmt *_stmt_select_nearest_poi = NULL;
+sqlite3_stmt *_stmt_insert_poi = NULL;
+sqlite3_stmt *_stmt_update_poi = NULL;
+sqlite3_stmt *_stmt_delete_poi = NULL;
+sqlite3_stmt *_stmt_delete_poi_by_catid = NULL;
+sqlite3_stmt *_stmt_nextlabel_poi = NULL;
+
+sqlite3_stmt *_stmt_select_cat = NULL;
+sqlite3_stmt *_stmt_insert_cat = NULL;
+sqlite3_stmt *_stmt_update_cat = NULL;
+sqlite3_stmt *_stmt_delete_cat = NULL;
+sqlite3_stmt *_stmt_toggle_cat = NULL;
+sqlite3_stmt *_stmt_selall_cat = NULL;
+
+gboolean db_prepare(sqlite3 *db)
+{
+
+return TRUE;
+}
+
+gboolean db_close(sqlite3 *db)
+{
+if (db) {
+       sqlite3_close(db);
+       db=NULL;
+}
+return TRUE;
+}
+
+gboolean db_connect(sqlite3 **ndb, const gchar *poi_db)
 {
        gchar buffer[100];
        gchar *perror;
        gchar **pszResult;
        guint nRow, nColumn;
+       sqlite3 *db;
+
        printf("%s()\n", __PRETTY_FUNCTION__);
 
+       if (ndb && *ndb)
+               db=*ndb;
+       else
+               db=NULL;
+
        if (db) {
                sqlite3_close(db);
                db = NULL;
@@ -45,10 +73,12 @@ gboolean db_connect(sqlite3 * db, gchar * poi_db)
                         sqlite3_errmsg(db));
                sqlite3_close(db);
                db = NULL;
-               /* popup_error(_window, buffer2); */
+               popup_error(_window, buffer2);
                return FALSE;
        }
 
+       *ndb=db;
+
        if (SQLITE_OK != sqlite3_get_table(db, "select label from poi limit 1",
                                           &pszResult, &nRow, &nColumn, NULL)) {
                gchar *create_sql;
@@ -117,7 +147,7 @@ gboolean db_connect(sqlite3 * db, gchar * poi_db)
                                 sqlite3_errmsg(db));
                        sqlite3_close(db);
                        db = NULL;
-                       /*popup_error(_window, buffer); */
+                       popup_error(_window, buffer);
                        return FALSE;
                }
        } else
index 520e646fb3e97a854f45232161f383877bad6265..0db786b88a2339856891fb3d8df3eebcf2b9543f 100644 (file)
 #include "ui-common.h"
 #include "hildon-wrappers.h"
 
+gboolean
+file_open(gchar *dir, gchar *file, GnomeVFSHandle **vfs)
+{
+GtkWidget *dialog;
+gboolean success;
+
+#ifdef WITH_HILDON
+dialog = hildon_file_chooser_dialog_new(GTK_WINDOW(_window), GTK_FILE_CHOOSER_ACTION_OPEN);
+#else
+dialog = gtk_file_chooser_dialog_new("Open...", GTK_WINDOW(_window), GTK_FILE_CHOOSER_ACTION_OPEN,
+                                                    GTK_STOCK_CANCEL,
+                                                    GTK_RESPONSE_CANCEL,
+                                                    GTK_STOCK_OPEN,
+                                                    GTK_RESPONSE_ACCEPT, NULL);
+#endif
+
+if (dir)
+       gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(dialog), dir);
+
+if (file)
+       gtk_file_chooser_set_uri(GTK_FILE_CHOOSER(dialog), file);
+
+while (!success && gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
+               gchar *file_uri_str;
+               GnomeVFSResult vfs_result;
+
+               /* Get the selected filename. */
+               file_uri_str = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog));
+
+               printf("file: %s\n", file_uri_str);
+
+               g_free(file_uri_str);
+}
+
+}
+
+gboolean
+file_save(gchar *dir, gchar *file, GnomeVFSHandle **vfs)
+{
+GtkWidget *dialog;
+gboolean success;
+
+#ifdef WITH_HILDON
+dialog = hildon_file_chooser_dialog_new(GTK_WINDOW(_window), GTK_FILE_CHOOSER_ACTION_SAVE);
+#else
+dialog = gtk_file_chooser_dialog_new("Save...", GTK_WINDOW(_window), GTK_FILE_CHOOSER_ACTION_SAVE,
+                                                    GTK_STOCK_CANCEL,
+                                                    GTK_RESPONSE_CANCEL,
+                                                    GTK_STOCK_SAVE,
+                                                    GTK_RESPONSE_ACCEPT, NULL);
+gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE);
+#endif
+
+if (dir)
+       gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(dialog), dir);
+
+if (file)
+       gtk_file_chooser_set_uri(GTK_FILE_CHOOSER(dialog), file);
+
+success=FALSE;
+if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
+       gchar *file_uri_str;
+       GnomeVFSResult vfs_result;
+
+       file_uri_str = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog));
+       vfs_result = gnome_vfs_create(vfs, file_uri_str, GNOME_VFS_OPEN_WRITE, FALSE, 0664);
+       g_free(file_uri_str);
+
+       if (vfs_result!=GNOME_VFS_OK) {
+               success=FALSE;
+       } else {
+               if (dir) {
+                       g_free(dir);
+                       dir = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER(dialog));
+               }
+               if (file) {
+                       g_free(file);
+                       file = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog));
+               }
+               success=TRUE;
+       }
+}
+
+gtk_widget_destroy(dialog);
+return success;
+}
+
 /**
  * This is a multi-purpose function for allowing the user to select a file
  * for either reading or writing.  If chooser_action is
@@ -27,8 +114,7 @@ open_file(gchar ** bytes_out, GnomeVFSHandle ** handle_out, gint * size_out,
        gboolean success = FALSE;
        printf("%s()\n", __PRETTY_FUNCTION__);
 
-       dialog =
-           hildon_file_chooser_dialog_new(GTK_WINDOW(_window), chooser_action);
+       dialog = hildon_file_chooser_dialog_new(GTK_WINDOW(_window), chooser_action);
 
        if (dir && *dir)
                gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER
index 7178874f54709394fa4cb45181105e50f4fd8384..a6456426ff94c943b81cb401db54af6a825eed42 100644 (file)
@@ -32,45 +32,45 @@ GtkWidget *hildon_file_chooser_dialog_new(GtkWindow * parent,
        return dialog;
 }
 
-void hildon_banner_show_information(void *w, void *t, gchar * text)
+static gboolean
+status_bar_clear(void)
 {
-       static guint cid = 0;
-
-       if (cid != 0)
-               gtk_statusbar_pop(_status_bar, cid);
+       gtk_statusbar_pop(_status_bar, 0);
+       return FALSE;
+}
 
-       cid = gtk_statusbar_get_context_id(_status_bar, text);
-       gtk_statusbar_push(_status_bar, cid, text);
+void hildon_banner_show_information(GtkWidget *w, void *t, gchar *text)
+{
+       gtk_statusbar_pop(_status_bar, 0);
+       gtk_statusbar_push(_status_bar, 0, text);
+       g_timeout_add(5000, status_bar_clear, NULL);
 }
 
 GtkWidget *hildon_banner_show_progress(GtkWidget * widget, GtkProgressBar * bar,
                                       const gchar * text)
 {
-       hildon_banner_show_information(NULL, NULL, text);
+       hildon_banner_show_information(_status_bar, NULL, text);
        return NULL;
 }
 
-GtkWidget *hildon_note_new_confirmation(GtkWidget * w, gchar * text)
+GtkWidget *hildon_note_new_confirmation(GtkWidget *widget, const gchar *text)
 {
-       GtkWidget *dialog;
-       dialog = gtk_message_dialog_new(w,
+       return gtk_message_dialog_new(widget,
                                        GTK_DIALOG_DESTROY_WITH_PARENT,
                                        GTK_MESSAGE_ERROR,
                                        GTK_BUTTONS_OK_CANCEL, text);
-
-       return dialog;
 }
 
-void hildon_banner_set_fraction(GtkWidget * w, gfloat tmp)
+void hildon_banner_set_fraction(GtkWidget * widget, gfloat tmp)
 {
+
 }
 
 GtkWidget *hildon_banner_show_animation(GtkWidget * widget,
                                        const gchar * animation_name,
                                        const gchar * text)
 {
-       g_print(animation_name);
-       g_print(text);
+       hildon_banner_show_information(_status_bar, NULL, text);
        return NULL;
 }
 
index a66beb82c129bd14a0b03958a437ef4f1986aadc..c2c91885bfc2984e49188d090c68fda7ce497b2d 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -1379,6 +1379,10 @@ gboolean map_cb_button_release(GtkWidget * widget, GdkEventButton * event)
                                                       (_menu_ac_none_item),
                                                       TRUE);
 
+               if (TRUE) {
+                       map_draw_track(event->x, event->y);
+               }
+
                map_center_unit(x2unit((gint) (event->x + 0.5)),
                                y2unit((gint) (event->y + 0.5)));
                break;
@@ -1396,7 +1400,6 @@ gboolean map_cb_button_release(GtkWidget * widget, GdkEventButton * event)
                before[1] = 0;
                break;
        case 3:
-               /* map_draw_track(event->x, event->y); */
                break;
        }
 
index 317501af446b3c9007ced458d38f12f06a916ffc..475ea74845532d8664a7dba745c1ec4697681695 100644 (file)
@@ -138,8 +138,7 @@ void set_conn_state(ConnState new_conn_state)
                if (!_connect_banner)
                        _connect_banner =
                            hildon_banner_show_animation(_window, NULL,
-                                                        _
-                                                        ("Searching for GPS receiver"));
+                                                        _("Searching for GPS receiver"));
                break;
        case RCVR_UP:
                if (_connect_banner) {
@@ -149,8 +148,7 @@ void set_conn_state(ConnState new_conn_state)
                if (!_fix_banner)
                        _fix_banner =
                            hildon_banner_show_progress(_window, NULL,
-                                                       _
-                                                       ("Establishing GPS fix"));
+                                                       _("Establishing GPS fix"));
                break;
        default:;               /* to quell warning. */
        }
index 7932d6e04916d9f3cab2e71a6e65f80743f5980e..bd7d085324e46d2807d5a4c09e8ca176ed0131fa 100644 (file)
--- a/src/poi.h
+++ b/src/poi.h
@@ -1,8 +1,54 @@
+/*
+
+POI table definitions:
+
+-- public POIs from different sources
+-- (Fuel, pubs, museums, etc)
+--
+create table poi (
+       poi_id integer PRIMARY KEY, 
+       cat_id integer,
+       source int,
+       source_id int,
+       type int,
+       lat real,
+       lon real,
+       elev real,
+       label text,
+       desc text,
+       wikipedia text,
+       url text,
+       phone varchar(64),
+       email varchar(64),
+);
+
+-- type:
+-- 0=POI
+-- 1=Landmark
+
+-- Shared categories for POIs and landmarks
+create table category (
+       cat_id integer PRIMARY KEY,
+       priority int,
+       label text, 
+       desc text, 
+       color char(6),
+       icon varchar(32),
+       enabled integer
+);
+
+*/
+
 #ifndef _MAPPER_POI_H
 #define _MAPPER_POI_H
 
 #include <sqlite3.h>
 
+typedef enum {
+       POI_TYPE_POINT=0,
+       POI_TYPE_LANDMARK=1,
+} poi_types_e;
+
 typedef struct _PoiDb PoiDb;
 struct _PoiDb {
        sqlite3 *db;
index 1e29f5257ec83e8262bf598fc5234bad24518c96..48b7bd4d3cc247e33af971f7ee7407a63cf436f8 100644 (file)
@@ -26,6 +26,7 @@
 #include "settings.h"
 #include "mapper-types.h"
 #include "map.h"
+#include "file.h"
 
 void route_find_nearest_point();
 void cancel_autoroute(gboolean temporary);
index 3d007ca53e30059e39660b1d7cac5b2c807d00ae..53a22fa4c99261b29e4e4839e4296007abd85e60 100644 (file)
@@ -797,52 +797,39 @@ gboolean settings_dialog()
                        rcvr_changed = TRUE;
                }
 
-               _center_ratio =
-                   hildon_controlbar_get_value(HILDON_CONTROLBAR
+               _center_ratio = hildon_controlbar_get_value(HILDON_CONTROLBAR
                                                (num_center_ratio));
 
-               _lead_ratio =
-                   hildon_controlbar_get_value(HILDON_CONTROLBAR
+               _lead_ratio = hildon_controlbar_get_value(HILDON_CONTROLBAR
                                                (num_lead_ratio));
 
-               _draw_width =
-                   hildon_controlbar_get_value(HILDON_CONTROLBAR
+               _draw_width = hildon_controlbar_get_value(HILDON_CONTROLBAR
                                                (num_draw_width));
 
-               _always_keep_on =
-                   !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
+               _always_keep_on = !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
                                                  (chk_always_keep_on));
 
                _units = gtk_combo_box_get_active(GTK_COMBO_BOX(cmb_units));
-               _degformat =
-                   gtk_combo_box_get_active(GTK_COMBO_BOX(cmb_degformat));
+               _degformat = gtk_combo_box_get_active(GTK_COMBO_BOX(cmb_degformat));
 
-               _speed_limit_on =
-                   gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
+               _speed_limit_on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
                                                 (chk_speed_limit_on));
-               _speed_limit =
-                   hildon_number_editor_get_value(HILDON_NUMBER_EDITOR
+               _speed_limit = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR
                                                   (num_speed));
-               _speed_location =
-                   gtk_combo_box_get_active(GTK_COMBO_BOX(cmb_speed_location));
+               _speed_location = gtk_combo_box_get_active(GTK_COMBO_BOX(cmb_speed_location));
 
-               _info_font_size =
-                   gtk_combo_box_get_active(GTK_COMBO_BOX(cmb_info_font_size));
+               _info_font_size = gtk_combo_box_get_active(GTK_COMBO_BOX(cmb_info_font_size));
 
-               _announce_notice_ratio =
-                   hildon_controlbar_get_value(HILDON_CONTROLBAR
+               _announce_notice_ratio = hildon_controlbar_get_value(HILDON_CONTROLBAR
                                                (num_announce_notice));
 
-               _voice_speed =
-                   hildon_controlbar_get_value(HILDON_CONTROLBAR
+               _voice_speed = hildon_controlbar_get_value(HILDON_CONTROLBAR
                                                (num_voice_speed)) / 3.0;
 
-               _voice_pitch =
-                   hildon_controlbar_get_value(HILDON_CONTROLBAR
+               _voice_pitch = hildon_controlbar_get_value(HILDON_CONTROLBAR
                                                (num_voice_pitch));
 
-               _enable_voice =
-                   gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
+               _enable_voice = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
                                                 (chk_enable_voice));
 
                if (_db) {
@@ -851,9 +838,8 @@ gboolean settings_dialog()
                }
                g_free(_poi_db);
                if (strlen(gtk_entry_get_text(GTK_ENTRY(txt_poi_db)))) {
-                       _poi_db =
-                           g_strdup(gtk_entry_get_text(GTK_ENTRY(txt_poi_db)));
-                       db_connect(_db, _poi_db);
+                       _poi_db = g_strdup(gtk_entry_get_text(GTK_ENTRY(txt_poi_db)));
+                       db_connect(&_db, _poi_db);
                } else
                        _poi_db = NULL;
 
@@ -863,9 +849,7 @@ gboolean settings_dialog()
                gtk_widget_set_sensitive(_cmenu_poi, _db != NULL);
                gtk_widget_set_sensitive(_menu_poi_item, _db != NULL);
 
-               _poi_zoom =
-                   hildon_number_editor_get_value(HILDON_NUMBER_EDITOR
-                                                  (num_poi_zoom));
+               _poi_zoom = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(num_poi_zoom));
 
                update_gcs();
 
index adb81aac970380271cb2437b265c6ed0742503bd..f5cdd66de61981d4fe0eee62365516c327344503 100644 (file)
@@ -7,6 +7,7 @@
 #include "settings.h"
 #include "mapper-types.h"
 #include "ui-common.h"
+#include "file.h"
 
 void path_resize(Path * path, guint size)
 {
@@ -252,9 +253,7 @@ gboolean track_open(void)
        gint size;
        gboolean r = FALSE;
 
-       if (open_file
-           (&buffer, NULL, &size, NULL, &_track_file_uri,
-            GTK_FILE_CHOOSER_ACTION_OPEN)) {
+       if (open_file(&buffer, NULL, &size, NULL, &_track_file_uri, GTK_FILE_CHOOSER_ACTION_OPEN)) {
                if (parse_gpx(&_track, buffer, size, -1)) {
                        map_force_redraw();
                        MACRO_BANNER_SHOW_INFO(_window, _("Track Opened"));
@@ -272,8 +271,9 @@ gboolean track_save(void)
        GnomeVFSHandle *handle;
        gboolean r = FALSE;
 
-       if (open_file(NULL, &handle, NULL, NULL, &_track_file_uri,
-                     GTK_FILE_CHOOSER_ACTION_SAVE)) {
+/*     if (open_file(NULL, &handle, NULL, NULL, &_track_file_uri, GTK_FILE_CHOOSER_ACTION_SAVE)) { */
+
+       if (file_save(_track_file_uri, _track_file_uri, &handle)) {
                if (write_gpx(&_track, handle)) {
                        MACRO_BANNER_SHOW_INFO(_window, _("Track Saved"));
                        r = TRUE;
@@ -357,12 +357,9 @@ gboolean track_insert_mark(void)
                if (*desc) {
                        MACRO_PATH_INCREMENT_WTAIL(_track);
                        _track.wtail->point = _track.tail;
-                       _track.wtail->desc
-                           = gtk_text_buffer_get_text(tbuf, &ti1, &ti2, TRUE);
+                       _track.wtail->desc = gtk_text_buffer_get_text(tbuf, &ti1, &ti2, TRUE);
                } else {
-                       popup_error(dialog,
-                                   _
-                                   ("Please provide a description for the mark."));
+                       popup_error(dialog, _("Please provide a description for the mark."));
                        g_free(desc);
                        continue;
                }
@@ -372,5 +369,4 @@ gboolean track_insert_mark(void)
                break;
        }
        gtk_widget_destroy(dialog);
-
 }
index 5938999170e618127a4509cdfc25bdcaa0163a5f..13ea9d27f48a9d27631b12e34b709ce5fee39e3b 100644 (file)
@@ -460,12 +460,9 @@ void menu_init()
        GtkWidget *_file_item;
 
        _file_item = gtk_menu_item_new_with_label("File");
-
-/*    gtk_widget_show_all(GTK_WIDGET(_menu_bar));*/
-
 #if 1
-       gtk_menu_item_set_submenu(GTK_MENU_ITEM(_file_item), GTK_MENU(menu));
-       gtk_menu_bar_append(GTK_MENU_BAR(_menu_bar), _file_item);
+       gtk_menu_item_set_submenu(GTK_MENU_ITEM(_file_item), GTK_WIDGET(menu));
+       gtk_menu_bar_append(GTK_MENU_BAR(_menu_bar), GTK_WIDGET(_file_item));
 #else
        gtk_menu_bar_append(GTK_MENU_BAR(_menu_bar), menu);
 #endif
@@ -623,24 +620,19 @@ void menu_init()
                        = gtk_menu_item_new_with_label(_("Show Distance to")));
        gtk_menu_append(submenu, _cmenu_way_route_to_item
                        =
-                       gtk_menu_item_new_with_label(_
-                                                    ("Download Route to...")));
+                       gtk_menu_item_new_with_label(_("Download Route to...")));
        gtk_menu_append(submenu, _cmenu_way_delete_item =
                        gtk_menu_item_new_with_label(_("Delete...")));
        gtk_menu_append(submenu, gtk_separator_menu_item_new());
-       gtk_menu_append(submenu, _cmenu_way_add_poi
-                       = gtk_menu_item_new_with_label(_("Add POI...")));
+       gtk_menu_append(submenu, _cmenu_way_add_poi = gtk_menu_item_new_with_label(_("Add POI...")));
        gtk_widget_set_sensitive(_cmenu_way_add_poi, _db != NULL);
        gtk_menu_append(submenu, gtk_separator_menu_item_new());
-       gtk_menu_append(submenu, _cmenu_way_goto_nextway
-                       = gtk_menu_item_new_with_label(_("Go to Next")));
+       gtk_menu_append(submenu, _cmenu_way_goto_nextway = gtk_menu_item_new_with_label(_("Go to Next")));
 
        /* Setup the POI context menu. */
-       gtk_menu_append(menu, _cmenu_poi
-                       = gtk_menu_item_new_with_label(_("POI")));
+       gtk_menu_append(menu, _cmenu_poi = gtk_menu_item_new_with_label(_("POI")));
        gtk_widget_set_sensitive(_cmenu_poi, _db != NULL);
-       gtk_menu_item_set_submenu(GTK_MENU_ITEM(_cmenu_poi),
-                                 submenu = gtk_menu_new());
+       gtk_menu_item_set_submenu(GTK_MENU_ITEM(_cmenu_poi), submenu = gtk_menu_new());
 
        gtk_menu_append(submenu, _cmenu_poi_edit_poi
                        = gtk_menu_item_new_with_label(_("View/Edit...")));
index 143dce77e7b0177e2b9900ed8d3c5b9603f8210e..776bad98f03bdbcafaac79fba3207621f2f4b695 100644 (file)
@@ -24,6 +24,8 @@
 #include <libxml/parser.h>
 
 #include "mapper-types.h"
+#include "ui-maemo.h"
+#include "hildon-wrappers.h"
 
 /** The main GtkContainer of the application. */
 GtkWidget *_window;
@@ -186,13 +188,11 @@ GtkWidget *_status_bar;
 
 GtkMenu *_menu_map;
 
-/** CONTEXT MENU ITEMS. */
+/** Context menu click location on map */
 guint _cmenu_position_x;
 guint _cmenu_position_y;
 
 gboolean window_present();
-
-#include "ui-maemo.h"
-#include "hildon-wrappers.h"
+void popup_error(GtkWidget * window, const gchar * error);
 
 #endif
index 9592e68717d12a933ff4c537c3115d5027a6c32a..f8a860bcc4f9a6e76b66025adc0b40eae733186b 100644 (file)
@@ -48,7 +48,7 @@
  * BELOW: DEFINES ***********************************************************
  ****************************************************************************/
 
-#define DEBUG
+/* #define DEBUG */
 
 #ifndef DEBUG
 #define printf(...)
@@ -324,7 +324,7 @@ if (_iap_http_proxy_host) {
     g_free(my_macro_buffer); \
 }
 #else
-#define MACRO_BANNER_SHOW_INFO(A, S) { g_print("INFO: %s\n", (S)); }
+#define MACRO_BANNER_SHOW_INFO(A, S) { hildon_banner_show_information(A, NULL, S); }
 #endif
 
 #define GPS_READ_BUF_SIZE 256