svnno****@sourc*****
svnno****@sourc*****
Thu Mar 22 14:32:20 JST 2007
Revision: 2948 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=kazehakase&view=rev&rev=2948 Author: ikezoe Date: 2007-03-22 14:32:20 +0900 (Thu, 22 Mar 2007) Log Message: ----------- * module/embed/gecko/kz-gecko-embed.cpp: kz_gecko_embed_new() now became no argument. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/module/embed/gecko/kz-gecko-embed.cpp Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2007-03-22 04:00:14 UTC (rev 2947) +++ kazehakase/trunk/ChangeLog 2007-03-22 05:32:20 UTC (rev 2948) @@ -4,6 +4,8 @@ We should set this value in module/embed/gecko/Makefile.am: * module/embed/gecko/mozilla.cpp, module/embed/gecko/mozilla-prefs.cpp: Remove extern "C". + * module/embed/gecko/kz-gecko-embed.cpp: kz_gecko_embed_new() now + became no argument. 2007-03-22 Kouhei Sutou <kou****@cozmi*****> Modified: kazehakase/trunk/module/embed/gecko/kz-gecko-embed.cpp =================================================================== --- kazehakase/trunk/module/embed/gecko/kz-gecko-embed.cpp 2007-03-22 04:00:14 UTC (rev 2947) +++ kazehakase/trunk/module/embed/gecko/kz-gecko-embed.cpp 2007-03-22 05:32:20 UTC (rev 2948) @@ -23,8 +23,6 @@ #include "kz-embed-prefs.h" #include "kz-gecko-single.h" -#define KZ_REGRESSION_BUG4474 1 - #include <string.h> #include <math.h> #include <sys/utsname.h> @@ -104,6 +102,11 @@ #define KZ_GECKO_EMBED_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), KZ_TYPE_GECKO_EMBED, KzGeckoEmbedPrivate)) +enum { + PROP_0, + PROP_LOCATION +}; + typedef struct _KzGeckoEmbedPrivate KzGeckoEmbedPrivate; struct _KzGeckoEmbedPrivate { @@ -132,7 +135,6 @@ gchar *migemo_keyword; #endif gchar *last_highlight; - gchar *first_url; }; typedef struct _KzGeckoEmbedClass KzGeckoEmbedClass; @@ -145,11 +147,10 @@ static GtkMozEmbedClass *kz_gecko_embed_parent_class; static KzGeckoSingle *gecko_single = NULL; -static GtkWidget *kz_gecko_embed_new (const gchar *url); +static GtkWidget *kz_gecko_embed_new (void); static void kz_gecko_embed_iface_init (KzEmbedIFace *iface); -static void kz_gecko_embed_destroy (GtkObject *object); static void kz_gecko_embed_realize (GtkWidget *widget); static void kz_gecko_embed_unrealize (GtkWidget *widget); static void kz_gecko_embed_size_allocate (GtkWidget *widget, @@ -400,6 +401,19 @@ static void kz_gecko_embed_class_init (KzGeckoEmbedClass *klass); static void kz_gecko_embed_init (KzGeckoEmbed *embed); +static GObject *constructor (GType type, + guint n_props, + GObjectConstructParam *props); + +static void dispose (GObject *object); +static void set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); static void kz_gecko_embed_register_type (GTypeModule *module) { @@ -461,9 +475,9 @@ } G_MODULE_EXPORT GtkWidget * -KZ_EMBED_MODULE_IMPL_CREATE (const gchar *url) +KZ_EMBED_MODULE_IMPL_CREATE (void) { - return kz_gecko_embed_new(url); + return kz_gecko_embed_new(); } GType @@ -606,13 +620,14 @@ kz_gecko_embed_parent_class = (GtkMozEmbedClass *)g_type_class_peek_parent (klass); gobject_class = (GObjectClass *) klass; - object_class = (GtkObjectClass *) klass; widget_class = (GtkWidgetClass *) klass; moz_embed_class = (GtkMozEmbedClass *) klass; - // GtkObject signals - object_class->destroy = kz_gecko_embed_destroy; - + gobject_class->constructor = constructor; + gobject_class->dispose = dispose; + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + // widget class widget_class->realize = kz_gecko_embed_realize; widget_class->unrealize = kz_gecko_embed_unrealize; @@ -649,6 +664,15 @@ moz_embed_class->dom_mouse_dbl_click = kz_gecko_embed_dom_mouse_dbl_click; moz_embed_class->dom_mouse_over = kz_gecko_embed_dom_mouse_over; + g_object_class_install_property + (gobject_class, + PROP_LOCATION, + g_param_spec_string( + "location", + _("The URL"), + _("The current URL"), + NULL, + (GParamFlags) G_PARAM_READWRITE)); g_type_class_add_private (gobject_class, sizeof(KzGeckoEmbedPrivate)); } @@ -679,39 +703,29 @@ priv->migemo_keyword = NULL; #endif priv->last_highlight = NULL; - priv->first_url = NULL; -#ifndef KZ_REGRESSION_BUG4474 -#ifndef HAVE_GECKO_1_8 - kz_moz_embed_load_url(KZ_EMBED(kzembed), "about:blank"); -#endif -#endif + kz_gecko_embed_load_url(KZ_EMBED(kzembed), "about:blank"); } -GtkWidget * -kz_gecko_embed_new (const gchar *url) +static GObject* +constructor (GType type, + guint n_props, + GObjectConstructParam *props) { - KzGeckoEmbed *kzembed = KZ_GECKO_EMBED(g_object_new(KZ_TYPE_GECKO_EMBED, NULL)); + GObject *object; + GObjectClass *klass = G_OBJECT_CLASS(kz_gecko_embed_parent_class); + gchar *title; - KzGeckoEmbedPrivate *priv = KZ_GECKO_EMBED_GET_PRIVATE (kzembed); -#ifndef KZ_REGRESSION_BUG4474 - // To use the gesture in empty tab, - // After "about:balnk" was loaded, the first url start to load. - if (url) - priv->first_url = g_strdup(url); -#ifdef HAVE_GECKO_1_8 - kz_gecko_embed_load_url(KZ_EMBED(kzembed), url); -#endif -#else - kz_gecko_embed_load_url(KZ_EMBED(kzembed), url); -#endif - return GTK_WIDGET(kzembed); + object = klass->constructor(type, n_props, props); + + return object; } + static void -kz_gecko_embed_destroy (GtkObject *object) +dispose (GObject *object) { - KzGeckoEmbedPrivate *priv = KZ_GECKO_EMBED_GET_PRIVATE(object); + KzGeckoEmbedPrivate *priv = KZ_GECKO_EMBED_GET_PRIVATE (object); if (priv->location) g_free(priv->location); @@ -721,16 +735,59 @@ g_free(priv->title); priv->title = NULL; - if (priv->first_url) - g_free(priv->first_url); - priv->first_url = NULL; + if (G_OBJECT_CLASS (kz_gecko_embed_parent_class)->dispose) + G_OBJECT_CLASS (kz_gecko_embed_parent_class)->dispose(object); +} - if (GTK_OBJECT_CLASS(kz_gecko_embed_parent_class)->destroy) - GTK_OBJECT_CLASS(kz_gecko_embed_parent_class)->destroy(object); + +static void +set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + KzGeckoEmbedPrivate *priv = KZ_GECKO_EMBED_GET_PRIVATE (object); + switch (prop_id) + { + case PROP_LOCATION: + priv->location = g_value_dup_string(value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } } static void +get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + KzGeckoEmbedPrivate *priv = KZ_GECKO_EMBED_GET_PRIVATE (object); + + switch (prop_id) + { + case PROP_LOCATION: + g_value_set_string(value, priv->location); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + + +GtkWidget * +kz_gecko_embed_new (void) +{ + return GTK_WIDGET(g_object_new(KZ_TYPE_GECKO_EMBED, + NULL)); + +} + +static void kz_gecko_embed_realize (GtkWidget *widget) { gboolean java = TRUE; @@ -826,8 +883,7 @@ start_page = g_strdup("about:blank"); } - if (!priv->first_url && - kz_gecko_embed_get_lock(kzembed)) + if (kz_gecko_embed_get_lock(kzembed)) { GtkMozEmbed *newembed = NULL; g_signal_emit_by_name(kzembed, @@ -1039,19 +1095,6 @@ KzGeckoEmbedPrivate *priv = KZ_GECKO_EMBED_GET_PRIVATE(embed); -#ifndef KZ_REGRESSION_BUG4474 - if (priv->first_url) - { - gchar *tmp = g_strdup(priv->first_url); - g_free(priv->first_url); - priv->first_url = NULL; - - kz_gecko_embed_load_url(KZ_EMBED(embed), tmp); - g_free(tmp); - - return; - } -#endif if (priv->location) g_free(priv->location); priv->location = gtk_moz_embed_get_location(embed); @@ -1071,8 +1114,6 @@ g_return_if_fail(KZ_IS_GECKO_EMBED(kzembed)); KzGeckoEmbedPrivate *priv = KZ_GECKO_EMBED_GET_PRIVATE (kzembed); - if (priv->first_url) - return; priv->is_loading = TRUE;