#include <GL/gl.h>
#include "aweather-gui.h"
-#include "aweather-plugin.h"
#include "plugin-example.h"
/****************
* GObject code *
****************/
+/* Plugin init */
static void aweather_example_plugin_init(AWeatherPluginInterface *iface);
static void aweather_example_expose(AWeatherPlugin *_example);
G_DEFINE_TYPE_WITH_CODE(AWeatherExample, aweather_example, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE(AWEATHER_TYPE_PLUGIN,
aweather_example_plugin_init));
-static void aweather_example_class_init(AWeatherExampleClass *klass)
-{
- GObjectClass *object_class = (GObjectClass*)klass;
-}
static void aweather_example_plugin_init(AWeatherPluginInterface *iface)
{
+ g_debug("AWeatherExample: plugin_init");
/* Add methods to the interface */
iface->expose = aweather_example_expose;
}
+/* Class/Object init */
static void aweather_example_init(AWeatherExample *example)
{
+ g_debug("AWeatherExample: init");
/* Set defaults */
example->gui = NULL;
example->button = NULL;
example->rotation = 30.0;
}
+static void aweather_example_dispose(GObject *gobject)
+{
+ g_debug("AWeatherExample: dispose");
+ AWeatherExample *self = AWEATHER_EXAMPLE(gobject);
+ /* Drop references */
+ G_OBJECT_CLASS(aweather_example_parent_class)->dispose(gobject);
+}
+static void aweather_example_finalize(GObject *gobject)
+{
+ g_debug("AWeatherExample: finalize");
+ AWeatherExample *self = AWEATHER_EXAMPLE(gobject);
+ /* Free data */
+ G_OBJECT_CLASS(aweather_example_parent_class)->finalize(gobject);
+
+}
+static void aweather_example_class_init(AWeatherExampleClass *klass)
+{
+ g_debug("AWeatherExample: class_init");
+ GObjectClass *gobject_class = (GObjectClass*)klass;
+ gobject_class->dispose = aweather_example_dispose;
+ gobject_class->finalize = aweather_example_finalize;
+}
/***********
* Helpers *
***********/
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;
GtkWidget *config = aweather_gui_get_widget(gui, "tabs");
/* Add configuration tab */
- GtkWidget *label = gtk_label_new("example");
+ GtkWidget *label = gtk_label_new("Example");
example->button = GTK_TOGGLE_BUTTON(gtk_toggle_button_new_with_label("Rotate"));
gtk_notebook_append_page(GTK_NOTEBOOK(config), GTK_WIDGET(example->button), label);
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);