]> Pileus Git - grits/blobdiff - examples/plugin/teapot.c
Debugging and code formatting
[grits] / examples / plugin / teapot.c
index fd551cc91bbb95a5770b77d5b73caac8d32997fd..06d466e13d414391c391f2f81f943359e441bdee 100644 (file)
@@ -1,16 +1,16 @@
 /*
  * Copyright (C) 2009 Andy Spencer <spenceal@rose-hulman.edu>
- * 
+ *
  * 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
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
@@ -18,7 +18,7 @@
 #include <gtk/gtkgl.h>
 #include <GL/gl.h>
 
-#include <gis.h>
+#include <gis/gis.h>
 
 #include "teapot.h"
 
@@ -30,7 +30,7 @@ static gboolean rotate(gpointer _self)
        GisPluginTeapot *self = _self;
        if (gtk_toggle_button_get_active(self->button)) {
                self->rotation += 1.0;
-               gis_opengl_redraw(self->opengl);
+               gtk_widget_queue_draw(GTK_WIDGET(self->viewer));
        }
        return TRUE;
 }
@@ -39,12 +39,11 @@ static gboolean rotate(gpointer _self)
 /***********
  * Methods *
  ***********/
-GisPluginTeapot *gis_plugin_teapot_new(GisWorld *world, GisView *view, GisOpenGL *opengl)
+GisPluginTeapot *gis_plugin_teapot_new(GisViewer *viewer, GisPrefs *prefs)
 {
        g_debug("GisPluginTeapot: new");
        GisPluginTeapot *self = g_object_new(GIS_TYPE_PLUGIN_TEAPOT, NULL);
-       self->opengl = opengl;
-
+       self->viewer = viewer;
        return self;
 }
 
@@ -105,7 +104,6 @@ static void gis_plugin_teapot_init(GisPluginTeapot *self)
        self->button    = GTK_TOGGLE_BUTTON(gtk_toggle_button_new_with_label("Rotate"));
        self->rotate_id = g_timeout_add(1000/60, rotate, self);
        self->rotation  = 30.0;
-       self->opengl    = NULL;
 }
 static void gis_plugin_teapot_dispose(GObject *gobject)
 {
@@ -115,18 +113,9 @@ static void gis_plugin_teapot_dispose(GObject *gobject)
        /* Drop references */
        G_OBJECT_CLASS(gis_plugin_teapot_parent_class)->dispose(gobject);
 }
-static void gis_plugin_teapot_finalize(GObject *gobject)
-{
-       g_debug("GisPluginTeapot: finalize");
-       GisPluginTeapot *self = GIS_PLUGIN_TEAPOT(gobject);
-       /* Free data */
-       G_OBJECT_CLASS(gis_plugin_teapot_parent_class)->finalize(gobject);
-
-}
 static void gis_plugin_teapot_class_init(GisPluginTeapotClass *klass)
 {
        g_debug("GisPluginTeapot: class_init");
        GObjectClass *gobject_class = (GObjectClass*)klass;
        gobject_class->dispose  = gis_plugin_teapot_dispose;
-       gobject_class->finalize = gis_plugin_teapot_finalize;
 }