From: Pierre-Luc Beaudoin Date: Tue, 12 Aug 2008 20:39:40 +0000 (-0400) Subject: Inherit from GtkAlignment X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=921ce6b36233ca2992effa01275a3d511a939a12;p=libchamplain Inherit from GtkAlignment --- diff --git a/src/champlain_widget.c b/src/champlain_widget.c index 8e09558..4f99b76 100644 --- a/src/champlain_widget.c +++ b/src/champlain_widget.c @@ -25,6 +25,7 @@ #include #include #include +#include enum { /* normal signals */ @@ -40,19 +41,19 @@ enum { static guint champlain_widget_signals[LAST_SIGNAL] = { 0, }; -#define WEBKIT_WEB_FRAME_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_FRAME, WebKitWebFramePrivate)) +#define CHAMPLAIN_WIDGET_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_WIDGET, ChamplainWidgetPrivate)) struct _ChamplainWidgetPrivate { - gboolean temp; + GtkWidget* clutterEmbed; }; -G_DEFINE_TYPE(ChamplainWidget, champlain_widget, GTK_TYPE_CONTAINER) +G_DEFINE_TYPE(ChamplainWidget, champlain_widget, GTK_TYPE_ALIGNMENT) + static void champlain_widget_class_init(ChamplainWidgetClass* champlainWidgetClass) { -/* - GtkWidgetClass* widgetClass = GTK_WIDGET_CLASS(champlainWidget); +/* GtkWidgetClass* widgetClass = GTK_WIDGET_CLASS(champlainWidget); widgetClass->realize = champlain_widget_realize; widgetClass->expose_event = champlain_widget_expose_event; widgetClass->key_press_event = champlain_widget_key_press_event; @@ -66,11 +67,6 @@ champlain_widget_class_init(ChamplainWidgetClass* champlainWidgetClass) widgetClass->focus_in_event = champlain_widget_focus_in_event; widgetClass->focus_out_event = champlain_widget_focus_out_event; widgetClass->get_accessible = champlain_widget_get_accessible; - - GtkContainerClass* containerClass = GTK_CONTAINER_CLASS(champlainWidget); - containerClass->add = champlain_widget_container_add; - containerClass->remove = champlain_widget_container_remove; - containerClass->forall = champlain_widget_container_forall; */ g_type_class_add_private(champlainWidgetClass, sizeof(ChamplainWidgetPrivate)); @@ -81,8 +77,13 @@ static void champlain_widget_init(ChamplainWidget* champlainWidget) } GtkWidget* champlain_widget_new() -{ +{ ChamplainWidget* widget = CHAMPLAIN_WIDGET(g_object_new(CHAMPLAIN_TYPE_WIDGET, NULL)); - + ChamplainWidgetPrivate* priv = CHAMPLAIN_WIDGET_GET_PRIVATE(widget); + + priv->clutterEmbed = gtk_clutter_embed_new(); + gtk_container_add(GTK_CONTAINER(widget), priv->clutterEmbed); + gtk_widget_show_all(GTK_WIDGET(widget)); + return GTK_WIDGET(widget); } diff --git a/src/champlain_widget.h b/src/champlain_widget.h index c481d51..c89dc1f 100644 --- a/src/champlain_widget.h +++ b/src/champlain_widget.h @@ -37,14 +37,15 @@ G_BEGIN_DECLS typedef struct _ChamplainWidgetPrivate ChamplainWidgetPrivate; -struct _ChamplainWidget { - GtkContainer parent_instance; +struct _ChamplainWidget { + GtkAlignment bin; ChamplainWidgetPrivate *priv; }; -struct _ChamplainWidgetClass { - GtkContainerClass parent_class; +struct _ChamplainWidgetClass { + GtkBinClass parent_class; + ChamplainWidget * (* create_widget) (ChamplainWidget* widget); diff --git a/src/launcher.c b/src/launcher.c index f07c299..69f1a09 100644 --- a/src/launcher.c +++ b/src/launcher.c @@ -39,6 +39,7 @@ main (int argc, char *argv[]) GtkWidget *widget; gtk_init (&argc, &argv); + clutter_init (&argc, &argv); /* create the main, top level, window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); @@ -50,7 +51,7 @@ main (int argc, char *argv[]) gtk_window_set_title (GTK_WINDOW (window), PACKAGE " " VERSION); /* open it a bit wider so that both the label and title show up */ - gtk_window_set_default_size (GTK_WINDOW (window), 200, 50); + gtk_window_set_default_size (GTK_WINDOW (window), 500, 500); /* Connect the destroy event of the window with our on_destroy function