]> Pileus Git - grits/commitdiff
Update example plugin
authorAndy Spencer <andy753421@gmail.com>
Sat, 14 Nov 2009 14:33:18 +0000 (14:33 +0000)
committerAndy Spencer <andy753421@gmail.com>
Sat, 14 Nov 2009 14:33:18 +0000 (14:33 +0000)
examples/plugin/teapot.c
examples/plugin/teapot.h
src/plugins/Makefile.am

index 982756c42970071f10af723ee084a5f5e9f61b0d..06d466e13d414391c391f2f81f943359e441bdee 100644 (file)
@@ -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;
 }
index 1baf35808ad917ad1e48ff885d8eb6aefec8ca4a..34b5cb1810f06f9adad2f1e174b93fa897ef5223 100644 (file)
@@ -34,10 +34,10 @@ struct _GisPluginTeapot {
        GObject parent_instance;
 
        /* instance members */
+       GisViewer       *viewer;
        GtkToggleButton *button;
        guint            rotate_id;
        float            rotation;
-       GisOpenGL       *opengl;
 };
 
 struct _GisPluginTeapotClass {
@@ -47,6 +47,6 @@ struct _GisPluginTeapotClass {
 GType gis_plugin_teapot_get_type();
 
 /* Methods */
-GisPluginTeapot *gis_plugin_teapot_new(GisWorld *world, GisView *view, GisOpenGL *opengl);
+GisPluginTeapot *gis_plugin_teapot_new(GisViewer *viewer, GisPrefs *prefs);
 
 #endif
index 7d27bc648461271d0b195cb95e5e76f8bb9221d4..905bfd79cf2ce6a615ae6afb0e8593f403fbe4e5 100644 (file)
@@ -12,5 +12,10 @@ bmng_la_SOURCES     = bmng.c bmng.h
 srtm_la_SOURCES     = srtm.c srtm.h
 test_la_SOURCES     = test.c test.h
 
+noinst_LTLIBRARIES  = teapot.la
+teapot_la_SOURCES   = \
+       $(top_srcdir)/examples/plugin/teapot.c
+       $(top_srcdir)/examples/plugin/teapot.h
+
 test:
        ( cd ../; make test )