From: Andrea Zagli Date: Tue, 18 Aug 2015 18:57:34 +0000 (+0200) Subject: Setted right parent class. X-Git-Tag: v0.0.1~14 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=6b4741a20285bb054228d50cc6f86905e182298d;p=libgtkmapserver Setted right parent class. --- diff --git a/src/gtkmapserver.c b/src/gtkmapserver.c index 71b3c42..02e7409 100644 --- a/src/gtkmapserver.c +++ b/src/gtkmapserver.c @@ -53,7 +53,7 @@ struct _GtkMapserverPrivate { }; -G_DEFINE_TYPE (GtkMapserver, gtk_mapserver, G_TYPE_OBJECT) +G_DEFINE_TYPE (GtkMapserver, gtk_mapserver, GOO_TYPE_CANVAS) #ifdef G_OS_WIN32 static HMODULE hmodule; @@ -91,14 +91,14 @@ gtk_mapserver_init (GtkMapserver *gtk_mapserver) GtkMapserverPrivate *priv = GTK_MAPSERVER_GET_PRIVATE (gtk_mapserver); } -GtkMapserver +GtkWidget *gtk_mapserver_new () { gchar *localedir; - GtkMapserver *gtk_mapserver = GTK_MAPSERVER (g_object_new (gtk_mapserver_get_type (), NULL)); + GtkWidget *gtk_mapserver = GTK_WIDGET (g_object_new (gtk_mapserver_get_type (), NULL)); - GtkMapserverPrivate *priv = GTK_MAPSERVER_GET_PRIVATE (gtk_mapserver); + GtkMapserverPrivate *priv = GTK_MAPSERVER_GET_PRIVATE (GTK_MAPSERVER (gtk_mapserver)); #ifdef G_OS_WIN32 diff --git a/src/gtkmapserver.h b/src/gtkmapserver.h index 5200d6a..4d572f8 100644 --- a/src/gtkmapserver.h +++ b/src/gtkmapserver.h @@ -27,6 +27,7 @@ #include #include #include +#include G_BEGIN_DECLS @@ -45,18 +46,18 @@ typedef struct _GtkMapserverClass GtkMapserverClass; struct _GtkMapserver { - GObject parent; + GooCanvas parent; }; struct _GtkMapserverClass { - GObjectClass parent_class; + GooCanvasClass parent_class; }; GType gtk_mapserver_get_type (void) G_GNUC_CONST; -GtkMapserver *gtk_mapserver_new (void); +GtkWidget *gtk_mapserver_new (void); G_END_DECLS diff --git a/tests/gtkmapserver.c b/tests/gtkmapserver.c index 7382430..ef4b82f 100644 --- a/tests/gtkmapserver.c +++ b/tests/gtkmapserver.c @@ -16,11 +16,39 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include + #include "gtkmapserver.h" +/* This is our handler for the "delete-event" signal of the window, which + is emitted when the 'x' close button is clicked. We just exit here. */ +static gboolean +on_delete_event (GtkWidget *window, + GdkEvent *event, + gpointer unused_data) +{ + exit (0); +} + int main (int argc, char **argv) { + GtkWidget *window; + GtkWidget *gtkmap; + + /* Initialize GTK+. */ + gtk_init (&argc, &argv); + + /* Create the window and widgets. */ + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_default_size (GTK_WINDOW (window), 640, 600); + gtk_widget_show (window); + g_signal_connect (window, + "delete_event", G_CALLBACK (on_delete_event), + NULL); + + /* Pass control to the GTK+ main event loop. */ + gtk_main (); return 0; }