X-Git-Url: http://pileus.org/git/?p=grits;a=blobdiff_plain;f=src%2Fgrits-test.c;h=10d59ece3491dfbd24c6e2deaa9a7bd2aa09c4f0;hp=2fef4aef0982ae77828054204582793afecd5aff;hb=95561789ea91d7aea0d6dcd7b9321f0d1fc97188;hpb=728d24822cd0836e97e4591f561a72f948dc45a7 diff --git a/src/grits-test.c b/src/grits-test.c index 2fef4ae..10d59ec 100644 --- a/src/grits-test.c +++ b/src/grits-test.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2010 Andy Spencer + * Copyright (C) 2009-2011 Andy Spencer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +17,6 @@ #include #include -#include #include #include "grits.h" @@ -31,13 +30,13 @@ GritsViewer *viewer = NULL; *************/ static gboolean grits_shutdown(GtkWidget *window) { + static gboolean shutdown = FALSE; + if (shutdown) return TRUE; + shutdown = TRUE; + grits_plugins_free(plugins); g_object_unref(prefs); gtk_widget_destroy(window); - - while (gtk_events_pending()) - gtk_main_iteration(); - gtk_main_quit(); return TRUE; } @@ -57,7 +56,8 @@ static void load_plugin(GritsPlugins *plugins, gchar *name, { GritsPlugin *plugin = grits_plugins_load(plugins, name, viewer, prefs); GtkWidget *config = grits_plugin_get_config(plugin); - gtk_notebook_append_page(notebook, config, gtk_label_new(name)); + if (config) + gtk_notebook_append_page(notebook, config, gtk_label_new(name)); } /*********** @@ -65,10 +65,8 @@ static void load_plugin(GritsPlugins *plugins, gchar *name, ***********/ int main(int argc, char **argv) { - g_thread_init(NULL); gdk_threads_init(); gtk_init(&argc, &argv); - gtk_gl_init(&argc, &argv); prefs = grits_prefs_new(NULL, NULL); plugins = grits_plugins_new(g_getenv("GRITS_PLUGIN_PATH"), prefs); @@ -80,6 +78,7 @@ int main(int argc, char **argv) GtkWidget *config = gtk_notebook_new(); g_signal_connect(window, "delete-event", G_CALLBACK(on_delete), NULL); g_signal_connect(window, "key-press-event", G_CALLBACK(on_key_press), NULL); + gtk_widget_set_size_request(GTK_WIDGET(viewer), 300, 300); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(config), GTK_POS_BOTTOM); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(viewer), TRUE, TRUE, 0); @@ -89,17 +88,23 @@ int main(int argc, char **argv) /* Configurable stuff */ grits_viewer_set_offline(viewer, TRUE); (void)load_plugin; - load_plugin(plugins, "elev", viewer, prefs, GTK_NOTEBOOK(config)); load_plugin(plugins, "env", viewer, prefs, GTK_NOTEBOOK(config)); - //load_plugin(plugins, "map", viewer, prefs, GTK_NOTEBOOK(config)); - load_plugin(plugins, "sat", viewer, prefs, GTK_NOTEBOOK(config)); - load_plugin(plugins, "test", viewer, prefs, GTK_NOTEBOOK(config)); + //load_plugin(plugins, "elev", viewer, prefs, GTK_NOTEBOOK(config)); + //load_plugin(plugins, "sat", viewer, prefs, GTK_NOTEBOOK(config)); + load_plugin(plugins, "map", viewer, prefs, GTK_NOTEBOOK(config)); + //load_plugin(plugins, "alert", viewer, prefs, GTK_NOTEBOOK(config)); //load_plugin(plugins, "radar", viewer, prefs, GTK_NOTEBOOK(config)); + load_plugin(plugins, "test", viewer, prefs, GTK_NOTEBOOK(config)); gtk_widget_show_all(config); gtk_main(); gdk_threads_leave(); gdk_display_close(gdk_display_get_default()); + + prefs = NULL; + plugins = NULL; + viewer = NULL; + window = vbox = config = NULL; return 0; }