]> err.no Git - libchamplain/commitdiff
Inherit from GtkAlignment
authorPierre-Luc Beaudoin <pierre-luc@squidy.info>
Tue, 12 Aug 2008 20:39:40 +0000 (16:39 -0400)
committerPierre-Luc Beaudoin <pierre-luc@squidy.info>
Tue, 12 Aug 2008 20:39:40 +0000 (16:39 -0400)
src/champlain_widget.c
src/champlain_widget.h
src/launcher.c

index 8e09558cff6a872554075408f238e9d88e0c3be1..4f99b763a2a961de9a8845365b4340ece8fbb67d 100644 (file)
@@ -25,6 +25,7 @@
 #include <stdio.h>
 #include <glib.h>
 #include <glib-object.h>
+#include <gtk-clutter-embed.h>
 
 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);
 }
index c481d518f083a10f5f177ae45bc67878c34ba5a6..c89dc1fd6684a8ac26a41dc705b52ae388be13dd 100644 (file)
@@ -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);
 
index f07c299ab2d91e3eb1c56cb58b07c5a196aa5784..69f1a0969a49f892567776266a04a741f06f3b61 100644 (file)
@@ -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