Boris Zbarsky wrote:
> Feynman wrote:
>> Thanks for response, I tested another solution, but it does not work.
>> MyEventListener::PageShow is never called
>
> What made you think it should be called? It shouldn't, given your code.
>
>> class MyEventListener : public nsIDOMPageTransitionListener
>
> Of course you don't actually QI to nsIDOMPageTransitionListener, which
> is why your PageShow is not being called.
>
>> MyEventListener::HandleEvent(nsIDOMEvent* aDOMEvent)
>
> This _is_ being called, right?
>
>> webBrowser->GetContentDOMWindow(&domWindow);
>>
>> rv = domWindow->GetDocument(&domDoc);
>
> These still leak. You really should fix that.
>
> -Boris
Thanks for advice. There must be problem in something else. I looked at
gnome-web-photo and found the code below. The problem is, that exactly
this code is working in gnome-web-photo, but its not working with my
configure script, the event listener is never called, everything else
seems ok. Is there something I could have done wrong in my configure
script or makefile (some important constant or ...) ? I have no idea ....
Thanks a lot
(the listener is declared in other file)
#include "config.h"
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gtkmozembed.h>
#include <nsCOMPtr.h>
#include <nsIServiceManager.h>
#include <nsIStyleSheetService.h>
#include <nsILocalFile.h>
#include <nsIURI.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include "Components.h"
#include "Listener.h"
/* --- */
#define TYPE_EMBED (embed_get_type ())
#define EMBED(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_EMBED, Embed))
GType embed_get_type (void);
typedef struct _Embed Embed;
typedef struct _EmbedClass EmbedClass;
struct _Embed
{
GtkMozEmbed parent_instance;
Listener *listener;
guint state;
};
struct _EmbedClass
{
GtkMozEmbedClass parent_class;
void (* onload) (Embed *embed);
};
static GObjectClass *parent_class = NULL;
static void
embed_net_stop (GtkMozEmbed *mozembed)
{
}
static void
embed_onload (Embed *embed)
{
printf("ONLOAD\n");
}
static void
embed_realize (GtkWidget *widget)
{
GtkMozEmbed *mozembed = GTK_MOZ_EMBED (widget);
Embed *embed = EMBED (widget);
GTK_WIDGET_CLASS (parent_class)->realize (widget);
embed->listener = new Listener(mozembed);
if (NS_FAILED (embed->listener->Attach ())) {
g_warning ("Couldn't attach the listener!\n");
}
}
static void
embed_init (Embed *embed)
{
}
static void
embed_class_init (EmbedClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkMozEmbedClass *moz_embed_class = GTK_MOZ_EMBED_CLASS (klass);
parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
widget_class->realize = embed_realize;
moz_embed_class->net_stop = embed_net_stop;
klass->onload = embed_onload;
}
G_DEFINE_TYPE (Embed, embed, GTK_TYPE_MOZ_EMBED);
/* --- */
static GtkWidget *window;
static GtkWidget *embed;
int
main (int argc, char **argv)
{
GdkScreen *screen;
GError *error = NULL;
gtk_init(&argc, &argv);
/* Create window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
embed = GTK_WIDGET (g_object_new (TYPE_EMBED, NULL));
gtk_container_add (GTK_CONTAINER (window), embed);
gtk_widget_show_all (window);
gtk_moz_embed_load_url (GTK_MOZ_EMBED (embed), "seznam.cz");
gtk_main ();
return 0;
}
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding