diff options
Diffstat (limited to 'embed')
32 files changed, 298 insertions, 409 deletions
diff --git a/embed/downloader-view.c b/embed/downloader-view.c index 70a930fd9..cd0ebe607 100644 --- a/embed/downloader-view.c +++ b/embed/downloader-view.c @@ -59,6 +59,8 @@ enum COL_PERSIST_OBJECT }; +#define EPHY_DOWNLOADER_VIEW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_DOWNLOADER_VIEW, DownloaderViewPrivate)) + struct DownloaderViewPrivate { GHashTable *details_hash; @@ -191,7 +193,7 @@ downloader_view_get_type (void) (GInstanceInitFunc) downloader_view_init }; - downloader_view_type = g_type_register_static (EPHY_DIALOG_TYPE, + downloader_view_type = g_type_register_static (EPHY_TYPE_DIALOG, "DownloaderView", &our_info, 0); } @@ -226,10 +228,8 @@ static void downloader_view_class_init (DownloaderViewClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - EphyDialogClass *ephy_dialog_class; parent_class = g_type_class_peek_parent (klass); - ephy_dialog_class = EPHY_DIALOG_CLASS (klass); object_class->finalize = downloader_view_finalize; @@ -261,6 +261,8 @@ downloader_view_class_init (DownloaderViewClass *klass) g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); + + g_type_class_add_private (object_class, sizeof(DownloaderViewPrivate)); } static void @@ -275,7 +277,8 @@ destroy_details_cb (DownloadDetails *details) static void downloader_view_init (DownloaderView *dv) { - dv->priv = g_new0 (DownloaderViewPrivate, 1); + dv->priv = EPHY_DOWNLOADER_VIEW_GET_PRIVATE (dv); + dv->priv->details_hash = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, @@ -288,29 +291,20 @@ downloader_view_init (DownloaderView *dv) static void downloader_view_finalize (GObject *object) { - DownloaderView *dv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_DOWNLOADER_VIEW (object)); - - dv = DOWNLOADER_VIEW (object); - - g_return_if_fail (dv->priv != NULL); + DownloaderView *dv = EPHY_DOWNLOADER_VIEW (object); g_hash_table_destroy (dv->priv->details_hash); g_object_unref (embed_shell); - g_free (dv->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } DownloaderView * downloader_view_new (void) { - return DOWNLOADER_VIEW (g_object_new - (DOWNLOADER_VIEW_TYPE, NULL)); + return EPHY_DOWNLOADER_VIEW (g_object_new + (EPHY_TYPE_DOWNLOADER_VIEW, NULL)); } static void @@ -562,7 +556,7 @@ ensure_selected_row (DownloaderView *dv) GtkTreeIter iter; GtkTreeSelection *selection; - g_return_if_fail (IS_DOWNLOADER_VIEW(dv)); + g_return_if_fail (EPHY_IS_DOWNLOADER_VIEW(dv)); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(dv->priv->treeview)); diff --git a/embed/downloader-view.h b/embed/downloader-view.h index 2b0b182a3..007b6727b 100644 --- a/embed/downloader-view.h +++ b/embed/downloader-view.h @@ -24,19 +24,17 @@ #include <glib-object.h> #include <glib.h> -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS + +#define EPHY_TYPE_DOWNLOADER_VIEW (downloader_view_get_type ()) +#define EPHY_DOWNLOADER_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_DOWNLOADER_VIEW, DownloaderView)) +#define EPHY_DOWNLOADER_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_DOWNLOADER_VIEW, DownloaderViewClass)) +#define EPHY_IS_DOWNLOADER_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_DOWNLOADER_VIEW)) +#define EPHY_IS_DOWNLOADER_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_DOWNLOADER_VIEW)) +#define EPHY_DOWNLOADER_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_DOWNLOADER_VIEW, DownloaderViewClass)) typedef struct DownloaderView DownloaderView; typedef struct DownloaderViewClass DownloaderViewClass; - -#define DOWNLOADER_VIEW_TYPE (downloader_view_get_type ()) -#define DOWNLOADER_VIEW(obj) (GTK_CHECK_CAST ((obj), DOWNLOADER_VIEW_TYPE, DownloaderView)) -#define DOWNLOADER_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), DOWNLOADER_VIEW, DownloaderViewClass)) -#define IS_DOWNLOADER_VIEW(obj) (GTK_CHECK_TYPE ((obj), DOWNLOADER_VIEW_TYPE)) -#define IS_DOWNLOADER_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), DOWNLOADER_VIEW)) - typedef struct DownloaderViewPrivate DownloaderViewPrivate; typedef enum @@ -88,8 +86,6 @@ void downloader_view_set_download_progress (DownloaderView *dv, gfloat progress, gpointer persist_object); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif diff --git a/embed/ephy-embed-dialog.c b/embed/ephy-embed-dialog.c index 552ec0106..38fc1abe8 100644 --- a/embed/ephy-embed-dialog.c +++ b/embed/ephy-embed-dialog.c @@ -41,6 +41,8 @@ enum PROP_EPHY_EMBED }; +#define EPHY_EMBED_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EMBED_DIALOG, EphyEmbedDialogPrivate)) + struct EphyEmbedDialogPrivate { EphyEmbed *embed; @@ -68,7 +70,7 @@ ephy_embed_dialog_get_type (void) (GInstanceInitFunc) ephy_embed_dialog_init }; - ephy_embed_dialog_type = g_type_register_static (EPHY_DIALOG_TYPE, + ephy_embed_dialog_type = g_type_register_static (EPHY_TYPE_DIALOG, "EphyEmbedDialog", &our_info, 0); } @@ -94,12 +96,14 @@ ephy_embed_dialog_class_init (EphyEmbedDialogClass *klass) "The dialog's embed", G_TYPE_OBJECT, G_PARAM_READWRITE)); + + g_type_class_add_private (object_class, sizeof(EphyEmbedDialogPrivate)); } static void ephy_embed_dialog_init (EphyEmbedDialog *dialog) { - dialog->priv = g_new0 (EphyEmbedDialogPrivate, 1); + dialog->priv = EPHY_EMBED_DIALOG_GET_PRIVATE (dialog); dialog->priv->embed = NULL; } @@ -117,19 +121,10 @@ unset_embed (EphyEmbedDialog *dialog) static void ephy_embed_dialog_finalize (GObject *object) { - EphyEmbedDialog *dialog; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_EPHY_EMBED_DIALOG (object)); - - dialog = EPHY_EMBED_DIALOG (object); - - g_return_if_fail (dialog->priv != NULL); + EphyEmbedDialog *dialog = EPHY_EMBED_DIALOG (object); unset_embed (dialog); - g_free (dialog->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -168,7 +163,7 @@ ephy_embed_dialog_get_property (GObject *object, EphyEmbedDialog * ephy_embed_dialog_new (EphyEmbed *embed) { - return EPHY_EMBED_DIALOG (g_object_new (EPHY_EMBED_DIALOG_TYPE, + return EPHY_EMBED_DIALOG (g_object_new (EPHY_TYPE_EMBED_DIALOG, "embed", embed, NULL)); } @@ -178,7 +173,7 @@ ephy_embed_dialog_new_with_parent (GtkWidget *parent_window, EphyEmbed *embed) { return EPHY_EMBED_DIALOG (g_object_new - (EPHY_EMBED_DIALOG_TYPE, + (EPHY_TYPE_EMBED_DIALOG, "ParentWindow", parent_window, "embed", embed, NULL)); diff --git a/embed/ephy-embed-dialog.h b/embed/ephy-embed-dialog.h index e8b7d3a3e..743f0b7c2 100644 --- a/embed/ephy-embed-dialog.h +++ b/embed/ephy-embed-dialog.h @@ -28,15 +28,14 @@ G_BEGIN_DECLS -typedef struct EphyEmbedDialogClass EphyEmbedDialogClass; - -#define EPHY_EMBED_DIALOG_TYPE (ephy_embed_dialog_get_type ()) -#define EPHY_EMBED_DIALOG(obj) (GTK_CHECK_CAST ((obj), EPHY_EMBED_DIALOG_TYPE, EphyEmbedDialog)) -#define EPHY_EMBED_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_EMBED_DIALOG_TYPE, EphyEmbedDialogClass)) -#define IS_EPHY_EMBED_DIALOG(obj) (GTK_CHECK_TYPE ((obj), EPHY_EMBED_DIALOG_TYPE)) -#define IS_EPHY_EMBED_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_EMBED_DIALOG)) -#define EPHY_EMBED_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_EMBED_DIALOG_TYPE, EphyEmbedDialogClass)) +#define EPHY_TYPE_EMBED_DIALOG (ephy_embed_dialog_get_type ()) +#define EPHY_EMBED_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_EMBED_DIALOG, EphyEmbedDialog)) +#define EPHY_EMBED_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_EMBED_DIALOG, EphyEmbedDialogClass)) +#define EPHY_IS_EMBED_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_EMBED_DIALOG)) +#define EPHY_IS_EMBED_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED_DIALOG)) +#define EPHY_EMBED_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_EMBED_DIALOG, EphyEmbedDialogClass)) +typedef struct EphyEmbedDialogClass EphyEmbedDialogClass; typedef struct EphyEmbedDialog EphyEmbedDialog; typedef struct EphyEmbedDialogPrivate EphyEmbedDialogPrivate; diff --git a/embed/ephy-embed-event.c b/embed/ephy-embed-event.c index 396410453..027164114 100644 --- a/embed/ephy-embed-event.c +++ b/embed/ephy-embed-event.c @@ -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 "ephy-embed-event.h" @@ -21,6 +23,8 @@ #include <glib/ghash.h> #include <gtk/gtktypeutils.h> +#define EPHY_EMBED_EVENT_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EMBED_EVENT, EphyEmbedEventPrivate)) + struct EphyEmbedEventPrivate { GHashTable *props; @@ -71,6 +75,8 @@ ephy_embed_event_class_init (EphyEmbedEventClass *klass) parent_class = g_type_class_peek_parent (klass); object_class->finalize = ephy_embed_event_finalize; + + g_type_class_add_private (object_class, sizeof(EphyEmbedEventPrivate)); } static void @@ -83,7 +89,7 @@ free_g_value (gpointer value) static void ephy_embed_event_init (EphyEmbedEvent *event) { - event->priv = g_new0 (EphyEmbedEventPrivate, 1); + event->priv = EPHY_EMBED_EVENT_GET_PRIVATE (event); event->priv->props = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, free_g_value); @@ -92,19 +98,10 @@ ephy_embed_event_init (EphyEmbedEvent *event) static void ephy_embed_event_finalize (GObject *object) { - EphyEmbedEvent *event; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_EPHY_EMBED_EVENT (object)); - - event = EPHY_EMBED_EVENT (object); - - g_return_if_fail (event->priv != NULL); + EphyEmbedEvent *event = EPHY_EMBED_EVENT (object); g_hash_table_destroy (event->priv->props); - g_free (event->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -114,9 +111,7 @@ ephy_embed_event_new (void) { EphyEmbedEvent *event; - event = EPHY_EMBED_EVENT (g_object_new (EPHY_EMBED_EVENT_TYPE, NULL)); - - g_return_val_if_fail (event->priv != NULL, NULL); + event = EPHY_EMBED_EVENT (g_object_new (EPHY_TYPE_EMBED_EVENT, NULL)); return event; } diff --git a/embed/ephy-embed-event.h b/embed/ephy-embed-event.h index 40eb15c55..6b994d7f1 100644 --- a/embed/ephy-embed-event.h +++ b/embed/ephy-embed-event.h @@ -26,15 +26,14 @@ G_BEGIN_DECLS -typedef struct EphyEmbedEventClass EphyEmbedEventClass; - -#define EPHY_EMBED_EVENT_TYPE (ephy_embed_event_get_type ()) -#define EPHY_EMBED_EVENT(obj) (GTK_CHECK_CAST ((obj), EPHY_EMBED_EVENT_TYPE, EphyEmbedEvent)) -#define EPHY_EMBED_EVENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_PERSIST_SHELL, EphyEmbedEventClass)) -#define IS_EPHY_EMBED_EVENT(obj) (GTK_CHECK_TYPE ((obj), EPHY_EMBED_EVENT_TYPE)) -#define IS_EPHY_EMBED_EVENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_EMBED_EVENT)) -#define EPHY_EMBED_EVENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_EMBED_SHELL_TYPE, EphyEmbedEventClass)) +#define EPHY_TYPE_EMBED_EVENT (ephy_embed_event_get_type ()) +#define EPHY_EMBED_EVENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_EMBED_EVENT, EphyEmbedEvent)) +#define EPHY_EMBED_EVENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_EMBED_EVENT, EphyEmbedEventClass)) +#define EPHY_IS_EMBED_EVENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_EMBED_EVENT)) +#define EPHY_IS_EMBED_EVENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED_EVENT)) +#define EPHY_EMBED_EVENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_EMBED_EVENT, EphyEmbedEventClass)) +typedef struct EphyEmbedEventClass EphyEmbedEventClass; typedef struct EphyEmbedEvent EphyEmbedEvent; typedef struct EphyEmbedEventPrivate EphyEmbedEventPrivate; diff --git a/embed/ephy-embed-persist.c b/embed/ephy-embed-persist.c index cd6e3e20e..54581e52b 100644 --- a/embed/ephy-embed-persist.c +++ b/embed/ephy-embed-persist.c @@ -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 <config.h> @@ -40,6 +42,8 @@ enum PROP_HANDLER }; +#define EPHY_EMBED_PERSIST_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EMBED_PERSIST, EphyEmbedPersistPrivate)) + struct EphyEmbedPersistPrivate { char *dir; @@ -196,6 +200,8 @@ ephy_embed_persist_class_init (EphyEmbedPersistClass *klass) "Handler", "Handler", G_PARAM_READWRITE)); + + g_type_class_add_private (object_class, sizeof(EphyEmbedPersistPrivate)); } static void @@ -275,7 +281,8 @@ ephy_embed_persist_get_property (GObject *object, static void ephy_embed_persist_init (EphyEmbedPersist *persist) { - persist->priv = g_new0 (EphyEmbedPersistPrivate, 1); + persist->priv = EPHY_EMBED_PERSIST_GET_PRIVATE (persist); + persist->priv->src = NULL; persist->priv->dir = NULL; persist->priv->handler = NULL; @@ -286,14 +293,7 @@ ephy_embed_persist_init (EphyEmbedPersist *persist) static void ephy_embed_persist_finalize (GObject *object) { - EphyEmbedPersist *persist; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_EPHY_EMBED_PERSIST (object)); - - persist = EPHY_EMBED_PERSIST (object); - - g_return_if_fail (persist->priv != NULL); + EphyEmbedPersist *persist = EPHY_EMBED_PERSIST (object); g_free (persist->priv->dir); g_free (persist->priv->src); @@ -304,8 +304,6 @@ ephy_embed_persist_finalize (GObject *object) g_free (persist->priv->handler); } - g_free (persist->priv); - LOG ("Embed persist finalize") G_OBJECT_CLASS (parent_class)->finalize (object); @@ -316,19 +314,12 @@ EphyEmbedPersist * ephy_embed_persist_new (EphyEmbed *embed) { EphyEmbedPersist *persist; - GType type = 0; - - type = MOZILLA_EMBED_PERSIST_TYPE; - g_assert (type != 0); - - persist = EPHY_EMBED_PERSIST (g_object_new (type, + persist = EPHY_EMBED_PERSIST (g_object_new (MOZILLA_TYPE_EMBED_PERSIST, "embed", embed, NULL)); - g_return_val_if_fail (persist->priv != NULL, NULL); - - return persist; + return persist; } gresult diff --git a/embed/ephy-embed-persist.h b/embed/ephy-embed-persist.h index 144927003..e8c7753b7 100644 --- a/embed/ephy-embed-persist.h +++ b/embed/ephy-embed-persist.h @@ -26,15 +26,14 @@ G_BEGIN_DECLS -typedef struct EphyEmbedPersistClass EphyEmbedPersistClass; - -#define EPHY_EMBED_PERSIST_TYPE (ephy_embed_persist_get_type ()) -#define EPHY_EMBED_PERSIST(obj) (GTK_CHECK_CAST ((obj), EPHY_EMBED_PERSIST_TYPE, EphyEmbedPersist)) -#define EPHY_EMBED_PERSIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_EMBED_PERSIST_TYPE, EphyEmbedPersistClass)) -#define IS_EPHY_EMBED_PERSIST(obj) (GTK_CHECK_TYPE ((obj), EPHY_EMBED_PERSIST_TYPE)) -#define IS_EPHY_EMBED_PERSIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_EMBED_PERSIST)) -#define EPHY_EMBED_PERSIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_EMBED_PERSIST_TYPE, EphyEmbedPersistClass)) +#define EPHY_TYPE_EMBED_PERSIST (ephy_embed_persist_get_type ()) +#define EPHY_EMBED_PERSIST(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_EMBED_PERSIST, EphyEmbedPersist)) +#define EPHY_EMBED_PERSIST_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_EMBED_PERSIST, EphyEmbedPersistClass)) +#define EPHY_IS_EMBED_PERSIST(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_EMBED_PERSIST)) +#define EPHY_IS_EMBED_PERSIST_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED_PERSIST)) +#define EPHY_EMBED_PERSIST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_EMBED_PERSIST, EphyEmbedPersistClass)) +typedef struct EphyEmbedPersistClass EphyEmbedPersistClass; typedef struct EphyEmbedPersist EphyEmbedPersist; typedef struct EphyEmbedPersistPrivate EphyEmbedPersistPrivate; diff --git a/embed/ephy-embed-popup-control.c b/embed/ephy-embed-popup-control.c index 05c6cc91b..9c6dd87b5 100644 --- a/embed/ephy-embed-popup-control.c +++ b/embed/ephy-embed-popup-control.c @@ -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 "ephy-embed-popup-control.h" @@ -37,6 +39,8 @@ typedef enum EMBED_POPUP_ELEMENT } EmbedPopupType; +#define EPHY_EMBED_POPUP_CONTROL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EMBED_POPUP_CONTROL, EphyEmbedPopupControlPrivate)) + struct EphyEmbedPopupControlPrivate { EphyEmbedEvent *event; @@ -243,12 +247,15 @@ ephy_embed_popup_control_class_init (EphyEmbedPopupControlClass *klass) "Bonobo control", BONOBO_TYPE_CONTROL, G_PARAM_READWRITE)); + + g_type_class_add_private (object_class, sizeof(EphyEmbedPopupControlPrivate)); } static void ephy_embed_popup_control_init (EphyEmbedPopupControl *gep) { - gep->priv = g_new0 (EphyEmbedPopupControlPrivate, 1); + gep->priv = EPHY_EMBED_POPUP_CONTROL_GET_PRIVATE (gep); + gep->priv->control = NULL; gep->priv->embed = NULL; gep->priv->event = NULL; @@ -258,14 +265,7 @@ ephy_embed_popup_control_init (EphyEmbedPopupControl *gep) static void ephy_embed_popup_control_finalize (GObject *object) { - EphyEmbedPopupControl *gep; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_EPHY_EMBED_POPUP_CONTROL (object)); - - gep = EPHY_EMBED_POPUP_CONTROL (object); - - g_return_if_fail (gep->priv != NULL); + EphyEmbedPopupControl *gep = EPHY_EMBED_POPUP_CONTROL (object); if (gep->priv->event) { @@ -274,8 +274,6 @@ ephy_embed_popup_control_finalize (GObject *object) g_free (gep->priv->selection); - g_free (gep->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -291,11 +289,9 @@ ephy_embed_popup_control_new (BonoboControl *control) { EphyEmbedPopupControl *p; - p = EPHY_EMBED_POPUP_CONTROL (g_object_new (EPHY_EMBED_POPUP_CONTROL_TYPE, - "BonoboControl", control, - NULL)); - - g_return_val_if_fail (p->priv != NULL, NULL); + p = EPHY_EMBED_POPUP_CONTROL (g_object_new (EPHY_TYPE_EMBED_POPUP_CONTROL, + "BonoboControl", control, + NULL)); return p; } @@ -434,7 +430,7 @@ ephy_embed_popup_control_connect_verbs (EphyEmbedPopupControl *p, EphyEmbedEvent * ephy_embed_popup_control_get_event (EphyEmbedPopupControl *p) { - g_return_val_if_fail (IS_EPHY_EMBED_POPUP_CONTROL (p), NULL); + g_return_val_if_fail (EPHY_IS_EMBED_POPUP_CONTROL (p), NULL); return p->priv->event; } diff --git a/embed/ephy-embed-popup-control.h b/embed/ephy-embed-popup-control.h index 075e62a9b..686368672 100644 --- a/embed/ephy-embed-popup-control.h +++ b/embed/ephy-embed-popup-control.h @@ -26,21 +26,14 @@ G_BEGIN_DECLS -typedef struct EphyEmbedPopupControlClass EphyEmbedPopupControlClass; - -#define EPHY_EMBED_POPUP_CONTROL_TYPE (ephy_embed_popup_control_get_type ()) -#define EPHY_EMBED_POPUP_CONTROL(obj) (GTK_CHECK_CAST ((obj), EPHY_EMBED_POPUP_CONTROL_TYPE, \ - EphyEmbedPopupControl)) -#define EPHY_EMBED_POPUP_CONTROL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \ - EPHY_EMBED_POPUP_CONTROL_TYPE,\ - EphyEmbedPopupControlClass)) -#define IS_EPHY_EMBED_POPUP_CONTROL(obj) (GTK_CHECK_TYPE ((obj), EPHY_EMBED_POPUP_CONTROL_TYPE)) -#define IS_EPHY_EMBED_POPUP_CONTROL_CLASS(klass)(GTK_CHECK_CLASS_TYPE ((klass), \ - EPHY_EMBED_POPUP_CONTROL)) -#define EPHY_EMBED_POPUP_CONTROL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - EPHY_EMBED_POPUP_CONTROL_TYPE, \ - EphyEmbedPopupControlClass)) +#define EPHY_TYPE_EMBED_POPUP_CONTROL (ephy_embed_popup_control_get_type ()) +#define EPHY_EMBED_POPUP_CONTROL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_EMBED_POPUP_CONTROL, EphyEmbedPopupControl)) +#define EPHY_EMBED_POPUP_CONTROL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_EMBED_POPUP_CONTROL, EphyEmbedPopupControlClass)) +#define EPHY_IS_EMBED_POPUP_CONTROL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_EMBED_POPUP_CONTROL)) +#define EPHY_IS_EMBED_POPUP_CONTROL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED_POPUP_CONTROL)) +#define EPHY_EMBED_POPUP_CONTROL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_EMBED_POPUP_CONTROL, EphyEmbedPopupControlClass)) +typedef struct EphyEmbedPopupControlClass EphyEmbedPopupControlClass; typedef struct EphyEmbedPopupControl EphyEmbedPopupControl; typedef struct EphyEmbedPopupControlPrivate EphyEmbedPopupControlPrivate; diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c index f772cccf5..39e320e0c 100644 --- a/embed/ephy-embed-shell.c +++ b/embed/ephy-embed-shell.c @@ -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 <config.h> @@ -27,6 +29,8 @@ #include <string.h> +#define EPHY_EMBED_SHELL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EMBED_SHELL, EphyEmbedShellPrivate)) + struct EphyEmbedShellPrivate { EphyHistory *global_history; @@ -87,8 +91,11 @@ ephy_embed_shell_class_init (EphyEmbedShellClass *klass) parent_class = (GObjectClass *) g_type_class_peek_parent (klass); object_class->finalize = ephy_embed_shell_finalize; + klass->get_downloader_view = impl_get_downloader_view; klass->get_global_history = impl_get_global_history; + + g_type_class_add_private (object_class, sizeof(EphyEmbedShellPrivate)); } static void @@ -97,7 +104,7 @@ ephy_embed_shell_init (EphyEmbedShell *ges) /* Singleton, globally accessible */ embed_shell = ges; - ges->priv = g_new0 (EphyEmbedShellPrivate, 1); + ges->priv = EPHY_EMBED_SHELL_GET_PRIVATE (ges); ges->priv->global_history = NULL; ges->priv->downloader_view = NULL; @@ -107,14 +114,7 @@ ephy_embed_shell_init (EphyEmbedShell *ges) static void ephy_embed_shell_finalize (GObject *object) { - EphyEmbedShell *ges; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_EPHY_EMBED_SHELL (object)); - - ges = EPHY_EMBED_SHELL (object); - - g_return_if_fail (ges->priv != NULL); + EphyEmbedShell *ges = EPHY_EMBED_SHELL (object); LOG ("Unref history") if (ges->priv->global_history) @@ -143,8 +143,6 @@ ephy_embed_shell_finalize (GObject *object) g_object_unref (G_OBJECT (ges->priv->embed_single)); } - g_free (ges->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -154,7 +152,7 @@ ephy_embed_shell_new (const char *type) if (strcmp (type, "mozilla") == 0) { return EPHY_EMBED_SHELL (g_object_new - (EPHY_EMBED_SHELL_TYPE, NULL)); + (EPHY_TYPE_EMBED_SHELL, NULL)); } g_assert_not_reached (); diff --git a/embed/ephy-embed-shell.h b/embed/ephy-embed-shell.h index 30d365d09..ec0b26215 100644 --- a/embed/ephy-embed-shell.h +++ b/embed/ephy-embed-shell.h @@ -28,16 +28,15 @@ G_BEGIN_DECLS -typedef struct EphyEmbedShellClass EphyEmbedShellClass; - -#define EPHY_EMBED_SHELL_TYPE (ephy_embed_shell_get_type ()) -#define EPHY_EMBED_SHELL_IMPL (ephy_embed_shell_get_impl ()) -#define EPHY_EMBED_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_EMBED_SHELL_TYPE, EphyEmbedShell)) -#define EPHY_EMBED_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_EMBED_SHELL_TYPE, EphyEmbedShellClass)) -#define IS_EPHY_EMBED_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_EMBED_SHELL_TYPE)) -#define IS_EPHY_EMBED_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EPHY_EMBED_SHELL_TYPE)) -#define EPHY_EMBED_SHELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_EMBED_SHELL_TYPE, EphyEmbedShellClass)) +#define EPHY_TYPE_EMBED_SHELL (ephy_embed_shell_get_type ()) +#define EPHY_EMBED_SHELL_IMPL (ephy_embed_shell_get_impl ()) +#define EPHY_EMBED_SHELL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_EMBED_SHELL, EphyEmbedShell)) +#define EPHY_EMBED_SHELL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_EMBED_SHELL, EphyEmbedShellClass)) +#define EPHY_IS_EMBED_SHELL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_EMBED_SHELL)) +#define EPHY_IS_EMBED_SHELL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED_SHELL)) +#define EPHY_EMBED_SHELL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_EMBED_SHELL, EphyEmbedShellClass)) +typedef struct EphyEmbedShellClass EphyEmbedShellClass; typedef struct EphyEmbedShell EphyEmbedShell; typedef struct EphyEmbedShellPrivate EphyEmbedShellPrivate; diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c index 66f6da6ee..fe42ba07b 100644 --- a/embed/ephy-embed-single.c +++ b/embed/ephy-embed-single.c @@ -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 <config.h> @@ -33,11 +35,13 @@ enum LAST_SIGNAL }; + +#define EPHY_EMBED_SINGLE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EMBED_SINGLE, EphyEmbedSinglePrivate)) + struct EphyEmbedSinglePrivate { EphyHistory *global_history; DownloaderView *downloader_view; - GList *embeds; EphyFaviconCache *favicon_cache; }; @@ -45,10 +49,9 @@ static void ephy_embed_single_class_init (EphyEmbedSingleClass *klass); static void ephy_embed_single_init (EphyEmbedSingle *ges); -static void -ephy_embed_single_finalize (GObject *object); static GObjectClass *parent_class = NULL; + static guint ephy_embed_single_signals[LAST_SIGNAL] = { 0 }; GType @@ -86,8 +89,6 @@ ephy_embed_single_class_init (EphyEmbedSingleClass *klass) parent_class = (GObjectClass *) g_type_class_peek_parent (klass); - object_class->finalize = ephy_embed_single_finalize; - ephy_embed_single_signals[NEW_WINDOW] = g_signal_new ("new_window_orphan", G_OBJECT_CLASS_TYPE (object_class), @@ -99,37 +100,21 @@ ephy_embed_single_class_init (EphyEmbedSingleClass *klass) 2, G_TYPE_POINTER, G_TYPE_INT); + + g_type_class_add_private (object_class, sizeof(EphyEmbedSinglePrivate)); } static void ephy_embed_single_init (EphyEmbedSingle *ges) { - ges->priv = g_new0 (EphyEmbedSinglePrivate, 1); + ges->priv = EPHY_EMBED_SINGLE_GET_PRIVATE (ges); ges->priv->global_history = NULL; ges->priv->downloader_view = NULL; - ges->priv->embeds = NULL; ges->priv->favicon_cache = NULL; } -static void -ephy_embed_single_finalize (GObject *object) -{ - EphyEmbedSingle *ges; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_EPHY_EMBED_SINGLE (object)); - - ges = EPHY_EMBED_SINGLE (object); - - g_return_if_fail (ges->priv != NULL); - - g_free (ges->priv); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - gresult ephy_embed_single_clear_cache (EphyEmbedSingle *shell) { diff --git a/embed/ephy-embed-single.h b/embed/ephy-embed-single.h index ee5b0cf74..2ca30f41b 100644 --- a/embed/ephy-embed-single.h +++ b/embed/ephy-embed-single.h @@ -28,15 +28,14 @@ G_BEGIN_DECLS -typedef struct EphyEmbedSingleClass EphyEmbedSingleClass; - -#define EPHY_EMBED_SINGLE_TYPE (ephy_embed_single_get_type ()) -#define EPHY_EMBED_SINGLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_EMBED_SINGLE_TYPE, EphyEmbedSingle)) -#define EPHY_EMBED_SINGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_EMBED_SINGLE_TYPE, EphyEmbedSingleClass)) -#define IS_EPHY_EMBED_SINGLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_EMBED_SINGLE_TYPE)) -#define IS_EPHY_EMBED_SINGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EPHY_EMBED_SINGLE_TYPE)) -#define EPHY_EMBED_SINGLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_EMBED_SINGLE_TYPE, EphyEmbedSingleClass)) +#define EPHY_TYPE_EMBED_SINGLE (ephy_embed_single_get_type ()) +#define EPHY_EMBED_SINGLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_EMBED_SINGLE, EphyEmbedSingle)) +#define EPHY_EMBED_SINGLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_EMBED_SINGLE, EphyEmbedSingleClass)) +#define EPHY_IS_EMBED_SINGLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_EMBED_SINGLE)) +#define EPHY_IS_EMBED_SINGLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED_SINGLE)) +#define EPHY_EMBED_SINGLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_EMBED_SINGLE, EphyEmbedSingleClass)) +typedef struct EphyEmbedSingleClass EphyEmbedSingleClass; typedef struct EphyEmbedSingle EphyEmbedSingle; typedef struct EphyEmbedSinglePrivate EphyEmbedSinglePrivate; diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c index bddab9191..ecb3dff7c 100644 --- a/embed/ephy-embed-utils.c +++ b/embed/ephy-embed-utils.c @@ -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 @@ -209,7 +211,7 @@ ephy_embed_utils_build_encodings_submenu (BonoboUIComponent *ui_component, EphyEmbedSingle *single; single = ephy_embed_shell_get_embed_single (EPHY_EMBED_SHELL (embed_shell)); - g_return_if_fail (IS_EPHY_EMBED_SHELL (embed_shell)); + g_return_if_fail (EPHY_IS_EMBED_SHELL (embed_shell)); START_PROFILER ("Encodings menu") diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index 48e9cdcf3..9b3b31289 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -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 @@ -90,7 +92,7 @@ ephy_embed_base_init (gpointer g_class) { ephy_embed_signals[NEW_WINDOW] = g_signal_new ("ge_new_window", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (EphyEmbedClass, new_window), NULL, NULL, @@ -101,7 +103,7 @@ ephy_embed_base_init (gpointer g_class) G_TYPE_INT); ephy_embed_signals[LINK_MESSAGE] = g_signal_new ("ge_link_message", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (EphyEmbedClass, link_message), NULL, NULL, @@ -111,7 +113,7 @@ ephy_embed_base_init (gpointer g_class) G_TYPE_STRING); ephy_embed_signals[CONTEXT_MENU] = g_signal_new ("ge_context_menu", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (EphyEmbedClass, context_menu), NULL, NULL, @@ -121,7 +123,7 @@ ephy_embed_base_init (gpointer g_class) G_TYPE_OBJECT); ephy_embed_signals[FAVICON] = g_signal_new ("ge_favicon", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (EphyEmbedClass, favicon), NULL, NULL, @@ -131,7 +133,7 @@ ephy_embed_base_init (gpointer g_class) G_TYPE_STRING); ephy_embed_signals[JS_STATUS] = g_signal_new ("ge_js_status", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (EphyEmbedClass, js_status), NULL, NULL, @@ -141,7 +143,7 @@ ephy_embed_base_init (gpointer g_class) G_TYPE_STRING); ephy_embed_signals[LOCATION] = g_signal_new ("ge_location", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (EphyEmbedClass, location), NULL, NULL, @@ -151,7 +153,7 @@ ephy_embed_base_init (gpointer g_class) G_TYPE_STRING); ephy_embed_signals[TITLE] = g_signal_new ("ge_title", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (EphyEmbedClass, title), NULL, NULL, @@ -160,7 +162,7 @@ ephy_embed_base_init (gpointer g_class) 0); ephy_embed_signals[PROGRESS] = g_signal_new ("ge_progress", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (EphyEmbedClass, progress), NULL, NULL, @@ -172,7 +174,7 @@ ephy_embed_base_init (gpointer g_class) G_TYPE_INT); ephy_embed_signals[NET_STATE] = g_signal_new ("ge_net_state", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (EphyEmbedClass, net_state), NULL, NULL, @@ -183,7 +185,7 @@ ephy_embed_base_init (gpointer g_class) G_TYPE_INT); ephy_embed_signals[VISIBILITY] = g_signal_new ("ge_visibility", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (EphyEmbedClass, visibility), NULL, NULL, @@ -193,7 +195,7 @@ ephy_embed_base_init (gpointer g_class) G_TYPE_BOOLEAN); ephy_embed_signals[DESTROY_BRSR] = g_signal_new ("ge_destroy_brsr", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (EphyEmbedClass, destroy_brsr), NULL, NULL, @@ -202,7 +204,7 @@ ephy_embed_base_init (gpointer g_class) 0); ephy_embed_signals[OPEN_URI] = g_signal_new ("ge_open_uri", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (EphyEmbedClass, open_uri), NULL, NULL, @@ -212,7 +214,7 @@ ephy_embed_base_init (gpointer g_class) G_TYPE_STRING); ephy_embed_signals[SIZE_TO] = g_signal_new ("ge_size_to", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (EphyEmbedClass, size_to), NULL, NULL, @@ -223,7 +225,7 @@ ephy_embed_base_init (gpointer g_class) G_TYPE_INT); ephy_embed_signals[DOM_MOUSE_CLICK] = g_signal_new ("ge_dom_mouse_click", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (EphyEmbedClass, dom_mouse_click), NULL, NULL, @@ -233,7 +235,7 @@ ephy_embed_base_init (gpointer g_class) G_TYPE_POINTER); ephy_embed_signals[DOM_MOUSE_DOWN] = g_signal_new ("ge_dom_mouse_down", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (EphyEmbedClass, dom_mouse_down), NULL, NULL, @@ -243,7 +245,7 @@ ephy_embed_base_init (gpointer g_class) G_TYPE_POINTER); ephy_embed_signals[SECURITY_CHANGE] = g_signal_new ("ge_security_change", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (EphyEmbedClass, security_change), NULL, NULL, @@ -253,7 +255,7 @@ ephy_embed_base_init (gpointer g_class) G_TYPE_INT); ephy_embed_signals[ZOOM_CHANGE] = g_signal_new ("ge_zoom_change", - EPHY_EMBED_TYPE, + EPHY_TYPE_EMBED, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (EphyEmbedClass, zoom_change), NULL, NULL, @@ -268,10 +270,10 @@ ephy_embed_base_init (gpointer g_class) EphyEmbed * ephy_embed_new (GObject *single) { - if (IS_MOZILLA_EMBED_SINGLE (single)) + if (MOZILLA_IS_EMBED_SINGLE (single)) { return EPHY_EMBED (g_object_new - (MOZILLA_EMBED_TYPE, NULL)); + (MOZILLA_TYPE_EMBED, NULL)); } g_assert_not_reached (); diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h index 24006c039..07daea595 100644 --- a/embed/ephy-embed.h +++ b/embed/ephy-embed.h @@ -28,15 +28,14 @@ G_BEGIN_DECLS -typedef struct EphyEmbedClass EphyEmbedClass; - -#define EPHY_EMBED_TYPE (ephy_embed_get_type ()) -#define EPHY_EMBED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_EMBED_TYPE, EphyEmbed)) -#define EPHY_EMBED_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), EPHY_EMBED_TYPE, EphyEmbedClass)) -#define IS_EPHY_EMBED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_EMBED_TYPE)) -#define IS_EPHY_EMBED_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), EPHY_EMBED_TYPE)) -#define EPHY_EMBED_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EPHY_EMBED_TYPE, EphyEmbedClass)) +#define EPHY_TYPE_EMBED (ephy_embed_get_type ()) +#define EPHY_EMBED(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_EMBED, EphyEmbed)) +#define EPHY_EMBED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_EMBED, EphyEmbedClass)) +#define EPHY_IS_EMBED(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_EMBED)) +#define EPHY_IS_EMBED_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED)) +#define EPHY_EMBED_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EPHY_TYPE_EMBED, EphyEmbedClass)) +typedef struct EphyEmbedClass EphyEmbedClass; typedef struct _EphyEmbed EphyEmbed; typedef enum diff --git a/embed/ephy-favicon-cache.c b/embed/ephy-favicon-cache.c index d5b7374b3..3c4bc6654 100644 --- a/embed/ephy-favicon-cache.c +++ b/embed/ephy-favicon-cache.c @@ -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 <libxml/tree.h> @@ -37,6 +39,8 @@ static void ephy_favicon_cache_class_init (EphyFaviconCacheClass *klass); static void ephy_favicon_cache_init (EphyFaviconCache *ma); static void ephy_favicon_cache_finalize (GObject *object); +#define EPHY_FAVICON_CACHE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_FAVICON_CACHE, EphyFaviconCachePrivate)) + struct EphyFaviconCachePrivate { char *directory; @@ -105,6 +109,8 @@ ephy_favicon_cache_class_init (EphyFaviconCacheClass *klass) G_TYPE_NONE, 1, G_TYPE_STRING); + + g_type_class_add_private (object_class, sizeof(EphyFaviconCachePrivate)); } EphyFaviconCache * @@ -114,8 +120,6 @@ ephy_favicon_cache_new (void) cache = EPHY_FAVICON_CACHE (g_object_new (EPHY_TYPE_FAVICON_CACHE, NULL)); - g_return_val_if_fail (cache->priv != NULL, NULL); - return cache; } @@ -258,7 +262,7 @@ ephy_favicon_cache_init (EphyFaviconCache *cache) { EphyNodeDb *db; - cache->priv = g_new0 (EphyFaviconCachePrivate, 1); + cache->priv = EPHY_FAVICON_CACHE_GET_PRIVATE (cache); db = ephy_node_db_new (EPHY_NODE_DB_SITEICONS); cache->priv->db = db; @@ -335,17 +339,10 @@ cleanup_downloads_hash (EphyFaviconCache *cache) static void ephy_favicon_cache_finalize (GObject *object) { - EphyFaviconCache *cache; + EphyFaviconCache *cache = EPHY_FAVICON_CACHE (object); LOG ("Finalize favicon cache") - g_return_if_fail (object != NULL); - g_return_if_fail (EPHY_IS_FAVICON_CACHE (object)); - - cache = EPHY_FAVICON_CACHE (object); - - g_return_if_fail (cache->priv != NULL); - cleanup_downloads_hash (cache); remove_obsolete_icons (cache); ephy_favicon_cache_save (cache); @@ -359,8 +356,6 @@ ephy_favicon_cache_finalize (GObject *object) g_object_unref (cache->priv->db); - g_free (cache->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/embed/ephy-favicon-cache.h b/embed/ephy-favicon-cache.h index 4e182cf2c..c9174ae28 100644 --- a/embed/ephy-favicon-cache.h +++ b/embed/ephy-favicon-cache.h @@ -25,11 +25,11 @@ G_BEGIN_DECLS #define EPHY_TYPE_FAVICON_CACHE (ephy_favicon_cache_get_type ()) -#define EPHY_FAVICON_CACHE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_FAVICON_CACHE, EphyFaviconCache)) -#define EPHY_FAVICON_CACHE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EPHY_TYPE_FAVICON_CACHE, EphyFaviconCacheClass)) -#define EPHY_IS_FAVICON_CACHE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_FAVICON_CACHE)) -#define EPHY_IS_FAVICON_CACHE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_FAVICON_CACHE)) -#define EPHY_FAVICON_CACHE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_FAVICON_CACHE, EphyFaviconCacheClass)) +#define EPHY_FAVICON_CACHE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_FAVICON_CACHE, EphyFaviconCache)) +#define EPHY_FAVICON_CACHE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EPHY_TYPE_FAVICON_CACHE, EphyFaviconCacheClass)) +#define EPHY_IS_FAVICON_CACHE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_FAVICON_CACHE)) +#define EPHY_IS_FAVICON_CACHE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_FAVICON_CACHE)) +#define EPHY_FAVICON_CACHE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_FAVICON_CACHE, EphyFaviconCacheClass)) typedef struct EphyFaviconCachePrivate EphyFaviconCachePrivate; diff --git a/embed/ephy-history.c b/embed/ephy-history.c index 18092876f..3a00a9c98 100644 --- a/embed/ephy-history.c +++ b/embed/ephy-history.c @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * */ #ifdef HAVE_CONFIG_H @@ -42,6 +41,8 @@ #define HISTORY_PAGE_OBSOLETE_DAYS 10 +#define EPHY_HISTORY_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_HISTORY, EphyHistoryPrivate)) + struct EphyHistoryPrivate { char *xml_file; @@ -197,6 +198,8 @@ ephy_history_class_init (EphyHistoryClass *klass) G_TYPE_NONE, 1, G_TYPE_STRING); + + g_type_class_add_private (object_class, sizeof(EphyHistoryPrivate)); } static void @@ -415,7 +418,7 @@ ephy_history_init (EphyHistory *eb) GValue value = { 0, }; EphyNodeDb *db; - eb->priv = g_new0 (EphyHistoryPrivate, 1); + eb->priv = EPHY_HISTORY_GET_PRIVATE (eb); db = ephy_node_db_new (EPHY_NODE_DB_HISTORY); eb->priv->db = db; @@ -492,13 +495,7 @@ ephy_history_init (EphyHistory *eb) static void ephy_history_finalize (GObject *object) { - EphyHistory *eb; - - g_return_if_fail (IS_EPHY_HISTORY (object)); - - eb = EPHY_HISTORY (object); - - g_return_if_fail (eb->priv != NULL); + EphyHistory *eb = EPHY_HISTORY (object); ephy_history_save (eb); @@ -514,8 +511,6 @@ ephy_history_finalize (GObject *object) g_source_remove (eb->priv->autosave_timeout); - g_free (eb->priv); - LOG ("Global history finalized"); G_OBJECT_CLASS (parent_class)->finalize (object); @@ -524,11 +519,11 @@ ephy_history_finalize (GObject *object) EphyHistory * ephy_history_new () { - EphyHistory *tab; + EphyHistory *eh; - tab = EPHY_HISTORY (g_object_new (EPHY_HISTORY_TYPE, NULL)); + eh = EPHY_HISTORY (g_object_new (EPHY_TYPE_HISTORY, NULL)); - return tab; + return eh; } static void diff --git a/embed/ephy-history.h b/embed/ephy-history.h index 5d89ce708..80565aba7 100644 --- a/embed/ephy-history.h +++ b/embed/ephy-history.h @@ -25,14 +25,14 @@ G_BEGIN_DECLS -typedef struct EphyHistoryClass EphyHistoryClass; - -#define EPHY_HISTORY_TYPE (ephy_history_get_type ()) -#define EPHY_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_HISTORY_TYPE, EphyHistory)) -#define EPHY_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_HISTORY_TYPE, EphyHistoryClass)) -#define IS_EPHY_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_HISTORY_TYPE)) -#define IS_EPHY_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EPHY_HISTORY_TYPE)) +#define EPHY_TYPE_HISTORY (ephy_history_get_type ()) +#define EPHY_HISTORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_HISTORY, EphyHistory)) +#define EPHY_HISTORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_HISTORY, EphyHistoryClass)) +#define EPHY_IS_HISTORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_HISTORY)) +#define EPHY_IS_HISTORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_HISTORY)) +#define EPHY_HISTORY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_HISTORY, EphyHistoryClass)) +typedef struct EphyHistoryClass EphyHistoryClass; typedef struct EphyHistory EphyHistory; typedef struct EphyHistoryPrivate EphyHistoryPrivate; diff --git a/embed/find-dialog.c b/embed/find-dialog.c index 20b77b42e..d280f35e1 100755 --- a/embed/find-dialog.c +++ b/embed/find-dialog.c @@ -42,6 +42,8 @@ void find_check_toggled_cb (GtkWidget *toggle, EphyDialog *dialog); static GObjectClass *parent_class = NULL; +#define EPHY_FIND_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_FIND_DIALOG, FindDialogPrivate)) + struct FindDialogPrivate { EphyEmbed *old_embed; @@ -89,7 +91,7 @@ find_dialog_get_type (void) (GInstanceInitFunc) find_dialog_init }; - find_dialog_type = g_type_register_static (EPHY_EMBED_DIALOG_TYPE, + find_dialog_type = g_type_register_static (EPHY_TYPE_EMBED_DIALOG, "FindDialog", &our_info, 0); } @@ -135,6 +137,8 @@ find_dialog_class_init (FindDialogClass *klass) object_class->finalize = find_dialog_finalize; ephy_dialog_class->show = impl_show; + + g_type_class_add_private (object_class, sizeof (FindDialogPrivate)); } static void @@ -183,7 +187,7 @@ set_properties (FindDialog *find_dialog) static void sync_page_change (EphyEmbed *embed, const char *address, FindDialog *dialog) { - g_return_if_fail (IS_EPHY_EMBED (embed)); + g_return_if_fail (EPHY_IS_EMBED (embed)); update_navigation_controls (dialog, TRUE, TRUE); set_properties (dialog); @@ -212,7 +216,7 @@ sync_embed (FindDialog *dialog, GParamSpec *pspec, gpointer data) unset_old_embed (dialog); embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG (dialog)); - g_return_if_fail (IS_EPHY_EMBED (embed)); + g_return_if_fail (EPHY_IS_EMBED (embed)); dialog->priv->old_embed = embed; g_signal_connect (G_OBJECT (embed), "ge_location", @@ -231,7 +235,7 @@ find_dialog_init (FindDialog *dialog) GdkPixbuf *icon; GtkWidget *window; - dialog->priv = g_new0 (FindDialogPrivate, 1); + dialog->priv = EPHY_FIND_DIALOG_GET_PRIVATE (dialog); dialog->priv->old_embed = NULL; @@ -258,19 +262,14 @@ find_dialog_finalize (GObject *object) { FindDialog *dialog; - g_return_if_fail (object != NULL); - g_return_if_fail (IS_FIND_DIALOG (object)); + g_return_if_fail (EPHY_IS_FIND_DIALOG (object)); - dialog = FIND_DIALOG (object); + dialog = EPHY_FIND_DIALOG (object); g_signal_handlers_disconnect_by_func (dialog, G_CALLBACK (sync_embed), NULL); - g_return_if_fail (dialog->priv != NULL); - unset_old_embed (dialog); - g_free (dialog->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -279,9 +278,9 @@ find_dialog_new (EphyEmbed *embed) { FindDialog *dialog; - dialog = FIND_DIALOG (g_object_new (FIND_DIALOG_TYPE, - "embed", embed, - NULL)); + dialog = EPHY_FIND_DIALOG (g_object_new (EPHY_TYPE_FIND_DIALOG, + "embed", embed, + NULL)); return EPHY_DIALOG(dialog); } @@ -292,10 +291,10 @@ find_dialog_new_with_parent (GtkWidget *window, { FindDialog *dialog; - dialog = FIND_DIALOG (g_object_new (FIND_DIALOG_TYPE, - "embed", embed, - "ParentWindow", window, - NULL)); + dialog = EPHY_FIND_DIALOG (g_object_new (EPHY_TYPE_FIND_DIALOG, + "embed", embed, + "ParentWindow", window, + NULL)); return EPHY_DIALOG(dialog); } @@ -306,7 +305,7 @@ find_dialog_go_next (FindDialog *dialog) gresult result; EphyEmbed *embed; - g_return_if_fail (IS_FIND_DIALOG (dialog)); + g_return_if_fail (EPHY_IS_FIND_DIALOG (dialog)); embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG(dialog)); g_return_if_fail (embed != NULL); @@ -329,7 +328,7 @@ find_dialog_go_prev (FindDialog *dialog) gresult result; EphyEmbed *embed; - g_return_if_fail (IS_FIND_DIALOG (dialog)); + g_return_if_fail (EPHY_IS_FIND_DIALOG (dialog)); embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG(dialog)); g_return_if_fail (embed != NULL); @@ -356,21 +355,21 @@ find_close_button_clicked_cb (GtkWidget *button, void find_next_button_clicked_cb (GtkWidget *button, EphyDialog *dialog) { - find_dialog_go_next (FIND_DIALOG(dialog)); + find_dialog_go_next (EPHY_FIND_DIALOG(dialog)); } void find_prev_button_clicked_cb (GtkWidget *button, EphyDialog *dialog) { - find_dialog_go_prev (FIND_DIALOG(dialog)); + find_dialog_go_prev (EPHY_FIND_DIALOG(dialog)); } void find_entry_changed_cb (GtkWidget *editable, EphyDialog *dialog) { - FindDialog *find_dialog = FIND_DIALOG(dialog); + FindDialog *find_dialog = EPHY_FIND_DIALOG(dialog); update_navigation_controls (find_dialog, TRUE, TRUE); set_properties (find_dialog); @@ -380,7 +379,7 @@ void find_check_toggled_cb (GtkWidget *toggle, EphyDialog *dialog) { - FindDialog *find_dialog = FIND_DIALOG(dialog); + FindDialog *find_dialog = EPHY_FIND_DIALOG(dialog); update_navigation_controls (find_dialog, TRUE, TRUE); set_properties (find_dialog); diff --git a/embed/find-dialog.h b/embed/find-dialog.h index b4c106f92..27a59a97e 100644 --- a/embed/find-dialog.h +++ b/embed/find-dialog.h @@ -23,15 +23,15 @@ G_BEGIN_DECLS -typedef struct FindDialog FindDialog; -typedef struct FindDialogClass FindDialogClass; - -#define FIND_DIALOG_TYPE (find_dialog_get_type ()) -#define FIND_DIALOG(obj) (GTK_CHECK_CAST ((obj), FIND_DIALOG_TYPE, FindDialog)) -#define FIND_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), FIND_DIALOG, FindDialogClass)) -#define IS_FIND_DIALOG(obj) (GTK_CHECK_TYPE ((obj), FIND_DIALOG_TYPE)) -#define IS_FIND_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), FIND_DIALOG)) +#define EPHY_TYPE_FIND_DIALOG (find_dialog_get_type ()) +#define EPHY_FIND_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_FIND_DIALOG, FindDialog)) +#define EPHY_FIND_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_FIND_DIALOG, FindDialogClass)) +#define EPHY_IS_FIND_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_FIND_DIALOG)) +#define EPHY_IS_FIND_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_FIND_DIALOG)) +#define EPHY_FIND_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_FIND_DIALOG, FindDialogClass)) +typedef struct FindDialogClass FindDialogClass; +typedef struct FindDialog FindDialog; typedef struct FindDialogPrivate FindDialogPrivate; struct FindDialog 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; diff --git a/embed/print-dialog.c b/embed/print-dialog.c index 9ece4cba5..1e20c9048 100755 --- a/embed/print-dialog.c +++ b/embed/print-dialog.c @@ -42,7 +42,6 @@ static void print_dialog_class_init (PrintDialogClass *klass); static void print_dialog_init (PrintDialog *dialog); -static void print_dialog_finalize (GObject *object); /* Glade callbacks */ void @@ -57,9 +56,10 @@ print_preview_button_cb (GtkWidget *widget, static GObjectClass *parent_class = NULL; +#define EPHY_PRINT_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_PRINT_DIALOG, PrintDialogPrivate)) + struct PrintDialogPrivate { - gpointer dummy; GtkWidget *window; }; @@ -145,7 +145,7 @@ print_dialog_get_type (void) (GInstanceInitFunc) print_dialog_init }; - print_dialog_type = g_type_register_static (EPHY_EMBED_DIALOG_TYPE, + print_dialog_type = g_type_register_static (EPHY_TYPE_EMBED_DIALOG, "PrintDialog", &our_info, 0); } @@ -161,8 +161,6 @@ print_dialog_class_init (PrintDialogClass *klass) parent_class = g_type_class_peek_parent (klass); - object_class->finalize = print_dialog_finalize; - print_dialog_signals[PREVIEW] = g_signal_new ("preview", G_OBJECT_CLASS_TYPE (object_class), @@ -172,16 +170,17 @@ print_dialog_class_init (PrintDialogClass *klass) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + + g_type_class_add_private (object_class, sizeof(PrintDialogPrivate)); } static void print_dialog_init (PrintDialog *dialog) { GdkPixbuf *icon; - dialog->priv = g_new0 (PrintDialogPrivate, 1); + dialog->priv = EPHY_PRINT_DIALOG_GET_PRIVATE (dialog); dialog->only_collect_info = FALSE; - dialog->ret_info = NULL; ephy_dialog_construct (EPHY_DIALOG(dialog), @@ -201,32 +200,15 @@ print_dialog_init (PrintDialog *dialog) g_object_unref (icon); } -static void -print_dialog_finalize (GObject *object) -{ - PrintDialog *dialog; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_PRINT_DIALOG (object)); - - dialog = PRINT_DIALOG (object); - - g_return_if_fail (dialog->priv != NULL); - - g_free (dialog->priv); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - EphyDialog * print_dialog_new (EphyEmbed *embed, EmbedPrintInfo **ret_info) { PrintDialog *dialog; - dialog = PRINT_DIALOG (g_object_new (PRINT_DIALOG_TYPE, - "embed", embed, - NULL)); + dialog = EPHY_PRINT_DIALOG (g_object_new (EPHY_TYPE_PRINT_DIALOG, + "embed", embed, + NULL)); if (!embed) dialog->only_collect_info = TRUE; dialog->ret_info = ret_info; @@ -241,10 +223,10 @@ print_dialog_new_with_parent (GtkWidget *window, { PrintDialog *dialog; - dialog = PRINT_DIALOG (g_object_new (PRINT_DIALOG_TYPE, - "embed", embed, - "ParentWindow", window, - NULL)); + dialog = EPHY_PRINT_DIALOG (g_object_new (EPHY_TYPE_PRINT_DIALOG, + "embed", embed, + "ParentWindow", window, + NULL)); if (!embed) dialog->only_collect_info = TRUE; dialog->ret_info = ret_info; @@ -379,9 +361,9 @@ print_dialog_print (EphyDialog *dialog) info = print_get_info (dialog); - if(PRINT_DIALOG(dialog)->only_collect_info && PRINT_DIALOG(dialog)->ret_info) + if(EPHY_PRINT_DIALOG(dialog)->only_collect_info && EPHY_PRINT_DIALOG(dialog)->ret_info) { - *(PRINT_DIALOG(dialog)->ret_info) = info; + *(EPHY_PRINT_DIALOG(dialog)->ret_info) = info; } else { @@ -405,9 +387,9 @@ print_dialog_preview (EphyDialog *dialog) info = print_get_info (dialog); - if(PRINT_DIALOG(dialog)->only_collect_info && PRINT_DIALOG(dialog)->ret_info) + if(EPHY_PRINT_DIALOG(dialog)->only_collect_info && EPHY_PRINT_DIALOG(dialog)->ret_info) { - *(PRINT_DIALOG(dialog)->ret_info) = info; + *(EPHY_PRINT_DIALOG(dialog)->ret_info) = info; } else { @@ -443,7 +425,7 @@ print_preview_button_cb (GtkWidget *widget, EphyDialog *dialog) { //FIXME: Don't show preview button at all. - if(!(PRINT_DIALOG(dialog)->only_collect_info)) + if(!(EPHY_PRINT_DIALOG(dialog)->only_collect_info)) print_dialog_preview (dialog); } diff --git a/embed/print-dialog.h b/embed/print-dialog.h index 5342f0223..c7b9a5b2e 100644 --- a/embed/print-dialog.h +++ b/embed/print-dialog.h @@ -27,15 +27,15 @@ G_BEGIN_DECLS +#define EPHY_TYPE_PRINT_DIALOG (print_dialog_get_type ()) +#define EPHY_PRINT_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_PRINT_DIALOG, PrintDialog)) +#define EPHY_PRINT_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_PRINT_DIALOG, PrintDialogClass)) +#define EPHY_IS_PRINT_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_PRINT_DIALOG)) +#define EPHY_IS_PRINT_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_PRINT_DIALOG)) +#define EPHY_PRINT_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_PRINT_DIALOG, PrintDialogClass)) + typedef struct PrintDialog PrintDialog; typedef struct PrintDialogClass PrintDialogClass; - -#define PRINT_DIALOG_TYPE (print_dialog_get_type ()) -#define PRINT_DIALOG(obj) (GTK_CHECK_CAST ((obj), PRINT_DIALOG_TYPE, PrintDialog)) -#define PRINT_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), PRINT_DIALOG, PrintDialogClass)) -#define IS_PRINT_DIALOG(obj) (GTK_CHECK_TYPE ((obj), PRINT_DIALOG_TYPE)) -#define IS_PRINT_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), PRINT_DIALOG)) - typedef struct PrintDialogPrivate PrintDialogPrivate; struct PrintDialog |