summaryrefslogtreecommitdiffstats
path: root/xparts/src/gtk
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit90825e2392b2d70e43c7a25b8a3752299a933894 (patch)
treee33aa27f02b74604afbfd0ea4f1cfca8833d882a /xparts/src/gtk
downloadtdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.tar.gz
tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'xparts/src/gtk')
-rw-r--r--xparts/src/gtk/Makefile.am13
-rw-r--r--xparts/src/gtk/configure.in.in1
-rw-r--r--xparts/src/gtk/gtkbrowserextension.c244
-rw-r--r--xparts/src/gtk/gtkbrowserextension.h54
-rw-r--r--xparts/src/gtk/gtkpart.c299
-rw-r--r--xparts/src/gtk/gtkpart.h61
6 files changed, 672 insertions, 0 deletions
diff --git a/xparts/src/gtk/Makefile.am b/xparts/src/gtk/Makefile.am
new file mode 100644
index 00000000..2e83df3b
--- /dev/null
+++ b/xparts/src/gtk/Makefile.am
@@ -0,0 +1,13 @@
+INCLUDES = $(GLIB_INCLUDES) -I$(prefix)/include -I$(top_srcdir) $(all_includes)
+
+AM_CFLAGS = $(GLIB_CFLAGS) $(GTK_CFLAGS)
+AM_CXXFLAGS = $(GLIB_CFLAGS) $(GTK_CFLAGS)
+
+lib_LTLIBRARIES = libgtkxparts.la
+
+libgtkxparts_la_SOURCES = gtkpart.c gtkbrowserextension.c
+libgtkxparts_la_LIBADD = $(GTK_LIBS) $(GLIB_LIBS) $(top_builddir)/dcopc/libdcopc.la
+libgtkxparts_la_LDFLAGS = -L$(prefix)/lib $(all_libraries) -no-undefined
+
+gtkxpartsinclude_HEADERS = gtkpart.h gtkbrowserextension.h
+gtkxpartsincludedir = $(includedir)/xkparts
diff --git a/xparts/src/gtk/configure.in.in b/xparts/src/gtk/configure.in.in
new file mode 100644
index 00000000..32dfac1e
--- /dev/null
+++ b/xparts/src/gtk/configure.in.in
@@ -0,0 +1 @@
+AM_CONDITIONAL(include_GTK_support, [ test "$GTK_CONFIG" != "no" ])
diff --git a/xparts/src/gtk/gtkbrowserextension.c b/xparts/src/gtk/gtkbrowserextension.c
new file mode 100644
index 00000000..165320a8
--- /dev/null
+++ b/xparts/src/gtk/gtkbrowserextension.c
@@ -0,0 +1,244 @@
+
+#include "gtkbrowserextension.h"
+
+#include <gdk/gdkx.h>
+
+#include <dcopc/util.h>
+#include <dcopc/marshal.h>
+#include <dcopc/dcopc.h>
+
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <stdlib.h>
+
+typedef struct _GtkXBrowserExtensionPrivate GtkXBrowserExtensionPrivate;
+
+struct _GtkXBrowserExtensionPrivate {
+ gchar *host_app_id;
+ gchar *host_obj_id;
+ DcopClient *client;
+};
+
+#define P ((GtkXBrowserExtensionPrivate *)(part->data))
+#define CLASS(obj) GTK_XBROWSEREXTENSION_CLASS(GTK_OBJECT(obj)->klass)
+
+
+/* class and instance initialization */
+
+static void
+gtk_xbrowserextension_class_init(GtkXBrowserExtensionClass *klass);
+
+static void
+gtk_xbrowserextension_init(GtkXBrowserExtension *part);
+
+static void
+gtk_xbrowserextension_destroy( GtkObject *obj );
+
+
+/* dcop handlers */
+
+gboolean gtk_xbrowserextension_dcop_process( DcopObject *obj, const char *fun, dcop_data *data,
+ char **reply_type, dcop_data **reply_data );
+
+GList *gtk_xbrowserextension_dcop_functions( DcopObject *obj );
+
+GList *gtk_xbrowserextension_dcop_interfaces( DcopObject *obj );
+
+static DcopObjectClass *parent_class = 0;
+
+/* --------------------------- implementations --------------------------------------- */
+
+/* type information */
+GtkType
+gtk_xbrowserextension_get_type(void)
+{
+ static GtkType part_type = 0;
+ if (!part_type)
+ {
+ static const GtkTypeInfo part_info =
+ {
+ "GtkXBrowserExtension",
+ sizeof(GtkXBrowserExtension),
+ sizeof(GtkXBrowserExtensionClass),
+ (GtkClassInitFunc)gtk_xbrowserextension_class_init,
+ (GtkObjectInitFunc)gtk_xbrowserextension_init,
+ 0,
+ 0,
+ 0
+ };
+ part_type = gtk_type_unique(DCOP_TYPE_OBJECT, &part_info);
+ }
+ return part_type;
+}
+
+/* class and instance initialization */
+static void
+gtk_xbrowserextension_class_init(GtkXBrowserExtensionClass *klass)
+{
+ GtkObjectClass *object_class = (GtkObjectClass *)klass;
+ DcopObjectClass *dcop_class = DCOP_OBJECT_CLASS(klass);
+ g_message( "gtk_xbrowserextension_class_init\n" );
+
+ parent_class = (DcopObjectClass *)gtk_type_class(dcop_object_get_type());
+
+ object_class->destroy = gtk_xbrowserextension_destroy;
+
+ dcop_class->process = gtk_xbrowserextension_dcop_process;
+ dcop_class->functions = gtk_xbrowserextension_dcop_functions;
+ dcop_class->interfaces = gtk_xbrowserextension_dcop_interfaces;
+
+ klass->save_state = 0;
+ klass->restore_state = 0;
+
+ g_message( "gtk_xbrowserextension_class_init\n" );
+}
+
+static void
+gtk_xbrowserextension_init(GtkXBrowserExtension *part)
+{
+ GtkXBrowserExtensionPrivate *d;
+ d = g_new( GtkXBrowserExtensionPrivate, 1 );
+ part->data = d;
+
+ dcop_object_set_id( DCOP_OBJECT(part), "XBrowserExtensionClient" );
+
+ d->client = 0;
+ d->host_app_id = 0;
+ d->host_obj_id = 0;
+
+ g_message( "gtk_xbrowserextension_init\n" );
+}
+
+GtkXBrowserExtension *gtk_xbrowserextension_new (void)
+{
+ return (GtkXBrowserExtension *) gtk_type_new(gtk_xbrowserextension_get_type());
+}
+
+
+gboolean gtk_xbrowserextension_dcop_process( DcopObject *obj, const char *fun, dcop_data *data,
+ char **reply_type, dcop_data **reply_data )
+{
+ GtkXBrowserExtension *part = GTK_XBROWSEREXTENSION(obj);
+ GtkXBrowserExtensionPrivate *d = (GtkXBrowserExtensionPrivate *)part->data;
+ GtkXBrowserExtensionClass *klass = GTK_XBROWSEREXTENSION_CLASS(GTK_OBJECT(part)->klass);
+
+ if ( strcmp( fun, "saveState()" ) == 0 )
+ {
+ const char *state = 0;
+ if( klass->save_state) {
+ state = klass->save_state( part );
+
+ dcop_marshal_bytearray( *reply_data, state, strlen( state ) );
+ }
+ return True;
+ }
+ else if ( strcmp( fun, "restoreState(QByteArray)" ) == 0 )
+ {
+ if( klass->restore_state ) {
+ size_t len;
+ char *state;
+ dcop_demarshal_bytearray( data, &state, &len );
+ klass->restore_state( part, state, len );
+ }
+ return True;
+ }
+ else if ( strcmp( fun, "setBrowserSignals(DCOPRef)" ) == 0 )
+ {
+ dcop_demarshal_string( data, &d->host_app_id );
+ dcop_demarshal_string( data, &d->host_obj_id );
+ return True;
+ }
+
+ return parent_class->process( obj, fun, data, reply_type, reply_data );
+}
+
+GList *gtk_xbrowserextension_dcop_functions( DcopObject *obj )
+{
+ GList *res = parent_class->functions( obj );
+ res = g_list_append( res, g_strdup( "saveState()" ) );
+ res = g_list_append( res, g_strdup( "restoreState(QByteArray)" ) );
+ return res;
+}
+
+GList *gtk_xbrowserextension_dcop_interfaces( DcopObject *obj )
+{
+ GList *res = parent_class->interfaces( obj );
+ res = g_list_append( res, g_strdup( "XBrowserExtension" ) );
+ return res;
+}
+
+void gtk_xbrowserextension_destroy( GtkObject *obj )
+{
+ GtkXBrowserExtension *part = GTK_XBROWSEREXTENSION(obj);
+ GtkXBrowserExtensionPrivate *d = (GtkXBrowserExtensionPrivate *) part->data;
+ g_free( d->host_app_id );
+ g_free( d->host_obj_id );
+ g_free( d );
+
+ GTK_OBJECT_CLASS(parent_class)->destroy(obj);
+}
+
+void gtk_xbrowserextension_set_dcop_client( GtkXBrowserExtension *part, DcopClient *client )
+{
+ P->client = client;
+}
+
+
+gboolean gtk_xbrowserextension_register( GtkXBrowserExtension *part, const gchar *host_app_id, const gchar *host_obj_id)
+{
+ dcop_data *reply_data;
+ char *reply_type;
+ dcop_data *data = dcop_data_ref( dcop_data_new() );
+ GtkXBrowserExtensionPrivate *d = (GtkXBrowserExtensionPrivate *)part->data;
+
+ if(!P->client)
+ fprintf(stderr, "register a dcop client first!\n");
+
+ dcop_marshal_string( data, dcop_client_app_id( P->client ) );
+ dcop_marshal_string( data, DCOP_ID(DCOP_OBJECT(part)) );
+
+ if ( !dcop_client_call( P->client, host_app_id, host_obj_id, "registerXBrowserExtension(DCOPRef)", data,
+ &reply_type, &reply_data ) ) {
+ fprintf( stderr, "cannot register with shell %s / %s\n", host_app_id, host_obj_id );
+ gtk_exit( 1 );
+ }
+ g_message( "back from registration call!" );
+
+ /*assert( strcmp( reply_type, "DCOPRef" ) == 0 );*/
+
+#if 0
+ /* this is wrong. but as we have the ref anyway, let's ignore the return value*/
+ dcop_demarshal_string( data, &d->host_app_id );
+ dcop_demarshal_string( data, &d->host_obj_id );
+
+ printf("appid=%s, objid=%s\n", d->host_app_id, d->host_obj_id);
+#endif
+ d->host_obj_id = g_strdup( host_obj_id );
+ d->host_app_id = g_strdup( host_app_id );
+
+ dcop_data_reset( reply_data );
+
+ dcop_data_deref( data );
+ g_message( "returning from gtk_xbrowserextension_register" );
+ return TRUE;
+}
+
+gboolean gtk_browserextension_open_url_request( GtkXBrowserExtension *part, const char *url )
+{
+ dcop_data *reply_data;
+ char *reply_type;
+ dcop_data *data = dcop_data_ref( dcop_data_new() );
+
+ if(!P->client)
+ fprintf(stderr, "register a dcop client first!\n");
+
+ dcop_marshal_string( data, url );
+
+ if ( !dcop_client_call( P->client, P->host_app_id, P->host_obj_id, "openURLRequest(QCString)", data,
+ &reply_type, &reply_data ) ) {
+ g_warning(" openURLRequest failed");
+ return FALSE;
+ }
+ return TRUE;
+}
diff --git a/xparts/src/gtk/gtkbrowserextension.h b/xparts/src/gtk/gtkbrowserextension.h
new file mode 100644
index 00000000..7efbd938
--- /dev/null
+++ b/xparts/src/gtk/gtkbrowserextension.h
@@ -0,0 +1,54 @@
+#ifndef _gtkxbrowserextension_h__
+#define _gtkxbrowserextension_h__
+
+#include <dcopc/dcopobject.h>
+#include <dcopc/dcopc.h>
+#include <dcopc/marshal.h>
+#include <dcopc/util.h>
+
+#include <gtk/gtk.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GTK_TYPE_XBROWSEREXTENSION (gtk_xbrowserextension_get_type())
+#define GTK_XBROWSEREXTENSION(obj) GTK_CHECK_CAST((obj), GTK_TYPE_XBROWSEREXTENSION, GtkXBrowserExtension)
+#define GTK_XBROWSEREXTENSION_CLASS(klass) GTK_CHECK_CLASS_CAST((klass), GTK_TYPE_XBROWSEREXTENSION, GtkXBrowserExtensionClass)
+#define GTK_IS_XBROWSEREXTENSION(obj) GTK_CHECK_TYPE((obj), GTK_TYPE_XBROWSEREXTENSION)
+#define GTK_IS_XBROWSEREXTENSION_CLASS(klass) GTK_CHECK_CLASS_TYPE((klass), GTK_TYPE_XBROWSEREXTENSION)
+
+#define GTK_XBROWSEREXTENSION_WIDGET(part) (gtk_xbrowserextension_get_widget(part))
+#define GTK_XBROWSEREXTENSION_DCOP(part) (gtk_xbrowserextension_get_dcop(part))
+
+typedef struct _GtkXBrowserExtension GtkXBrowserExtension;
+typedef struct _GtkXBrowserExtensionClass GtkXBrowserExtensionClass;
+
+struct _GtkXBrowserExtension
+{
+ DcopObject obj;
+ void *data;
+};
+
+struct _GtkXBrowserExtensionClass
+{
+ DcopObjectClass parent_class;
+
+ const char * ( *save_state)( GtkXBrowserExtension *ext );
+ void (* restore_state) ( GtkXBrowserExtension *ext, const char *state, unsigned int size );
+};
+
+extern GtkType gtk_xbrowserextension_get_type (void);
+extern GtkXBrowserExtension *gtk_xbrowserextension_new (void);
+
+gboolean gtk_browserextension_open_url_request( GtkXBrowserExtension *ext, const char *url );
+
+/* "virtual" functions from DcopObject */
+void gtk_xbrowserextension_set_dcop_client( GtkXBrowserExtension *part, DcopClient *client );
+gboolean gtk_xbrowserextension_register( GtkXBrowserExtension *part, const gchar *host_app_id, const gchar *host_obj_id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/xparts/src/gtk/gtkpart.c b/xparts/src/gtk/gtkpart.c
new file mode 100644
index 00000000..740910fb
--- /dev/null
+++ b/xparts/src/gtk/gtkpart.c
@@ -0,0 +1,299 @@
+
+#include "gtkpart.h"
+
+#include <gdk/gdkx.h>
+
+#include <dcopc/util.h>
+#include <dcopc/marshal.h>
+#include <dcopc/dcopc.h>
+
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <stdlib.h>
+
+typedef struct _GtkXPartPrivate GtkXPartPrivate;
+
+struct _GtkXPartPrivate {
+ GtkWidget *widget;
+ gchar *host_app_id;
+ gchar *host_obj_id;
+ DcopClient *client;
+};
+
+#define P ((GtkXPartPrivate *)(part->data))
+#define CLASS(obj) GTK_XPART_CLASS(GTK_OBJECT(obj)->klass)
+
+
+/* class and instance initialization */
+
+static void
+gtk_xpart_class_init(GtkXPartClass *klass);
+
+static void
+gtk_xpart_init(GtkXPart *part);
+
+static void
+gtk_xpart_destroy( GtkObject *obj );
+
+/* dcop handlers */
+
+gboolean gtk_xpart_dcop_process( DcopObject *obj, const char *fun, dcop_data *data,
+ char **reply_type, dcop_data **reply_data );
+
+GList *gtk_xpart_dcop_functions( DcopObject *obj );
+
+GList *gtk_xpart_dcop_interfaces( DcopObject *obj );
+
+static DcopObjectClass *parent_class = 0;
+
+/* --------------------------- implementations --------------------------------------- */
+
+/* type information */
+GtkType
+gtk_xpart_get_type(void)
+{
+ static GtkType part_type = 0;
+ if (!part_type)
+ {
+ static const GtkTypeInfo part_info =
+ {
+ "GtkXPart",
+ sizeof(GtkXPart),
+ sizeof(GtkXPartClass),
+ (GtkClassInitFunc)gtk_xpart_class_init,
+ (GtkObjectInitFunc)gtk_xpart_init,
+ 0,
+ 0,
+ 0
+ };
+ part_type = gtk_type_unique(DCOP_TYPE_OBJECT, &part_info);
+ }
+ return part_type;
+}
+
+/* class and instance initialization */
+static void
+gtk_xpart_class_init(GtkXPartClass *klass)
+{
+ GtkObjectClass *object_class = (GtkObjectClass *)klass;
+ DcopObjectClass *dcop_class = DCOP_OBJECT_CLASS(klass);
+
+ parent_class = (DcopObjectClass *)gtk_type_class(dcop_object_get_type());
+
+ object_class->destroy = gtk_xpart_destroy;
+
+ dcop_class->process = gtk_xpart_dcop_process;
+ dcop_class->functions = gtk_xpart_dcop_functions;
+ dcop_class->interfaces = gtk_xpart_dcop_interfaces;
+
+ klass->open_url = 0;
+ klass->close_url = 0;
+ klass->query_extension = 0;
+
+ g_message( "gtk_xpart_class_init\n" );
+}
+
+static void
+gtk_xpart_init(GtkXPart *part)
+{
+ GtkXPartPrivate *d;
+ d = g_new( GtkXPartPrivate, 1 );
+ part->data = d;
+
+ dcop_object_set_id( DCOP_OBJECT(part), "XPartClient" );
+
+ d->widget = 0;
+ d->client = 0;
+ d->host_app_id = 0;
+ d->host_obj_id = 0;
+
+ g_message( "gtk_xpart_init\n" );
+}
+
+GtkXPart *gtk_xpart_new (void)
+{
+ return (GtkXPart *) gtk_type_new(gtk_xpart_get_type());
+}
+
+
+void gtk_xpart_set_widget( GtkXPart *part, GtkWidget *widget )
+{
+ GtkXPartPrivate *d = (GtkXPartPrivate *)part->data;
+ d->widget = widget;
+ gtk_object_ref( GTK_OBJECT( widget ) );
+}
+
+
+
+gboolean gtk_xpart_dcop_process( DcopObject *obj, const char *fun, dcop_data *data,
+ char **reply_type, dcop_data **reply_data )
+{
+ GtkXPart *part = GTK_XPART(obj);
+ GtkXPartPrivate *d = (GtkXPartPrivate *)part->data;
+ GtkXPartClass *klass = GTK_XPART_CLASS(GTK_OBJECT(part)->klass);
+ gboolean b;
+
+ if ( strcmp( fun, "windowId()" ) == 0 )
+ {
+ *reply_type = strdup( "Q_UINT32" );
+ *reply_data = dcop_data_ref( dcop_data_new() );
+
+ fprintf( stderr, "returning window id %ld\n", GDK_WINDOW_XWINDOW( d->widget->window ) );
+ dcop_marshal_uint32( *reply_data, GDK_WINDOW_XWINDOW( d->widget->window ) );
+
+ return True;
+ }
+ else if ( strcmp( fun, "show()" ) == 0 )
+ {
+ fprintf( stderr, "show %p!\n", d->widget );
+ gtk_widget_show_all( d->widget );
+ return True;
+ }
+ else if ( strcmp( fun, "openURL(QCString)" ) == 0 )
+ {
+ char *url;
+ fprintf( stderr, "openURL!\n" );
+ dcop_demarshal_string( data, &url );
+ b = FALSE;
+ if ( klass->open_url )
+ b = klass->open_url( part, url );
+ *reply_type = strdup( "bool" );
+ *reply_data = dcop_data_ref( dcop_data_new() );
+ dcop_marshal_boolean( *reply_data, b );
+ return True;
+ }
+ else if ( strcmp( fun, "closeURL()" ) == 0 )
+ {
+ fprintf( stderr, "closeURL!\n" );
+ b = FALSE;
+ if ( klass->close_url )
+ b = klass->close_url( part );
+ *reply_type = strdup( "bool" );
+ *reply_data = dcop_data_ref( dcop_data_new() );
+ dcop_marshal_boolean( *reply_data, b );
+ return True;
+ }
+ else if ( strcmp( fun, "activateAction(QCString,int)" ) == 0 )
+ {
+ char *name;
+ uint state;
+ dcop_demarshal_string( data, &name );
+ dcop_demarshal_uint32( data, &state );
+ fprintf( stderr, "activateAction %s state=%d\n", name, state );
+ gtk_signal_emit_by_name( GTK_OBJECT(part), name, state);
+ return True;
+ }
+ else if ( strcmp( fun, "queryExtension(QCString)" ) == 0 ) {
+ char *name;
+ char *extension = NULL;
+ dcop_demarshal_string( data, &name );
+ if ( klass->query_extension )
+ extension = klass->query_extension( part, name );
+ *reply_type = strdup( "DCOPRef" );
+ *reply_data = dcop_data_ref( dcop_data_new() );
+ dcop_marshal_string( *reply_data, dcop_client_app_id( P->client ) );
+ dcop_marshal_string( *reply_data, extension );
+ return True;
+ }
+
+ return parent_class->process( obj, fun, data, reply_type, reply_data );
+}
+
+GList *gtk_xpart_dcop_functions( DcopObject *obj )
+{
+ GList *res = parent_class->functions( obj );
+ res = g_list_append( res, g_strdup( "windowId()" ) );
+ res = g_list_append( res, g_strdup( "show()" ) );
+ res = g_list_append( res, g_strdup( "bool openURL(QString url)" ) );
+ res = g_list_append( res, g_strdup( "bool closeURL()" ) );
+ res = g_list_append( res, g_strdup( "queryExtension(QCString)" ) );
+ return res;
+}
+
+GList *gtk_xpart_dcop_interfaces( DcopObject *obj )
+{
+ GList *res = parent_class->interfaces( obj );
+ res = g_list_append( res, g_strdup( "XPart" ) );
+ return res;
+}
+
+void gtk_xpart_destroy( GtkObject *obj )
+{
+ GtkXPart *part = GTK_XPART(obj);
+ GtkXPartPrivate *d = (GtkXPartPrivate *) part->data;
+ g_free( d->host_app_id );
+ g_free( d->host_obj_id );
+
+ gtk_object_destroy( GTK_OBJECT( d->widget ) );
+
+ GTK_OBJECT_CLASS(parent_class)->destroy(obj);
+}
+
+void gtk_xpart_set_dcop_client( GtkXPart *part, DcopClient *client )
+{
+ P->client = client;
+}
+
+
+gboolean gtk_xpart_register( GtkXPart *part, const gchar *host_app_id, const gchar *host_obj_id)
+{
+ dcop_data *reply_data;
+ char *reply_type;
+ dcop_data *data = dcop_data_ref( dcop_data_new() );
+ GtkXPartPrivate *d = (GtkXPartPrivate *)part->data;
+
+ if(!P->client)
+ fprintf(stderr, "register a dcop client first!\n");
+
+ dcop_marshal_string( data, dcop_client_app_id( P->client ) );
+ dcop_marshal_string( data, DCOP_ID(DCOP_OBJECT(part)) );
+
+ if ( !dcop_client_call( P->client, host_app_id, host_obj_id, "registerXPart(DCOPRef)", data,
+ &reply_type, &reply_data ) ) {
+ fprintf( stderr, "cannot register with shell %s / %s\n", host_app_id, host_obj_id );
+ gtk_exit( 1 );
+ }
+ g_message( "back from registration call!" );
+
+ /*assert( strcmp( reply_type, "DCOPRef" ) == 0 );*/
+
+#if 0
+ /* this is wrong. but as we have the ref anyway, let's ignore the return value*/
+ dcop_demarshal_string( data, &d->host_app_id );
+ dcop_demarshal_string( data, &d->host_obj_id );
+
+ printf("appid=%s, objid=%s\n", d->host_app_id, d->host_obj_id);
+#endif
+ d->host_obj_id = g_strdup( host_obj_id );
+ d->host_app_id = g_strdup( host_app_id );
+
+ dcop_data_reset( reply_data );
+
+ dcop_data_deref( data );
+ g_message( "returning from gtk_xpart_register" );
+ return TRUE;
+}
+
+
+gboolean gtk_xpart_initialize_actions( GtkXPart *part, const char * actions )
+{
+ GtkXPartPrivate *d = (GtkXPartPrivate *) part->data;
+ dcop_data *data = 0;
+
+ g_message( "gtk_xpart_initialize_actions\n" );
+
+ if(!P->client)
+ g_message( "register a dcop client first!\n" );
+
+ data = dcop_data_ref( dcop_data_new() );
+ dcop_marshal_string( data, actions );
+
+ if( !dcop_client_send( d->client, d->host_app_id, d->host_obj_id, "createActions(QCString)", data ) ) {
+ fprintf( stderr, "could not create actions\n" );
+ dcop_data_deref( data );
+ return FALSE;
+ }
+ dcop_data_deref( data );
+ return TRUE;
+}
diff --git a/xparts/src/gtk/gtkpart.h b/xparts/src/gtk/gtkpart.h
new file mode 100644
index 00000000..e803f03e
--- /dev/null
+++ b/xparts/src/gtk/gtkpart.h
@@ -0,0 +1,61 @@
+#ifndef _gtkxpart_h__
+#define _gtkxpart_h__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <dcopc/dcopobject.h>
+#include <dcopc/dcopc.h>
+#include <dcopc/marshal.h>
+#include <dcopc/util.h>
+
+#include <gtk/gtk.h>
+
+#include "gtkbrowserextension.h"
+
+#define GTK_TYPE_XPART (gtk_xpart_get_type())
+#define GTK_XPART(obj) GTK_CHECK_CAST((obj), GTK_TYPE_XPART, GtkXPart)
+#define GTK_XPART_CLASS(klass) GTK_CHECK_CLASS_CAST((klass), GTK_TYPE_XPART, GtkXPartClass)
+#define GTK_IS_XPART(obj) GTK_CHECK_TYPE((obj), GTK_TYPE_XPART)
+#define GTK_IS_XPART_CLASS(klass) GTK_CHECK_CLASS_TYPE((klass), GTK_TYPE_XPART)
+
+#define GTK_XPART_WIDGET(part) (gtk_xpart_get_widget(part))
+#define GTK_XPART_DCOP(part) (gtk_xpart_get_dcop(part))
+
+typedef struct _GtkXPart GtkXPart;
+typedef struct _GtkXPartClass GtkXPartClass;
+
+struct _GtkXPart
+{
+ DcopObject obj;
+ void *data;
+};
+
+struct _GtkXPartClass
+{
+ DcopObjectClass parent_class;
+
+ gboolean (* open_url) ( GtkXPart *part, const char * url );
+ gboolean (* close_url) ( GtkXPart *part );
+
+ /* virtual function, returns the dcop object id of the extension, or NULL if it
+ doesn't exist */
+ char * (*query_extension) ( GtkXPart *part, const char *name );
+};
+
+extern GtkType gtk_xpart_get_type (void);
+extern GtkXPart *gtk_xpart_new (void);
+
+/* "virtual" functions from DcopObject */
+void gtk_xpart_set_dcop_client( GtkXPart *part, DcopClient *client );
+gboolean gtk_xpart_register( GtkXPart *part, const gchar *host_app_id, const gchar *host_obj_id);
+gboolean gtk_xpart_initialize_actions( GtkXPart *part, const char * actions );
+
+void gtk_xpart_set_widget( GtkXPart *part, GtkWidget *widget );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif