[Xfce4-commits] <xfce4-weather-plugin:master> Do not activate location name widget without latitude and longitude set.

Harald Judt noreply at xfce.org
Wed Jul 18 13:10:01 CEST 2012


Updating branch refs/heads/master
         to 494ddf8643f1627354be3088b1f14b5176476307 (commit)
       from 40e64e797dc722e4f971f24f08209ef702e6d93e (commit)

commit 494ddf8643f1627354be3088b1f14b5176476307
Author: Harald Judt <h.judt at gmx.at>
Date:   Wed Jul 18 13:05:41 2012 +0200

    Do not activate location name widget without latitude and longitude set.
    
    Because longitude and latitude are not shown anywhere in the config dialog,
    the user might think it is enough to type in some text and everything will
    work. So only activate the text box when latitude and longitude are known,
    otherwise keep it disabled.

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

diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index e0974a9..8725e9e 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -381,7 +381,7 @@ static void auto_locate_cb(const gchar *loc_name, const gchar *lat, const gchar
     gtk_entry_set_text (GTK_ENTRY (dialog->txt_lat), "");
     gtk_entry_set_text (GTK_ENTRY (dialog->txt_lon), "");
     gtk_entry_set_text (GTK_ENTRY (dialog->txt_loc_name), _("Unset"));
-    gtk_widget_set_sensitive(dialog->txt_loc_name, TRUE);
+    gtk_widget_set_sensitive(dialog->txt_loc_name, FALSE);
   }
 }
 
@@ -474,12 +474,17 @@ create_config_dialog (xfceweather_data *data,
   gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
   gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (dialog->txt_loc_name));
 
-  if (dialog->wd->lat != NULL)
+  if (dialog->wd->lat != NULL && strlen(dialog->wd->lat) > 0)
     gtk_entry_set_text (GTK_ENTRY (dialog->txt_lat),
                         dialog->wd->lat);
-  if (dialog->wd->lon != NULL)
+  else
+    gtk_widget_set_sensitive(dialog->txt_loc_name, FALSE);
+
+  if (dialog->wd->lon != NULL && strlen(dialog->wd->lon) > 0)
     gtk_entry_set_text (GTK_ENTRY (dialog->txt_lon),
                         dialog->wd->lon);
+  else
+    gtk_widget_set_sensitive(dialog->txt_loc_name, FALSE);
 
   if (dialog->wd->location_name != NULL)
     gtk_entry_set_text (GTK_ENTRY (dialog->txt_loc_name),


More information about the Xfce4-commits mailing list