From cb3ab43b66164a9c046d716ed50e9926fc6016b3 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Mon, 16 Jul 2007 16:33:48 +0300 Subject: [PATCH] Remove gps reset hack. --- src/cb.c | 21 ++------------------- src/settings-gui.c | 3 --- src/ui-common.c | 6 ------ src/utils.c | 24 ------------------------ src/utils.h | 17 ++++++++--------- 5 files changed, 10 insertions(+), 61 deletions(-) diff --git a/src/cb.c b/src/cb.c index aa08bdb..ac71df6 100644 --- a/src/cb.c +++ b/src/cb.c @@ -57,10 +57,8 @@ gboolean map_cb_configure(GtkWidget * widget, GdkEventConfigure * event) _min_center.unitx = pixel2unit(grid2pixel(_screen_grids_halfwidth)); _min_center.unity = pixel2unit(grid2pixel(_screen_grids_halfheight)); - _max_center.unitx = - WORLD_SIZE_UNITS - grid2unit(_screen_grids_halfwidth) - 1; - _max_center.unity = - WORLD_SIZE_UNITS - grid2unit(_screen_grids_halfheight) - 1; + _max_center.unitx = WORLD_SIZE_UNITS - grid2unit(_screen_grids_halfwidth) - 1; + _max_center.unity = WORLD_SIZE_UNITS - grid2unit(_screen_grids_halfheight) - 1; map_center_unit(_center.unitx, _center.unity); @@ -656,7 +654,6 @@ gboolean menu_cb_enable_gps(GtkAction * action) map_move_mark(); gps_show_info(); gtk_widget_set_sensitive(GTK_WIDGET(_menu_gps_details_item), _enable_gps); - gtk_widget_set_sensitive(GTK_WIDGET(_menu_gps_reset_item), _enable_gps); vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__); return TRUE; @@ -679,16 +676,6 @@ gboolean menu_cb_auto_download(GtkAction * action) return TRUE; } -gboolean menu_cb_gps_reset(GtkAction * action) -{ - printf("%s()\n", __PRETTY_FUNCTION__); - - reset_bluetooth(); - - vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__); - return TRUE; -} - gboolean menu_cb_gps_details(GtkAction * action) { printf("%s()\n", __PRETTY_FUNCTION__); @@ -907,10 +894,6 @@ gboolean window_cb_key_press(GtkWidget * widget, GdkEventKey * event) break; } - case CUSTOM_ACTION_RESET_BLUETOOTH: - reset_bluetooth(); - break; - case CUSTOM_ACTION_ROUTE_DISTNEXT: route_show_distance_to_next(); break; diff --git a/src/settings-gui.c b/src/settings-gui.c index 69112e6..8b207ff 100644 --- a/src/settings-gui.c +++ b/src/settings-gui.c @@ -789,9 +789,6 @@ gboolean settings_dialog() gtk_widget_set_sensitive(GTK_WIDGET (_menu_gps_details_item), FALSE); - gtk_widget_set_sensitive(GTK_WIDGET - (_menu_gps_reset_item), - FALSE); } } else if (!_rcvr_mac || strcmp(_rcvr_mac, gtk_entry_get_text(GTK_ENTRY(txt_rcvr_mac)))) { /* User specified a new rcvr mac. */ diff --git a/src/ui-common.c b/src/ui-common.c index 0c827d7..0b0685d 100644 --- a/src/ui-common.c +++ b/src/ui-common.c @@ -430,10 +430,6 @@ static void menu_init() gtk_menu_item_new_with_label(_("Details..."))); gtk_widget_set_sensitive(GTK_WIDGET(_menu_gps_details_item), _enable_gps); - gtk_menu_append(submenu, _menu_gps_reset_item = - gtk_menu_item_new_with_label(_("Reset Bluetooth"))); - gtk_widget_set_sensitive(GTK_WIDGET(_menu_gps_reset_item), _enable_gps); - gtk_menu_append(menu, gtk_separator_menu_item_new()); /* The other menu items. */ @@ -548,8 +544,6 @@ static void menu_init() G_CALLBACK(menu_cb_gps_show_info), NULL); g_signal_connect(G_OBJECT(_menu_gps_details_item), "activate", G_CALLBACK(menu_cb_gps_details), NULL); - g_signal_connect(G_OBJECT(_menu_gps_reset_item), "activate", - G_CALLBACK(menu_cb_gps_reset), NULL); g_signal_connect(G_OBJECT(_menu_auto_download_item), "toggled", G_CALLBACK(menu_cb_auto_download), NULL); diff --git a/src/utils.c b/src/utils.c index d1da655..75b5238 100644 --- a/src/utils.c +++ b/src/utils.c @@ -187,27 +187,3 @@ download_comparefunc(const ProgressUpdateInfo * a, /* Do updates after non-updates (because they'll both be done anyway). */ return (a->retries - b->retries); } - -#ifdef BT_HACK -void reset_bluetooth() -{ - printf("%s()\n", __PRETTY_FUNCTION__); - if (system - ("/usr/bin/sudo -l | grep -q '/usr/sbin/hciconfig *hci0 *reset'" - " && sudo /usr/sbin/hciconfig hci0 reset")) - popup_error(_window, - _ - ("An error occurred while trying to reset the bluetooth " - "radio.\n\n" - "Did you make sure to modify\nthe /etc/sudoers file?")); - else if (_conn_state > RCVR_OFF) { - set_conn_state(RCVR_DOWN); - rcvr_connect_later(); - } - vprintf("%s(): return\n", __PRETTY_FUNCTION__); -} -#else -void reset_bluetooth() -{ -} -#endif diff --git a/src/utils.h b/src/utils.h index a4c8fc2..bbac306 100644 --- a/src/utils.h +++ b/src/utils.h @@ -70,6 +70,11 @@ #define PI (3.14159265358979323846f) +#define MERCATOR_SPAN (-6.28318377773622f) +#define MERCATOR_TOP (3.14159188886811f) + +#define SQR(s) ((s)*(s)) + /** MAX_ZOOM defines the largest map zoom level we will download. * (MAX_ZOOM - 1) is the largest map zoom level that the user can zoom to. */ @@ -135,10 +140,8 @@ (tofill) = strtol((str), &error_check, 10); \ if(error_check == (str)) \ { \ - g_printerr("Line %d: Failed to parse string as int: %s\n", \ - __LINE__, str); \ - MACRO_BANNER_SHOW_INFO(_window, \ - _("Invalid NMEA input from receiver!")); \ + g_printerr("Line %d: Failed to parse string as int: %s\n", __LINE__, str); \ + MACRO_BANNER_SHOW_INFO(_window, _("Invalid NMEA input from receiver!")); \ return; \ } \ } @@ -148,8 +151,7 @@ if(error_check == (str)) \ { \ g_printerr("Failed to parse string as float: %s\n", str); \ - MACRO_BANNER_SHOW_INFO(_window, \ - _("Invalid NMEA input from receiver!")); \ + MACRO_BANNER_SHOW_INFO(_window, _("Invalid NMEA input from receiver!")); \ return; \ } \ } @@ -172,9 +174,6 @@ } \ }; -#define MERCATOR_SPAN (-6.28318377773622f) -#define MERCATOR_TOP (3.14159188886811f) - #define latlon2unit(lat, lon, unitx, unity) { \ gfloat tmp; \ unitx = (lon + 180.f) * (WORLD_SIZE_UNITS / 360.f) + 0.5f; \ -- 2.39.5