]> Pileus Git - grits/blobdiff - src/grits-test.c
Add support for GTK 3
[grits] / src / grits-test.c
index 54251ba1414819a31092a5db7cbd76686e5328cf..cde36cdc533fdb0786450bc881026ba65696f243 100644 (file)
@@ -21,6 +21,8 @@
 
 #include "grits.h"
 
+#include "compat.h"
+
 GritsPrefs   *prefs   = NULL;
 GritsPlugins *plugins = NULL;
 GritsViewer  *viewer  = NULL;
@@ -47,7 +49,7 @@ static gboolean on_delete(GtkWidget *widget, GdkEvent *event, gpointer data)
 static gboolean on_key_press(GtkWidget *widget, GdkEventKey *event,
                gpointer _)
 {
-       if (event->keyval == GDK_q)
+       if (event->keyval == GDK_KEY_q)
                return grits_shutdown(widget);
        return FALSE;
 }
@@ -65,17 +67,14 @@ 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);
 
        prefs   = grits_prefs_new(NULL, NULL);
        plugins = grits_plugins_new(g_getenv("GRITS_PLUGIN_PATH"), prefs);
        viewer  = grits_opengl_new(plugins, prefs);
 
-       gdk_threads_enter();
        GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-       GtkWidget *vbox   = gtk_vbox_new(FALSE, 0);
+       GtkWidget *vbox   = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
        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);
@@ -95,13 +94,12 @@ int main(int argc, char **argv)
        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));
+       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());
+       //gdk_display_close(gdk_display_get_default());
 
        prefs   = NULL;
        plugins = NULL;