svnno****@sourc*****
svnno****@sourc*****
Fri Mar 30 16:11:07 JST 2007
Revision: 3108 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=kazehakase&view=rev&rev=3108 Author: ikezoe Date: 2007-03-30 16:11:07 +0900 (Fri, 30 Mar 2007) Log Message: ----------- * module/embed/gecko/mozilla.[cpp|h], module/embed/gecko/kz-gecko-single.cpp: KzGeckoSingle is now a child of GtkMozEmbedSingle. Modified Paths: -------------- kazehakase/trunk/module/embed/gecko/kz-gecko-embed-module.cpp kazehakase/trunk/module/embed/gecko/kz-gecko-single.cpp kazehakase/trunk/module/embed/gecko/mozilla.cpp kazehakase/trunk/module/embed/gecko/mozilla.h Modified: kazehakase/trunk/module/embed/gecko/kz-gecko-embed-module.cpp =================================================================== --- kazehakase/trunk/module/embed/gecko/kz-gecko-embed-module.cpp 2007-03-30 07:10:33 UTC (rev 3107) +++ kazehakase/trunk/module/embed/gecko/kz-gecko-embed-module.cpp 2007-03-30 07:11:07 UTC (rev 3108) @@ -22,12 +22,19 @@ #include "kz-gecko-embed.h" #include "kz-gecko-single.h" +#include "mozilla-prefs.h" static KzGeckoSingle *gecko_single = NULL; G_MODULE_EXPORT void KZ_MODULE_IMPL_INIT (GTypeModule *module) { + mozilla_prefs_init(); + + gtk_moz_embed_set_comp_path(MOZILLA_HOME); + + gtk_moz_embed_push_startup(); + gecko_single = kz_gecko_single_new(kz_app); kz_gecko_embed_register_type(module); } @@ -36,6 +43,7 @@ KZ_MODULE_IMPL_EXIT (void) { g_object_unref(gecko_single); + gtk_moz_embed_pop_startup(); } G_MODULE_EXPORT GObject * Modified: kazehakase/trunk/module/embed/gecko/kz-gecko-single.cpp =================================================================== --- kazehakase/trunk/module/embed/gecko/kz-gecko-single.cpp 2007-03-30 07:10:33 UTC (rev 3107) +++ kazehakase/trunk/module/embed/gecko/kz-gecko-single.cpp 2007-03-30 07:11:07 UTC (rev 3108) @@ -82,7 +82,7 @@ static KzGeckoSingle *the_kz_gecko_single = NULL; -G_DEFINE_TYPE(KzGeckoSingle, kz_gecko_single, G_TYPE_OBJECT) +G_DEFINE_TYPE(KzGeckoSingle, kz_gecko_single, GTK_TYPE_MOZ_EMBED_SINGLE) static void kz_gecko_single_class_init (KzGeckoSingleClass *klass) @@ -128,8 +128,7 @@ profile = kz_app_get_profile(priv->kz_app); - mozilla_init(profile); - + mozilla_register_components(); g_signal_connect(profile, "changed::Global", G_CALLBACK(cb_global_profile_changed), NULL); g_signal_connect(profile, "changed::Font", @@ -485,3 +484,24 @@ } } +static void +destroy_browser_cb (GtkMozEmbed *embed, GtkWidget *transient_window) +{ + gtk_widget_destroy(GTK_WIDGET(transient_window)); +} + + +static void +new_window_orphan_cb (GtkMozEmbedSingle *embed, GtkMozEmbed **retval, + guint chromemask, gpointer data) +{ + // FIXME! but I don't have any nice idea... + GtkWidget *newWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); + GtkMozEmbed *newBrowser = GTK_MOZ_EMBED(gtk_moz_embed_new()); + + gtk_container_add(GTK_CONTAINER(newWindow), GTK_WIDGET(newBrowser)); + g_signal_connect(newBrowser,"destroy_browser", + G_CALLBACK(destroy_browser_cb),newWindow); + *retval = GTK_MOZ_EMBED(newBrowser); +} + Modified: kazehakase/trunk/module/embed/gecko/mozilla.cpp =================================================================== --- kazehakase/trunk/module/embed/gecko/mozilla.cpp 2007-03-30 07:10:33 UTC (rev 3107) +++ kazehakase/trunk/module/embed/gecko/mozilla.cpp 2007-03-30 07:11:07 UTC (rev 3108) @@ -146,7 +146,7 @@ } #endif -static gboolean +gboolean mozilla_register_components (void) { gboolean ret = TRUE; @@ -186,60 +186,3 @@ return ret; } -static void -destroy_browser_cb (GtkMozEmbed *embed, GtkWidget *transient_window) -{ - gtk_widget_destroy(GTK_WIDGET(transient_window)); -} - - -static void -new_window_orphan_cb (GtkMozEmbedSingle *embed, GtkMozEmbed **retval, - guint chromemask, gpointer data) -{ - // FIXME! but I don't have any nice idea... - GtkWidget *newWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); - GtkMozEmbed *newBrowser = GTK_MOZ_EMBED(gtk_moz_embed_new()); - - gtk_container_add(GTK_CONTAINER(newWindow), GTK_WIDGET(newBrowser)); - g_signal_connect(newBrowser,"destroy_browser", - G_CALLBACK(destroy_browser_cb),newWindow); - *retval = GTK_MOZ_EMBED(newBrowser); -} - -void -mozilla_init (KzProfile *profile) -{ - GtkMozEmbedSingle *single = NULL; - - mozilla_prefs_init(); - - gtk_moz_embed_set_comp_path(MOZILLA_HOME); - - gtk_moz_embed_push_startup(); -#warning FIXME! - mozilla_prefs_set(profile); - - // - // get the singleton object and hook up to its new window callback - // so we can create orphaned windows. - // - single = gtk_moz_embed_single_get(); - if (!single) { - g_error("Failed to get singleton embed object!"); - return; - } - - g_signal_connect(single, "new_window_orphan", - G_CALLBACK(new_window_orphan_cb), NULL); - - mozilla_register_components(); -} - - -void -mozilla_exit (void) -{ - gtk_moz_embed_pop_startup(); -} - Modified: kazehakase/trunk/module/embed/gecko/mozilla.h =================================================================== --- kazehakase/trunk/module/embed/gecko/mozilla.h 2007-03-30 07:10:33 UTC (rev 3107) +++ kazehakase/trunk/module/embed/gecko/mozilla.h 2007-03-30 07:11:07 UTC (rev 3108) @@ -26,8 +26,7 @@ G_BEGIN_DECLS -void mozilla_init (KzProfile *profile); -void mozilla_exit (void); +gboolean mozilla_register_components (void); G_END_DECLS