poi-gui.c \
map-poi.c \
settings-gui.c \
+ filter-gui.c \
speed-display.c \
hildon-wrappers.c \
ui-common.c \
return TRUE;
}
+gboolean menu_cb_track_filter(GtkAction * action)
+{
+filter_dialog();
+return TRUE;
+}
+
gboolean menu_cb_show_tracks(GtkAction * action)
{
printf("%s()\n", __PRETTY_FUNCTION__);
gboolean menu_cb_track_distlast(GtkAction * action);
gboolean menu_cb_track_distfirst(GtkAction * action);
gboolean menu_cb_track_clear(GtkAction * action);
+gboolean menu_cb_track_filter(GtkAction * action);
/* Callbacks for the "Maps" submenu. */
gboolean menu_cb_maps_select(GtkAction * action, gpointer new_repo);
return TRUE;
}
+gboolean
config_save_home(void)
{
GConfClient *gconf_client = gconf_client_get_default();
return TRUE;
}
+gboolean
+config_save_filter(void)
+{
+GConfClient *gconf_client = gconf_client_get_default();
+
+if (!gconf_client)
+ return FALSE;
+
+/* Filtering */
+gconf_client_set_bool(gconf_client, GCONF_KEY_GPS_FILTER, _gps_filter, NULL);
+gconf_client_set_float(gconf_client, GCONF_KEY_GPS_FILTER_HDOP, _filter_hdop, NULL);
+gconf_client_set_float(gconf_client, GCONF_KEY_GPS_FILTER_VDOP, _filter_vdop, NULL);
+gconf_client_set_float(gconf_client, GCONF_KEY_GPS_FILTER_ANGLE, _filter_angle, NULL);
+gconf_client_set_float(gconf_client, GCONF_KEY_GPS_FILTER_OSM, _filter_osm, NULL);
+
+return TRUE;
+}
+
/**
* Save all configuration data to GCONF.
*/
/* Save Enable GPS flag. */
gconf_client_set_bool(gconf_client, GCONF_KEY_ENABLE_GPS, _enable_gps, NULL);
- /* Filtering */
- gconf_client_set_bool(gconf_client, GCONF_KEY_GPS_FILTER, _gps_filter, NULL);
- gconf_client_set_float(gconf_client, GCONF_KEY_GPS_FILTER_HDOP, _filter_hdop, NULL);
- gconf_client_set_float(gconf_client, GCONF_KEY_GPS_FILTER_VDOP, _filter_vdop, NULL);
- gconf_client_set_float(gconf_client, GCONF_KEY_GPS_FILTER_ANGLE, _filter_angle, NULL);
- gconf_client_set_float(gconf_client, GCONF_KEY_GPS_FILTER_OSM, _filter_osm, NULL);
-
/* Save Route Locations. */
gconf_client_set_list(gconf_client, GCONF_KEY_ROUTE_LOCATIONS, GCONF_VALUE_STRING, _loc_list, NULL);
--- /dev/null
+#include "config.h"
+
+#define _GNU_SOURCE
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <stddef.h>
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+#include <libintl.h>
+#include <locale.h>
+
+#include "hildon-mapper.h"
+
+#include "utils.h"
+#include "gps.h"
+#include "map.h"
+#include "mapper-types.h"
+#include "bt.h"
+#include "ui-common.h"
+#include "settings.h"
+
+#include "hildon-wrappers.h"
+
+GtkWidget *dialog;
+GtkWidget *swindow;
+GtkWidget *table;
+GtkWidget *notebook;
+GtkWidget *label;
+
+GtkWidget *chk_gps_filter;
+GtkWidget *num_angle;
+GtkWidget *num_hdop;
+GtkWidget *num_vdop;
+GtkWidget *num_osm_dist;
+
+gboolean
+filter_dialog(void)
+{
+dialog = gtk_dialog_new_with_buttons(_("Track Filter"),
+ GTK_WINDOW(_window),
+ GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
+ NULL);
+
+gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
+ notebook = gtk_notebook_new(), TRUE, TRUE, 0);
+
+gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
+ table = gtk_table_new(2,4,FALSE), label = gtk_label_new(_("GPS")));
+
+gtk_table_attach(GTK_TABLE(table),
+ chk_gps_filter = gtk_check_button_new_with_label(_("Enable track filter")),
+ 0, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 2, 4);
+gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_gps_filter), _gps_filter);
+
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Horizontal")),
+ 0, 1, 1, 2, GTK_FILL, 0, 2, 4);
+gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+gtk_table_attach(GTK_TABLE(table), num_hdop = gtk_hscale_new_with_range(0, 200, 0.1),
+ 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 2, 4);
+
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Vertical")),
+ 0, 1, 2, 3, GTK_FILL, 0, 2, 4);
+gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+gtk_table_attach(GTK_TABLE(table), num_vdop = gtk_hscale_new_with_range(0, 200, 0.1),
+ 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, 0, 2, 4);
+
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Angle")),
+ 0, 1, 3, 4, GTK_FILL, 0, 2, 4);
+gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+gtk_table_attach(GTK_TABLE(table), num_angle = gtk_hscale_new_with_range(0, 45, 0.5),
+ 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, 0, 2, 4);
+
+gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
+ table = gtk_table_new(2,1,FALSE), label = gtk_label_new(_("Other")));
+
+/* Distance to OSM data */
+gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Distance to OSM Data")),
+ 0, 1, 0, 1, GTK_FILL, 0, 2, 4);
+gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
+gtk_table_attach(GTK_TABLE(table), num_osm_dist = gtk_hscale_new_with_range(0, 5000, 50),
+ 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 2, 4);
+
+gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_gps_filter), _gps_filter);
+gtk_range_set_value(GTK_RANGE(num_hdop), _filter_hdop);
+gtk_range_set_value(GTK_RANGE(num_vdop), _filter_vdop);
+gtk_range_set_value(GTK_RANGE(num_angle), _filter_angle);
+gtk_range_set_value(GTK_RANGE(num_osm_dist), _filter_osm);
+
+gtk_widget_show_all(dialog);
+
+if (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) {
+ _filter_angle = gtk_range_get_value(GTK_RANGE(num_angle));
+ _filter_hdop = gtk_range_get_value(GTK_RANGE(num_hdop));
+ _filter_vdop = gtk_range_get_value(GTK_RANGE(num_vdop));
+ _filter_osm = gtk_range_get_value(GTK_RANGE(num_osm_dist));
+ _gps_filter = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chk_gps_filter));
+
+ config_save_filter();
+}
+
+gtk_widget_destroy(dialog);
+
+return TRUE;
+}
GtkWidget *cmb_speed_location;
GtkWidget *cmb_info_font_size;
- GtkWidget *_filter_window;
- GtkWidget *chk_gps_filter;
- GtkWidget *num_angle;
- GtkWidget *num_hdop;
- GtkWidget *num_vdop;
- GtkWidget *num_osm_dist;
-
BrowseInfo browse_info = { 0, 0 };
ScanInfo scan_info = { 0 };
gboolean rcvr_changed = FALSE;
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
gtk_misc_set_alignment(GTK_MISC(label), 0.5f, 0.5f);
- _filter_window=gtk_scrolled_window_new(NULL, NULL);
- gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
- _filter_window,
- label = gtk_label_new(_("Filter")));
-
- table = gtk_table_new(2, 5, FALSE);
- gtk_scrolled_window_add_with_viewport(_filter_window, table);
-
- gtk_table_attach(GTK_TABLE(table),
- chk_gps_filter = gtk_check_button_new_with_label(_("Enable GPS track filter")),
- 0, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 2, 4);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_gps_filter), _gps_filter);
-
- gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Horizontal")),
- 0, 1, 1, 2, GTK_FILL, 0, 2, 4);
- gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
- gtk_table_attach(GTK_TABLE(table), num_hdop = gtk_hscale_new_with_range(0, 200, 0.1),
- 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 2, 4);
-
- gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Vertical")),
- 0, 1, 2, 3, GTK_FILL, 0, 2, 4);
- gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
- gtk_table_attach(GTK_TABLE(table), num_vdop = gtk_hscale_new_with_range(0, 200, 0.1),
- 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, 0, 2, 4);
-
- gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Angle")),
- 0, 1, 3, 4, GTK_FILL, 0, 2, 4);
- gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
- gtk_table_attach(GTK_TABLE(table), num_angle = gtk_hscale_new_with_range(0, 45, 0.5),
- 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, 0, 2, 4);
-
- /* Distance to OSM data */
- gtk_table_attach(GTK_TABLE(table), label = gtk_label_new(_("Distance to OSM Data")),
- 0, 1, 4, 5, GTK_FILL, 0, 2, 4);
- gtk_misc_set_alignment(GTK_MISC(label), 1.f, 0.5f);
- gtk_table_attach(GTK_TABLE(table), num_osm_dist = gtk_hscale_new_with_range(0, 5000, 50),
- 1, 2, 4, 5, GTK_EXPAND | GTK_FILL, 0, 2, 4);
/* Auto-Center page. */
gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
gtk_combo_box_set_active(GTK_COMBO_BOX(cmb_speed_location), _speed_location);
gtk_combo_box_set_active(GTK_COMBO_BOX(cmb_info_font_size), _info_font_size);
- gtk_range_set_value(num_hdop, _filter_hdop);
- gtk_range_set_value(num_vdop, _filter_vdop);
- gtk_range_set_value(num_angle, _filter_angle);
- gtk_range_set_value(num_osm_dist, _filter_osm);
-
gtk_widget_show_all(dialog);
/* TODO: Uncomment the following hide function calls if moimart ever
_voice_pitch = hildon_controlbar_get_value(HILDON_CONTROLBAR(num_voice_pitch));
_enable_voice = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chk_enable_voice));
- _filter_angle = gtk_range_get_value(GTK_RANGE(num_angle));
- _filter_hdop = gtk_range_get_value(GTK_RANGE(num_hdop));
- _filter_vdop = gtk_range_get_value(GTK_RANGE(num_vdop));
- _filter_osm = gtk_range_get_value(GTK_RANGE(num_osm_dist));
- _gps_filter = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chk_gps_filter));
if (_db) {
mapper_db_disconnect(&_db);
gtk_menu_append(submenu, _menu_track_distlast_item = gtk_menu_item_new_with_label(_("Show Distance from Last Mark")));
gtk_menu_append(submenu, _menu_track_distfirst_item = gtk_menu_item_new_with_label(_("Show Distance from Beginning")));
gtk_menu_append(submenu, _menu_track_clear_item = gtk_menu_item_new_with_label(_("Clear")));
+ gtk_menu_append(submenu, gtk_separator_menu_item_new());
+ gtk_menu_append(submenu, _menu_track_filter = gtk_menu_item_new_with_label(_("Filter...")));
/* The "Maps" submenu. */
menu_item = gtk_menu_item_new_with_label(_("Maps"));
G_CALLBACK(menu_cb_track_distfirst), NULL);
g_signal_connect(G_OBJECT(_menu_track_clear_item), "activate",
G_CALLBACK(menu_cb_track_clear), NULL);
+ g_signal_connect(G_OBJECT(_menu_track_filter), "activate",
+ G_CALLBACK(menu_cb_track_filter), NULL);
/* Connect the "Maps" signals. */
g_signal_connect(G_OBJECT(_menu_maps_repoman_item), "activate",
GtkWidget *_menu_track_distlast_item;
GtkWidget *_menu_track_distfirst_item;
GtkWidget *_menu_track_clear_item;
+GtkWidget *_menu_track_filter;
/* Menu items for the "Maps" submenu. */
GtkWidget *_menu_maps_submenu;