Skip to content
Browse files

Some minor fixes. Starting a glue layer to work around GtkMozEmbed API

issues.

svn path=/trunk/gtkmozembed-sharp/; revision=15355
  • Loading branch information...
1 parent 27eaed6 commit 9f106489cfeb4a33492c049db47a0ec3660ea2d7 Mark Crichton committed
Showing with 81 additions and 15 deletions.
  1. +1 −1 Makefile.am
  2. +2 −5 api/gtkmozembed-api.xml
  3. +36 −0 configure.in
  4. +6 −0 glue/.cvsignore
  5. +17 −0 glue/Makefile.am
  6. +12 −0 glue/newwindow.c
  7. +4 −0 gtkmozembed/EmbedWidget.custom
  8. +1 −6 sample/GtkMozApp.cs
  9. +2 −3 sources/GtkMozEmbed.metadata
View
2 Makefile.am
@@ -1 +1 @@
-SUBDIRS = sources api gtkmozembed sample
+SUBDIRS = sources api glue gtkmozembed sample
View
7 api/gtkmozembed-api.xml
@@ -27,7 +27,7 @@
<member cname="GTK_MOZ_EMBED_FLAG_DEPENDENT" name="Dependent" value="268435456U"/>
<member cname="GTK_MOZ_EMBED_FLAG_MODAL" name="Modal" value="536870912U"/>
<member cname="GTK_MOZ_EMBED_FLAG_OPENASDIALOG" name="Openasdialog" value="1073741824U"/>
- <member cname="GTK_MOZ_EMBED_FLAG_OPENASCHROME" name="Openaschrome" value="2147483648U "/>
+ <member cname="GTK_MOZ_EMBED_FLAG_OPENASCHROME" name="Openaschrome" value="2147483648U"/>
</enum>
<enum name="ProgressFlags" cname="GtkMozEmbedProgressFlags" type="enum">
<member cname="GTK_MOZ_EMBED_FLAG_START" name="Start" value="1"/>
@@ -38,7 +38,7 @@
<member cname="GTK_MOZ_EMBED_FLAG_IS_REQUEST" name="IsRequest" value="65536"/>
<member cname="GTK_MOZ_EMBED_FLAG_IS_DOCUMENT" name="IsDocument" value="131072"/>
<member cname="GTK_MOZ_EMBED_FLAG_IS_NETWORK" name="IsNetwork" value="262144"/>
- <member cname="GTK_MOZ_EMBED_FLAG_IS_WINDOW" name="IsWindow" value="524288 "/>
+ <member cname="GTK_MOZ_EMBED_FLAG_IS_WINDOW" name="IsWindow" value="524288"/>
</enum>
<enum name="ReloadFlags" cname="GtkMozEmbedReloadFlags" type="enum">
<member cname="GTK_MOZ_EMBED_FLAG_RELOADNORMAL" name="Reloadnormal"/>
@@ -355,9 +355,6 @@
<method name="Get" cname="gtk_moz_embed_single_get" shared="true">
<return-type type="GtkMozEmbedSingle*"/>
</method>
- <method name="GetType" cname="gtk_moz_embed_single_get_type" shared="true">
- <return-type type="GtkType"/>
- </method>
</object>
</namespace>
</api>
View
36 configure.in
@@ -2,6 +2,7 @@ AC_INIT(README)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(gtkmozembed, 0.1)
AM_MAINTAINER_MODE
+AM_PROG_LIBTOOL
AC_MSG_CHECKING([whether we're compiling from CVS])
if test -f "$srcdir/.cvs_version" ; then
@@ -39,10 +40,45 @@ fi
AC_SUBST(PATH)
AC_SUBST(LD_LIBRARY_PATH)
+dnl Find pkg-config
+AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+if test "x$PKG_CONFIG" = "xno"; then
+ AC_MSG_ERROR([You need to install pkg-config])
+fi
+
+dnl Find GTK
+BUILD_GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
+BUILD_GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
+AC_SUBST(BUILD_GTK_CFLAGS)
+AC_SUBST(BUILD_GTK_LIBS)
+
+GTK_REQUIRED_VERSION=2.0.0
+
+PKG_CHECK_MODULES(BASE_DEPENDENCIES, gtk+-2.0 >= $GTK_REQUIRED_VERSION gmodule-2.0 >= $GTK_REQUIRED_VERSION)
+
+AC_SUBST(BASE_DEPENDENCIES_CFLAGS)
+AC_SUBST(BASE_DEPENDENCIES_LIBS)
+
+dnl Find Mozilla
+AC_ARG_WITH(mozilla-headers,
+ [ --with-mozilla-headers Specify location of MOZILLA headers],
+ [MOZ_CFLAGS="-I$withval"],
+ [MOZ_CFLAGS="-I/usr/include/mozilla"])
+
+AC_ARG_WITH(mozilla-libs,
+ [ --with-mozilla-libs Specify location of MOZILLA libs],
+ [MOZ_LIBS="-L$withval"],
+ [MOZ_LIBS="-L/usr/lib/mozilla"])
+
+AC_SUBST(MOZ_LIBS)
+AC_SUBST(MOZ_CFLAGS)
+
+
AC_OUTPUT([
Makefile
api/Makefile
gtkmozembed/Makefile
+glue/Makefile
sample/Makefile
sources/Makefile
])
View
6 glue/.cvsignore
@@ -0,0 +1,6 @@
+*.lo
+*.la
+Makefile.in
+Makefile
+.deps
+.libs
View
17 glue/Makefile.am
@@ -0,0 +1,17 @@
+lib_LTLIBRARIES = libgtkmozembedsharpglue.la
+
+BASESOURCES = \
+ newwindow.c \
+ #
+
+libgtkmozembedsharpglue_la_LDFLAGS = -module -avoid-version
+
+libgtkmozembedsharpglue_la_SOURCES = \
+ $(BASESOURCES)
+
+libgtkmozembedsharpglue_la_LIBADD = $(BASE_DEPENDENCIES_LIBS) $(MOZ_LIBS)
+
+INCLUDES = -I$(top_srcdir) $(BASE_DEPENDENCIES_CFLAGS) $(MOZ_CFLAGS)
+
+CLEANFILES = lib*.a
+
View
12 glue/newwindow.c
@@ -0,0 +1,12 @@
+/* GO GO GADGET SPEW! */
+
+#include <gtkembedmoz/gtkmozembed.h>
+#include <stdio.h>
+
+void
+gtkmozembedsharp_fix_newwindow (GtkMozEmbed *widget)
+{
+ printf("We need to fix NewWindow. Fun\n");
+
+ return;
+}
View
4 gtkmozembed/EmbedWidget.custom
@@ -1,10 +1,14 @@
[DllImport("gtkembedmoz")]
static extern IntPtr gtk_moz_embed_new();
+[DllImport("gtkmozembedsharpglue")]
+static extern void gtkmozembedsharp_fix_newwindow(IntPtr a);
+
public EmbedWidget(string aPath, string aDir)
{
gtk_moz_embed_set_profile_path(aPath, aDir);
Raw = gtk_moz_embed_new ();
+ gtkmozembedsharp_fix_newwindow(Raw);
}
public EmbedWidget()
View
7 sample/GtkMozApp.cs
@@ -71,7 +71,7 @@ public static int Main (string[] args)
//moz.JsStatus += new EventHandler(moz_jsstatus_cb);
// Now the ones with args!
- moz.NewWindow += new NewWindowHandler(moz_new_win_cb);
+ //moz.NewWindow += new NewWindowHandler(moz_new_win_cb);
//moz.Progress += new ProgressHandler(moz_progress_cb);
//moz.ProgressAll += new ProgressAllHandler(moz_progressall_cb);
//moz.NetState += new NetStateHandler(moz_netstate_cb);
@@ -145,11 +145,6 @@ static void moz_destroybrsr_cb (object obj, EventArgs args)
win.Destroy();
}
- static void moz_new_win_cb (object obj, NewWindowArgs args)
- {
- Console.Error.WriteLine("Mozilla threw a newwin.");
- //args.RetVal = new EmbedWidget();
- }
static void entry_act (object obj, EventArgs args)
{
moz.LoadUrl(editbox.Text);
View
5 sources/GtkMozEmbed.metadata
@@ -120,13 +120,12 @@
</data>
</rule>
-<!-- These signals are a mess. We have to handle them differently -->
<rule>
<class name="GtkMozEmbed">
<signal>NewWindow</signal>
</class>
<data>
- <attribute target="signal">
+ <attribute target="method">
<name>hidden</name>
<value>1</value>
</attribute>
@@ -138,7 +137,7 @@
<signal>NewWindowOrphan</signal>
</class>
<data>
- <attribute target="signal">
+ <attribute target="method">
<name>hidden</name>
<value>1</value>
</attribute>

0 comments on commit 9f10648

Please sign in to comment.
Something went wrong with that request. Please try again.