[Xfce4-commits] <xfce4-weather-plugin:master> Make sure coordinates from search results do not exceed spin button precision.

Harald Judt noreply at xfce.org
Sun Dec 9 23:44:03 CET 2012


Updating branch refs/heads/master
         to dd32a6346f87b14874ad0de07e174c4467fe8463 (commit)
       from abc52690c5c5bf6b4870c8b773625afde118f169 (commit)

commit dd32a6346f87b14874ad0de07e174c4467fe8463
Author: Harald Judt <h.judt at gmx.at>
Date:   Sun Dec 9 19:25:16 2012 +0100

    Make sure coordinates from search results do not exceed spin button precision.

 panel-plugin/weather-config.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index 64885b1..1669572 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -346,16 +346,22 @@ cb_findlocation(GtkButton *button,
 {
     xfceweather_dialog *dialog = (xfceweather_dialog *) user_data;
     search_dialog *sdialog;
-    gchar *loc_name;
+    gchar *loc_name, *lat, *lon;
+    gchar latbuf[15], lonbuf[15];
 
     sdialog = create_search_dialog(NULL, dialog->wd->session);
 
     gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
     if (run_search_dialog(sdialog)) {
+        /* limit digit precision of coordinates from search results */
+        lat = g_ascii_formatd(latbuf, 15, "%.7f",
+                              string_to_double(sdialog->result_lat, 0));
         gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->spin_lat),
-                                  string_to_double(sdialog->result_lat, 0));
+                                  string_to_double(lat, 0));
+        lon = g_ascii_formatd(lonbuf, 15, "%.7f",
+                              string_to_double(sdialog->result_lon, 0));
         gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->spin_lon),
-                                  string_to_double(sdialog->result_lon, 0));
+                                  string_to_double(lon, 0));
         loc_name = sanitize_location_name(sdialog->result_name);
         gtk_entry_set_text(GTK_ENTRY(dialog->text_loc_name), loc_name);
         g_free(loc_name);


More information about the Xfce4-commits mailing list