From 40b17f742041c317915326c6f5ea6d92397c7363 Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Mon, 25 May 2009 01:48:49 +0000 Subject: [PATCH] * Fixing some async issue (w/ gthread_init) * Consistent debug messages * Debug levels * Command line arguments * Making AWeatherGui a subclass of GtkWindow --- TODO | 1 - configure.ac | 2 +- data/main.glade | 4 +-- src/aweather-gui.c | 67 ++++++++++++++++++++------------------------ src/aweather-gui.h | 7 ++--- src/aweather-view.c | 35 ++++++++++++----------- src/data.c | 18 ++++++------ src/main.c | 48 +++++++++++++++++++++++++++++-- src/plugin-example.c | 4 +-- src/plugin-radar.c | 15 +++++----- src/plugin-ridge.c | 7 +++-- 11 files changed, 121 insertions(+), 87 deletions(-) diff --git a/TODO b/TODO index cac456d..613f2bc 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,6 @@ Road plan --------- 0.1 - Working * Fix all memory leaks - * Asynchronous IO and data loading * Pre-load textures and polys in OpenGL 0.x - Volume scans diff --git a/configure.ac b/configure.ac index 49ca761..a40bc83 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ PKG_PROG_PKG_CONFIG GTK_DOC_CHECK(1.9) # Check for required packages -PKG_CHECK_MODULES(GTK, gtk+-2.0 gtkglext-1.0 gmodule-export-2.0 gobject-2.0) +PKG_CHECK_MODULES(GTK, gtk+-2.0 gtkglext-1.0 gmodule-export-2.0 gobject-2.0 gthread-2.0) # Define odd RSL install location #AC_SUBST(RSL_CFLAGS, "-I/usr/local/trmm/GVBOX/include/") diff --git a/data/main.glade b/data/main.glade index 50368fa..eadaba0 100644 --- a/data/main.glade +++ b/data/main.glade @@ -1,12 +1,12 @@ - + - + True diff --git a/src/aweather-gui.c b/src/aweather-gui.c index 4c5bff2..48fc87e 100644 --- a/src/aweather-gui.c +++ b/src/aweather-gui.c @@ -31,38 +31,35 @@ /**************** * GObject code * ****************/ -G_DEFINE_TYPE(AWeatherGui, aweather_gui, G_TYPE_OBJECT); +G_DEFINE_TYPE(AWeatherGui, aweather_gui, GTK_TYPE_WINDOW); static void aweather_gui_init(AWeatherGui *gui) { gui->plugins = NULL; - //g_message("aweather_gui_init"); + g_debug("AWeatherGui: init"); } static GObject *aweather_gui_constructor(GType gtype, guint n_properties, GObjectConstructParam *properties) { - //g_message("aweather_gui_constructor"); + g_debug("aweather_gui: constructor"); GObjectClass *parent_class = G_OBJECT_CLASS(aweather_gui_parent_class); return parent_class->constructor(gtype, n_properties, properties); } -static void aweather_gui_dispose (GObject *gobject) +static void aweather_gui_dispose(GObject *gobject) { - //g_message("aweather_gui_dispose"); + g_debug("AWeatherGui: dispose"); AWeatherGui *gui = AWEATHER_GUI(gobject); g_object_unref(gui->view ); g_object_unref(gui->builder); - g_object_unref(gui->window ); - g_object_unref(gui->tabs ); - g_object_unref(gui->drawing); G_OBJECT_CLASS(aweather_gui_parent_class)->dispose(gobject); } static void aweather_gui_finalize(GObject *gobject) { - //g_message("aweather_gui_finalize"); + g_debug("AWeatherGui: finalize"); G_OBJECT_CLASS(aweather_gui_parent_class)->finalize(gobject); } static void aweather_gui_class_init(AWeatherGuiClass *klass) { - //g_message("aweather_gui_class_init"); + g_debug("AWeatherGui: class_init"); GObjectClass *gobject_class = G_OBJECT_CLASS(klass); gobject_class->constructor = aweather_gui_constructor; gobject_class->dispose = aweather_gui_dispose; @@ -74,7 +71,7 @@ static void aweather_gui_class_init(AWeatherGuiClass *klass) *************/ gboolean on_key_press(GtkWidget *widget, GdkEventKey *event, AWeatherGui *gui) { - g_message("key_press: key=%x, state=%x", event->keyval, event->state); + g_debug("AWeatherGui: on_key_press - key=%x, state=%x", event->keyval, event->state); AWeatherView *view = aweather_gui_get_view(gui); double x,y,z; aweather_view_get_location(view, &x, &y, &z); @@ -145,9 +142,8 @@ void on_site_changed(GtkComboBox *combo, AWeatherGui *gui) gboolean on_map(GtkWidget *da, GdkEventConfigure *event, AWeatherGui *gui) { - g_message("on_map"); + g_debug("AWeatherGui: on_map"); AWeatherView *view = aweather_gui_get_view(gui); - aweather_view_set_site(view, "IND"); /* Misc */ glEnable(GL_BLEND); @@ -171,7 +167,7 @@ gboolean on_map(GtkWidget *da, GdkEventConfigure *event, AWeatherGui *gui) gboolean on_configure(GtkWidget *da, GdkEventConfigure *event, AWeatherGui *gui) { - //g_message("on_confiure"); + g_debug("AWeatherGui: on_confiure"); aweather_gui_gl_begin(gui); double x, y, z; @@ -199,7 +195,7 @@ gboolean on_configure(GtkWidget *da, GdkEventConfigure *event, AWeatherGui *gui) gboolean on_expose(GtkWidget *da, GdkEventExpose *event, AWeatherGui *gui) { - g_message("aweather:expose - begin"); + g_debug("AWeatherGui: on_expose - begin"); aweather_gui_gl_begin(gui); double x, y, z; @@ -220,7 +216,7 @@ gboolean on_expose(GtkWidget *da, GdkEventExpose *event, AWeatherGui *gui) aweather_gui_gl_end(gui); aweather_gui_gl_flush(gui); - g_message("aweather:expose - end\n"); + g_debug("AWeatherGui: on_expose - end\n"); return FALSE; } @@ -250,7 +246,7 @@ void on_location_changed(AWeatherView *view, /* TODO: replace the code in these with `gtk_tree_model_find' utility */ static void update_time_widget(AWeatherView *view, char *time, AWeatherGui *gui) { - g_message("updating time widget"); + g_debug("AWeatherGui: update_time_widget"); GtkTreeView *tview = GTK_TREE_VIEW(aweather_gui_get_widget(gui, "time")); GtkTreeModel *model = GTK_TREE_MODEL(gtk_tree_view_get_model(tview)); for (int i = 0; i < gtk_tree_model_iter_n_children(model, NULL); i++) { @@ -274,7 +270,7 @@ static void update_time_widget(AWeatherView *view, char *time, AWeatherGui *gui) } static void update_site_widget(AWeatherView *view, char *site, AWeatherGui *gui) { - g_message("updating site widget to %s", site); + g_debug("AWeatherGui: updat_site_widget - site=%s", site); GtkComboBox *combo = GTK_COMBO_BOX(aweather_gui_get_widget(gui, "site")); GtkTreeModel *model = GTK_TREE_MODEL(gtk_combo_box_get_model(combo)); for (int i = 0; i < gtk_tree_model_iter_n_children(model, NULL); i++) { @@ -380,28 +376,27 @@ static void opengl_setup(AWeatherGui *gui) ***********/ AWeatherGui *aweather_gui_new() { - //g_message("aweather_gui_new"); + g_debug("AWeatherGui: new"); GError *error = NULL; - AWeatherGui *gui = g_object_new(AWEATHER_TYPE_GUI, NULL); + AWeatherGui *self = g_object_new(AWEATHER_TYPE_GUI, NULL); + self->view = aweather_view_new(); + self->builder = gtk_builder_new(); - gui->builder = gtk_builder_new(); - if (!gtk_builder_add_from_file(gui->builder, DATADIR "/aweather/main.xml", &error)) + if (!gtk_builder_add_from_file(self->builder, DATADIR "/aweather/main.xml", &error)) g_error("Failed to create gtk builder: %s", error->message); - gui->view = aweather_view_new(); - gui->window = GTK_WINDOW (gtk_builder_get_object(gui->builder, "main")); - gui->tabs = GTK_NOTEBOOK (gtk_builder_get_object(gui->builder, "tabs")); - gui->drawing = GTK_DRAWING_AREA(gtk_builder_get_object(gui->builder, "drawing")); - gtk_builder_connect_signals(gui->builder, gui); - + gtk_builder_connect_signals(self->builder, self); + g_signal_connect(self, "delete-event", G_CALLBACK(gtk_main_quit), self); + g_signal_connect(self, "key-press-event", G_CALLBACK(on_key_press), self); + gtk_widget_reparent(aweather_gui_get_widget(self, "body"), GTK_WIDGET(self)); /* Load components */ - aweather_view_set_location(gui->view, 0, 0, -300*1000); - g_signal_connect(gui->view, "location-changed", G_CALLBACK(on_location_changed), gui); - site_setup(gui); - time_setup(gui); - opengl_setup(gui); - return gui; + aweather_view_set_location(self->view, 0, 0, -300*1000); + g_signal_connect(self->view, "location-changed", G_CALLBACK(on_location_changed), self); + site_setup(self); + time_setup(self); + opengl_setup(self); + return self; } AWeatherView *aweather_gui_get_view(AWeatherGui *gui) { @@ -423,12 +418,12 @@ GtkWidget *aweather_gui_get_widget(AWeatherGui *gui, const gchar *name) } void aweather_gui_register_plugin(AWeatherGui *gui, AWeatherPlugin *plugin) { - g_message("registering plugin"); + g_debug("AWeatherGui: register_plugin"); gui->plugins = g_list_append(gui->plugins, plugin); } void aweather_gui_gl_redraw(AWeatherGui *gui) { - g_message("redraw"); + g_debug("AWeatherGui: gl_redraw"); GtkWidget *drawing = aweather_gui_get_widget(gui, "drawing"); gtk_widget_queue_draw(drawing); } diff --git a/src/aweather-gui.h b/src/aweather-gui.h index 91e53d2..af5e4a8 100644 --- a/src/aweather-gui.h +++ b/src/aweather-gui.h @@ -35,19 +35,16 @@ typedef struct _AWeatherGui AWeatherGui; typedef struct _AWeatherGuiClass AWeatherGuiClass; struct _AWeatherGui { - GObject parent_instance; + GtkWindow parent_instance; /* instance members */ AWeatherView *view; GtkBuilder *builder; - GtkWindow *window; - GtkNotebook *tabs; - GtkDrawingArea *drawing; GList *plugins; }; struct _AWeatherGuiClass { - GObjectClass parent_class; + GtkWindowClass parent_class; /* class members */ }; diff --git a/src/aweather-view.c b/src/aweather-view.c index 7caaf9b..627824f 100644 --- a/src/aweather-view.c +++ b/src/aweather-view.c @@ -43,7 +43,7 @@ static guint signals[NUM_SIGNALS]; static void aweather_view_init(AWeatherView *self) { - //g_message("aweather_view_init"); + g_debug("AWeatherView: init"); /* Default values */ self->time = g_strdup(""); self->site = g_strdup(""); @@ -52,21 +52,21 @@ static void aweather_view_init(AWeatherView *self) static GObject *aweather_view_constructor(GType gtype, guint n_properties, GObjectConstructParam *properties) { - //g_message("aweather_view_constructor"); + g_debug("AWeatherView: constructor"); GObjectClass *parent_class = G_OBJECT_CLASS(aweather_view_parent_class); return parent_class->constructor(gtype, n_properties, properties); } -static void aweather_view_dispose (GObject *gobject) +static void aweather_view_dispose(GObject *gobject) { - //g_message("aweather_view_dispose"); + g_debug("AWeatherView: dispose"); /* Drop references to other GObjects */ G_OBJECT_CLASS(aweather_view_parent_class)->dispose(gobject); } static void aweather_view_finalize(GObject *gobject) { - //g_message("aweather_view_finalize"); + g_debug("AWeatherView: finalize"); AWeatherView *self = AWEATHER_VIEW(gobject); g_free(self->site); G_OBJECT_CLASS(aweather_view_parent_class)->finalize(gobject); @@ -75,7 +75,7 @@ static void aweather_view_finalize(GObject *gobject) static void aweather_view_set_property(GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { - //g_message("aweather_view_set_property"); + g_debug("AWeatherView: set_property"); AWeatherView *self = AWEATHER_VIEW(object); switch (property_id) { case PROP_TIME: aweather_view_set_time(self, g_value_get_string(value)); break; @@ -87,7 +87,7 @@ static void aweather_view_set_property(GObject *object, guint property_id, static void aweather_view_get_property(GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { - //g_message("aweather_view_get_property"); + g_debug("AWeatherView: get_property"); AWeatherView *self = AWEATHER_VIEW(object); switch (property_id) { case PROP_TIME: g_value_set_string(value, aweather_view_get_time(self)); break; @@ -98,7 +98,7 @@ static void aweather_view_get_property(GObject *object, guint property_id, static void aweather_view_class_init(AWeatherViewClass *klass) { - //g_message("aweather_view_class_init"); + g_debug("AWeatherView: class_init"); GObjectClass *gobject_class = G_OBJECT_CLASS(klass); gobject_class->constructor = aweather_view_constructor; gobject_class->dispose = aweather_view_dispose; @@ -194,14 +194,14 @@ static void _aweather_view_emit_refresh(AWeatherView *view) ***********/ AWeatherView *aweather_view_new() { - //g_message("aweather_view_new"); + g_debug("AWeatherView: new"); return g_object_new(AWEATHER_TYPE_VIEW, NULL); } void aweather_view_set_time(AWeatherView *view, const char *time) { g_assert(AWEATHER_IS_VIEW(view)); - //g_message("aweather_view:set_time: setting time to %s", time); + g_debug("AWeatherView: set_time - time=%s", time); g_free(view->time); view->time = g_strdup(time); _aweather_view_emit_time_changed(view); @@ -210,14 +210,14 @@ void aweather_view_set_time(AWeatherView *view, const char *time) gchar *aweather_view_get_time(AWeatherView *view) { g_assert(AWEATHER_IS_VIEW(view)); - //g_message("aweather_view_get_time"); + g_debug("AWeatherView: get_time"); return view->time; } void aweather_view_get_location(AWeatherView *view, gdouble *x, gdouble *y, gdouble *z) { g_assert(AWEATHER_IS_VIEW(view)); - //g_message("aweather_view_get_location"); + g_debug("AWeatherView: get_location"); *x = view->location[0]; *y = view->location[1]; *z = view->location[2]; @@ -226,7 +226,7 @@ void aweather_view_get_location(AWeatherView *view, gdouble *x, gdouble *y, gdou void aweather_view_set_location(AWeatherView *view, gdouble x, gdouble y, gdouble z) { g_assert(AWEATHER_IS_VIEW(view)); - //g_message("aweather_view_set_location"); + g_debug("AWeatherView: set_location"); view->location[0] = x; view->location[1] = y; view->location[2] = z; @@ -236,7 +236,7 @@ void aweather_view_set_location(AWeatherView *view, gdouble x, gdouble y, gdoubl void aweather_view_pan(AWeatherView *view, gdouble x, gdouble y, gdouble z) { g_assert(AWEATHER_IS_VIEW(view)); - g_message("aweather_view_pan: %f, %f, %f", x, y, z); + g_debug("AWeatherView: pan - x=%.0f, y=%.0f, z=%.0f", x, y, z); view->location[0] += x; view->location[1] += y; view->location[2] += z; @@ -246,20 +246,21 @@ void aweather_view_pan(AWeatherView *view, gdouble x, gdouble y, gdouble z) void aweather_view_zoom(AWeatherView *view, gdouble scale) { g_assert(AWEATHER_IS_VIEW(view)); + g_debug("AWeatherView: zoom"); view->location[2] *= scale; _aweather_view_emit_location_changed(view); } void aweather_view_refresh(AWeatherView *view) { - g_message("aweather_view_refresh: .."); + g_debug("AWeatherView: refresh"); _aweather_view_emit_refresh(view); } void aweather_view_set_site(AWeatherView *view, const gchar *site) { g_assert(AWEATHER_IS_VIEW(view)); - //g_message("aweather_view_set_site"); + g_debug("AWeatherView: set_site"); g_free(view->site); view->site = g_strdup(site); _aweather_view_emit_site_changed(view); @@ -268,7 +269,7 @@ void aweather_view_set_site(AWeatherView *view, const gchar *site) gchar *aweather_view_get_site(AWeatherView *view) { g_assert(AWEATHER_IS_VIEW(view)); - //g_message("aweather_view_get_site"); + g_debug("AWeatherView: get_site"); return view->site; } diff --git a/src/data.c b/src/data.c index 1440fd9..7a881bd 100644 --- a/src/data.c +++ b/src/data.c @@ -51,7 +51,7 @@ static void cache_file_cb(GObject *source_object, GAsyncResult *res, gpointer _i GError *error = NULL; g_file_copy_finish(G_FILE(source_object), res, &error); if (error) { - g_message("error copying file ([%s]->[%s]): %s", + g_warning("error copying file ([%s]->[%s]): %s", url, local, error->message); g_error_free(error); } else { @@ -68,7 +68,7 @@ static void do_cache(GFile *src, GFile *dst, char *reason, AWeatherCacheDoneCallback callback, gpointer user_data) { char *name = g_file_get_basename(dst); - g_message("Caching file %s: %s", name, reason); + g_debug("data: do_cache - Caching file %s: %s", name, reason); g_free(name); GFile *parent = g_file_get_parent(dst); @@ -82,13 +82,13 @@ static void do_cache(GFile *src, GFile *dst, char *reason, info->dst = dst; info->user_data = user_data; g_file_copy_async(src, dst, - G_FILE_COPY_OVERWRITE, // GFileCopyFlags flags, - 0, // int io_priority, - NULL, // GCancellable *cancellable, - NULL, // GFileProgressCallback progress_callback, - NULL, // gpointer progress_callback_data, - cache_file_cb, // GAsyncReadyCallback callback, - info); // gpointer user_data + G_FILE_COPY_OVERWRITE, // GFileCopyFlags flags, + G_PRIORITY_DEFAULT_IDLE, // int io_priority, + NULL, // GCancellable *cancellable, + NULL, // GFileProgressCallback progress_callback, + NULL, // gpointer progress_callback_data, + cache_file_cb, // GAsyncReadyCallback callback, + info); // gpointer user_data return; } diff --git a/src/main.c b/src/main.c index 343b6b9..d1b13b3 100644 --- a/src/main.c +++ b/src/main.c @@ -24,24 +24,66 @@ #include "plugin-ridge.h" #include "plugin-example.h" +static gint log_levels = 0; + +static void log_func(const gchar *log_domain, GLogLevelFlags log_level, + const gchar *message, gpointer udata) +{ + if (log_level & log_levels) + g_log_default_handler(log_domain, log_level, message, udata); +} + +static gboolean on_map(AWeatherGui *gui, GdkEvent *event, gchar *site) +{ + AWeatherView *view = aweather_gui_get_view(gui); + aweather_view_set_site(view, site); + return FALSE; +} + /******** * Main * ********/ int main(int argc, char *argv[]) { - gtk_init(&argc, &argv); + /* Arguments */ + gint opt_debug = 6; + gchar *opt_site = "IND"; + gboolean opt_auto = FALSE; + GOptionEntry entries[] = { + //long short flg type location description arg desc + {"debug", 'd', 0, G_OPTION_ARG_INT, &opt_debug, "Change default log level", "[1-7]"}, + {"site", 's', 0, G_OPTION_ARG_STRING, &opt_site, "Set initial site", NULL}, + {"auto", 'a', 0, G_OPTION_ARG_NONE, &opt_auto, "Auto update radar (todo)", NULL}, + {NULL} + }; + + /* Init */ + GError *error = NULL; + g_thread_init(NULL); + if (!gtk_init_with_args(&argc, &argv, "aweather", entries, NULL, &error)) { + g_print("%s\n", error->message); + g_error_free(error); + return -1; + } gtk_gl_init(&argc, &argv); + /* Finish arguments */ + log_levels = 1 << opt_debug; + + /* Logging */ + g_log_set_handler(NULL, G_LOG_LEVEL_MASK, log_func, NULL); + /* Set up AWeather */ AWeatherGui *gui = aweather_gui_new(); - //AWeatherView *view = aweather_gui_get_view(gui); + AWeatherView *view = aweather_gui_get_view(gui); + g_signal_connect(gui, "map-event", G_CALLBACK(on_map), opt_site); /* Load plugins */ aweather_gui_register_plugin(gui, AWEATHER_PLUGIN(aweather_example_new(gui))); aweather_gui_register_plugin(gui, AWEATHER_PLUGIN(aweather_ridge_new(gui))); aweather_gui_register_plugin(gui, AWEATHER_PLUGIN(aweather_radar_new(gui))); - gtk_widget_show_all(aweather_gui_get_widget(gui, "window")); + gtk_widget_show_all(GTK_WIDGET(gui)); gtk_main(); return 0; diff --git a/src/plugin-example.c b/src/plugin-example.c index 26be63a..4060642 100644 --- a/src/plugin-example.c +++ b/src/plugin-example.c @@ -66,7 +66,7 @@ static gboolean rotate(gpointer _example) ***********/ AWeatherExample *aweather_example_new(AWeatherGui *gui) { - //g_message("aweather_view_new"); + g_debug("AWeatherExample: new"); AWeatherExample *example = g_object_new(AWEATHER_TYPE_EXAMPLE, NULL); example->gui = gui; @@ -88,7 +88,7 @@ AWeatherExample *aweather_example_new(AWeatherGui *gui) static void aweather_example_expose(AWeatherPlugin *_example) { AWeatherExample *example = AWEATHER_EXAMPLE(_example); - g_message("aweather_example_expose"); + g_debug("AWeatherExample: expose"); glDisable(GL_TEXTURE_2D); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(-1,1,-1,1,-10,10); diff --git a/src/plugin-radar.c b/src/plugin-radar.c index 7858023..07161c5 100644 --- a/src/plugin-radar.c +++ b/src/plugin-radar.c @@ -152,7 +152,6 @@ static void load_radar_gui(AWeatherRadar *self, Radar *radar) Sweep *sweep = vol->sweep[si]; if (sweep == NULL || sweep->h.elev == 0) continue; if (sweep->h.elev != elev) { - g_message("adding elev"); cols++; elev = sweep->h.elev; @@ -200,10 +199,10 @@ static void load_radar(AWeatherRadar *self, gchar *radar_file) g_free(dir); RSL_read_these_sweeps("all", NULL); if (self->cur_radar) { - g_message("Freeing radar"); + g_debug("AWeatherRadar: load_radar - Freeing old radar"); RSL_free_radar(self->cur_radar); } - g_message("Allocating radar"); + g_debug("AWeatherRadar: load_radar - Loading new radar"); Radar *radar = self->cur_radar = RSL_wsr88d_to_radar(radar_file, site); if (radar == NULL) { g_warning("fail to load radar: path=%s, site=%s", radar_file, site); @@ -305,7 +304,7 @@ static void cached_cb(char *path, gboolean updated, gpointer _self) decompressed_t *udata = g_malloc(sizeof(decompressed_t)); udata->self = self; udata->radar_file = decompressed; - g_message("File updated, decompressing.."); + g_debug("AWeatherRadar: cached_cb - File updated, decompressing.."); char *argv[] = {"wsr88ddec", path, decompressed, NULL}; GPid pid; GError *error = NULL; @@ -341,7 +340,7 @@ static void on_sweep_clicked(GtkRadioButton *button, gpointer _self) static void on_time_changed(AWeatherView *view, char *time, gpointer _self) { AWeatherRadar *self = AWEATHER_RADAR(_self); - g_message("radar:setting time"); + g_debug("AWeatherRadar: on_time_changed - setting time"); // format: http://mesonet.agron.iastate.edu/data/nexrd2/raw/KABR/KABR_20090510_0323 char *site = aweather_view_get_site(view); char *base = "http://mesonet.agron.iastate.edu/data/"; @@ -358,7 +357,7 @@ static void on_time_changed(AWeatherView *view, char *time, gpointer _self) static void on_site_changed(AWeatherView *view, char *site, gpointer _self) { AWeatherRadar *self = AWEATHER_RADAR(_self); - g_message("Loading wsr88d list for %s", site); + g_debug("AWeatherRadar: on_site_changed - Loading wsr88d list for %s", site); char *time = NULL; update_times(self, site, &time); aweather_view_set_time(view, time); @@ -381,7 +380,7 @@ static void on_refresh(AWeatherView *view, gpointer user_data, gpointer _self) ***********/ AWeatherRadar *aweather_radar_new(AWeatherGui *gui) { - //g_message("aweather_view_new"); + g_debug("AWeatherRadar: new"); AWeatherRadar *self = g_object_new(AWEATHER_TYPE_RADAR, NULL); self->gui = gui; @@ -405,7 +404,7 @@ AWeatherRadar *aweather_radar_new(AWeatherGui *gui) static void _aweather_radar_expose(AWeatherPlugin *_self) { AWeatherRadar *self = AWEATHER_RADAR(_self); - g_message("radar:expose"); + g_debug("AWeatherRadar: expose"); if (self->cur_sweep == NULL) return; Sweep *sweep = self->cur_sweep; diff --git a/src/plugin-ridge.c b/src/plugin-ridge.c index a9838b9..646878c 100644 --- a/src/plugin-ridge.c +++ b/src/plugin-ridge.c @@ -111,7 +111,8 @@ void load_texture(AWeatherRidge *self, layer_t *layer, gchar *filename) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); char *base = g_path_get_basename(filename); - g_message("loaded image: w=%-3d h=%-3d fmt=%x px=(%02x,%02x,%02x,%02x) img=%s", + g_debug("AWeatherRidge: load_texture - " + "w=%-3d h=%-3d fmt=%x px=(%02x,%02x,%02x,%02x) img=%s", width, height, format, pixels[0], pixels[1], pixels[2], pixels[3], base); g_free(base); @@ -144,7 +145,7 @@ void cached_cb(gchar *filename, gboolean updated, gpointer _udata) *************/ static void on_site_changed(AWeatherView *view, gchar *site, AWeatherRidge *self) { - g_message("site changed to %s", site); + g_debug("AWeatherRidge: on_site_changed - site=%s", site); for (int i = 0; i < LAYER_COUNT; i++) { gchar *base = "http://radar.weather.gov/ridge/"; gchar *path = g_strdup_printf(layers[i].fmt, site); @@ -198,7 +199,7 @@ static void aweather_ridge_expose(AWeatherPlugin *_ridge) { AWeatherRidge *ridge = AWEATHER_RIDGE(_ridge); - g_message("ridge:expose"); + g_debug("AWeatherRidge: expose"); glPushMatrix(); glEnable(GL_TEXTURE_2D); glColor4f(1,1,1,1); -- 2.41.0