diff options
author | Christian Persch <chpe@src.gnome.org> | 2003-09-02 07:20:17 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-09-02 07:20:17 +0800 |
commit | 73a95385f4034998cc78199dc8bb9ee22d90d6aa (patch) | |
tree | 499d78ab52e8937f672e3659105dda083a34c988 /embed/mozilla | |
parent | 3375c1878c4c0ebf4f5067d128024ea484208f62 (diff) | |
download | gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar.gz gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar.bz2 gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar.lz gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar.xz gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar.zst gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.zip |
Mega-patch, changelog too long to paste here.
Diffstat (limited to 'embed/mozilla')
-rw-r--r-- | embed/mozilla/ProgressListener.cpp | 4 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-persist.cpp | 25 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-persist.h | 15 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-single.cpp | 28 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-single.h | 12 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed.cpp | 40 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed.h | 15 |
7 files changed, 58 insertions, 81 deletions
diff --git a/embed/mozilla/ProgressListener.cpp b/embed/mozilla/ProgressListener.cpp index e9cc7b835..433b2234c 100644 --- a/embed/mozilla/ProgressListener.cpp +++ b/embed/mozilla/ProgressListener.cpp @@ -118,7 +118,7 @@ NS_METHOD GProgressListener::PrivateInit (void) if (NS_FAILED (rv)) return NS_ERROR_FAILURE; source = g_strdup (cTmp.get()); - mDownloaderView = DOWNLOADER_VIEW + mDownloaderView = EPHY_DOWNLOADER_VIEW (ephy_embed_shell_get_downloader_view (embed_shell)); downloader_view_add_download (mDownloaderView, filename, source, dest, (gpointer)this); @@ -339,7 +339,7 @@ NS_IMETHODIMP GProgressListener::OnStateChange (nsIWebProgress *aWebProgress, break; case ACTION_OBJECT_NOTIFY: - g_return_val_if_fail (IS_EPHY_EMBED_PERSIST (mEphyPersist), + g_return_val_if_fail (EPHY_IS_EMBED_PERSIST (mEphyPersist), NS_ERROR_FAILURE); PersistHandlerInfo *handler; diff --git a/embed/mozilla/mozilla-embed-persist.cpp b/embed/mozilla/mozilla-embed-persist.cpp index 0161086cb..7e120935b 100644 --- a/embed/mozilla/mozilla-embed-persist.cpp +++ b/embed/mozilla/mozilla-embed-persist.cpp @@ -14,6 +14,8 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ */ #include "ProgressListener.h" @@ -39,6 +41,8 @@ impl_save (EphyEmbedPersist *persist); static gresult impl_cancel (EphyEmbedPersist *persist); +#define MOZILLA_EMBED_PERSIST_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), MOZILLA_TYPE_EMBED_PERSIST, MozillaEmbedPersistPrivate)) + struct MozillaEmbedPersistPrivate { nsCOMPtr<nsIWebBrowserPersist> mPersist; @@ -68,7 +72,7 @@ mozilla_embed_persist_get_type (void) }; mozilla_embed_persist_type = - g_type_register_static (EPHY_EMBED_PERSIST_TYPE, + g_type_register_static (EPHY_TYPE_EMBED_PERSIST, "MozillaEmbedPersist", &our_info, (GTypeFlags)0); } @@ -80,41 +84,34 @@ static void mozilla_embed_persist_class_init (MozillaEmbedPersistClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - EphyEmbedPersistClass *persist_class; + EphyEmbedPersistClass *persist_class = EPHY_EMBED_PERSIST_CLASS (klass); parent_class = (GObjectClass *) g_type_class_peek_parent (klass); - persist_class = EPHY_EMBED_PERSIST_CLASS (klass); object_class->finalize = mozilla_embed_persist_finalize; persist_class->save = impl_save; persist_class->cancel = impl_cancel; + + g_type_class_add_private (object_class, sizeof(MozillaEmbedPersistPrivate)); } static void mozilla_embed_persist_init (MozillaEmbedPersist *persist) { - persist->priv = g_new0 (MozillaEmbedPersistPrivate, 1); + persist->priv = MOZILLA_EMBED_PERSIST_GET_PRIVATE (persist); + persist->priv->mPersist = do_CreateInstance (NS_WEBBROWSERPERSIST_CONTRACTID); } static void mozilla_embed_persist_finalize (GObject *object) { - MozillaEmbedPersist *persist; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_MOZILLA_EMBED_PERSIST (object)); - - persist = MOZILLA_EMBED_PERSIST (object); + MozillaEmbedPersist *persist = MOZILLA_EMBED_PERSIST (object); persist->priv->mPersist->SetProgressListener (nsnull); persist->priv->mPersist = nsnull; - - g_return_if_fail (persist->priv != NULL); - g_free (persist->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/embed/mozilla/mozilla-embed-persist.h b/embed/mozilla/mozilla-embed-persist.h index 7abd11e68..7eab5de9a 100644 --- a/embed/mozilla/mozilla-embed-persist.h +++ b/embed/mozilla/mozilla-embed-persist.h @@ -26,15 +26,14 @@ G_BEGIN_DECLS -typedef struct MozillaEmbedPersistClass MozillaEmbedPersistClass; - -#define MOZILLA_EMBED_PERSIST_TYPE (mozilla_embed_persist_get_type ()) -#define MOZILLA_EMBED_PERSIST(obj) (GTK_CHECK_CAST ((obj), MOZILLA_EMBED_PERSIST_TYPE, MozillaEmbedPersist)) -#define MOZILLA_EMBED_PERSIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), MOZILLA_EMBED_PERSIST_TYPE, MozillaEmbedPersistClass)) -#define IS_MOZILLA_EMBED_PERSIST(obj) (GTK_CHECK_TYPE ((obj), MOZILLA_EMBED_PERSIST_TYPE)) -#define IS_MOZILLA_EMBED_PERSIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), MOZILLA_EMBED_PERSIST)) -#define MOZILLA_EMBED_PERSIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOZILLA_EMBED_PERSIST_TYPE, MozillaEmbedPersistClass)) +#define MOZILLA_TYPE_EMBED_PERSIST (mozilla_embed_persist_get_type ()) +#define MOZILLA_EMBED_PERSIST(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MOZILLA_TYPE_EMBED_PERSIST, MozillaEmbedPersist)) +#define MOZILLA_EMBED_PERSIST_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MOZILLA_TYPE_EMBED_PERSIST, MozillaEmbedPersistClass)) +#define MOZILLA_IS_EMBED_PERSIST(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MOZILLA_TYPE_EMBED_PERSIST)) +#define MOZILLA_IS_EMBED_PERSIST_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MOZILLA_TYPE_EMBED_PERSIST)) +#define MOZILLA_EMBED_PERSIST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MOZILLA_TYPE_EMBED_PERSIST, MozillaEmbedPersistClass)) +typedef struct MozillaEmbedPersistClass MozillaEmbedPersistClass; typedef struct MozillaEmbedPersist MozillaEmbedPersist; typedef struct MozillaEmbedPersistPrivate MozillaEmbedPersistPrivate; diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp index 3a296f20a..f81fdc1a1 100644 --- a/embed/mozilla/mozilla-embed-single.cpp +++ b/embed/mozilla/mozilla-embed-single.cpp @@ -14,6 +14,8 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ */ #ifdef HAVE_CONFIG_H @@ -244,6 +246,8 @@ static void mozilla_embed_single_new_window_orphan_cb (GtkMozEmbedSingle *embed, guint chrome_mask, EphyEmbedSingle *shell); +#define MOZILLA_EMBED_SINGLE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), MOZILLA_TYPE_EMBED_SINGLE, MozillaEmbedSinglePrivate)) + struct MozillaEmbedSinglePrivate { char *user_prefs; @@ -274,7 +278,7 @@ mozilla_embed_single_get_type (void) (GInstanceInitFunc) mozilla_embed_single_init }; - mozilla_embed_single_type = g_type_register_static (EPHY_EMBED_SINGLE_TYPE, + mozilla_embed_single_type = g_type_register_static (EPHY_TYPE_EMBED_SINGLE, "MozillaEmbedSingle", &our_info, (GTypeFlags)0); } @@ -286,10 +290,9 @@ static void mozilla_embed_single_class_init (MozillaEmbedSingleClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - EphyEmbedSingleClass *shell_class; + EphyEmbedSingleClass *shell_class = EPHY_EMBED_SINGLE_CLASS (klass); parent_class = (GObjectClass *) g_type_class_peek_parent (klass); - shell_class = EPHY_EMBED_SINGLE_CLASS (klass); object_class->finalize = mozilla_embed_single_finalize; @@ -304,12 +307,14 @@ mozilla_embed_single_class_init (MozillaEmbedSingleClass *klass) shell_class->list_passwords = impl_list_passwords; shell_class->remove_passwords = impl_remove_passwords; shell_class->show_file_picker = impl_show_file_picker; + + g_type_class_add_private (object_class, sizeof(MozillaEmbedSinglePrivate)); } EphyEmbedSingle * mozilla_embed_single_new (void) { - return EPHY_EMBED_SINGLE (g_object_new (MOZILLA_EMBED_SINGLE_TYPE, NULL)); + return EPHY_EMBED_SINGLE (g_object_new (MOZILLA_TYPE_EMBED_SINGLE, NULL)); } static gboolean @@ -529,7 +534,7 @@ mozilla_register_external_protocols (void) static void mozilla_embed_single_init (MozillaEmbedSingle *mes) { - mes->priv = g_new0 (MozillaEmbedSinglePrivate, 1); + mes->priv = MOZILLA_EMBED_SINGLE_GET_PRIVATE (mes); mes->priv->theme_window = NULL; mes->priv->user_prefs = @@ -677,18 +682,11 @@ mozilla_embed_single_new_window_orphan_cb (GtkMozEmbedSingle *embed, static void mozilla_embed_single_finalize (GObject *object) { - MozillaEmbedSingle *mes; + MozillaEmbedSingle *mes = MOZILLA_EMBED_SINGLE (object); /* Destroy EphyEmbedSingle before because some * services depend on xpcom */ - G_OBJECT_CLASS (parent_class)->finalize (object); - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_MOZILLA_EMBED_SINGLE (object)); - - mes = MOZILLA_EMBED_SINGLE (object); - - g_return_if_fail (mes->priv != NULL); + G_OBJECT_CLASS (parent_class)->finalize (object); mozilla_notifiers_free (); @@ -700,8 +698,6 @@ mozilla_embed_single_finalize (GObject *object) { gtk_widget_destroy (mes->priv->theme_window); } - - g_free (mes->priv); } static gresult diff --git a/embed/mozilla/mozilla-embed-single.h b/embed/mozilla/mozilla-embed-single.h index 02801daff..71cc48416 100644 --- a/embed/mozilla/mozilla-embed-single.h +++ b/embed/mozilla/mozilla-embed-single.h @@ -25,12 +25,12 @@ G_BEGIN_DECLS -#define MOZILLA_EMBED_SINGLE_TYPE (mozilla_embed_single_get_type ()) -#define MOZILLA_EMBED_SINGLE(obj) (GTK_CHECK_CAST ((obj), MOZILLA_EMBED_SINGLE_TYPE, MozillaEmbedSingle)) -#define MOZILLA_EMBED_SINGLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), MOZILLA_EMBED_SINGLE_TYPE, MozillaEmbedSingleClass)) -#define IS_MOZILLA_EMBED_SINGLE(obj) (GTK_CHECK_TYPE ((obj), MOZILLA_EMBED_SINGLE_TYPE)) -#define IS_MOZILLA_EMBED_SINGLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), MOZILLA_EMBED_SINGLE)) -#define MOZILLA_EMBED_SINGLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOZILLA_EMBED_SINGLE_TYPE, MozillaEmbedSingleClass)) +#define MOZILLA_TYPE_EMBED_SINGLE (mozilla_embed_single_get_type ()) +#define MOZILLA_EMBED_SINGLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MOZILLA_TYPE_EMBED_SINGLE, MozillaEmbedSingle)) +#define MOZILLA_EMBED_SINGLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MOZILLA_TYPE_EMBED_SINGLE, MozillaEmbedSingleClass)) +#define MOZILLA_IS_EMBED_SINGLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MOZILLA_TYPE_EMBED_SINGLE)) +#define MOZILLA_IS_EMBED_SINGLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MOZILLA_TYPE_EMBED_SINGLE)) +#define MOZILLA_EMBED_SINGLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MOZILLA_TYPE_EMBED_SINGLE, MozillaEmbedSingleClass)) typedef struct MozillaEmbedSingle MozillaEmbedSingle; typedef struct MozillaEmbedSinglePrivate MozillaEmbedSinglePrivate; diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp index 66695ef64..0ca866a05 100644 --- a/embed/mozilla/mozilla-embed.cpp +++ b/embed/mozilla/mozilla-embed.cpp @@ -14,6 +14,8 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ */ #include "gtkmozembed.h" @@ -43,8 +45,6 @@ mozilla_embed_class_init (MozillaEmbedClass *klass); static void mozilla_embed_init (MozillaEmbed *gs); static void -mozilla_embed_finalize (GObject *object); -static void mozilla_embed_destroy (GtkObject *object); static void ephy_embed_init (EphyEmbedClass *embed_class); @@ -233,6 +233,8 @@ signal_connections[] = { NULL, NULL } }; +#define MOZILLA_EMBED_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), MOZILLA_TYPE_EMBED, MozillaEmbedPrivate)) + struct MozillaEmbedPrivate { MozillaEmbedPrivate() : wrapper(NULL), security_state(-1), no_page(1) @@ -284,7 +286,7 @@ mozilla_embed_get_type (void) &our_info, (GTypeFlags)0); g_type_add_interface_static (mozilla_embed_type, - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, &embed_info); } @@ -311,7 +313,7 @@ impl_find_next (EphyEmbed *embed, static gresult impl_activate (EphyEmbed *embed) { - g_return_val_if_fail (IS_EPHY_EMBED (embed), G_FAILED); + g_return_val_if_fail (EPHY_IS_EMBED (embed), G_FAILED); gtk_widget_grab_focus (GTK_BIN (embed)->child); @@ -388,16 +390,19 @@ mozilla_embed_class_init (MozillaEmbedClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); + parent_class = (GObjectClass *) g_type_class_peek_parent (klass); - + gtk_object_class->destroy = mozilla_embed_destroy; - object_class->finalize = mozilla_embed_finalize; + + g_type_class_add_private (object_class, sizeof(MozillaEmbedPrivate)); } static void mozilla_embed_init (MozillaEmbed *embed) { - embed->priv = g_new0 (MozillaEmbedPrivate, 1); + embed->priv = MOZILLA_EMBED_GET_PRIVATE (embed); + embed->priv->no_page = 1; mozilla_embed_connect_signals (embed); @@ -454,25 +459,6 @@ mozilla_embed_destroy (GtkObject *object) } static void -mozilla_embed_finalize (GObject *object) -{ - MozillaEmbed *embed; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_MOZILLA_EMBED (object)); - - embed = MOZILLA_EMBED (object); - - g_return_if_fail (embed->priv != NULL); - - g_free (embed->priv); - - G_OBJECT_CLASS (parent_class)->finalize (object); - - LOG ("MozillaEmbed finalized %p", embed) -} - -static void impl_get_capabilities (EphyEmbed *embed, EmbedCapabilities *caps) { @@ -1225,7 +1211,7 @@ static void mozilla_embed_title_changed_cb (GtkMozEmbed *embed, MozillaEmbed *membed) { - g_return_if_fail (IS_MOZILLA_EMBED (membed)); + g_return_if_fail (MOZILLA_IS_EMBED (membed)); g_return_if_fail (GTK_IS_WIDGET (embed)); g_signal_emit_by_name (membed, "ge_title"); } diff --git a/embed/mozilla/mozilla-embed.h b/embed/mozilla/mozilla-embed.h index cbe34d018..ca74d4f72 100644 --- a/embed/mozilla/mozilla-embed.h +++ b/embed/mozilla/mozilla-embed.h @@ -29,15 +29,14 @@ G_BEGIN_DECLS -typedef struct MozillaEmbedClass MozillaEmbedClass; - -#define MOZILLA_EMBED_TYPE (mozilla_embed_get_type ()) -#define MOZILLA_EMBED(obj) (GTK_CHECK_CAST ((obj), MOZILLA_EMBED_TYPE, MozillaEmbed)) -#define MOZILLA_EMBED_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), MOZILLA_EMBED_TYPE, MozillaEmbedClass)) -#define IS_MOZILLA_EMBED(obj) (GTK_CHECK_TYPE ((obj), MOZILLA_EMBED_TYPE)) -#define IS_MOZILLA_EMBED_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), MOZILLA_EMBED)) -#define MOZILLA_EMBED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOZILLA_EMBED_TYPE, MozillaEmbedClass)) +#define MOZILLA_TYPE_EMBED (mozilla_embed_get_type ()) +#define MOZILLA_EMBED(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MOZILLA_TYPE_EMBED, MozillaEmbed)) +#define MOZILLA_EMBED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MOZILLA_TYPE_EMBED, MozillaEmbedClass)) +#define MOZILLA_IS_EMBED(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MOZILLA_TYPE_EMBED)) +#define MOZILLA_IS_EMBED_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MOZILLA_TYPE_EMBED)) +#define MOZILLA_EMBED_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MOZILLA_TYPE_EMBED, MozillaEmbedClass)) +typedef struct MozillaEmbedClass MozillaEmbedClass; typedef struct MozillaEmbed MozillaEmbed; typedef struct MozillaEmbedPrivate MozillaEmbedPrivate; |