GtkTreeIter iter;
};
-
#define UPDATE_GC(gc) gdk_gc_set_line_attributes(gc, _draw_width, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND);
void
}
static gboolean
-settings_dialog_browse_forfile(GtkWidget * widget, BrowseInfo * browse_info)
+settings_dialog_browse_forfile(GtkWidget *widget, BrowseInfo *browse_info)
{
GtkWidget *dialog;
gint res;
gtk_tree_model_get(GTK_TREE_MODEL(gdi.store), &gdi.iter, 0, &(gps->io.type), -1);
g_debug("GPS: %d", gps->io.type);
} else {
- popup_error(dialog, "Please select GPS type");
+ popup_error(dialog, _("Please select GPS type"));
continue;
}
return rcvr_changed;
}
+/* XXX: Find a better place for this */
+static void
+reinit_database(gchar *newdb)
+{
+if (_mapper_db)
+ g_free(_mapper_db);
+_mapper_db=newdb;
+
+if (_db || newdb==NULL) {
+ poi_deinit(_db);
+ osm_deinit();
+ db_close(&_db);
+ _db=NULL;
+ if (newdb==NULL)
+ return;
+}
+db_connect(&_db, _mapper_db);
+poi_init(&_db);
+osm_init(&_db);
+}
+
gboolean
settings_dialog_osm(void)
{
gtk_widget_show_all(dialog);
if (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) {
- if (_db) {
- poi_deinit(_db);
- osm_deinit();
- db_close(&_db);
- _db=NULL;
- }
- g_free(_mapper_db);
+ _map_location_sens=hildon_controlbar_get_value(HILDON_CONTROLBAR(num_sens));
if (strlen(gtk_entry_get_text(GTK_ENTRY(txt_mapper_db)))>0) {
- _mapper_db=g_strdup(gtk_entry_get_text(GTK_ENTRY(txt_mapper_db)));
- db_connect(&_db, _mapper_db);
- poi_init(&_db);
- osm_init(&_db);
+ gchar *tmp;
+ tmp=g_strdup(gtk_entry_get_text(GTK_ENTRY(txt_mapper_db)));
+ if (tmp && _mapper_db && strcmp(tmp, _mapper_db)!=0) {
+ reinit_database(tmp);
+ }
} else {
_mapper_db=NULL;
+ reinit_database(NULL);
}
-
- _map_location_sens=hildon_controlbar_get_value(HILDON_CONTROLBAR(num_sens));
config_save();
}
gtk_widget_destroy(dialog);