]> Pileus Git - grits/blobdiff - src/aweather-view.c
site and time selection for both ridge and radar
[grits] / src / aweather-view.c
index 7f5fc1f1271bc8b34680e9f830269d109eb344f9..8857bc5128cf4343ce3cd50ac556c41189aab5bd 100644 (file)
@@ -23,8 +23,8 @@ static void aweather_view_init(AWeatherView *self)
 {
        //g_message("aweather_view_init");
        /* Default values */
 {
        //g_message("aweather_view_init");
        /* Default values */
-       self->time     = 0;
-       self->location = g_strdup("IND");
+       self->time     = g_strdup(""); //g_strdup("LATEST");
+       self->location = g_strdup(""); //g_strdup("IND");
 }
 
 static GObject *aweather_view_constructor(GType gtype, guint n_properties,
 }
 
 static GObject *aweather_view_constructor(GType gtype, guint n_properties,
@@ -56,7 +56,7 @@ static void aweather_view_set_property(GObject *object, guint property_id,
        //g_message("aweather_view_set_property");
        AWeatherView *self = AWEATHER_VIEW(object);
        switch (property_id) {
        //g_message("aweather_view_set_property");
        AWeatherView *self = AWEATHER_VIEW(object);
        switch (property_id) {
-       case PROP_TIME:     aweather_view_set_time    (self, g_value_get_int   (value)); break;
+       case PROP_TIME:     aweather_view_set_time    (self, g_value_get_string(value)); break;
        case PROP_LOCATION: aweather_view_set_location(self, g_value_get_string(value)); break;
        default:            G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
        }
        case PROP_LOCATION: aweather_view_set_location(self, g_value_get_string(value)); break;
        default:            G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
        }
@@ -68,7 +68,7 @@ static void aweather_view_get_property(GObject *object, guint property_id,
        //g_message("aweather_view_get_property");
        AWeatherView *self = AWEATHER_VIEW(object);
        switch (property_id) {
        //g_message("aweather_view_get_property");
        AWeatherView *self = AWEATHER_VIEW(object);
        switch (property_id) {
-       case PROP_TIME:     g_value_set_int   (value, aweather_view_get_time    (self)); break;
+       case PROP_TIME:     g_value_set_string(value, aweather_view_get_time    (self)); break;
        case PROP_LOCATION: g_value_set_string(value, aweather_view_get_location(self)); break;
        default:            G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
        }
        case PROP_LOCATION: g_value_set_string(value, aweather_view_get_location(self)); break;
        default:            G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
        }
@@ -84,11 +84,10 @@ static void aweather_view_class_init(AWeatherViewClass *klass)
        gobject_class->get_property = aweather_view_get_property;
        gobject_class->set_property = aweather_view_set_property;
        g_object_class_install_property(gobject_class, PROP_TIME,
        gobject_class->get_property = aweather_view_get_property;
        gobject_class->set_property = aweather_view_set_property;
        g_object_class_install_property(gobject_class, PROP_TIME,
-               g_param_spec_int(
+               g_param_spec_pointer(
                        "time",
                        "time of the current frame",
                        "(format unknown)", 
                        "time",
                        "time of the current frame",
                        "(format unknown)", 
-                       G_MININT32, G_MAXINT32, 0,
                        G_PARAM_READWRITE));
        g_object_class_install_property(gobject_class, PROP_LOCATION,
                g_param_spec_pointer(
                        G_PARAM_READWRITE));
        g_object_class_install_property(gobject_class, PROP_LOCATION,
                g_param_spec_pointer(
@@ -106,7 +105,7 @@ static void aweather_view_class_init(AWeatherViewClass *klass)
                        g_cclosure_marshal_VOID__INT,
                        G_TYPE_NONE,
                        1,
                        g_cclosure_marshal_VOID__INT,
                        G_TYPE_NONE,
                        1,
-                       G_TYPE_INT);
+                       G_TYPE_STRING);
        signals[SIG_LOCATION_CHANGED] = g_signal_new(
                        "location-changed",
                        G_TYPE_FROM_CLASS(gobject_class),
        signals[SIG_LOCATION_CHANGED] = g_signal_new(
                        "location-changed",
                        G_TYPE_FROM_CLASS(gobject_class),
@@ -128,15 +127,15 @@ AWeatherView *aweather_view_new()
        return g_object_new(AWEATHER_TYPE_VIEW, NULL);
 }
 
        return g_object_new(AWEATHER_TYPE_VIEW, NULL);
 }
 
-void aweather_view_set_time(AWeatherView *view, int time)
+void aweather_view_set_time(AWeatherView *view, const char *time)
 {
        g_assert(AWEATHER_IS_VIEW(view));
 {
        g_assert(AWEATHER_IS_VIEW(view));
-       //g_message("aweather_view_set_time");
-       view->time = time;
+       //g_message("aweather_view:set_time: setting time to %s", time);
+       view->time = g_strdup(time);
        g_signal_emit(view, signals[SIG_TIME_CHANGED], 0, time);
 }
 
        g_signal_emit(view, signals[SIG_TIME_CHANGED], 0, time);
 }
 
-int aweather_view_get_time(AWeatherView *view)
+gchar *aweather_view_get_time(AWeatherView *view)
 {
        g_assert(AWEATHER_IS_VIEW(view));
        //g_message("aweather_view_get_time");
 {
        g_assert(AWEATHER_IS_VIEW(view));
        //g_message("aweather_view_get_time");