diff options
100 files changed, 1195 insertions, 1190 deletions
@@ -1,5 +1,247 @@ 2003-09-02 Christian Persch <chpe@cvs.gnome.org> + * embed/downloader-view.c: (downloader_view_get_type), + (downloader_view_class_init), (downloader_view_init), + (downloader_view_finalize), (downloader_view_new), + (ensure_selected_row): + * embed/downloader-view.h: + * embed/ephy-embed-dialog.c: (ephy_embed_dialog_get_type), + (ephy_embed_dialog_class_init), (ephy_embed_dialog_init), + (ephy_embed_dialog_finalize), (ephy_embed_dialog_new), + (ephy_embed_dialog_new_with_parent): + * embed/ephy-embed-dialog.h: + * embed/ephy-embed-event.c: (ephy_embed_event_class_init), + (ephy_embed_event_init), (ephy_embed_event_finalize), + (ephy_embed_event_new): + * embed/ephy-embed-event.h: + * embed/ephy-embed-persist.c: (ephy_embed_persist_class_init), + (ephy_embed_persist_init), (ephy_embed_persist_finalize), + (ephy_embed_persist_new): + * embed/ephy-embed-persist.h: + * embed/ephy-embed-popup-control.c: + (ephy_embed_popup_control_class_init), + (ephy_embed_popup_control_init), + (ephy_embed_popup_control_finalize), + (ephy_embed_popup_control_new), + (ephy_embed_popup_control_get_event): + * embed/ephy-embed-popup-control.h: + * embed/ephy-embed-shell.c: (ephy_embed_shell_class_init), + (ephy_embed_shell_init), (ephy_embed_shell_finalize), + (ephy_embed_shell_new): + * embed/ephy-embed-shell.h: + * embed/ephy-embed-single.c: (ephy_embed_single_class_init), + (ephy_embed_single_init): + * embed/ephy-embed-single.h: + * embed/ephy-embed-utils.c: + (ephy_embed_utils_build_encodings_submenu): + * embed/ephy-embed.c: (ephy_embed_base_init), (ephy_embed_new): + * embed/ephy-embed.h: + * embed/ephy-favicon-cache.c: (ephy_favicon_cache_class_init), + (ephy_favicon_cache_new), (ephy_favicon_cache_init), + (ephy_favicon_cache_finalize): + * embed/ephy-favicon-cache.h: + * embed/ephy-history.c: (ephy_history_class_init), + (ephy_history_init), (ephy_history_finalize), (ephy_history_new): + * embed/ephy-history.h: + * embed/find-dialog.c: (find_dialog_get_type), + (find_dialog_class_init), (sync_page_change), (sync_embed), + (find_dialog_init), (find_dialog_finalize), (find_dialog_new), + (find_dialog_new_with_parent), (find_dialog_go_next), + (find_dialog_go_prev), (find_next_button_clicked_cb), + (find_prev_button_clicked_cb), (find_entry_changed_cb), + (find_check_toggled_cb): + * embed/find-dialog.h: + * embed/mozilla/ProgressListener.cpp: + * embed/mozilla/mozilla-embed-persist.cpp: + * embed/mozilla/mozilla-embed-persist.h: + * embed/mozilla/mozilla-embed-single.cpp: + * embed/mozilla/mozilla-embed-single.h: + * embed/mozilla/mozilla-embed.cpp: + * embed/mozilla/mozilla-embed.h: + * embed/print-dialog.c: (print_dialog_get_type), + (print_dialog_class_init), (print_dialog_init), (print_dialog_new), + (print_dialog_new_with_parent), (print_dialog_print), + (print_dialog_preview), (print_preview_button_cb): + * embed/print-dialog.h: + * lib/ephy-autocompletion.c: (ephy_autocompletion_class_init), + (ephy_autocompletion_init), (ephy_autocompletion_finalize_impl): + * lib/ephy-dialog.c: (ephy_dialog_class_init), (ephy_dialog_init), + (ephy_dialog_finalize), (ephy_dialog_new), + (ephy_dialog_new_with_parent): + * lib/ephy-dialog.h: + * lib/ephy-node-db.c: (ephy_node_db_class_init), + (ephy_node_db_init), (ephy_node_db_finalize): + * lib/ephy-node-filter.c: (ephy_node_filter_class_init), + (ephy_node_filter_init), (ephy_node_filter_finalize): + * lib/widgets/ephy-arrow-toolbutton.c: + (ephy_arrow_toolbutton_set_tooltip), + (ephy_arrow_toolbutton_class_init), (ephy_arrow_toolbutton_init), + (ephy_arrow_toolbutton_finalize): + * lib/widgets/ephy-arrow-toolbutton.h: + * lib/widgets/ephy-autocompletion-window.c: + (ephy_autocompletion_window_class_init), + (ephy_autocompletion_window_init), + (ephy_autocompletion_window_finalize_impl): + * lib/widgets/ephy-location-entry.c: + (ephy_location_entry_class_init), (ephy_location_entry_init), + (ephy_location_entry_finalize_impl): + * lib/widgets/ephy-node-view.c: (ephy_node_view_class_init), + (ephy_node_view_finalize), (ephy_node_view_init): + * lib/widgets/ephy-search-entry.c: (ephy_search_entry_class_init), + (ephy_search_entry_init): + * lib/widgets/ephy-spinner.c: (ephy_spinner_new), + (ephy_spinner_init), (ephy_spinner_expose), + (ephy_spinner_finalize), (ephy_spinner_class_init): + * lib/widgets/ephy-spinner.h: + * lib/widgets/ephy-tree-model-node.c: + (ephy_tree_model_node_class_init), (ephy_tree_model_node_init), + (ephy_tree_model_node_finalize): + * lib/widgets/ephy-tree-model-sort.c: + (ephy_tree_model_sort_class_init), (ephy_tree_model_sort_init), + (ephy_tree_model_sort_finalize): + * lib/widgets/ephy-zoom-action.c: (ephy_zoom_action_class_init), + (ephy_zoom_action_init): + * lib/widgets/ephy-zoom-control.c: (ephy_zoom_control_init), + (ephy_zoom_control_class_init), (ephy_zoom_control_finalize): + * src/bookmarks/ephy-bookmark-action.c: + (ephy_bookmark_action_finalize), (ephy_bookmark_action_class_init), + (ephy_bookmark_action_init), (ephy_bookmark_action_new): + * src/bookmarks/ephy-bookmark-properties.c: + (ephy_bookmark_properties_class_init), + (ephy_bookmark_properties_init): + * src/bookmarks/ephy-bookmarks-editor.c: + (ephy_bookmarks_editor_class_init), + (ephy_bookmarks_editor_finalize), (ephy_bookmarks_editor_init): + * src/bookmarks/ephy-bookmarks-editor.h: + * src/bookmarks/ephy-bookmarks-menu.c: + (ephy_bookmarks_menu_class_init), (ephy_bookmarks_menu_init), + (ephy_bookmarks_menu_finalize): + * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_class_init), + (update_favorites_menus), (ephy_bookmarks_init), + (ephy_bookmarks_finalize), (ephy_bookmarks_new), + (ephy_bookmarks_find_bookmark): + * src/bookmarks/ephy-bookmarks.h: + * src/bookmarks/ephy-new-bookmark.c: + (ephy_new_bookmark_class_init), (ephy_new_bookmark_finalize), + (ephy_new_bookmark_init): + * src/bookmarks/ephy-topic-action.c: + (ephy_topic_action_class_init), (ephy_topic_action_init): + * src/bookmarks/ephy-topics-selector.c: + (ephy_topics_selector_class_init), (ephy_topics_selector_init), + (ephy_topics_selector_new): + * src/bookmarks/ephy-topics-selector.h: + * src/ephy-automation.c: (ephy_automation_factory), + (impl_ephy_automation_loadurl), (impl_ephy_automation_quit), + (impl_ephy_automation_load_session): + * src/ephy-automation.h: + * src/ephy-encoding-menu.c: (ephy_encoding_menu_class_init), + (ephy_encoding_menu_init), (ephy_encoding_menu_finalize_impl): + * src/ephy-favicon-action.c: (ephy_favicon_action_class_init), + (ephy_favicon_action_init), (ephy_favicon_action_finalize): + * src/ephy-favorites-menu.c: (ephy_favorites_menu_class_init), + (ephy_favorites_menu_init), (ephy_favorites_menu_finalize): + * src/ephy-history-window.c: (confirmation_dialog_response_cb), + (ephy_history_window_class_init), (ephy_history_window_finalize), + (ephy_history_window_init): + * src/ephy-location-action.h: + * src/ephy-nautilus-view.c: (ephy_nautilus_view_instance_init), + (ephy_nautilus_view_finalize), (ephy_nautilus_view_class_init): + * src/ephy-nautilus-view.h: + * src/ephy-navigation-action.c: + (ephy_navigation_action_class_init), (ephy_navigation_action_init): + * src/ephy-notebook.c: (ephy_notebook_class_init), + (ephy_notebook_new), (notebook_drag_data_received_cb), + (ephy_notebook_init), (ephy_notebook_finalize), + (ephy_notebook_insert_page), (ephy_notebook_remove_page): + * src/ephy-notebook.h: + * src/ephy-plugin.h: + * src/ephy-shell.c: (ephy_shell_get_type), (ephy_shell_class_init), + (ephy_shell_init), (ephy_shell_finalize), (ephy_shell_new), + (ephy_shell_get_active_window): + * src/ephy-shell.h: + * src/ephy-spinner-action.c: (ephy_spinner_action_class_init), + (ephy_spinner_action_init): + * src/ephy-tab.c: (ephy_tab_action_activate_cb), + (ephy_tab_class_init), (ephy_tab_finalize), (ephy_tab_new), + (ephy_tab_set_load_status), (ephy_tab_get_load_status), + (ephy_tab_set_link_message), (ephy_tab_get_link_message), + (ephy_tab_get_embed), (ephy_tab_set_window), (ephy_tab_get_window), + (ephy_tab_get_size), (ephy_tab_get_visibility), + (ephy_tab_set_visibility), (ephy_tab_set_icon_address), + (ephy_tab_get_icon_address), (ephy_tab_net_state_cb), + (ephy_tab_destroy_brsr_cb), (ephy_tab_dom_mouse_click_cb), + (ephy_tab_init), (ephy_tab_set_load_percent), + (ephy_tab_get_load_percent), (ephy_tab_get_navigation_flags), + (ephy_tab_get_status_message), (ephy_tab_set_title), + (ephy_tab_get_title), (ephy_tab_get_location), + (ephy_tab_set_location), (ephy_tab_set_security_level), + (ephy_tab_get_security_level), (ephy_tab_set_zoom), + (ephy_tab_get_zoom), (ephy_tab_get_action): + * src/ephy-tab.h: + * src/ephy-tabs-menu.c: (ephy_tabs_menu_class_init), + (ephy_tabs_menu_init), (ephy_tabs_menu_finalize_impl): + * src/ephy-tabs-menu.h: + * src/ephy-toolbars-model.c: (ephy_toolbars_model_class_init), + (ephy_toolbars_model_init), (ephy_toolbars_model_finalize), + (ephy_toolbars_model_new): + * src/ephy-toolbars-model.h: + * src/ephy-window.c: (remove_from_session), + (ephy_window_class_init), (sync_tab_load_progress), + (sync_tab_load_status), (sync_tab_message), (sync_tab_security), + (sync_tab_visibility), (tab_context_menu_cb), + (ephy_window_set_active_tab), (tab_added_cb), (tab_removed_cb), + (tab_detached_cb), (ephy_window_init), (ephy_window_finalize), + (ephy_window_new), (ephy_window_get_notebook), + (ephy_window_add_tab), (real_get_active_tab), + (ephy_window_remove_tab), (ephy_window_load_url), + (ephy_window_update_control), (ephy_window_get_active_tab), + (ephy_window_get_active_embed), (ephy_window_get_tabs), + (ephy_window_notebook_switch_page_cb), (ephy_window_set_zoom): + * src/ephy-window.h: + * src/language-editor.c: (language_editor_get_type), + (language_editor_class_init), (language_editor_init), + (language_editor_new): + * src/language-editor.h: + * src/pdm-dialog.c: (pdm_dialog_get_type), (pdm_dialog_class_init), + (pdm_dialog_init), (pdm_dialog_finalize), (pdm_dialog_new), + (pdm_dialog_response_cb): + * src/pdm-dialog.h: + * src/popup-commands.c: (popup_cmd_copy_link_address): + * src/ppview-toolbar.c: (ppview_toolbar_get_type), + (ppview_toolbar_class_init), (ppview_toolbar_set_property), + (ppview_toolbar_get_property), (ppview_toolbar_init), + (ppview_toolbar_finalize), (ppview_toolbar_new), + (toolbar_cmd_ppv_goto_first), (toolbar_cmd_ppv_go_back), + (toolbar_cmd_ppv_go_forward), (toolbar_cmd_ppv_close): + * src/ppview-toolbar.h: + * src/prefs-dialog.c: (prefs_dialog_get_type), (prefs_dialog_new), + (prefs_dialog_class_init), (prefs_dialog_finalize), + (autodetect_encoding_menu_changed_cb), (language_menu_changed_cb), + (prefs_dialog_init), (fonts_language_optionmenu_changed_cb), + (prefs_language_more_button_clicked_cb): + * src/prefs-dialog.h: + * src/session.c: (session_class_init), (session_init), + (session_dispose), (session_finalize), (session_new), + (session_get_windows): + * src/session.h: + * src/statusbar.c: (statusbar_class_init), (statusbar_init), + (statusbar_finalize), (statusbar_new): + * src/statusbar.h: + * src/toolbar.c: (toolbar_class_init), (toolbar_set_property), + (toolbar_get_property), (action_request_cb), + (location_user_changed_cb), (toolbar_init), (toolbar_finalize), + (toolbar_new): + * src/toolbar.h: + + Change object macros: Consistently name types EPHY_TYPE_X, + check macros EPHY_IS_X[_CLASS] instead of IS_EPHY_X[_CLASS], + and replace the obsolete GTK_CHECK_* macros with G_TYPE_CHECK_*. + + Use gobject instance private data, and remove unnecessary type checks + in class implementations. + +2003-09-02 Christian Persch <chpe@cvs.gnome.org> + * src/ppview-toolbar.c: Fix ui xml, make ppview toolbar work again. 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 diff --git a/lib/ephy-autocompletion.c b/lib/ephy-autocompletion.c index 17fc052b7..6c28eaf78 100644 --- a/lib/ephy-autocompletion.c +++ b/lib/ephy-autocompletion.c @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * */ #include <string.h> @@ -45,6 +44,8 @@ typedef struct { #define ACMA_BASE_SIZE 10240 +#define EPHY_AUTOCOMPLETION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_AUTOCOMPLETION, EphyAutocompletionPrivate)) + struct _EphyAutocompletionPrivate { GSList *sources; @@ -125,9 +126,12 @@ ephy_autocompletion_get_type (void) static void ephy_autocompletion_class_init (EphyAutocompletionClass *klass) { - G_OBJECT_CLASS (klass)->finalize = ephy_autocompletion_finalize_impl; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + g_object_class = g_type_class_peek_parent (klass); + object_class->finalize = ephy_autocompletion_finalize_impl; + EphyAutocompletionSignals[EPHY_AUTOCOMPLETION_SOURCES_CHANGED] = g_signal_new ( "sources-changed", G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST | G_SIGNAL_RUN_CLEANUP, @@ -135,12 +139,14 @@ ephy_autocompletion_class_init (EphyAutocompletionClass *klass) NULL, NULL, ephy_marshal_VOID__VOID, G_TYPE_NONE, 0); + + g_type_class_add_private (object_class, sizeof (EphyAutocompletionPrivate)); } static void ephy_autocompletion_init (EphyAutocompletion *ac) { - EphyAutocompletionPrivate *p = g_new0 (EphyAutocompletionPrivate, 1); + EphyAutocompletionPrivate *p = EPHY_AUTOCOMPLETION_GET_PRIVATE (ac); ac->priv = p; p->sources = NULL; acma_init (&p->matches); @@ -184,8 +190,6 @@ ephy_autocompletion_finalize_impl (GObject *o) g_strfreev (p->prefixes); g_free (p->prefix_lengths); - g_free (p); - G_OBJECT_CLASS (g_object_class)->finalize (o); } diff --git a/lib/ephy-dialog.c b/lib/ephy-dialog.c index 79b70c257..973aca87a 100644 --- a/lib/ephy-dialog.c +++ b/lib/ephy-dialog.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-dialog.h" @@ -94,6 +96,8 @@ typedef struct GList *string_enum; } PropertyInfo; +#define EPHY_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_DIALOG, EphyDialogPrivate)) + struct EphyDialogPrivate { GtkWidget *parent; @@ -188,6 +192,8 @@ ephy_dialog_class_init (EphyDialogClass *klass) "Modal dialog", FALSE, G_PARAM_READWRITE)); + + g_type_class_add_private (object_class, sizeof (EphyDialogPrivate)); } static void @@ -798,7 +804,7 @@ prefs_connect_signals (EphyDialog *dialog) static void ephy_dialog_init (EphyDialog *dialog) { - dialog->priv = g_new0 (EphyDialogPrivate, 1); + dialog->priv = EPHY_DIALOG_GET_PRIVATE (dialog); dialog->priv->parent = NULL; dialog->priv->dialog = NULL; @@ -939,20 +945,12 @@ free_props (PropertyInfo *properties) static void ephy_dialog_finalize (GObject *object) { - EphyDialog *dialog; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_EPHY_DIALOG (object)); - - dialog = EPHY_DIALOG (object); - - g_return_if_fail (dialog->priv != NULL); + EphyDialog *dialog = EPHY_DIALOG (object); free_props (dialog->priv->props); g_free (dialog->priv->name); g_free (dialog->priv->props); - g_free (dialog->priv); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -1011,13 +1009,13 @@ ephy_dialog_set_parent (EphyDialog *dialog, EphyDialog * ephy_dialog_new (void) { - return EPHY_DIALOG (g_object_new (EPHY_DIALOG_TYPE, NULL)); + return EPHY_DIALOG (g_object_new (EPHY_TYPE_DIALOG, NULL)); } EphyDialog * ephy_dialog_new_with_parent (GtkWidget *parent_window) { - return EPHY_DIALOG (g_object_new (EPHY_DIALOG_TYPE, + return EPHY_DIALOG (g_object_new (EPHY_TYPE_DIALOG, "ParentWindow", parent_window, NULL)); } diff --git a/lib/ephy-dialog.h b/lib/ephy-dialog.h index 646c146fc..572280dc7 100644 --- a/lib/ephy-dialog.h +++ b/lib/ephy-dialog.h @@ -25,15 +25,14 @@ G_BEGIN_DECLS -typedef struct EphyDialogClass EphyDialogClass; - -#define EPHY_DIALOG_TYPE (ephy_dialog_get_type ()) -#define EPHY_DIALOG(obj) (GTK_CHECK_CAST ((obj), EPHY_DIALOG_TYPE, EphyDialog)) -#define EPHY_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_DIALOG_TYPE, EphyDialogClass)) -#define IS_EPHY_DIALOG(obj) (GTK_CHECK_TYPE ((obj), EPHY_DIALOG_TYPE)) -#define IS_EPHY_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_DIALOG)) -#define EPHY_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_DIALOG_TYPE, EphyDialogClass)) +#define EPHY_TYPE_DIALOG (ephy_dialog_get_type ()) +#define EPHY_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_DIALOG, EphyDialog)) +#define EPHY_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_DIALOG, EphyDialogClass)) +#define EPHY_IS_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_DIALOG)) +#define EPHY_IS_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_DIALOG)) +#define EPHY_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_DIALOG, EphyDialogClass)) +typedef struct EphyDialogClass EphyDialogClass; typedef struct EphyDialog EphyDialog; typedef struct EphyDialogPrivate EphyDialogPrivate; diff --git a/lib/ephy-node-db.c b/lib/ephy-node-db.c index 86913d93c..c6d084bed 100644 --- a/lib/ephy-node-db.c +++ b/lib/ephy-node-db.c @@ -33,6 +33,8 @@ enum PROP_NAME }; +#define EPHY_NODE_DB_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NODE_DB, EphyNodeDbPrivate)) + struct EphyNodeDbPrivate { char *name; @@ -142,12 +144,14 @@ ephy_node_db_class_init (EphyNodeDbClass *klass) "Name", NULL, G_PARAM_READWRITE)); + + g_type_class_add_private (object_class, sizeof (EphyNodeDbPrivate)); } static void ephy_node_db_init (EphyNodeDb *db) { - db->priv = g_new0 (EphyNodeDbPrivate, 1); + db->priv = EPHY_NODE_DB_GET_PRIVATE (db); db->priv->name = NULL; @@ -165,13 +169,7 @@ ephy_node_db_init (EphyNodeDb *db) static void ephy_node_db_finalize (GObject *object) { - EphyNodeDb *db; - - g_return_if_fail (object != NULL); - - db = EPHY_NODE_DB (object); - - g_return_if_fail (db->priv != NULL); + EphyNodeDb *db = EPHY_NODE_DB (object); g_hash_table_remove (ephy_node_databases, db->priv->name); if (g_hash_table_size (ephy_node_databases) == 0) @@ -187,8 +185,6 @@ ephy_node_db_finalize (GObject *object) g_free (db->priv->name); - g_free (db->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/lib/ephy-node-filter.c b/lib/ephy-node-filter.c index 8f0bddbc0..93e2fb902 100644 --- a/lib/ephy-node-filter.c +++ b/lib/ephy-node-filter.c @@ -37,6 +37,8 @@ enum LAST_SIGNAL }; +#define EPHY_NODE_FILTER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NODE_FILTER, EphyNodeFilterPrivate)) + struct EphyNodeFilterPrivate { GPtrArray *levels; @@ -118,12 +120,14 @@ ephy_node_filter_class_init (EphyNodeFilterClass *klass) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + + g_type_class_add_private (object_class, sizeof (EphyNodeFilterPrivate)); } static void ephy_node_filter_init (EphyNodeFilter *filter) { - filter->priv = g_new0 (EphyNodeFilterPrivate, 1); + filter->priv = EPHY_NODE_FILTER_GET_PRIVATE (filter); filter->priv->levels = g_ptr_array_new (); } @@ -131,14 +135,7 @@ ephy_node_filter_init (EphyNodeFilter *filter) static void ephy_node_filter_finalize (GObject *object) { - EphyNodeFilter *filter; - - g_return_if_fail (object != NULL); - g_return_if_fail (EPHY_IS_NODE_FILTER (object)); - - filter = EPHY_NODE_FILTER (object); - - g_return_if_fail (filter->priv != NULL); + EphyNodeFilter *filter = EPHY_NODE_FILTER (object); ephy_node_filter_empty (filter); diff --git a/lib/widgets/ephy-arrow-toolbutton.c b/lib/widgets/ephy-arrow-toolbutton.c index e40237f5f..147c7d80b 100644 --- a/lib/widgets/ephy-arrow-toolbutton.c +++ b/lib/widgets/ephy-arrow-toolbutton.c @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * */ #include "ephy-arrow-toolbutton.h" @@ -30,6 +29,8 @@ #include <gtk/gtkmenu.h> #include <gtk/gtkmain.h> +#define EPHY_ARROW_TOOLBUTTON_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_ARROW_TOOLBUTTON, EphyArrowToolButtonPrivate)) + struct EphyArrowToolButtonPrivate { GtkWidget *arrow_widget; @@ -88,7 +89,7 @@ ephy_arrow_toolbutton_set_tooltip (GtkToolItem *tool_item, { EphyArrowToolButton *button = EPHY_ARROW_TOOLBUTTON (tool_item); - g_return_val_if_fail (IS_EPHY_ARROW_TOOLBUTTON (button), FALSE); + g_return_val_if_fail (EPHY_IS_ARROW_TOOLBUTTON (button), FALSE); gtk_tooltips_set_tip (tooltips, button->priv->button, tip_text, tip_private); @@ -115,6 +116,8 @@ ephy_arrow_toolbutton_class_init (EphyArrowToolButtonClass *klass) NULL, NULL, ephy_marshal_VOID__VOID, G_TYPE_NONE, 0); + + g_type_class_add_private (object_class, sizeof (EphyArrowToolButtonPrivate)); } static void @@ -202,7 +205,7 @@ ephy_arrow_toolbutton_init (EphyArrowToolButton *arrowtb) GtkWidget *arrow_button; GtkWidget *real_button; - arrowtb->priv = g_new (EphyArrowToolButtonPrivate, 1); + arrowtb->priv = EPHY_ARROW_TOOLBUTTON_GET_PRIVATE (arrowtb); gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (arrowtb), FALSE); @@ -256,8 +259,6 @@ ephy_arrow_toolbutton_finalize (GObject *object) gtk_widget_destroy (GTK_WIDGET (arrow_toolbutton->priv->menu)); - g_free (arrow_toolbutton->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/lib/widgets/ephy-arrow-toolbutton.h b/lib/widgets/ephy-arrow-toolbutton.h index f1452f585..2e2164592 100644 --- a/lib/widgets/ephy-arrow-toolbutton.h +++ b/lib/widgets/ephy-arrow-toolbutton.h @@ -25,14 +25,14 @@ G_BEGIN_DECLS -typedef struct EphyArrowToolButtonClass EphyArrowToolButtonClass; - -#define EPHY_ARROW_TOOLBUTTON_TYPE (ephy_arrow_toolbutton_get_type ()) -#define EPHY_ARROW_TOOLBUTTON(obj) (GTK_CHECK_CAST ((obj), EPHY_ARROW_TOOLBUTTON_TYPE, EphyArrowToolButton)) -#define EPHY_ARROW_TOOLBUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_ARROW_TOOLBUTTON_TYPE, EphyArrowToolButtonClass)) -#define IS_EPHY_ARROW_TOOLBUTTON(obj) (GTK_CHECK_TYPE ((obj), EPHY_ARROW_TOOLBUTTON_TYPE)) -#define IS_EPHY_ARROW_TOOLBUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_ARROW_TOOLBUTTON)) +#define EPHY_TYPE_ARROW_TOOLBUTTON (ephy_arrow_toolbutton_get_type ()) +#define EPHY_ARROW_TOOLBUTTON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_ARROW_TOOLBUTTON, EphyArrowToolButton)) +#define EPHY_ARROW_TOOLBUTTON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_ARROW_TOOLBUTTON, EphyArrowToolButtonClass)) +#define EPHY_IS_ARROW_TOOLBUTTON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_ARROW_TOOLBUTTON)) +#define EPHY_IS_ARROW_TOOLBUTTON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_ARROW_TOOLBUTTON)) +#define EPHY_ARROW_TOOLBUTTON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_ARROW_TOOLBUTTON, EphyArrowToolButtonClass)) +typedef struct EphyArrowToolButtonClass EphyArrowToolButtonClass; typedef struct EphyArrowToolButton EphyArrowToolButton; typedef struct EphyArrowToolButtonPrivate EphyArrowToolButtonPrivate; diff --git a/lib/widgets/ephy-autocompletion-window.c b/lib/widgets/ephy-autocompletion-window.c index 56cbb31ee..39bd9d77e 100644 --- a/lib/widgets/ephy-autocompletion-window.c +++ b/lib/widgets/ephy-autocompletion-window.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 <gtk/gtkcellrenderertext.h> @@ -46,6 +48,9 @@ /** * Private data */ + +#define EPHY_AUTOCOMPLETION_WINDOW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_AUTOCOMPLETION_WINDOW, EphyAutocompletionWindowPrivate)) + struct _EphyAutocompletionWindowPrivate { EphyAutocompletion *autocompletion; GtkWidget *parent; @@ -130,9 +135,12 @@ ephy_autocompletion_window_get_type (void) static void ephy_autocompletion_window_class_init (EphyAutocompletionWindowClass *klass) { - G_OBJECT_CLASS (klass)->finalize = ephy_autocompletion_window_finalize_impl; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + g_object_class = g_type_class_peek_parent (klass); + object_class->finalize = ephy_autocompletion_window_finalize_impl; + EphyAutocompletionWindowSignals[ACTIVATED] = g_signal_new ( "activated", G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST | G_SIGNAL_RUN_CLEANUP, @@ -162,12 +170,14 @@ ephy_autocompletion_window_class_init (EphyAutocompletionWindowClass *klass) NULL, NULL, ephy_marshal_VOID__VOID, G_TYPE_NONE, 0); + + g_type_class_add_private (object_class, sizeof (EphyAutocompletionWindowPrivate)); } static void ephy_autocompletion_window_init (EphyAutocompletionWindow *aw) { - EphyAutocompletionWindowPrivate *p = g_new0 (EphyAutocompletionWindowPrivate, 1); + EphyAutocompletionWindowPrivate *p = EPHY_AUTOCOMPLETION_WINDOW_GET_PRIVATE (aw); GtkTreeSelection *s; aw->priv = p; @@ -207,7 +217,6 @@ ephy_autocompletion_window_finalize_impl (GObject *o) } g_free (p->selected); - g_free (p); gdk_pointer_ungrab (GDK_CURRENT_TIME); gdk_keyboard_ungrab (GDK_CURRENT_TIME); diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c index 1d9d2172f..3c1c6ce52 100644 --- a/lib/widgets/ephy-location-entry.c +++ b/lib/widgets/ephy-location-entry.c @@ -15,6 +15,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-location-entry.h" @@ -37,6 +39,9 @@ /** * Private data */ + +#define EPHY_LOCATION_ENTRY_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_LOCATION_ENTRY, EphyLocationEntryPrivate)) + struct _EphyLocationEntryPrivate { GtkWidget *combo; GtkWidget *entry; @@ -198,6 +203,8 @@ ephy_location_entry_class_init (EphyLocationEntryClass *klass) G_TYPE_NONE, 0, G_TYPE_NONE); + + g_type_class_add_private (object_class, sizeof (EphyLocationEntryPrivate)); } static gboolean @@ -215,8 +222,9 @@ ephy_location_entry_init (EphyLocationEntry *w) LOG ("EphyLocationEntry initialising %p", w) - p = g_new0 (EphyLocationEntryPrivate, 1); + p = EPHY_LOCATION_ENTRY_GET_PRIVATE (w); w->priv = p; + p->last_action_target = NULL; p->before_completion = NULL; p->user_changed = TRUE; @@ -255,7 +263,6 @@ ephy_location_entry_finalize_impl (GObject *o) g_free (p->before_completion); g_free (p->autocompletion_key); - g_free (p); G_OBJECT_CLASS (parent_class)->finalize (o); } diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c index 9677d8384..9c40f8f06 100644 --- a/lib/widgets/ephy-node-view.c +++ b/lib/widgets/ephy-node-view.c @@ -46,6 +46,9 @@ static void ephy_node_view_get_property (GObject *object, GValue *value, GParamSpec *pspec); + +#define EPHY_NODE_VIEW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NODE_VIEW, EphyNodeViewPrivate)) + struct EphyNodeViewPrivate { EphyNode *root; @@ -197,19 +200,14 @@ ephy_node_view_class_init (EphyNodeViewClass *klass) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + + g_type_class_add_private (object_class, sizeof (EphyNodeViewPrivate)); } static void ephy_node_view_finalize (GObject *object) { - EphyNodeView *view; - - g_return_if_fail (object != NULL); - g_return_if_fail (EPHY_IS_NODE_VIEW (object)); - - view = EPHY_NODE_VIEW (object); - - g_return_if_fail (view->priv != NULL); + EphyNodeView *view = EPHY_NODE_VIEW (object); g_object_unref (G_OBJECT (view->priv->sortmodel)); g_object_unref (G_OBJECT (view->priv->filtermodel)); @@ -220,8 +218,6 @@ ephy_node_view_finalize (GObject *object) gtk_target_list_unref (view->priv->source_target_list); } - g_free (view->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -1304,7 +1300,8 @@ ephy_node_view_add_column (EphyNodeView *view, static void ephy_node_view_init (EphyNodeView *view) { - view->priv = g_new0 (EphyNodeViewPrivate, 1); + view->priv = EPHY_NODE_VIEW_GET_PRIVATE (view); + view->priv->editable_renderer = NULL; view->priv->editing = TRUE; view->priv->searchable_data_column = -1; diff --git a/lib/widgets/ephy-search-entry.c b/lib/widgets/ephy-search-entry.c index e1b106594..1e8a9e096 100644 --- a/lib/widgets/ephy-search-entry.c +++ b/lib/widgets/ephy-search-entry.c @@ -27,7 +27,8 @@ static void ephy_search_entry_class_init (EphySearchEntryClass *klass); static void ephy_search_entry_init (EphySearchEntry *entry); -static void ephy_search_entry_finalize (GObject *object); + +#define EPHY_SEARCH_ENTRY_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SEARCH_ENTRY, EphySearchEntryPrivate)) struct EphySearchEntryPrivate { @@ -81,8 +82,6 @@ ephy_search_entry_class_init (EphySearchEntryClass *klass) parent_class = g_type_class_peek_parent (klass); - object_class->finalize = ephy_search_entry_finalize; - ephy_search_entry_signals[SEARCH] = g_signal_new ("search", G_OBJECT_CLASS_TYPE (object_class), @@ -93,6 +92,8 @@ ephy_search_entry_class_init (EphySearchEntryClass *klass) G_TYPE_NONE, 1, G_TYPE_STRING); + + g_type_class_add_private (object_class, sizeof (EphySearchEntryPrivate)); } static gboolean @@ -139,7 +140,10 @@ ephy_search_entry_destroy_cb (GtkEditable *editable, static void ephy_search_entry_init (EphySearchEntry *entry) { - entry->priv = g_new0 (EphySearchEntryPrivate, 1); + entry->priv = EPHY_SEARCH_ENTRY_GET_PRIVATE (entry); + + entry->priv->clearing = FALSE; + entry->priv->timeout = 0; g_signal_connect (G_OBJECT (entry), "destroy", @@ -151,23 +155,6 @@ ephy_search_entry_init (EphySearchEntry *entry) entry); } -static void -ephy_search_entry_finalize (GObject *object) -{ - EphySearchEntry *entry; - - g_return_if_fail (object != NULL); - g_return_if_fail (EPHY_IS_SEARCH_ENTRY (object)); - - entry = EPHY_SEARCH_ENTRY (object); - - g_return_if_fail (entry->priv != NULL); - - g_free (entry->priv); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - GtkWidget * ephy_search_entry_new (void) { diff --git a/lib/widgets/ephy-spinner.c b/lib/widgets/ephy-spinner.c index abd38984e..09c0c8529 100644 --- a/lib/widgets/ephy-spinner.c +++ b/lib/widgets/ephy-spinner.c @@ -41,6 +41,8 @@ #define spinner_DEFAULT_TIMEOUT 100 /* Milliseconds Per Frame */ +#define EPHY_SPINNER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SPINNER, EphySpinnerDetails)) + struct EphySpinnerDetails { GList *image_list; GdkPixbuf *quiescent_pixbuf; @@ -108,7 +110,7 @@ ephy_spinner_new (void) { GtkWidget *s; - s = GTK_WIDGET (g_object_new (EPHY_SPINNER_TYPE, NULL)); + s = GTK_WIDGET (g_object_new (EPHY_TYPE_SPINNER, NULL)); return s; } @@ -173,7 +175,7 @@ ephy_spinner_init (EphySpinner *spinner) | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); - spinner->details = g_new0 (EphySpinnerDetails, 1); + spinner->details = EPHY_SPINNER_GET_PRIVATE (spinner); spinner->details->delay = spinner_DEFAULT_TIMEOUT; spinner->details->icon_theme = gnome_icon_theme_new (); @@ -231,7 +233,7 @@ ephy_spinner_expose (GtkWidget *widget, GdkEventExpose *event) int x_offset, y_offset, width, height; GdkRectangle pix_area, dest; - g_return_val_if_fail (IS_EPHY_SPINNER (widget), FALSE); + g_return_val_if_fail (EPHY_IS_SPINNER (widget), FALSE); spinner = EPHY_SPINNER (widget); @@ -506,30 +508,31 @@ ephy_spinner_size_request (GtkWidget *widget, GtkRequisition *requisition) static void ephy_spinner_finalize (GObject *object) { - EphySpinner *spinner; - - spinner = EPHY_SPINNER (object); + EphySpinner *spinner = EPHY_SPINNER (object); ephy_spinner_remove_update_callback (spinner); ephy_spinner_unload_images (spinner); g_object_unref (spinner->details->icon_theme); - g_free (spinner->details); - G_OBJECT_CLASS (parent_class)->finalize (object); } static void ephy_spinner_class_init (EphySpinnerClass *class) { + GObjectClass *object_class; GtkWidgetClass *widget_class; - parent_class = g_type_class_peek_parent (class); + object_class = G_OBJECT_CLASS (class); widget_class = GTK_WIDGET_CLASS (class); - G_OBJECT_CLASS (class)->finalize = ephy_spinner_finalize; + parent_class = g_type_class_peek_parent (class); + + object_class->finalize = ephy_spinner_finalize; widget_class->expose_event = ephy_spinner_expose; widget_class->size_request = ephy_spinner_size_request; + + g_type_class_add_private (object_class, sizeof (EphySpinnerDetails)); } diff --git a/lib/widgets/ephy-spinner.h b/lib/widgets/ephy-spinner.h index 3070d0473..c573488e6 100644 --- a/lib/widgets/ephy-spinner.h +++ b/lib/widgets/ephy-spinner.h @@ -32,13 +32,12 @@ G_BEGIN_DECLS -#define EPHY_SPINNER_TYPE (ephy_spinner_get_type ()) -#define EPHY_SPINNER(obj) (GTK_CHECK_CAST ((obj), EPHY_SPINNER_TYPE, EphySpinner)) -#define EPHY_SPINNER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_SPINNER_TYPE, EphySpinnerClass)) -#define IS_EPHY_SPINNER(obj) (GTK_CHECK_TYPE ((obj), EPHY_SPINNER_TYPE)) -#define IS_EPHY_SPINNER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_SPINNER_TYPE)) - -typedef struct EphySpinnerInfo EphySpinnerInfo; +#define EPHY_TYPE_SPINNER (ephy_spinner_get_type ()) +#define EPHY_SPINNER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_SPINNER, EphySpinner)) +#define EPHY_SPINNER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_SPINNER, EphySpinnerClass)) +#define EPHY_IS_SPINNER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_SPINNER)) +#define EPHY_IS_SPINNER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_SPINNER)) +#define EPHY_SPINNER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_SPINNER, EphySpinnerClass)) typedef struct EphySpinner EphySpinner; typedef struct EphySpinnerClass EphySpinnerClass; diff --git a/lib/widgets/ephy-tree-model-node.c b/lib/widgets/ephy-tree-model-node.c index 563853016..2f1acb5a1 100644 --- a/lib/widgets/ephy-tree-model-node.c +++ b/lib/widgets/ephy-tree-model-node.c @@ -85,6 +85,8 @@ static void root_destroy_cb (EphyNode *node, static inline GtkTreePath *get_path_real (EphyTreeModelNode *model, EphyNode *node); +#define EPHY_TREE_MODEL_NODE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TREE_MODEL_NODE, EphyTreeModelNodePrivate)) + struct EphyTreeModelNodePrivate { EphyNode *root; @@ -176,6 +178,8 @@ ephy_tree_model_node_class_init (EphyTreeModelNodeClass *klass) "Filter object", EPHY_TYPE_NODE_FILTER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_type_class_add_private (object_class, sizeof (EphyTreeModelNodePrivate)); } static void @@ -189,8 +193,9 @@ ephy_tree_model_node_init (EphyTreeModelNode *model) } while (model->stamp == 0); - model->priv = g_new0 (EphyTreeModelNodePrivate, 1); + model->priv = EPHY_TREE_MODEL_NODE_GET_PRIVATE (model); + /* FIXME: huh? */ dummy = gtk_tree_view_new (); gtk_widget_destroy (dummy); @@ -202,19 +207,10 @@ ephy_tree_model_node_init (EphyTreeModelNode *model) static void ephy_tree_model_node_finalize (GObject *object) { - EphyTreeModelNode *model; - - g_return_if_fail (object != NULL); - g_return_if_fail (EPHY_IS_TREE_MODEL_NODE (object)); - - model = EPHY_TREE_MODEL_NODE (object); - - g_return_if_fail (model->priv != NULL); + EphyTreeModelNode *model = EPHY_TREE_MODEL_NODE (object); g_ptr_array_free (model->priv->columns, TRUE); - g_free (model->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/lib/widgets/ephy-tree-model-sort.c b/lib/widgets/ephy-tree-model-sort.c index 14096989b..40c519aa2 100644 --- a/lib/widgets/ephy-tree-model-sort.c +++ b/lib/widgets/ephy-tree-model-sort.c @@ -41,6 +41,8 @@ static gboolean ephy_tree_model_sort_multi_drag_data_get (EggTreeMultiDragSource static gboolean ephy_tree_model_sort_multi_drag_data_delete (EggTreeMultiDragSource *drag_source, GList *path_list); +#define EPHY_TREE_MODEL_SORT_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TREE_MODEL_SORT, EphyTreeModelSortPrivate)) + struct EphyTreeModelSortPrivate { char *str_list; @@ -95,12 +97,14 @@ ephy_tree_model_sort_class_init (EphyTreeModelSortClass *klass) parent_class = g_type_class_peek_parent (klass); object_class->finalize = ephy_tree_model_sort_finalize; + + g_type_class_add_private (object_class, sizeof (EphyTreeModelSortPrivate)); } static void ephy_tree_model_sort_init (EphyTreeModelSort *ma) { - ma->priv = g_new0 (EphyTreeModelSortPrivate, 1); + ma->priv = EPHY_TREE_MODEL_SORT_GET_PRIVATE (ma); ma->priv->drag_column_id = -1; } @@ -108,15 +112,9 @@ ephy_tree_model_sort_init (EphyTreeModelSort *ma) static void ephy_tree_model_sort_finalize (GObject *object) { - EphyTreeModelSort *model; - - g_return_if_fail (object != NULL); - g_return_if_fail (EPHY_IS_TREE_MODEL_SORT (object)); - - model = EPHY_TREE_MODEL_SORT (object); + EphyTreeModelSort *model = EPHY_TREE_MODEL_SORT (object); g_free (model->priv->str_list); - g_free (model->priv); G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/lib/widgets/ephy-zoom-action.c b/lib/widgets/ephy-zoom-action.c index c952a1a08..e5e04f04e 100644 --- a/lib/widgets/ephy-zoom-action.c +++ b/lib/widgets/ephy-zoom-action.c @@ -15,6 +15,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 @@ -28,6 +30,8 @@ #include <glib-object.h> #include <bonobo/bonobo-i18n.h> +#define EPHY_ZOOM_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_ZOOM_ACTION, EphyZoomActionPrivate)) + struct _EphyZoomActionPrivate { float zoom; }; @@ -41,7 +45,6 @@ enum static void ephy_zoom_action_init (EphyZoomAction *action); static void ephy_zoom_action_class_init (EphyZoomActionClass *class); -static void ephy_zoom_action_finalize (GObject *object); enum { @@ -150,15 +153,13 @@ ephy_zoom_action_get_property (GObject *object, static void ephy_zoom_action_class_init (EphyZoomActionClass *class) { - GtkActionClass *action_class; GObjectClass *object_class = G_OBJECT_CLASS (class); + GtkActionClass *action_class = GTK_ACTION_CLASS (class); object_class->set_property = ephy_zoom_action_set_property; object_class->get_property = ephy_zoom_action_get_property; - object_class->finalize = ephy_zoom_action_finalize; parent_class = g_type_class_peek_parent (class); - action_class = GTK_ACTION_CLASS (class); action_class->toolbar_item_type = EPHY_TYPE_ZOOM_CONTROL; action_class->connect_proxy = connect_proxy; @@ -183,26 +184,18 @@ ephy_zoom_action_class_init (EphyZoomActionClass *class) G_TYPE_NONE, 1, G_TYPE_FLOAT); + + g_type_class_add_private (object_class, sizeof (EphyZoomActionPrivate)); } static void ephy_zoom_action_init (EphyZoomAction *action) { - action->priv = g_new0 (EphyZoomActionPrivate, 1); + action->priv = EPHY_ZOOM_ACTION_GET_PRIVATE (action); action->priv->zoom = 1.0; } -static void -ephy_zoom_action_finalize (GObject *object) -{ - EphyZoomAction *action = EPHY_ZOOM_ACTION (object); - - g_free (action->priv); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - void ephy_zoom_action_set_zoom_level (EphyZoomAction *action, float zoom) { diff --git a/lib/widgets/ephy-zoom-control.c b/lib/widgets/ephy-zoom-control.c index 91c611012..6fe7dd9f6 100644 --- a/lib/widgets/ephy-zoom-control.c +++ b/lib/widgets/ephy-zoom-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$ */ #ifdef HAVE_CONFIG_H @@ -33,6 +35,9 @@ /** * Private data */ + +#define EPHY_ZOOM_CONTROL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_ZOOM_CONTROL, EphyZoomControlPrivate)) + struct _EphyZoomControlPrivate { GtkWidget *option_menu; float zoom; @@ -191,7 +196,7 @@ ephy_zoom_control_init (EphyZoomControl *control) GtkWidget *item, *menu, *box; guint i; - p = g_new0 (EphyZoomControlPrivate, 1); + p = EPHY_ZOOM_CONTROL_GET_PRIVATE (control); control->priv = p; p->zoom = 1.0; @@ -325,6 +330,8 @@ ephy_zoom_control_class_init (EphyZoomControlClass *klass) G_TYPE_NONE, 1, G_TYPE_FLOAT); + + g_type_class_add_private (object_class, sizeof (EphyZoomControlPrivate)); } static void @@ -334,12 +341,9 @@ ephy_zoom_control_finalize (GObject *o) g_object_unref (control->priv->option_menu); - g_free (control->priv); - G_OBJECT_CLASS (parent_class)->finalize (o); } - void ephy_zoom_control_set_zoom_level (EphyZoomControl *control, float zoom) { diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c index dbd3f0ea4..96c07822d 100644 --- a/src/bookmarks/ephy-bookmark-action.c +++ b/src/bookmarks/ephy-bookmark-action.c @@ -36,6 +36,8 @@ static void ephy_bookmark_action_init (EphyBookmarkAction *action); static void ephy_bookmark_action_class_init (EphyBookmarkActionClass *class); +#define EPHY_BOOKMARK_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_BOOKMARK_ACTION, EphyBookmarkActionPrivate)) + struct EphyBookmarkActionPrivate { int bookmark_id; @@ -407,19 +409,11 @@ ephy_bookmark_action_get_property (GObject *object, static void ephy_bookmark_action_finalize (GObject *object) { - EphyBookmarkAction *eba; - - g_return_if_fail (EPHY_IS_BOOKMARK_ACTION (object)); - - eba = EPHY_BOOKMARK_ACTION (object); - - g_return_if_fail (eba->priv != NULL); + EphyBookmarkAction *eba = EPHY_BOOKMARK_ACTION (object); g_free (eba->priv->location); g_free (eba->priv->icon); - g_free (eba->priv); - LOG ("Bookmark action finalized") G_OBJECT_CLASS (parent_class)->finalize (object); @@ -428,11 +422,10 @@ ephy_bookmark_action_finalize (GObject *object) static void ephy_bookmark_action_class_init (EphyBookmarkActionClass *class) { - GtkActionClass *action_class; GObjectClass *object_class = G_OBJECT_CLASS (class); + GtkActionClass *action_class = GTK_ACTION_CLASS (class); parent_class = g_type_class_peek_parent (class); - action_class = GTK_ACTION_CLASS (class); action_class->toolbar_item_type = GTK_TYPE_TOOL_ITEM; action_class->create_tool_item = create_tool_item; @@ -484,6 +477,8 @@ ephy_bookmark_action_class_init (EphyBookmarkActionClass *class) "Icon", NULL, G_PARAM_READWRITE)); + + g_type_class_add_private (object_class, sizeof(EphyBookmarkActionPrivate)); } static void @@ -528,12 +523,11 @@ ephy_bookmark_action_init (EphyBookmarkAction *action) EphyBookmarks *bookmarks; EphyNode *node; - action->priv = g_new0 (EphyBookmarkActionPrivate, 1); + action->priv = EPHY_BOOKMARK_ACTION_GET_PRIVATE (action); action->priv->location = NULL; action->priv->icon = NULL; - bookmarks = ephy_shell_get_bookmarks (ephy_shell); node = ephy_bookmarks_get_bookmarks (bookmarks); ephy_node_signal_connect_object (node, EPHY_NODE_CHILD_CHANGED, @@ -562,4 +556,3 @@ ephy_bookmark_action_new (const char *name, guint id) return action; } - diff --git a/src/bookmarks/ephy-bookmark-properties.c b/src/bookmarks/ephy-bookmark-properties.c index 050fa21cc..8006bdf71 100644 --- a/src/bookmarks/ephy-bookmark-properties.c +++ b/src/bookmarks/ephy-bookmark-properties.c @@ -43,7 +43,6 @@ static void ephy_bookmark_properties_class_init (EphyBookmarkPropertiesClass *klass); static void ephy_bookmark_properties_init (EphyBookmarkProperties *editor); -static void ephy_bookmark_properties_finalize (GObject *object); static void ephy_bookmark_properties_set_property (GObject *object, guint prop_id, const GValue *value, @@ -53,6 +52,8 @@ static void ephy_bookmark_properties_get_property (GObject *object, GValue *value, GParamSpec *pspec); +#define EPHY_BOOKMARK_PROPERTIES_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_BOOKMARK_PROPERTIES, EphyBookmarkPropertiesPrivate)) + struct EphyBookmarkPropertiesPrivate { EphyBookmarks *bookmarks; @@ -109,8 +110,6 @@ ephy_bookmark_properties_class_init (EphyBookmarkPropertiesClass *klass) parent_class = g_type_class_peek_parent (klass); - object_class->finalize = ephy_bookmark_properties_finalize; - object_class->set_property = ephy_bookmark_properties_set_property; object_class->get_property = ephy_bookmark_properties_get_property; @@ -119,7 +118,7 @@ ephy_bookmark_properties_class_init (EphyBookmarkPropertiesClass *klass) g_param_spec_object ("bookmarks", "Bookmarks set", "Bookmarks set", - EPHY_BOOKMARKS_TYPE, + EPHY_TYPE_BOOKMARKS, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (object_class, @@ -128,23 +127,8 @@ ephy_bookmark_properties_class_init (EphyBookmarkPropertiesClass *klass) "Bookmark", "Bookmark", G_PARAM_READWRITE)); -} - -static void -ephy_bookmark_properties_finalize (GObject *object) -{ - EphyBookmarkProperties *editor; - - g_return_if_fail (object != NULL); - g_return_if_fail (EPHY_IS_BOOKMARK_PROPERTIES (object)); - - editor = EPHY_BOOKMARK_PROPERTIES (object); - - g_return_if_fail (editor->priv != NULL); - - g_free (editor->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + g_type_class_add_private (object_class, sizeof(EphyBookmarkPropertiesPrivate)); } static void @@ -440,7 +424,7 @@ build_ui (EphyBookmarkProperties *editor) static void ephy_bookmark_properties_init (EphyBookmarkProperties *editor) { - editor->priv = g_new0 (EphyBookmarkPropertiesPrivate, 1); + editor->priv = EPHY_BOOKMARK_PROPERTIES_GET_PRIVATE (editor); editor->priv->bookmark = NULL; editor->priv->tb_model = EPHY_TOOLBARS_MODEL diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c index 60199e983..137f76c01 100644 --- a/src/bookmarks/ephy-bookmarks-editor.c +++ b/src/bookmarks/ephy-bookmarks-editor.c @@ -123,6 +123,8 @@ static void cmd_select_all (GtkAction *action, static void cmd_help_contents (GtkAction *action, EphyBookmarksEditor *editor); +#define EPHY_BOOKMARKS_EDITOR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_BOOKMARKS_EDITOR, EphyBookmarksEditorPrivate)) + struct EphyBookmarksEditorPrivate { EphyBookmarks *bookmarks; @@ -701,21 +703,16 @@ ephy_bookmarks_editor_class_init (EphyBookmarksEditorClass *klass) g_param_spec_object ("bookmarks", "Bookmarks set", "Bookmarks set", - EPHY_BOOKMARKS_TYPE, + EPHY_TYPE_BOOKMARKS, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_type_class_add_private (object_class, sizeof(EphyBookmarksEditorPrivate)); } static void ephy_bookmarks_editor_finalize (GObject *object) { - EphyBookmarksEditor *editor; - - g_return_if_fail (object != NULL); - g_return_if_fail (EPHY_IS_BOOKMARKS_EDITOR (object)); - - editor = EPHY_BOOKMARKS_EDITOR (object); - - g_return_if_fail (editor->priv != NULL); + EphyBookmarksEditor *editor = EPHY_BOOKMARKS_EDITOR (object); g_object_unref (G_OBJECT (editor->priv->bookmarks_filter)); @@ -733,8 +730,6 @@ ephy_bookmarks_editor_finalize (GObject *object) g_hash_table_destroy (editor->priv->props_dialogs); - g_free (editor->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -1468,7 +1463,7 @@ toolbar_items_changed_cb (EphyToolbarsModel *model, static void ephy_bookmarks_editor_init (EphyBookmarksEditor *editor) { - editor->priv = g_new0 (EphyBookmarksEditorPrivate, 1); + editor->priv = EPHY_BOOKMARKS_EDITOR_GET_PRIVATE (editor); editor->priv->props_dialogs = g_hash_table_new (g_direct_hash, g_direct_equal); diff --git a/src/bookmarks/ephy-bookmarks-editor.h b/src/bookmarks/ephy-bookmarks-editor.h index 69b671874..3242b64ee 100644 --- a/src/bookmarks/ephy-bookmarks-editor.h +++ b/src/bookmarks/ephy-bookmarks-editor.h @@ -28,12 +28,12 @@ G_BEGIN_DECLS -#define EPHY_TYPE_BOOKMARKS_EDITOR (ephy_bookmarks_editor_get_type ()) -#define EPHY_BOOKMARKS_EDITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_BOOKMARKS_EDITOR, EphyBookmarksEditor)) -#define EPHY_BOOKMARKS_EDITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_BOOKMARKS_EDITOR, EphyBookmarksEditorClass)) -#define EPHY_IS_BOOKMARKS_EDITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_BOOKMARKS_EDITOR)) -#define EPHY_IS_BOOKMARKS_EDITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_BOOKMARKS_EDITOR)) -#define EPHY_BOOKMARKS_EDITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_BOOKMARKS_EDITOR, EphyBookmarksEditorClass)) +#define EPHY_TYPE_BOOKMARKS_EDITOR (ephy_bookmarks_editor_get_type ()) +#define EPHY_BOOKMARKS_EDITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_BOOKMARKS_EDITOR, EphyBookmarksEditor)) +#define EPHY_BOOKMARKS_EDITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_BOOKMARKS_EDITOR, EphyBookmarksEditorClass)) +#define EPHY_IS_BOOKMARKS_EDITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_BOOKMARKS_EDITOR)) +#define EPHY_IS_BOOKMARKS_EDITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_BOOKMARKS_EDITOR)) +#define EPHY_BOOKMARKS_EDITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_BOOKMARKS_EDITOR, EphyBookmarksEditorClass)) typedef struct EphyBookmarksEditorPrivate EphyBookmarksEditorPrivate; diff --git a/src/bookmarks/ephy-bookmarks-menu.c b/src/bookmarks/ephy-bookmarks-menu.c index 6c3e27b62..f7674c443 100644 --- a/src/bookmarks/ephy-bookmarks-menu.c +++ b/src/bookmarks/ephy-bookmarks-menu.c @@ -37,6 +37,9 @@ /** * Private data */ + +#define EPHY_BOOKMARKS_MENU_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_BOOKMARKS_MENU, EphyBookmarksMenuPrivate)) + struct _EphyBookmarksMenuPrivate { EphyWindow *window; @@ -405,9 +408,11 @@ ephy_bookmarks_menu_class_init (EphyBookmarksMenuClass *klass) g_param_spec_object ("EphyWindow", "EphyWindow", "Parent window", - EPHY_WINDOW_TYPE, + EPHY_TYPE_WINDOW, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_type_class_add_private (object_class, sizeof(EphyBookmarksMenuPrivate)); } static gboolean @@ -432,7 +437,7 @@ bookmarks_tree_changed_cb (EphyBookmarks *bookmarks, EphyBookmarksMenu *menu) static void ephy_bookmarks_menu_init (EphyBookmarksMenu *menu) { - EphyBookmarksMenuPrivate *p = g_new0 (EphyBookmarksMenuPrivate, 1); + EphyBookmarksMenuPrivate *p = EPHY_BOOKMARKS_MENU_GET_PRIVATE (menu); menu->priv = p; @@ -465,8 +470,6 @@ ephy_bookmarks_menu_finalize (GObject *o) g_object_unref (p->action_group); } - g_free (p); - G_OBJECT_CLASS (parent_class)->finalize (o); } diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c index 036113673..978561e01 100644 --- a/src/bookmarks/ephy-bookmarks.c +++ b/src/bookmarks/ephy-bookmarks.c @@ -43,6 +43,8 @@ #define BOOKMARKS_SAVE_DELAY (3 * 1000) #define MAX_FAVORITES_NUM 10 +#define EPHY_BOOKMARKS_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_BOOKMARKS, EphyBookmarksPrivate)) + struct EphyBookmarksPrivate { EphyToolbarsModel *toolbars_model; @@ -304,9 +306,10 @@ ephy_bookmarks_class_init (EphyBookmarksClass *klass) g_param_spec_object ("toolbars_model", "Toolbars model", "Toolbars model", - EPHY_TOOLBARS_MODEL_TYPE, + EPHY_TYPE_TOOLBARS_MODEL, G_PARAM_READWRITE)); + g_type_class_add_private (object_class, sizeof(EphyBookmarksPrivate)); } static gboolean @@ -520,7 +523,7 @@ update_favorites_menus () Session *session; const GList *l; - session = SESSION (ephy_shell_get_session (ephy_shell)); + session = EPHY_SESSION (ephy_shell_get_session (ephy_shell)); l = session_get_windows (session); for (; l != NULL; l = l->next) @@ -668,9 +671,7 @@ ephy_bookmarks_init (EphyBookmarks *eb) GValue value = { 0, }; EphyNodeDb *db; - LOG ("Init"); - - eb->priv = g_new0 (EphyBookmarksPrivate, 1); + eb->priv = EPHY_BOOKMARKS_GET_PRIVATE (eb); eb->priv->toolbars_model = NULL; db = ephy_node_db_new (EPHY_NODE_DB_BOOKMARKS); @@ -770,13 +771,7 @@ ephy_bookmarks_init (EphyBookmarks *eb) static void ephy_bookmarks_finalize (GObject *object) { - EphyBookmarks *eb; - - g_return_if_fail (IS_EPHY_BOOKMARKS (object)); - - eb = EPHY_BOOKMARKS (object); - - g_return_if_fail (eb->priv != NULL); + EphyBookmarks *eb = EPHY_BOOKMARKS (object); if (eb->priv->save_timeout_id != 0) { @@ -801,8 +796,6 @@ ephy_bookmarks_finalize (GObject *object) g_free (eb->priv->xml_file); g_free (eb->priv->rdf_file); - g_free (eb->priv); - LOG ("Bookmarks finalized") G_OBJECT_CLASS (parent_class)->finalize (object); @@ -811,11 +804,11 @@ ephy_bookmarks_finalize (GObject *object) EphyBookmarks * ephy_bookmarks_new () { - EphyBookmarks *tab; + EphyBookmarks *eb; - tab = EPHY_BOOKMARKS (g_object_new (EPHY_BOOKMARKS_TYPE, NULL)); + eb = EPHY_BOOKMARKS (g_object_new (EPHY_TYPE_BOOKMARKS, NULL)); - return tab; + return eb; } static void @@ -893,7 +886,7 @@ ephy_bookmarks_find_bookmark (EphyBookmarks *eb, GPtrArray *children; int i; - g_return_val_if_fail (IS_EPHY_BOOKMARKS (eb), NULL); + g_return_val_if_fail (EPHY_IS_BOOKMARKS (eb), NULL); g_return_val_if_fail (eb->priv->bookmarks != NULL, NULL); g_return_val_if_fail (url != NULL, NULL); diff --git a/src/bookmarks/ephy-bookmarks.h b/src/bookmarks/ephy-bookmarks.h index 962326d24..fbbc2d1f2 100644 --- a/src/bookmarks/ephy-bookmarks.h +++ b/src/bookmarks/ephy-bookmarks.h @@ -25,14 +25,14 @@ G_BEGIN_DECLS -typedef struct EphyBookmarksClass EphyBookmarksClass; - -#define EPHY_BOOKMARKS_TYPE (ephy_bookmarks_get_type ()) -#define EPHY_BOOKMARKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_BOOKMARKS_TYPE, EphyBookmarks)) -#define EPHY_BOOKMARKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_BOOKMARKS_TYPE, EphyBookmarksClass)) -#define IS_EPHY_BOOKMARKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_BOOKMARKS_TYPE)) -#define IS_EPHY_BOOKMARKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EPHY_BOOKMARKS_TYPE)) +#define EPHY_TYPE_BOOKMARKS (ephy_bookmarks_get_type ()) +#define EPHY_BOOKMARKS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_BOOKMARKS, EphyBookmarks)) +#define EPHY_BOOKMARKS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_BOOKMARKS, EphyBookmarksClass)) +#define EPHY_IS_BOOKMARKS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_BOOKMARKS)) +#define EPHY_IS_BOOKMARKS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_BOOKMARKS)) +#define EPHY_BOOKMARKS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_BOOKMARKS, EphyBookmarksClass)) +typedef struct EphyBookmarksClass EphyBookmarksClass; typedef struct EphyBookmarks EphyBookmarks; typedef struct EphyBookmarksPrivate EphyBookmarksPrivate; diff --git a/src/bookmarks/ephy-new-bookmark.c b/src/bookmarks/ephy-new-bookmark.c index 8cad27263..b11d61fed 100644 --- a/src/bookmarks/ephy-new-bookmark.c +++ b/src/bookmarks/ephy-new-bookmark.c @@ -51,6 +51,8 @@ static void ephy_new_bookmark_get_property (GObject *object, GValue *value, GParamSpec *pspec); +#define EPHY_NEW_BOOKMARK_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NEW_BOOKMARK, EphyNewBookmarkPrivate)) + struct EphyNewBookmarkPrivate { EphyBookmarks *bookmarks; @@ -116,7 +118,7 @@ ephy_new_bookmark_class_init (EphyNewBookmarkClass *klass) g_param_spec_object ("bookmarks", "Bookmarks set", "Bookmarks set", - EPHY_BOOKMARKS_TYPE, + EPHY_TYPE_BOOKMARKS, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (object_class, PROP_LOCATION, @@ -125,25 +127,18 @@ ephy_new_bookmark_class_init (EphyNewBookmarkClass *klass) "Bookmark location", "", G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_type_class_add_private (object_class, sizeof(EphyNewBookmarkPrivate)); } static void ephy_new_bookmark_finalize (GObject *object) { - EphyNewBookmark *editor; - - g_return_if_fail (object != NULL); - g_return_if_fail (EPHY_IS_NEW_BOOKMARK (object)); - - editor = EPHY_NEW_BOOKMARK (object); - - g_return_if_fail (editor->priv != NULL); + EphyNewBookmark *editor = EPHY_NEW_BOOKMARK (object); g_free (editor->priv->location); g_free (editor->priv->icon); - g_free (editor->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -460,7 +455,8 @@ ephy_new_bookmark_get_property (GObject *object, static void ephy_new_bookmark_init (EphyNewBookmark *editor) { - editor->priv = g_new0 (EphyNewBookmarkPrivate, 1); + editor->priv = EPHY_NEW_BOOKMARK_GET_PRIVATE (editor); + editor->priv->location = NULL; editor->priv->icon = NULL; editor->priv->id = 0; diff --git a/src/bookmarks/ephy-topic-action.c b/src/bookmarks/ephy-topic-action.c index 214c1c1a0..f302144f7 100644 --- a/src/bookmarks/ephy-topic-action.c +++ b/src/bookmarks/ephy-topic-action.c @@ -36,6 +36,8 @@ static void ephy_topic_action_init (EphyTopicAction *action); static void ephy_topic_action_class_init (EphyTopicActionClass *class); +#define EPHY_TOPIC_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TOPIC_ACTION, EphyTopicActionPrivate)) + struct EphyTopicActionPrivate { int topic_id; @@ -564,38 +566,18 @@ ephy_topic_action_get_property (GObject *object, } static void -ephy_topic_action_finalize (GObject *object) -{ - EphyTopicAction *eba; - - g_return_if_fail (EPHY_IS_TOPIC_ACTION (object)); - - eba = EPHY_TOPIC_ACTION (object); - - g_return_if_fail (eba->priv != NULL); - - g_free (eba->priv); - - LOG ("Bookmark action finalized") - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void ephy_topic_action_class_init (EphyTopicActionClass *class) { - GtkActionClass *action_class; GObjectClass *object_class = G_OBJECT_CLASS (class); + GtkActionClass *action_class = GTK_ACTION_CLASS (class); parent_class = g_type_class_peek_parent (class); - action_class = GTK_ACTION_CLASS (class); action_class->toolbar_item_type = GTK_TYPE_TOOL_ITEM; action_class->create_tool_item = create_tool_item; action_class->create_menu_item = create_menu_item; action_class->connect_proxy = connect_proxy; - object_class->finalize = ephy_topic_action_finalize; object_class->set_property = ephy_topic_action_set_property; object_class->get_property = ephy_topic_action_get_property; @@ -619,6 +601,8 @@ ephy_topic_action_class_init (EphyTopicActionClass *class) G_MAXINT, 0, G_PARAM_READWRITE)); + + g_type_class_add_private (object_class, sizeof(EphyTopicActionPrivate)); } static void @@ -651,7 +635,7 @@ ephy_topic_action_init (EphyTopicAction *action) EphyBookmarks *bookmarks; EphyNode *node; - action->priv = g_new0 (EphyTopicActionPrivate, 1); + action->priv = EPHY_TOPIC_ACTION_GET_PRIVATE (action); bookmarks = ephy_shell_get_bookmarks (ephy_shell); node = ephy_bookmarks_get_keywords (bookmarks); diff --git a/src/bookmarks/ephy-topics-selector.c b/src/bookmarks/ephy-topics-selector.c index 9d8447731..e1a583a72 100644 --- a/src/bookmarks/ephy-topics-selector.c +++ b/src/bookmarks/ephy-topics-selector.c @@ -31,7 +31,6 @@ static void ephy_topics_selector_class_init (EphyTopicsSelectorClass *klass); static void ephy_topics_selector_init (EphyTopicsSelector *editor); -static void ephy_topics_selector_finalize (GObject *object); static void ephy_topics_selector_set_property (GObject *object, guint prop_id, const GValue *value, @@ -41,6 +40,8 @@ static void ephy_topics_selector_get_property (GObject *object, GValue *value, GParamSpec *pspec); +#define EPHY_TOPICS_SELECTOR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TOPICS_SELECTOR, EphyTopicsSelectorPrivate)) + struct EphyTopicsSelectorPrivate { EphyBookmarks *bookmarks; @@ -99,8 +100,6 @@ ephy_topics_selector_class_init (EphyTopicsSelectorClass *klass) parent_class = g_type_class_peek_parent (klass); - object_class->finalize = ephy_topics_selector_finalize; - object_class->set_property = ephy_topics_selector_set_property; object_class->get_property = ephy_topics_selector_get_property; @@ -109,7 +108,7 @@ ephy_topics_selector_class_init (EphyTopicsSelectorClass *klass) g_param_spec_object ("bookmarks", "Bookmarks set", "Bookmarks set", - EPHY_BOOKMARKS_TYPE, + EPHY_TYPE_BOOKMARKS, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (object_class, @@ -118,23 +117,8 @@ ephy_topics_selector_class_init (EphyTopicsSelectorClass *klass) "Bookmark", "Bookmark", G_PARAM_READWRITE)); -} - -static void -ephy_topics_selector_finalize (GObject *object) -{ - EphyTopicsSelector *editor; - - g_return_if_fail (object != NULL); - g_return_if_fail (EPHY_IS_TOPIC_SELECTOR (object)); - - editor = EPHY_TOPICS_SELECTOR (object); - - g_return_if_fail (editor->priv != NULL); - - g_free (editor->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + g_type_class_add_private (object_class, sizeof(EphyTopicsSelectorPrivate)); } void @@ -395,7 +379,7 @@ ephy_topics_build_ui (EphyTopicsSelector *editor) static void ephy_topics_selector_init (EphyTopicsSelector *editor) { - editor->priv = g_new0 (EphyTopicsSelectorPrivate, 1); + editor->priv = EPHY_TOPICS_SELECTOR_GET_PRIVATE (editor); editor->priv->bookmark = NULL; } @@ -409,7 +393,7 @@ ephy_topics_selector_new (EphyBookmarks *bookmarks, g_assert (bookmarks != NULL); editor = EPHY_TOPICS_SELECTOR (g_object_new - (EPHY_TYPE_TOPIC_SELECTOR, + (EPHY_TYPE_TOPICS_SELECTOR, "bookmarks", bookmarks, "bookmark", bookmark, NULL)); diff --git a/src/bookmarks/ephy-topics-selector.h b/src/bookmarks/ephy-topics-selector.h index d87086980..06e35a355 100644 --- a/src/bookmarks/ephy-topics-selector.h +++ b/src/bookmarks/ephy-topics-selector.h @@ -27,12 +27,12 @@ G_BEGIN_DECLS -#define EPHY_TYPE_TOPIC_SELECTOR (ephy_topics_selector_get_type ()) -#define EPHY_TOPICS_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_TOPIC_SELECTOR, EphyTopicsSelector)) -#define EPHY_TOPICS_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_TOPIC_SELECTOR, EphyTopicsSelectorClass)) -#define EPHY_IS_TOPIC_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_TOPIC_SELECTOR)) -#define EPHY_IS_TOPIC_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_TOPIC_SELECTOR)) -#define EPHY_TOPICS_SELECTOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_TOPIC_SELECTOR, EphyTopicsSelectorClass)) +#define EPHY_TYPE_TOPICS_SELECTOR (ephy_topics_selector_get_type ()) +#define EPHY_TOPICS_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_TOPICS_SELECTOR, EphyTopicsSelector)) +#define EPHY_TOPICS_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_TOPICS_SELECTOR, EphyTopicsSelectorClass)) +#define EPHY_IS_TOPICS_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_TOPICS_SELECTOR)) +#define EPHY_IS_TOPICS_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_TOPICS_SELECTOR)) +#define EPHY_TOPICS_SELECTOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_TOPICS_SELECTOR, EphyTopicsSelectorClass)) typedef struct EphyTopicsSelectorPrivate EphyTopicsSelectorPrivate; diff --git a/src/ephy-automation.c b/src/ephy-automation.c index 2baa56c17..529b1854e 100644 --- a/src/ephy-automation.c +++ b/src/ephy-automation.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-automation.h" @@ -62,7 +64,7 @@ ephy_automation_factory (BonoboGenericFactory *this_factory, { EphyAutomation *a; - a = g_object_new (EPHY_AUTOMATION_TYPE, NULL); + a = g_object_new (EPHY_TYPE_AUTOMATION, NULL); return BONOBO_OBJECT(a); } @@ -95,7 +97,7 @@ impl_ephy_automation_loadurl (PortableServer_Servant _servant, EphyWindow *window; Session *session; - session = SESSION (ephy_shell_get_session (ephy_shell)); + session = EPHY_SESSION (ephy_shell_get_session (ephy_shell)); /* no window open, let's try to autoresume */ if (session_get_windows (session) == NULL) @@ -156,7 +158,7 @@ impl_ephy_automation_quit (PortableServer_Servant _servant, { Session *session; - session = SESSION (ephy_shell_get_session (ephy_shell)); + session = EPHY_SESSION (ephy_shell_get_session (ephy_shell)); session_close (session); } @@ -168,7 +170,7 @@ impl_ephy_automation_load_session (PortableServer_Servant _servant, { Session *session; - session = SESSION (ephy_shell_get_session (ephy_shell)); + session = EPHY_SESSION (ephy_shell_get_session (ephy_shell)); session_load (session, filename); } diff --git a/src/ephy-automation.h b/src/ephy-automation.h index 4b3701605..3474b9705 100644 --- a/src/ephy-automation.h +++ b/src/ephy-automation.h @@ -16,8 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _EPHY_AUTOMATION_H_ -#define _EPHY_AUTOMATION_H_ +#ifndef EPHY_AUTOMATION_H +#define EPHY_AUTOMATION_H #include "EphyAutomation.h" @@ -26,12 +26,12 @@ G_BEGIN_DECLS -#define EPHY_AUTOMATION_TYPE (ephy_automation_get_type ()) -#define EPHY_AUTOMATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_AUTOMATION_TYPE, EphyAutomation)) -#define EPHY_AUTOMATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_AUTOMATION_TYPE, EphyAutomationClass)) -#define EPHY_AUTOMATION_IS_OBJECT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_AUTOMATION_TYPE)) -#define EPHY_AUTOMATION_IS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_AUTOMATION_TYPE)) -#define EPHY_AUTOMATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_AUTOMATION_TYPE, EphyAutomationClass)) +#define EPHY_TYPE_AUTOMATION (ephy_automation_get_type ()) +#define EPHY_AUTOMATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_AUTOMATION, EphyAutomation)) +#define EPHY_AUTOMATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_AUTOMATION, EphyAutomationClass)) +#define EPHY_IS_AUTOMATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_AUTOMATION)) +#define EPHY_IS_AUTOMATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_AUTOMATION)) +#define EPHY_AUTOMATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_AUTOMATION, EphyAutomationClass)) typedef struct { BonoboObject parent; diff --git a/src/ephy-encoding-menu.c b/src/ephy-encoding-menu.c index d9769e87b..f713c168b 100644 --- a/src/ephy-encoding-menu.c +++ b/src/ephy-encoding-menu.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 @@ -32,6 +34,9 @@ /** * Private data */ + +#define EPHY_ENCODING_MENU_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_ENCODING_MENU, EphyEncodingMenuPrivate)) + struct _EphyEncodingMenuPrivate { EphyWindow *window; @@ -105,14 +110,17 @@ ephy_encoding_menu_class_init (EphyEncodingMenuClass *klass) g_param_spec_object ("EphyWindow", "EphyWindow", "Parent window", - EPHY_WINDOW_TYPE, - G_PARAM_READWRITE)); + EPHY_TYPE_WINDOW, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + + g_type_class_add_private (object_class, sizeof(EphyEncodingMenuPrivate)); } static void ephy_encoding_menu_init (EphyEncodingMenu *wrhm) { - EphyEncodingMenuPrivate *p = g_new0 (EphyEncodingMenuPrivate, 1); + EphyEncodingMenuPrivate *p = EPHY_ENCODING_MENU_GET_PRIVATE (wrhm); wrhm->priv = p; wrhm->priv->action_group = NULL; @@ -132,8 +140,6 @@ ephy_encoding_menu_finalize_impl (GObject *o) g_object_unref (p->action_group); } - g_free (p); - G_OBJECT_CLASS (g_object_class)->finalize (o); } diff --git a/src/ephy-favicon-action.c b/src/ephy-favicon-action.c index 86b567095..4b8b290fb 100644 --- a/src/ephy-favicon-action.c +++ b/src/ephy-favicon-action.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-favicon-action.h" @@ -37,6 +39,8 @@ static GtkTargetEntry url_drag_types [] = }; static int n_url_drag_types = G_N_ELEMENTS (url_drag_types); +#define EPHY_FAVICON_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_FAVICON_ACTION, EphyFaviconActionPrivate)) + struct EphyFaviconActionPrivate { EphyWindow *window; @@ -271,12 +275,15 @@ ephy_favicon_action_class_init (EphyFaviconActionClass *class) "The icon", NULL, G_PARAM_READWRITE)); + + g_type_class_add_private (object_class, sizeof(EphyFaviconActionPrivate)); } static void ephy_favicon_action_init (EphyFaviconAction *action) { - action->priv = g_new0 (EphyFaviconActionPrivate, 1); + action->priv = EPHY_FAVICON_ACTION_GET_PRIVATE (action); + action->priv->icon = NULL; action->priv->cache = EPHY_FAVICON_CACHE @@ -288,19 +295,9 @@ ephy_favicon_action_init (EphyFaviconAction *action) static void ephy_favicon_action_finalize (GObject *object) { - EphyFaviconAction *action; - - g_return_if_fail (EPHY_IS_FAVICON_ACTION (object)); - - action = EPHY_FAVICON_ACTION (object); - - g_return_if_fail (action->priv != NULL); + EphyFaviconAction *action = EPHY_FAVICON_ACTION (object); g_object_unref (action->priv->cache); - g_free (action->priv); - - LOG ("Favicon action finalized") - G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/src/ephy-favorites-menu.c b/src/ephy-favorites-menu.c index 3cb54a9e0..99afe038c 100644 --- a/src/ephy-favorites-menu.c +++ b/src/ephy-favorites-menu.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 @@ -30,6 +32,9 @@ /** * Private data */ + +#define EPHY_FAVORITES_MENU_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_FAVORITES_MENU, EphyFavoritesMenuPrivate)) + struct _EphyFavoritesMenuPrivate { EphyWindow *window; @@ -225,15 +230,18 @@ ephy_favorites_menu_class_init (EphyFavoritesMenuClass *klass) PROP_EPHY_WINDOW, g_param_spec_object ("EphyWindow", "EphyWindow", - "Parent window", - EPHY_WINDOW_TYPE, - G_PARAM_READWRITE)); + "Parent window", + EPHY_TYPE_WINDOW, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + + g_type_class_add_private (object_class, sizeof(EphyFavoritesMenuPrivate)); } static void ephy_favorites_menu_init (EphyFavoritesMenu *wrhm) { - EphyFavoritesMenuPrivate *p = g_new0 (EphyFavoritesMenuPrivate, 1); + EphyFavoritesMenuPrivate *p = EPHY_FAVORITES_MENU_GET_PRIVATE (wrhm); wrhm->priv = p; wrhm->priv->bookmarks = ephy_shell_get_bookmarks (ephy_shell); @@ -255,8 +263,6 @@ ephy_favorites_menu_finalize (GObject *o) g_object_unref (p->action_group); } - g_free (p); - G_OBJECT_CLASS (parent_class)->finalize (o); } diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c index 95428f753..682030978 100644 --- a/src/ephy-history-window.c +++ b/src/ephy-history-window.c @@ -15,6 +15,7 @@ * 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 @@ -97,6 +98,8 @@ static void cmd_select_all (GtkAction *action, static void cmd_help_contents (GtkAction *action, EphyHistoryWindow *editor); +#define EPHY_HISTORY_WINDOW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_HISTORY_WINDOW, EphyHistoryWindowPrivate)) + struct EphyHistoryWindowPrivate { EphyHistory *history; @@ -194,7 +197,7 @@ confirmation_dialog_response_cb (GtkDialog *dialog, gint response, if (response != GTK_RESPONSE_OK) return; - session = SESSION (ephy_shell_get_session (ephy_shell)); + session = EPHY_SESSION (ephy_shell_get_session (ephy_shell)); windows = session_get_windows (session); for (; windows != NULL; windows = windows->next) @@ -560,21 +563,16 @@ ephy_history_window_class_init (EphyHistoryWindowClass *klass) g_param_spec_object ("history", "Global history", "Global History", - EPHY_HISTORY_TYPE, + EPHY_TYPE_HISTORY, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_type_class_add_private (object_class, sizeof(EphyHistoryWindowPrivate)); } static void ephy_history_window_finalize (GObject *object) { - EphyHistoryWindow *editor; - - g_return_if_fail (object != NULL); - g_return_if_fail (EPHY_IS_HISTORY_WINDOW (object)); - - editor = EPHY_HISTORY_WINDOW (object); - - g_return_if_fail (editor->priv != NULL); + EphyHistoryWindow *editor = EPHY_HISTORY_WINDOW (object); g_object_unref (G_OBJECT (editor->priv->pages_filter)); @@ -590,8 +588,6 @@ ephy_history_window_finalize (GObject *object) (gpointer *)&editor->priv->window); } - g_free (editor->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -1179,7 +1175,7 @@ ephy_history_window_get_property (GObject *object, static void ephy_history_window_init (EphyHistoryWindow *editor) { - editor->priv = g_new0 (EphyHistoryWindowPrivate, 1); + editor->priv = EPHY_HISTORY_WINDOW_GET_PRIVATE (editor); } static void diff --git a/src/ephy-location-action.h b/src/ephy-location-action.h index 2c169c462..fd27ec8b8 100644 --- a/src/ephy-location-action.h +++ b/src/ephy-location-action.h @@ -21,6 +21,8 @@ #include <gtk/gtkaction.h> +G_BEGIN_DECLS + #define EPHY_TYPE_LOCATION_ACTION (ephy_location_action_get_type ()) #define EPHY_LOCATION_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_LOCATION_ACTION, EphyLocationAction)) #define EPHY_LOCATION_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TYPE_LOCATION_ACTION, EphyLocationActionClass)) @@ -47,4 +49,6 @@ GType ephy_location_action_get_type (void); GtkWidget *ephy_location_action_get_widget (EphyLocationAction *action); +G_END_DECLS + #endif diff --git a/src/ephy-nautilus-view.c b/src/ephy-nautilus-view.c index b6dfa9d86..d78110aff 100644 --- a/src/ephy-nautilus-view.c +++ b/src/ephy-nautilus-view.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$ */ @@ -101,6 +103,8 @@ static void gnv_popup_cmd_frame_in_new_window (BonoboUIComponent *uic, EphyEmbedPopupControl*popup, const char* verbname); +#define EPHY_NAUTILUS_VIEW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NAUTILUS_VIEW, EphyNautilusViewPrivate)) + struct EphyNautilusViewPrivate { EphyEmbed *embed; char *title; @@ -140,7 +144,7 @@ static void ephy_nautilus_view_instance_init (EphyNautilusView *view) { GtkWidget *w; - EphyNautilusViewPrivate *p = g_new0 (EphyNautilusViewPrivate, 1); + EphyNautilusViewPrivate *p = EPHY_NAUTILUS_VIEW_GET_PRIVATE (view); EphyEmbedSingle *single; float *levels; gchar **names; @@ -271,7 +275,6 @@ ephy_nautilus_view_finalize (GObject *object) g_free (p->title); g_free (p->location); - g_free (p); GNOME_CALL_PARENT (G_OBJECT_CLASS, finalize, (object)); @@ -281,7 +284,11 @@ ephy_nautilus_view_finalize (GObject *object) static void ephy_nautilus_view_class_init (EphyNautilusViewClass *class) { - G_OBJECT_CLASS (class)->finalize = ephy_nautilus_view_finalize; + GObjectClas *object_class = G_OBJECT_CLASS (class); + + object_class->finalize = ephy_nautilus_view_finalize; + + g_type_class_add_private (object_class, sizeof(EphyNautilusViewPrivate)); } static gint diff --git a/src/ephy-nautilus-view.h b/src/ephy-nautilus-view.h index 3dd13560b..12a2e7844 100644 --- a/src/ephy-nautilus-view.h +++ b/src/ephy-nautilus-view.h @@ -25,13 +25,12 @@ G_BEGIN_DECLS -#define EPHY_TYPE_NAUTILUS_VIEW (ephy_nautilus_view_get_type ()) -#define EPHY_NAUTILUS_VIEW(obj) (GTK_CHECK_CAST ((obj), EPHY_TYPE_NAUTILUS_VIEW, \ - EphyNautilusView)) -#define EPHY_NAUTILUS_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_TYPE_NAUTILUS_VIEW, \ - EphyNautilusViewClass)) -#define EPHY_IS_NAUTILUS_VIEW(obj) (GTK_CHECK_TYPE ((obj), EPHY_TYPE_NAUTILUS_VIEW)) -#define EPHY_IS_NAUTILUS_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_IS_NAUTILUS_VIEW_CLASS)) +#define EPHY_TYPE_NAUTILUS_VIEW (ephy_nautilus_view_get_type ()) +#define EPHY_NAUTILUS_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_NAUTILUS_VIEW, EphyNautilusView)) +#define EPHY_NAUTILUS_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_NAUTILUS_VIEW, EphyNautilusViewClass)) +#define EPHY_IS_NAUTILUS_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_NAUTILUS_VIEW)) +#define EPHY_IS_NAUTILUS_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_NAUTILUS_VIEW)) +#define EPHY_NAUTILUS_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_NAUTILUS_VIEW, EphyNautilusViewClass)) typedef struct EphyNautilusView EphyNautilusView; typedef struct EphyNautilusViewClass EphyNautilusViewClass; diff --git a/src/ephy-navigation-action.c b/src/ephy-navigation-action.c index 81a14ad67..769cd9e19 100644 --- a/src/ephy-navigation-action.c +++ b/src/ephy-navigation-action.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-navigation-action.h" @@ -30,6 +32,8 @@ static void ephy_navigation_action_class_init (EphyNavigationActionClass *class) static GObjectClass *parent_class = NULL; +#define EPHY_NAVIGATION_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NAVIGATION_ACTION, EphyNavigationActionPrivate)) + struct EphyNavigationActionPrivate { EphyWindow *window; @@ -299,31 +303,17 @@ ephy_navigation_action_get_property (GObject *object, } static void -ephy_navigation_action_finalize (GObject *object) -{ - EphyNavigationAction *action = EPHY_NAVIGATION_ACTION (object); - - g_return_if_fail (action->priv != NULL); - - g_free (action->priv); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void ephy_navigation_action_class_init (EphyNavigationActionClass *class) { - GtkActionClass *action_class; GObjectClass *object_class = G_OBJECT_CLASS (class); + GtkActionClass *action_class = GTK_ACTION_CLASS (class); - object_class->finalize = ephy_navigation_action_finalize; object_class->set_property = ephy_navigation_action_set_property; object_class->get_property = ephy_navigation_action_get_property; parent_class = g_type_class_peek_parent (class); - action_class = GTK_ACTION_CLASS (class); - action_class->toolbar_item_type = EPHY_ARROW_TOOLBUTTON_TYPE; + action_class->toolbar_item_type = EPHY_TYPE_ARROW_TOOLBUTTON; action_class->connect_proxy = connect_proxy; g_object_class_install_property (object_class, @@ -343,12 +333,13 @@ ephy_navigation_action_class_init (EphyNavigationActionClass *class) G_TYPE_OBJECT, G_PARAM_READWRITE)); + g_type_class_add_private (object_class, sizeof(EphyNavigationActionPrivate)); } static void ephy_navigation_action_init (EphyNavigationAction *action) { - action->priv = g_new0 (EphyNavigationActionPrivate, 1); + action->priv = EPHY_NAVIGATION_ACTION_GET_PRIVATE (action); } diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c index 44284559d..620b81d68 100644 --- a/src/ephy-notebook.c +++ b/src/ephy-notebook.c @@ -46,6 +46,8 @@ #define TAB_MIN_SIZE 60 #define TAB_NB_MAX 8 +#define EPHY_NOTEBOOK_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NOTEBOOK, EphyNotebookPrivate)) + struct EphyNotebookPrivate { GList *focused_pages; @@ -167,6 +169,8 @@ ephy_notebook_class_init (EphyNotebookClass *klass) ephy_marshal_VOID__VOID, G_TYPE_NONE, 0); + + g_type_class_add_private (object_class, sizeof(EphyNotebookPrivate)); } static gboolean @@ -573,7 +577,7 @@ button_press_cb (EphyNotebook *notebook, GtkWidget * ephy_notebook_new (void) { - return GTK_WIDGET (g_object_new (EPHY_NOTEBOOK_TYPE, NULL)); + return GTK_WIDGET (g_object_new (EPHY_TYPE_NOTEBOOK, NULL)); } static void @@ -647,7 +651,7 @@ notebook_drag_data_received_cb (GtkWidget* widget, GdkDragContext *context, if (uris == NULL) return; toplevel = gtk_widget_get_toplevel (widget); - g_return_if_fail (IS_EPHY_WINDOW (toplevel)); + g_return_if_fail (EPHY_IS_WINDOW (toplevel)); window = EPHY_WINDOW (toplevel); if (child) @@ -721,7 +725,7 @@ tabs_visibility_notifier (GConfClient *client, static void ephy_notebook_init (EphyNotebook *notebook) { - notebook->priv = g_new (EphyNotebookPrivate, 1); + notebook->priv = EPHY_NOTEBOOK_GET_PRIVATE (notebook); notebook->priv->title_tips = gtk_tooltips_new (); g_object_ref (G_OBJECT (notebook->priv->title_tips)); @@ -777,8 +781,6 @@ ephy_notebook_finalize (GObject *object) g_list_free (notebook->priv->opened_tabs); g_object_unref (notebook->priv->title_tips); - g_free (notebook->priv); - LOG ("EphyNotebook finalised %p", object) } @@ -963,9 +965,9 @@ ephy_notebook_insert_page (EphyNotebook *nb, EphyTab *tab; GtkWidget *label; - g_return_if_fail (IS_EPHY_EMBED (child)); + g_return_if_fail (EPHY_IS_EMBED (child)); tab = EPHY_TAB (g_object_get_data (G_OBJECT (child), "EphyTab")); - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_TAB (tab)); label = build_tab_label (nb, child); @@ -1063,11 +1065,11 @@ ephy_notebook_remove_page (EphyNotebook *nb, EphyTab *tab; GtkWidget *label, *ebox; - g_return_if_fail (IS_EPHY_NOTEBOOK (nb)); - g_return_if_fail (IS_EPHY_EMBED (child)); + g_return_if_fail (EPHY_IS_NOTEBOOK (nb)); + g_return_if_fail (EPHY_IS_EMBED (child)); tab = EPHY_TAB (g_object_get_data (G_OBJECT (child), "EphyTab")); - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_TAB (tab)); num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (nb)); if (num <= 1) diff --git a/src/ephy-notebook.h b/src/ephy-notebook.h index ef5edd94b..9809fdfaf 100644 --- a/src/ephy-notebook.h +++ b/src/ephy-notebook.h @@ -24,14 +24,14 @@ G_BEGIN_DECLS -typedef struct EphyNotebookClass EphyNotebookClass; - -#define EPHY_NOTEBOOK_TYPE (ephy_notebook_get_type ()) -#define EPHY_NOTEBOOK(obj) (GTK_CHECK_CAST ((obj), EPHY_NOTEBOOK_TYPE, EphyNotebook)) -#define EPHY_NOTEBOOK_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_NOTEBOOK_TYPE, EphyNotebookClass)) -#define IS_EPHY_NOTEBOOK(obj) (GTK_CHECK_TYPE ((obj), EPHY_NOTEBOOK_TYPE)) -#define IS_EPHY_NOTEBOOK_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_NOTEBOOK)) +#define EPHY_TYPE_NOTEBOOK (ephy_notebook_get_type ()) +#define EPHY_NOTEBOOK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_NOTEBOOK, EphyNotebook)) +#define EPHY_NOTEBOOK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_NOTEBOOK, EphyNotebookClass)) +#define EPHY_IS_NOTEBOOK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_NOTEBOOK)) +#define EPHY_IS_NOTEBOOK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_NOTEBOOK)) +#define EPHY_NOTEBOOK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_NOTEBOOK, EphyNotebookClass)) +typedef struct EphyNotebookClass EphyNotebookClass; typedef struct EphyNotebook EphyNotebook; typedef struct EphyNotebookPrivate EphyNotebookPrivate; diff --git a/src/ephy-plugin.h b/src/ephy-plugin.h index 243cfdb6a..132305111 100644 --- a/src/ephy-plugin.h +++ b/src/ephy-plugin.h @@ -21,6 +21,8 @@ #include <glib-object.h> +G_BEGIN_DECLS + #define EPHY_TYPE_PLUGIN (ephy_plugin_get_type ()) #define EPHY_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_PLUGIN, EphyPlugin)) #define EPHY_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TYPE_PLUGIN, EphyPluginClass)) @@ -34,4 +36,6 @@ GType ephy_plugin_get_type (void); EphyPlugin *ephy_plugin_new (const char *name); +G_END_DECLS + #endif diff --git a/src/ephy-shell.c b/src/ephy-shell.c index f056d66d5..4fe89e069 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -61,6 +61,8 @@ #endif +#define EPHY_SHELL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SHELL, EphyShellPrivate)) + struct EphyShellPrivate { Session *session; @@ -116,7 +118,7 @@ ephy_shell_get_type (void) (GInstanceInitFunc) ephy_shell_init }; - ephy_shell_type = g_type_register_static (EPHY_EMBED_SHELL_TYPE, + ephy_shell_type = g_type_register_static (EPHY_TYPE_EMBED_SHELL, "EphyShell", &our_info, 0); } @@ -133,6 +135,8 @@ ephy_shell_class_init (EphyShellClass *klass) parent_class = g_type_class_peek_parent (klass); object_class->finalize = ephy_shell_finalize; + + g_type_class_add_private (object_class, sizeof(EphyShellPrivate)); } static void @@ -193,7 +197,8 @@ ephy_shell_init (EphyShell *gs) EphyEmbedSingle *single; EphyShell **ptr = &ephy_shell; - gs->priv = g_new0 (EphyShellPrivate, 1); + gs->priv = EPHY_SHELL_GET_PRIVATE (gs); + gs->priv->session = NULL; gs->priv->bookmarks = NULL; gs->priv->bme = NULL; @@ -245,14 +250,7 @@ ephy_shell_init (EphyShell *gs) static void ephy_shell_finalize (GObject *object) { - EphyShell *gs; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_EPHY_SHELL (object)); - - gs = EPHY_SHELL (object); - - g_return_if_fail (gs->priv != NULL); + EphyShell *gs = EPHY_SHELL (object); g_assert (ephy_shell == NULL); @@ -268,7 +266,7 @@ ephy_shell_finalize (GObject *object) LOG ("Unref session") if (gs->priv->session) { - g_return_if_fail (IS_SESSION(gs->priv->session)); + g_return_if_fail (EPHY_IS_SESSION(gs->priv->session)); g_object_remove_weak_pointer (G_OBJECT(gs->priv->session), (gpointer *)&gs->priv->session); @@ -301,8 +299,6 @@ ephy_shell_finalize (GObject *object) G_OBJECT_CLASS (parent_class)->finalize (object); - g_free (gs->priv); - ephy_state_save (); ephy_file_helpers_shutdown (); @@ -316,7 +312,7 @@ ephy_shell_finalize (GObject *object) EphyShell * ephy_shell_new (void) { - return EPHY_SHELL (g_object_new (EPHY_SHELL_TYPE, NULL)); + return EPHY_SHELL (g_object_new (EPHY_TYPE_SHELL, NULL)); } static void @@ -371,7 +367,7 @@ ephy_shell_get_active_window (EphyShell *gs) Session *session; const GList *windows; - session = SESSION (ephy_shell_get_session (gs)); + session = EPHY_SESSION (ephy_shell_get_session (gs)); windows = session_get_windows (session); if (windows == NULL) return NULL; diff --git a/src/ephy-shell.h b/src/ephy-shell.h index 3ce3add31..aad9f3808 100644 --- a/src/ephy-shell.h +++ b/src/ephy-shell.h @@ -29,19 +29,20 @@ G_BEGIN_DECLS +#define EPHY_TYPE_SHELL (ephy_shell_get_type ()) +#define EPHY_SHELL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_SHELL, EphyShell)) +#define EPHY_SHELL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_SHELL, EphyShellClass)) +#define EPHY_IS_SHELL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_SHELL)) +#define EPHY_IS_SHELL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_SHELL)) +#define EPHY_SHELL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_SHELL, EphyShellClass)) + +/* FIXME: huh? */ #ifndef EPHY_SHELL_TYPE_DEF typedef struct EphyShell EphyShell; #define EPHY_SHELL_TYPE_DEF #endif typedef struct EphyShellClass EphyShellClass; - -#define EPHY_SHELL_TYPE (ephy_shell_get_type ()) -#define EPHY_SHELL(obj) (GTK_CHECK_CAST ((obj), EPHY_SHELL_TYPE, EphyShell)) -#define EPHY_SHELL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_SHELL, EphyShellClass)) -#define IS_EPHY_SHELL(obj) (GTK_CHECK_TYPE ((obj), EPHY_SHELL_TYPE)) -#define IS_EPHY_SHELL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_SHELL)) - typedef struct EphyShellPrivate EphyShellPrivate; extern EphyShell *ephy_shell; diff --git a/src/ephy-spinner-action.c b/src/ephy-spinner-action.c index 39140fe61..be69ce9b5 100644 --- a/src/ephy-spinner-action.c +++ b/src/ephy-spinner-action.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-spinner-action.h" @@ -25,6 +27,8 @@ static void ephy_spinner_action_init (EphySpinnerAction *action); static void ephy_spinner_action_class_init (EphySpinnerActionClass *class); +#define EPHY_SPINNER_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SPINNER_ACTION, EphySpinnerActionPrivate)) + struct EphySpinnerActionPrivate { gboolean throbbing; @@ -184,31 +188,17 @@ ephy_spinner_action_get_property (GObject *object, } static void -ephy_spinner_action_finalize (GObject *object) -{ - EphySpinnerAction *action = EPHY_SPINNER_ACTION (object); - - g_return_if_fail (action->priv != NULL); - - g_free (action->priv); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void ephy_spinner_action_class_init (EphySpinnerActionClass *class) { - GtkActionClass *action_class; GObjectClass *object_class = G_OBJECT_CLASS (class); + GtkActionClass *action_class = GTK_ACTION_CLASS (class); parent_class = g_type_class_peek_parent (class); - action_class = GTK_ACTION_CLASS (class); - action_class->toolbar_item_type = EPHY_SPINNER_TYPE; + action_class->toolbar_item_type = EPHY_TYPE_SPINNER; action_class->create_tool_item = create_tool_item; action_class->connect_proxy = connect_proxy; - object_class->finalize = ephy_spinner_action_finalize; object_class->set_property = ephy_spinner_action_set_property; object_class->get_property = ephy_spinner_action_get_property; @@ -219,10 +209,12 @@ ephy_spinner_action_class_init (EphySpinnerActionClass *class) "Throbbing", FALSE, G_PARAM_READWRITE)); + + g_type_class_add_private (object_class, sizeof(EphySpinnerActionPrivate)); } static void ephy_spinner_action_init (EphySpinnerAction *action) { - action->priv = g_new0 (EphySpinnerActionPrivate, 1); + action->priv = EPHY_SPINNER_ACTION_GET_PRIVATE (action); } diff --git a/src/ephy-tab.c b/src/ephy-tab.c index 4678b565c..43815893a 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -51,6 +51,8 @@ #include <gtk/gtkuimanager.h> #include <string.h> +#define EPHY_TAB_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TAB, EphyTabPrivate)) + struct EphyTabPrivate { EphyEmbed *embed; @@ -226,7 +228,7 @@ ephy_tab_get_property (GObject *object, static void ephy_tab_action_activate_cb (GtkAction *action, EphyTab *tab) { - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_TAB (tab)); ephy_window_jump_to_tab (tab->priv->window, tab); } @@ -327,7 +329,7 @@ ephy_tab_class_init (EphyTabClass *class) g_param_spec_object ("window", "Window", "The tab's parent window", - EPHY_WINDOW_TYPE, + EPHY_TYPE_WINDOW, G_PARAM_READWRITE)); g_object_class_install_property (object_class, @@ -339,6 +341,8 @@ ephy_tab_class_init (EphyTabClass *class) ZOOM_MAXIMAL, 1.0, G_PARAM_READABLE)); + + g_type_class_add_private (object_class, sizeof(EphyTabPrivate)); } static void @@ -362,13 +366,7 @@ ephy_tab_embed_destroy_cb (GtkWidget *widget, EphyTab *tab) static void ephy_tab_finalize (GObject *object) { - EphyTab *tab; - - g_return_if_fail (IS_EPHY_TAB (object)); - - tab = EPHY_TAB (object); - - g_return_if_fail (tab->priv != NULL); + EphyTab *tab = EPHY_TAB (object); g_idle_remove_by_data (tab->priv->embed); @@ -383,8 +381,6 @@ ephy_tab_finalize (GObject *object) g_free (tab->priv->link_message); g_free (tab->priv->status_message); - g_free (tab->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); LOG ("EphyTab finalized %p", tab) @@ -397,15 +393,15 @@ ephy_tab_new (void) { EphyTab *tab; - tab = EPHY_TAB (g_object_new (EPHY_TAB_TYPE, NULL)); - g_return_val_if_fail (tab->priv != NULL, NULL); + tab = EPHY_TAB (g_object_new (EPHY_TYPE_TAB, NULL)); + return tab; } static void ephy_tab_set_load_status (EphyTab *tab, gboolean status) { - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_TAB (tab)); tab->priv->load_status = status; @@ -415,7 +411,7 @@ ephy_tab_set_load_status (EphyTab *tab, gboolean status) gboolean ephy_tab_get_load_status (EphyTab *tab) { - g_return_val_if_fail (IS_EPHY_TAB (tab), FALSE); + g_return_val_if_fail (EPHY_IS_TAB (tab), FALSE); return tab->priv->load_status; } @@ -423,7 +419,7 @@ ephy_tab_get_load_status (EphyTab *tab) static void ephy_tab_set_link_message (EphyTab *tab, const char *message) { - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_TAB (tab)); g_free (tab->priv->link_message); tab->priv->link_message = g_strdup (message); @@ -434,7 +430,7 @@ ephy_tab_set_link_message (EphyTab *tab, const char *message) const char * ephy_tab_get_link_message (EphyTab *tab) { - g_return_val_if_fail (IS_EPHY_TAB (tab), NULL); + g_return_val_if_fail (EPHY_IS_TAB (tab), NULL); return tab->priv->link_message; } @@ -442,7 +438,7 @@ ephy_tab_get_link_message (EphyTab *tab) EphyEmbed * ephy_tab_get_embed (EphyTab *tab) { - g_return_val_if_fail (IS_EPHY_TAB (tab), NULL); + g_return_val_if_fail (EPHY_IS_TAB (tab), NULL); return tab->priv->embed; } @@ -450,8 +446,8 @@ ephy_tab_get_embed (EphyTab *tab) void ephy_tab_set_window (EphyTab *tab, EphyWindow *window) { - g_return_if_fail (IS_EPHY_TAB (tab)); - if (window) g_return_if_fail (IS_EPHY_WINDOW (window)); + g_return_if_fail (EPHY_IS_TAB (tab)); + if (window) g_return_if_fail (EPHY_IS_WINDOW (window)); if (window != tab->priv->window) { @@ -464,7 +460,7 @@ ephy_tab_set_window (EphyTab *tab, EphyWindow *window) EphyWindow * ephy_tab_get_window (EphyTab *tab) { - g_return_val_if_fail (IS_EPHY_TAB (tab), NULL); + g_return_val_if_fail (EPHY_IS_TAB (tab), NULL); return tab->priv->window; } @@ -472,7 +468,7 @@ ephy_tab_get_window (EphyTab *tab) void ephy_tab_get_size (EphyTab *tab, int *width, int *height) { - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_TAB (tab)); *width = tab->priv->width; *height = tab->priv->height; @@ -481,7 +477,7 @@ ephy_tab_get_size (EphyTab *tab, int *width, int *height) gboolean ephy_tab_get_visibility (EphyTab *tab) { - g_return_val_if_fail (IS_EPHY_TAB (tab), FALSE); + g_return_val_if_fail (EPHY_IS_TAB (tab), FALSE); return tab->priv->visibility; } @@ -490,7 +486,7 @@ void ephy_tab_set_visibility (EphyTab *tab, gboolean visible) { - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_TAB (tab)); tab->priv->visibility = visible; @@ -519,7 +515,7 @@ ephy_tab_set_icon_address (EphyTab *tab, const char *address) EphyBookmarks *eb; EphyHistory *history; - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_TAB (tab)); g_free (tab->priv->icon_address); @@ -542,7 +538,7 @@ ephy_tab_set_icon_address (EphyTab *tab, const char *address) const char * ephy_tab_get_icon_address (EphyTab *tab) { - g_return_val_if_fail (IS_EPHY_TAB (tab), NULL); + g_return_val_if_fail (EPHY_IS_TAB (tab), NULL); return tab->priv->icon_address; } @@ -766,7 +762,7 @@ ephy_tab_net_state_cb (EphyEmbed *embed, const char *uri, /* tab load completed, save in session */ Session *s; - s = SESSION (ephy_shell_get_session (ephy_shell)); + s = EPHY_SESSION (ephy_shell_get_session (ephy_shell)); session_save (s, SESSION_CRASHED); ephy_tab_set_load_percent (tab, 0); @@ -822,7 +818,7 @@ ephy_tab_visibility_cb (EphyEmbed *embed, gboolean visibility, static void ephy_tab_destroy_brsr_cb (EphyEmbed *embed, EphyTab *tab) { - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_TAB (tab)); g_return_if_fail (tab->priv->window != NULL); ephy_window_remove_tab (tab->priv->window, tab); @@ -929,7 +925,7 @@ ephy_tab_dom_mouse_click_cb (EphyEmbed *embed, window = ephy_tab_get_window (tab); g_return_val_if_fail (window != NULL, FALSE); - g_assert (IS_EPHY_EMBED_EVENT(event)); + g_assert (EPHY_IS_EMBED_EVENT(event)); ephy_embed_event_get_event_type (event, &type); ephy_embed_event_get_context (event, &context); @@ -980,7 +976,7 @@ ephy_tab_init (EphyTab *tab) single = ephy_embed_shell_get_embed_single (EPHY_EMBED_SHELL (ephy_shell)); - tab->priv = g_new0 (EphyTabPrivate, 1); + tab->priv = EPHY_TAB_GET_PRIVATE (tab); tab->priv->window = NULL; tab->priv->status_message = NULL; @@ -1075,7 +1071,7 @@ ephy_tab_init (EphyTab *tab) void ephy_tab_set_load_percent (EphyTab *tab, int percent) { - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_TAB (tab)); if (percent != tab->priv->load_percent) { @@ -1088,7 +1084,7 @@ ephy_tab_set_load_percent (EphyTab *tab, int percent) int ephy_tab_get_load_percent (EphyTab *tab) { - g_return_val_if_fail (IS_EPHY_TAB (tab), -1); + g_return_val_if_fail (EPHY_IS_TAB (tab), -1); return tab->priv->load_percent; } @@ -1127,7 +1123,7 @@ ephy_tab_update_navigation_flags (EphyTab *tab) TabNavigationFlags ephy_tab_get_navigation_flags (EphyTab *tab) { - g_return_val_if_fail (IS_EPHY_TAB (tab), 0); + g_return_val_if_fail (EPHY_IS_TAB (tab), 0); return tab->priv->nav_flags; } @@ -1135,7 +1131,7 @@ ephy_tab_get_navigation_flags (EphyTab *tab) const char * ephy_tab_get_status_message (EphyTab *tab) { - g_return_val_if_fail (IS_EPHY_TAB (tab), ""); + g_return_val_if_fail (EPHY_IS_TAB (tab), ""); if (tab->priv->link_message && tab->priv->link_message[0] != '\0') { @@ -1159,7 +1155,7 @@ ephy_tab_set_title (EphyTab *tab, const char *new_title) char *title_short = NULL; char *title = NULL; - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_TAB (tab)); g_free (tab->priv->title); @@ -1223,7 +1219,7 @@ ephy_tab_set_title (EphyTab *tab, const char *new_title) const char * ephy_tab_get_title (EphyTab *tab) { - g_return_val_if_fail (IS_EPHY_TAB (tab), ""); + g_return_val_if_fail (EPHY_IS_TAB (tab), ""); return tab->priv->title; } @@ -1231,7 +1227,7 @@ ephy_tab_get_title (EphyTab *tab) const char * ephy_tab_get_location (EphyTab *tab) { - g_return_val_if_fail (IS_EPHY_TAB (tab), ""); + g_return_val_if_fail (EPHY_IS_TAB (tab), ""); return tab->priv->address; } @@ -1241,7 +1237,7 @@ ephy_tab_set_location (EphyTab *tab, const char *address, TabAddressExpire expire) { - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_TAB (tab)); if (tab->priv->address) g_free (tab->priv->address); tab->priv->address = g_strdup (address); @@ -1262,7 +1258,7 @@ ephy_tab_set_location (EphyTab *tab, static void ephy_tab_set_security_level (EphyTab *tab, EmbedSecurityLevel level) { - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_TAB (tab)); tab->priv->security_level = level; @@ -1272,7 +1268,7 @@ ephy_tab_set_security_level (EphyTab *tab, EmbedSecurityLevel level) EmbedSecurityLevel ephy_tab_get_security_level (EphyTab *tab) { - g_return_val_if_fail (IS_EPHY_TAB (tab), STATE_IS_UNKNOWN); + g_return_val_if_fail (EPHY_IS_TAB (tab), STATE_IS_UNKNOWN); return tab->priv->security_level; } @@ -1280,7 +1276,7 @@ ephy_tab_get_security_level (EphyTab *tab) static void ephy_tab_set_zoom (EphyTab *tab, float zoom) { - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_TAB (tab)); tab->priv->zoom = zoom; @@ -1290,7 +1286,7 @@ ephy_tab_set_zoom (EphyTab *tab, float zoom) float ephy_tab_get_zoom (EphyTab *tab) { - g_return_val_if_fail (IS_EPHY_TAB (tab), 1.0); + g_return_val_if_fail (EPHY_IS_TAB (tab), 1.0); return tab->priv->zoom; } @@ -1298,7 +1294,7 @@ ephy_tab_get_zoom (EphyTab *tab) GObject * ephy_tab_get_action (EphyTab *tab) { - g_return_val_if_fail (IS_EPHY_TAB (tab), NULL); + g_return_val_if_fail (EPHY_IS_TAB (tab), NULL); return G_OBJECT (tab->priv->action); } diff --git a/src/ephy-tab.h b/src/ephy-tab.h index eaf4f6b62..022ac675b 100644 --- a/src/ephy-tab.h +++ b/src/ephy-tab.h @@ -26,15 +26,14 @@ G_BEGIN_DECLS -typedef struct EphyTabClass EphyTabClass; - -#define EPHY_TAB_TYPE (ephy_tab_get_type ()) -#define EPHY_TAB(obj) (GTK_CHECK_CAST ((obj), EPHY_TAB_TYPE, EphyTab)) -#define EPHY_TAB_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_TAB, EphyTabClass)) -#define IS_EPHY_TAB(obj) (GTK_CHECK_TYPE ((obj), EPHY_TAB_TYPE)) -#define IS_EPHY_TAB_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_TAB)) -#define EPHY_TAB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TAB_TYPE, EphyTabClass)) +#define EPHY_TYPE_TAB (ephy_tab_get_type ()) +#define EPHY_TAB(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_TAB, EphyTab)) +#define EPHY_TAB_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_TAB, EphyTabClass)) +#define EPHY_IS_TAB(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_TAB)) +#define EPHY_IS_TAB_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_TAB)) +#define EPHY_TAB_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_TAB, EphyTabClass)) +typedef struct EphyTabClass EphyTabClass; typedef struct EphyTab EphyTab; typedef struct EphyTabPrivate EphyTabPrivate; diff --git a/src/ephy-tabs-menu.c b/src/ephy-tabs-menu.c index ca9d625c2..02bcd9b08 100644 --- a/src/ephy-tabs-menu.c +++ b/src/ephy-tabs-menu.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 @@ -38,6 +40,9 @@ /** * Private data */ + +#define EPHY_TABS_MENU_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TABS_MENU, EphyTabsMenuPrivate)) + struct _EphyTabsMenuPrivate { EphyWindow *window; @@ -140,19 +145,17 @@ ephy_tabs_menu_class_init (EphyTabsMenuClass *klass) g_param_spec_object ("EphyWindow", "EphyWindow", "Parent window", - EPHY_WINDOW_TYPE, + EPHY_TYPE_WINDOW, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_type_class_add_private (object_class, sizeof(EphyTabsMenuPrivate)); } static void ephy_tabs_menu_init (EphyTabsMenu *menu) { - EphyTabsMenuPrivate *p; - - p = g_new0 (EphyTabsMenuPrivate, 1); - - menu->priv = p; + menu->priv = EPHY_TABS_MENU_GET_PRIVATE (menu); menu->priv->ui_id = 0; menu->priv->action_group = NULL; @@ -192,8 +195,6 @@ ephy_tabs_menu_finalize_impl (GObject *o) g_object_unref (p->action_group); } - g_free (p); - G_OBJECT_CLASS (g_object_class)->finalize (o); } diff --git a/src/ephy-tabs-menu.h b/src/ephy-tabs-menu.h index 7e63a47cc..466da48b5 100644 --- a/src/ephy-tabs-menu.h +++ b/src/ephy-tabs-menu.h @@ -21,23 +21,19 @@ #include "ephy-window.h" -/* object forward declarations */ +G_BEGIN_DECLS + +#define EPHY_TYPE_TABS_MENU (ephy_tabs_menu_get_type ()) +#define EPHY_TABS_MENU(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_TABS_MENU, EphyTabsMenu)) +#define EPHY_TABS_MENU_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_TABS_MENU, EphyTabsMenuClass)) +#define EPHY_IS_TABS_MENU(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_TABS_MENU)) +#define EPHY_IS_TABS_MENU_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_TABS_MENU)) +#define EPHY_TABS_MENU_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_TABS_MENU, EphyTabsMenuClass)) typedef struct _EphyTabsMenu EphyTabsMenu; typedef struct _EphyTabsMenuClass EphyTabsMenuClass; typedef struct _EphyTabsMenuPrivate EphyTabsMenuPrivate; -/** - * Editor object - */ - -#define EPHY_TYPE_TABS_MENU (ephy_tabs_menu_get_type()) -#define EPHY_TABS_MENU(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EPHY_TYPE_TABS_MENU, EphyTabsMenu)) -#define EPHY_TABS_MENU_CLASS(klass)(G_TYPE_CHECK_CLASS_CAST((klass), EPHY_TYPE_TABS_MENU, EphyTabsMenuClass)) -#define EPHY_IS_TABS_MENU(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EPHY_TYPE_TABS_MENU)) -#define EPHY_IS_TABS_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EPHY_TYPE_TABS_MENU)) -#define EPHY_TABS_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_TABS_MENU, EphyTabsMenuClass)) - struct _EphyTabsMenuClass { GObjectClass parent_class; @@ -57,5 +53,6 @@ EphyTabsMenu *ephy_tabs_menu_new (EphyWindow *window); void ephy_tabs_menu_update (EphyTabsMenu *menu); -#endif +G_END_DECLS +#endif diff --git a/src/ephy-toolbars-model.c b/src/ephy-toolbars-model.c index 6384b06e5..55d351873 100755 --- a/src/ephy-toolbars-model.c +++ b/src/ephy-toolbars-model.c @@ -56,6 +56,8 @@ enum static GObjectClass *parent_class = NULL; +#define EPHY_TOOLBARS_MODEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TOOLBARS_MODEL, EphyToolbarsModelPrivate)) + struct EphyToolbarsModelPrivate { EphyBookmarks *bookmarks; @@ -403,8 +405,10 @@ ephy_toolbars_model_class_init (EphyToolbarsModelClass *klass) g_param_spec_object ("bookmarks", "Bookmarks", "Bookmarks", - EPHY_BOOKMARKS_TYPE, + EPHY_TYPE_BOOKMARKS, G_PARAM_READWRITE)); + + g_type_class_add_private (object_class, sizeof(EphyToolbarsModelPrivate)); } static void @@ -456,7 +460,8 @@ toolbar_removed (EphyToolbarsModel *model, int position) static void ephy_toolbars_model_init (EphyToolbarsModel *t) { - t->priv = g_new0 (EphyToolbarsModelPrivate, 1); + t->priv = EPHY_TOOLBARS_MODEL_GET_PRIVATE (t); + t->priv->bookmarks = NULL; t->priv->loading = FALSE; t->priv->xml_file = g_build_filename (ephy_dot_dir (), @@ -474,17 +479,12 @@ ephy_toolbars_model_finalize (GObject *object) { EphyToolbarsModel *t = EPHY_TOOLBARS_MODEL (object); - g_return_if_fail (object != NULL); - g_return_if_fail (IS_EPHY_TOOLBARS_MODEL (object)); - save_changes (t); g_object_unref (t->priv->bookmarks); g_free (t->priv->xml_file); - g_free (t->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -493,7 +493,7 @@ ephy_toolbars_model_new (EphyBookmarks *bookmarks) { EphyToolbarsModel *t; - t = EPHY_TOOLBARS_MODEL (g_object_new (EPHY_TOOLBARS_MODEL_TYPE, + t = EPHY_TOOLBARS_MODEL (g_object_new (EPHY_TYPE_TOOLBARS_MODEL, "bookmarks", bookmarks, NULL)); diff --git a/src/ephy-toolbars-model.h b/src/ephy-toolbars-model.h index 0261a85fb..580a321fa 100755 --- a/src/ephy-toolbars-model.h +++ b/src/ephy-toolbars-model.h @@ -24,15 +24,14 @@ G_BEGIN_DECLS -typedef struct EphyToolbarsModelClass EphyToolbarsModelClass; - -#define EPHY_TOOLBARS_MODEL_TYPE (ephy_toolbars_model_get_type ()) -#define EPHY_TOOLBARS_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TOOLBARS_MODEL_TYPE, EphyToolbarsModel)) -#define EPHY_TOOLBARS_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TOOLBARS_MODEL_TYPE, EphyToolbarsModelClass)) -#define IS_EPHY_TOOLBARS_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_TOOLBARS_MODEL_TYPE)) -#define IS_EPHY_TOOLBARS_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EPHY_TOOLBARS_MODEL_TYPE)) -#define EPHY_TOOLBARS_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_TOOLBARS_MODEL_TYPE, EphyToolbarsModelClass)) +#define EPHY_TYPE_TOOLBARS_MODEL (ephy_toolbars_model_get_type ()) +#define EPHY_TOOLBARS_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_TOOLBARS_MODEL, EphyToolbarsModel)) +#define EPHY_TOOLBARS_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_TOOLBARS_MODEL, EphyToolbarsModelClass)) +#define EPHY_IS_TOOLBARS_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_TOOLBARS_MODEL)) +#define EPHY_IS_TOOLBARS_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_TOOLBARS_MODEL)) +#define EPHY_TOOLBARS_MODEL_GET_CLASS(o)(G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_TOOLBARS_MODEL, EphyToolbarsModelClass)) +typedef struct EphyToolbarsModelClass EphyToolbarsModelClass; typedef struct EphyToolbarsModel EphyToolbarsModel; typedef struct EphyToolbarsModelPrivate EphyToolbarsModelPrivate; diff --git a/src/ephy-window.c b/src/ephy-window.c index 412ce79e9..661e695c3 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -260,6 +260,8 @@ static GtkActionEntry ephy_popups_entries [] = { }; static guint ephy_popups_n_entries = G_N_ELEMENTS (ephy_popups_entries); +#define EPHY_WINDOW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_WINDOW, EphyWindowPrivate)) + struct EphyWindowPrivate { GtkWidget *main_vbox; @@ -333,7 +335,7 @@ remove_from_session (EphyWindow *window) { Session *session; - session = SESSION (ephy_shell_get_session (ephy_shell)); + session = EPHY_SESSION (ephy_shell_get_session (ephy_shell)); g_return_if_fail (session != NULL); session_remove_window (session, window); @@ -376,6 +378,8 @@ ephy_window_class_init (EphyWindowClass *klass) widget_class->show = ephy_window_show; gtkobject_class->destroy = ephy_window_destroy; + + g_type_class_add_private (object_class, sizeof(EphyWindowPrivate)); } static void @@ -709,7 +713,7 @@ sync_tab_load_progress (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) { if (window->priv->closing) return; - statusbar_set_progress (STATUSBAR (window->priv->statusbar), + statusbar_set_progress (EPHY_STATUSBAR (window->priv->statusbar), ephy_tab_get_load_percent (tab)); } @@ -725,7 +729,7 @@ sync_tab_load_status (EphyTab *dummy, GParamSpec *pspec, EphyWindow *window) for (l = tabs; l != NULL; l = l->next) { EphyTab *tab = EPHY_TAB(l->data); - g_return_if_fail (IS_EPHY_TAB(tab)); + g_return_if_fail (EPHY_IS_TAB(tab)); if (ephy_tab_get_load_status (tab)) { @@ -750,7 +754,7 @@ sync_tab_message (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) { if (window->priv->closing) return; - statusbar_set_message (STATUSBAR (window->priv->statusbar), + statusbar_set_message (EPHY_STATUSBAR (window->priv->statusbar), ephy_tab_get_status_message (tab)); } @@ -859,7 +863,7 @@ sync_tab_security (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) } - statusbar_set_security_state (STATUSBAR (window->priv->statusbar), + statusbar_set_security_state (EPHY_STATUSBAR (window->priv->statusbar), secure, tooltip); g_free (tooltip); @@ -905,7 +909,7 @@ sync_tab_visibility (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) for (l = tabs; l != NULL; l = l->next) { EphyTab *tab = EPHY_TAB(l->data); - g_return_if_fail (IS_EPHY_TAB(tab)); + g_return_if_fail (EPHY_IS_TAB(tab)); if (ephy_tab_get_visibility (tab)) { @@ -1071,12 +1075,12 @@ tab_context_menu_cb (EphyEmbed *embed, { EphyTab *tab; - g_return_val_if_fail (IS_EPHY_WINDOW (window), FALSE); - g_return_val_if_fail (IS_EPHY_EMBED (embed), FALSE); - g_assert (IS_EPHY_EMBED_EVENT(event)); + g_return_val_if_fail (EPHY_IS_WINDOW (window), FALSE); + g_return_val_if_fail (EPHY_IS_EMBED (embed), FALSE); + g_assert (EPHY_IS_EMBED_EVENT(event)); tab = EPHY_TAB (g_object_get_data (G_OBJECT (embed), "EphyTab")); - g_return_val_if_fail (IS_EPHY_TAB (tab), FALSE); + g_return_val_if_fail (EPHY_IS_TAB (tab), FALSE); g_return_val_if_fail (window->priv->active_tab == tab, FALSE); window = ephy_tab_get_window (tab); @@ -1093,7 +1097,7 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab) EphyTab *old_tab; EphyEmbed *embed; - g_return_if_fail (IS_EPHY_WINDOW (window)); + g_return_if_fail (EPHY_IS_WINDOW (window)); if (ephy_tab_get_window (new_tab) != window) return; old_tab = window->priv->active_tab; @@ -1237,7 +1241,7 @@ tab_added_cb (EphyNotebook *notebook, GtkWidget *child, EphyWindow *window) { EphyTab *tab; - g_return_if_fail (IS_EPHY_EMBED (child)); + g_return_if_fail (EPHY_IS_EMBED (child)); tab = EPHY_TAB (g_object_get_data (G_OBJECT (child), "EphyTab")); window->priv->num_tabs++; @@ -1256,7 +1260,7 @@ tab_removed_cb (EphyNotebook *notebook, GtkWidget *child, EphyWindow *window) { EphyTab *tab; - g_return_if_fail (IS_EPHY_EMBED (child)); + g_return_if_fail (EPHY_IS_EMBED (child)); tab = EPHY_TAB (g_object_get_data (G_OBJECT (child), "EphyTab")); g_signal_handlers_disconnect_by_func (G_OBJECT (tab), @@ -1287,8 +1291,8 @@ tab_detached_cb (EphyNotebook *notebook, GtkWidget *child, { EphyWindow *window; - g_return_if_fail (IS_EPHY_NOTEBOOK (notebook)); - g_return_if_fail (IS_EPHY_EMBED (child)); + g_return_if_fail (EPHY_IS_NOTEBOOK (notebook)); + g_return_if_fail (EPHY_IS_EMBED (child)); window = ephy_window_new (); ephy_notebook_move_page (notebook, @@ -1339,9 +1343,10 @@ ephy_window_init (EphyWindow *window) LOG ("EphyWindow initialising %p", window) - session = SESSION (ephy_shell_get_session (ephy_shell)); + session = EPHY_SESSION (ephy_shell_get_session (ephy_shell)); + + window->priv = EPHY_WINDOW_GET_PRIVATE (window); - window->priv = g_new0 (EphyWindowPrivate, 1); window->priv->active_tab = NULL; window->priv->chrome_mask = 0; window->priv->closing = FALSE; @@ -1398,13 +1403,7 @@ save_window_chrome (EphyWindow *window) static void ephy_window_finalize (GObject *object) { - EphyWindow *window; - - g_return_if_fail (IS_EPHY_WINDOW (object)); - - window = EPHY_WINDOW (object); - - g_return_if_fail (window->priv != NULL); + EphyWindow *window = EPHY_WINDOW (object); if (window->priv->find_dialog) { @@ -1431,8 +1430,6 @@ ephy_window_finalize (GObject *object) window->priv->action_group); g_object_unref (window->ui_merge); - g_free (window->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); LOG ("Ephy Window finalized %p", window) @@ -1443,7 +1440,7 @@ ephy_window_finalize (GObject *object) EphyWindow * ephy_window_new (void) { - return EPHY_WINDOW (g_object_new (EPHY_WINDOW_TYPE, NULL)); + return EPHY_WINDOW (g_object_new (EPHY_TYPE_WINDOW, NULL)); } EmbedChromeMask @@ -1527,7 +1524,7 @@ ephy_window_set_chrome (EphyWindow *window, GtkWidget * ephy_window_get_notebook (EphyWindow *window) { - g_return_val_if_fail (IS_EPHY_WINDOW (window), NULL); + g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL); return GTK_WIDGET (window->priv->notebook); } @@ -1540,8 +1537,8 @@ ephy_window_add_tab (EphyWindow *window, { GtkWidget *widget; - g_return_if_fail (IS_EPHY_WINDOW (window)); - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_WINDOW (window)); + g_return_if_fail (EPHY_IS_TAB (tab)); widget = GTK_WIDGET(ephy_tab_get_embed (tab)); @@ -1579,7 +1576,7 @@ real_get_active_tab (EphyWindow *window, int page_num) g_return_val_if_fail (GTK_IS_WIDGET (embed_widget), NULL); tab = g_object_get_data (G_OBJECT (embed_widget), "EphyTab"); - g_return_val_if_fail (IS_EPHY_TAB (tab), NULL); + g_return_val_if_fail (EPHY_IS_TAB (tab), NULL); return tab; } @@ -1590,8 +1587,8 @@ ephy_window_remove_tab (EphyWindow *window, { GtkWidget *embed; - g_return_if_fail (IS_EPHY_WINDOW (window)); - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_WINDOW (window)); + g_return_if_fail (EPHY_IS_TAB (tab)); embed = GTK_WIDGET (ephy_tab_get_embed (tab)); @@ -1605,7 +1602,7 @@ ephy_window_load_url (EphyWindow *window, { EphyEmbed *embed; - g_return_if_fail (IS_EPHY_WINDOW(window)); + g_return_if_fail (EPHY_IS_WINDOW(window)); embed = ephy_window_get_active_embed (window); g_return_if_fail (embed != NULL); g_return_if_fail (url != NULL); @@ -1670,7 +1667,7 @@ void ephy_window_update_control (EphyWindow *window, ControlID control) { - g_return_if_fail (IS_EPHY_WINDOW (window)); + g_return_if_fail (EPHY_IS_WINDOW (window)); switch (control) { @@ -1686,7 +1683,7 @@ ephy_window_update_control (EphyWindow *window, EphyTab * ephy_window_get_active_tab (EphyWindow *window) { - g_return_val_if_fail (IS_EPHY_WINDOW (window), NULL); + g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL); return window->priv->active_tab; } @@ -1696,7 +1693,7 @@ ephy_window_get_active_embed (EphyWindow *window) { EphyTab *tab; - g_return_val_if_fail (IS_EPHY_WINDOW (window), NULL); + g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL); tab = ephy_window_get_active_tab (window); @@ -1720,7 +1717,7 @@ ephy_window_get_tabs (EphyWindow *window) EphyTab *tab; tab = g_object_get_data (G_OBJECT (w), "EphyTab"); - g_return_val_if_fail (IS_EPHY_TAB (G_OBJECT (tab)), NULL); + g_return_val_if_fail (EPHY_IS_TAB (G_OBJECT (tab)), NULL); tabs = g_list_prepend (tabs, tab); i++; @@ -1762,7 +1759,7 @@ ephy_window_notebook_switch_page_cb (GtkNotebook *notebook, { EphyTab *tab; - g_return_if_fail (IS_EPHY_WINDOW (window)); + g_return_if_fail (EPHY_IS_WINDOW (window)); if (window->priv->closing) return; /* get the new tab */ @@ -1837,7 +1834,7 @@ ephy_window_set_zoom (EphyWindow *window, EphyEmbed *embed; float current_zoom = 1.0; - g_return_if_fail (IS_EPHY_WINDOW (window)); + g_return_if_fail (EPHY_IS_WINDOW (window)); embed = ephy_window_get_active_embed (window); g_return_if_fail (embed != NULL); diff --git a/src/ephy-window.h b/src/ephy-window.h index d1eeb1d20..4f5a4d677 100644 --- a/src/ephy-window.h +++ b/src/ephy-window.h @@ -29,14 +29,14 @@ G_BEGIN_DECLS -typedef struct EphyWindowClass EphyWindowClass; - -#define EPHY_WINDOW_TYPE (ephy_window_get_type ()) -#define EPHY_WINDOW(obj) (GTK_CHECK_CAST ((obj), EPHY_WINDOW_TYPE, EphyWindow)) -#define EPHY_WINDOW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_WINDOW, EphyWindowClass)) -#define IS_EPHY_WINDOW(obj) (GTK_CHECK_TYPE ((obj), EPHY_WINDOW_TYPE)) -#define IS_EPHY_WINDOW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_WINDOW)) +#define EPHY_TYPE_WINDOW (ephy_window_get_type ()) +#define EPHY_WINDOW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_WINDOW, EphyWindow)) +#define EPHY_WINDOW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_WINDOW, EphyWindowClass)) +#define EPHY_IS_WINDOW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_WINDOW)) +#define EPHY_IS_WINDOW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_WINDOW)) +#define EPHY_WINDOW_GET_CLASS(o)(G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_WINDOW, EphyWindowClass)) +typedef struct EphyWindowClass EphyWindowClass; typedef struct EphyWindow EphyWindow; typedef struct EphyWindowPrivate EphyWindowPrivate; typedef struct Toolbar Toolbar; diff --git a/src/language-editor.c b/src/language-editor.c index 6950062dd..d72a50699 100644 --- a/src/language-editor.c +++ b/src/language-editor.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 "language-editor.h" @@ -56,6 +58,7 @@ EphyDialogProperty properties [] = { -1, NULL, NULL } }; +#define EPHY_LANGUAGE_EDITOR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_LANGUAGE_EDITOR, LanguageEditorPrivate)) struct LanguageEditorPrivate { @@ -74,8 +77,6 @@ static void language_editor_class_init (LanguageEditorClass *klass); static void language_editor_init (LanguageEditor *ge); -static void -language_editor_finalize (GObject *object); /* Glade callbacks */ @@ -106,7 +107,7 @@ language_editor_get_type (void) (GInstanceInitFunc) language_editor_init }; - language_editor_type = g_type_register_static (EPHY_DIALOG_TYPE, + language_editor_type = g_type_register_static (EPHY_TYPE_DIALOG, "LanguageEditor", &our_info, 0); } @@ -122,8 +123,6 @@ language_editor_class_init (LanguageEditorClass *klass) parent_class = g_type_class_peek_parent (klass); - object_class->finalize = language_editor_finalize; - signals[CHANGED] = g_signal_new ("changed", G_OBJECT_CLASS_TYPE (object_class), @@ -134,6 +133,8 @@ language_editor_class_init (LanguageEditorClass *klass) G_TYPE_NONE, 1, G_TYPE_POINTER); + + g_type_class_add_private (object_class, sizeof(LanguageEditorPrivate)); } static void @@ -312,7 +313,7 @@ language_editor_init (LanguageEditor *le) GtkWidget *add_button; GtkWidget *remove_button; - le->priv = g_new0 (LanguageEditorPrivate, 1); + le->priv = EPHY_LANGUAGE_EDITOR_GET_PRIVATE (le); ephy_dialog_construct (EPHY_DIALOG(le), properties, @@ -332,29 +333,12 @@ language_editor_init (LanguageEditor *le) optionmenu); } -static void -language_editor_finalize (GObject *object) -{ - LanguageEditor *ge; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_LANGUAGE_EDITOR (object)); - - ge = LANGUAGE_EDITOR (object); - - g_return_if_fail (ge->priv != NULL); - - g_free (ge->priv); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - LanguageEditor * language_editor_new (GtkWidget *parent) { - return LANGUAGE_EDITOR (g_object_new (LANGUAGE_EDITOR_TYPE, - "ParentWindow", parent, - NULL)); + return EPHY_LANGUAGE_EDITOR (g_object_new (EPHY_TYPE_LANGUAGE_EDITOR, + "ParentWindow", parent, + NULL)); } void diff --git a/src/language-editor.h b/src/language-editor.h index c4da83028..536d16eb8 100644 --- a/src/language-editor.h +++ b/src/language-editor.h @@ -28,15 +28,15 @@ G_BEGIN_DECLS +#define EPHY_TYPE_LANGUAGE_EDITOR (language_editor_get_type ()) +#define EPHY_LANGUAGE_EDITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_LANGUAGE_EDITOR, LanguageEditor)) +#define EPHY_LANGUAGE_EDITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_LANGUAGE_EDITOR, LanguageEditorClass)) +#define EPHY_IS_LANGUAGE_EDITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_LANGUAGE_EDITOR)) +#define EPHY_IS_LANGUAGE_EDITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_LANGUAGE_EDITOR)) +#define EPHY_LANGUAGE_EDITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_LANGUAGE_EDITOR, LanguageEditorClass)) + typedef struct LanguageEditor LanguageEditor; typedef struct LanguageEditorClass LanguageEditorClass; - -#define LANGUAGE_EDITOR_TYPE (language_editor_get_type ()) -#define LANGUAGE_EDITOR(obj) (GTK_CHECK_CAST ((obj), LANGUAGE_EDITOR_TYPE, LanguageEditor)) -#define LANGUAGE_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), LANGUAGE_EDITOR, LanguageEditorClass)) -#define IS_LANGUAGE_EDITOR(obj) (GTK_CHECK_TYPE ((obj), LANGUAGE_EDITOR_TYPE)) -#define IS_LANGUAGE_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), LANGUAGE_EDITOR)) - typedef struct LanguageEditorPrivate LanguageEditorPrivate; struct LanguageEditor diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c index 45a816939..b57cde4d4 100755 --- a/src/pdm-dialog.c +++ b/src/pdm-dialog.c @@ -76,6 +76,8 @@ struct PdmActionInfo PdmDialog *dialog; }; +#define EPHY_PDM_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_PDM_DIALOG, PdmDialogPrivate)) + struct PdmDialogPrivate { GtkTreeModel *model; @@ -145,9 +147,9 @@ pdm_dialog_get_type (void) (GInstanceInitFunc) pdm_dialog_init }; - pdm_dialog_type = g_type_register_static (EPHY_DIALOG_TYPE, - "PdmDialog", - &our_info, 0); + pdm_dialog_type = g_type_register_static (EPHY_TYPE_DIALOG, + "PdmDialog", + &our_info, 0); } return pdm_dialog_type; @@ -162,6 +164,8 @@ pdm_dialog_class_init (PdmDialogClass *klass) parent_class = g_type_class_peek_parent (klass); object_class->finalize = pdm_dialog_finalize; + + g_type_class_add_private (object_class, sizeof(PdmDialogPrivate)); } static void @@ -610,7 +614,8 @@ pdm_dialog_init (PdmDialog *dialog) single = ephy_embed_shell_get_embed_single (EPHY_EMBED_SHELL (ephy_shell)); - dialog->priv = g_new0 (PdmDialogPrivate, 1); + dialog->priv = EPHY_PDM_DIALOG_GET_PRIVATE (dialog); + dialog->priv->cookies = NULL; dialog->priv->passwords = NULL; @@ -654,14 +659,7 @@ pdm_dialog_init (PdmDialog *dialog) static void pdm_dialog_finalize (GObject *object) { - PdmDialog *dialog; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_PDM_DIALOG (object)); - - dialog = PDM_DIALOG (object); - - g_return_if_fail (dialog->priv != NULL); + PdmDialog *dialog = EPHY_PDM_DIALOG (object); pdm_dialog_passwords_free (dialog->priv->passwords, NULL); pdm_dialog_cookies_free (dialog->priv->cookies, NULL); @@ -669,9 +667,6 @@ pdm_dialog_finalize (GObject *object) g_free (dialog->priv->passwords); g_free (dialog->priv->cookies); - g_free (dialog->priv); - dialog->priv = NULL; - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -680,9 +675,9 @@ pdm_dialog_new (GtkWidget *window) { PdmDialog *dialog; - dialog = PDM_DIALOG (g_object_new (PDM_DIALOG_TYPE, - "ParentWindow", window, - NULL)); + dialog = EPHY_PDM_DIALOG (g_object_new (EPHY_TYPE_PDM_DIALOG, + "ParentWindow", window, + NULL)); return EPHY_DIALOG(dialog); } @@ -820,8 +815,8 @@ pdm_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer data) } else if (response_id == GTK_RESPONSE_HELP) { - g_return_if_fail (IS_PDM_DIALOG (data)); + g_return_if_fail (EPHY_IS_PDM_DIALOG (data)); - pdm_dialog_show_help (PDM_DIALOG (data)); + pdm_dialog_show_help (EPHY_PDM_DIALOG (data)); } } diff --git a/src/pdm-dialog.h b/src/pdm-dialog.h index 7216d4ac0..b5878a6f6 100644 --- a/src/pdm-dialog.h +++ b/src/pdm-dialog.h @@ -24,15 +24,15 @@ G_BEGIN_DECLS +#define EPHY_TYPE_PDM_DIALOG (pdm_dialog_get_type ()) +#define EPHY_PDM_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_PDM_DIALOG, PdmDialog)) +#define EPHY_PDM_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_PDM_DIALOG, PdmDialogClass)) +#define EPHY_IS_PDM_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_PDM_DIALOG)) +#define EPHY_IS_PDM_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_PDM_DIALOG)) +#define EPHY_PDM_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_PDM_DIALOG, PdmDialogClass)) + typedef struct PdmDialog PdmDialog; typedef struct PdmDialogClass PdmDialogClass; - -#define PDM_DIALOG_TYPE (pdm_dialog_get_type ()) -#define PDM_DIALOG(obj) (GTK_CHECK_CAST ((obj), PDM_DIALOG_TYPE, PdmDialog)) -#define PDM_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), PDM_DIALOG, PdmDialogClass)) -#define IS_PDM_DIALOG(obj) (GTK_CHECK_TYPE ((obj), PDM_DIALOG_TYPE)) -#define IS_PDM_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), PDM_DIALOG)) - typedef struct PdmDialogPrivate PdmDialogPrivate; struct PdmDialog @@ -53,4 +53,3 @@ EphyDialog *pdm_dialog_new (GtkWidget *window); G_END_DECLS #endif - diff --git a/src/popup-commands.c b/src/popup-commands.c index 8a9548510..c1557eb7f 100644 --- a/src/popup-commands.c +++ b/src/popup-commands.c @@ -241,7 +241,7 @@ popup_cmd_copy_link_address (GtkAction *action, const GValue *value; event = get_event_info (window); - g_return_if_fail (IS_EPHY_EMBED_EVENT (event)); + g_return_if_fail (EPHY_IS_EMBED_EVENT (event)); if (event->context & EMBED_CONTEXT_EMAIL_LINK) { diff --git a/src/ppview-toolbar.c b/src/ppview-toolbar.c index 33ecd0a81..1f7c2c224 100755 --- a/src/ppview-toolbar.c +++ b/src/ppview-toolbar.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 @@ -55,6 +57,8 @@ enum static GObjectClass *parent_class = NULL; +#define EPHY_PPVIEW_TOOLBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_PPVIEW_TOOLBAR, PPViewToolbarPrivate)) + struct PPViewToolbarPrivate { EphyWindow *window; @@ -123,30 +127,29 @@ static const gchar *ui_info = GType ppview_toolbar_get_type (void) { - static GType ppview_toolbar_type = 0; - - if (ppview_toolbar_type == 0) - { - static const GTypeInfo our_info = - { - sizeof (PPViewToolbarClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) ppview_toolbar_class_init, - NULL, - NULL, /* class_data */ - sizeof (PPViewToolbar), - 0, /* n_preallocs */ - (GInstanceInitFunc) ppview_toolbar_init - }; - - ppview_toolbar_type = g_type_register_static (G_TYPE_OBJECT, - "PPViewToolbar", - &our_info, 0); + static GType ppview_toolbar_type = 0; + + if (ppview_toolbar_type == 0) + { + static const GTypeInfo our_info = + { + sizeof (PPViewToolbarClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) ppview_toolbar_class_init, + NULL, + NULL, /* class_data */ + sizeof (PPViewToolbar), + 0, /* n_preallocs */ + (GInstanceInitFunc) ppview_toolbar_init + }; + + ppview_toolbar_type = g_type_register_static (G_TYPE_OBJECT, + "PPViewToolbar", + &our_info, 0); } - return ppview_toolbar_type; - + return ppview_toolbar_type; } static void @@ -166,8 +169,11 @@ ppview_toolbar_class_init (PPViewToolbarClass *klass) g_param_spec_object ("EphyWindow", "EphyWindow", "Parent window", - EPHY_WINDOW_TYPE, - G_PARAM_READWRITE)); + EPHY_TYPE_WINDOW, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + + g_type_class_add_private (object_class, sizeof(PPViewToolbarPrivate)); } static void @@ -176,7 +182,7 @@ ppview_toolbar_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - PPViewToolbar *t = PPVIEW_TOOLBAR (object); + PPViewToolbar *t = EPHY_PPVIEW_TOOLBAR (object); switch (prop_id) { @@ -192,7 +198,7 @@ ppview_toolbar_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - PPViewToolbar *t = PPVIEW_TOOLBAR (object); + PPViewToolbar *t = EPHY_PPVIEW_TOOLBAR (object); switch (prop_id) { @@ -251,7 +257,7 @@ ppview_toolbar_set_window (PPViewToolbar *t, EphyWindow *window) static void ppview_toolbar_init (PPViewToolbar *t) { - t->priv = g_new0 (PPViewToolbarPrivate, 1); + t->priv = EPHY_PPVIEW_TOOLBAR_GET_PRIVATE (t); t->priv->window = NULL; t->priv->ui_merge = NULL; @@ -261,22 +267,13 @@ ppview_toolbar_init (PPViewToolbar *t) static void ppview_toolbar_finalize (GObject *object) { - PPViewToolbar *t; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_PPVIEW_TOOLBAR (object)); - - t = PPVIEW_TOOLBAR (object); - - g_return_if_fail (t->priv != NULL); + PPViewToolbar *t = EPHY_PPVIEW_TOOLBAR (object); gtk_ui_manager_remove_ui (t->priv->ui_merge, t->priv->ui_id); gtk_ui_manager_remove_action_group (t->priv->ui_merge, t->priv->action_group); g_object_unref (t->priv->action_group); - g_free (t->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -285,11 +282,9 @@ ppview_toolbar_new (EphyWindow *window) { PPViewToolbar *t; - t = PPVIEW_TOOLBAR (g_object_new (PPVIEW_TOOLBAR_TYPE, - "EphyWindow", window, - NULL)); - - g_return_val_if_fail (t->priv != NULL, NULL); + t = EPHY_PPVIEW_TOOLBAR (g_object_new (EPHY_TYPE_PPVIEW_TOOLBAR, + "EphyWindow", window, + NULL)); return t; } @@ -302,7 +297,7 @@ toolbar_cmd_ppv_goto_first (GtkUIManager *merge, EphyEmbed *embed; embed = ephy_window_get_active_embed (window); - g_return_if_fail (embed != NULL); + g_return_if_fail (EPHY_IS_EMBED (embed)); ephy_embed_print_preview_navigate (embed, PRINTPREVIEW_HOME, 0); @@ -354,7 +349,7 @@ toolbar_cmd_ppv_go_back (GtkUIManager *merge, EphyEmbed *embed; embed = ephy_window_get_active_embed (window); - g_return_if_fail (embed != NULL); + g_return_if_fail (EPHY_IS_EMBED (embed)); t->priv->current_page = clamp_page_limits (t, t->priv->current_page - 1); @@ -373,7 +368,7 @@ toolbar_cmd_ppv_go_forward (GtkUIManager *merge, EphyEmbed *embed; embed = ephy_window_get_active_embed (window); - g_return_if_fail (embed != NULL); + g_return_if_fail (EPHY_IS_EMBED (embed)); t->priv->current_page = clamp_page_limits (t, t->priv->current_page + 1); @@ -392,18 +387,18 @@ toolbar_cmd_ppv_close (GtkUIManager *merge, EphyEmbed *embed; GtkWidget *notebook; - g_return_if_fail (IS_PPVIEW_TOOLBAR (t)); + g_return_if_fail (EPHY_IS_PPVIEW_TOOLBAR (t)); window = t->priv->window; - g_return_if_fail (IS_EPHY_WINDOW (window)); + g_return_if_fail (EPHY_IS_WINDOW (window)); embed = ephy_window_get_active_embed (window); - g_return_if_fail (IS_EPHY_EMBED (embed)); + g_return_if_fail (EPHY_IS_EMBED (embed)); ephy_window_set_chrome (window, t->priv->original_mask); notebook = ephy_window_get_notebook (window); - g_return_if_fail (IS_EPHY_NOTEBOOK (notebook)); + g_return_if_fail (EPHY_IS_NOTEBOOK (notebook)); ephy_notebook_set_show_tabs (EPHY_NOTEBOOK (notebook), TRUE); diff --git a/src/ppview-toolbar.h b/src/ppview-toolbar.h index 35356a0e5..b71444ebb 100644 --- a/src/ppview-toolbar.h +++ b/src/ppview-toolbar.h @@ -26,15 +26,15 @@ G_BEGIN_DECLS +#define EPHY_TYPE_PPVIEW_TOOLBAR (ppview_toolbar_get_type ()) +#define EPHY_PPVIEW_TOOLBAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_PPVIEW_TOOLBAR, PPViewToolbar)) +#define EPHY_PPVIEW_TOOLBAR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_PPVIEW_TOOLBAR, PPViewToolbarClass)) +#define EPHY_IS_PPVIEW_TOOLBAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_PPVIEW_TOOLBAR)) +#define EPHY_IS_PPVIEW_TOOLBAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_PPVIEW_TOOLBAR)) +#define EPHY_PPVIEW_TOOLBAR_GET_CLASS(o)(G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_PPVIEW_TOOLBAR, PPViewToolbarClass)) + typedef struct PPViewToolbar PPViewToolbar; typedef struct PPViewToolbarClass PPViewToolbarClass; - -#define PPVIEW_TOOLBAR_TYPE (ppview_toolbar_get_type ()) -#define PPVIEW_TOOLBAR(obj) (GTK_CHECK_CAST ((obj), PPVIEW_TOOLBAR_TYPE, PPViewToolbar)) -#define PPVIEW_TOOLBAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), PPVIEW_TOOLBAR, PPViewToolbarClass)) -#define IS_PPVIEW_TOOLBAR(obj) (GTK_CHECK_TYPE ((obj), PPVIEW_TOOLBAR_TYPE)) -#define IS_PPVIEW_TOOLBAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), PPVIEW_TOOLBAR)) - typedef struct PPViewToolbarPrivate PPViewToolbarPrivate; struct PPViewToolbar diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index 5c332bca8..6f0b05e97 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.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 @@ -305,6 +307,8 @@ typedef struct gchar *code; } EphyLangItem; +#define EPHY_PREFS_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_PREFS_DIALOG, PrefsDialogPrivate)) + struct PrefsDialogPrivate { GtkWidget *notebook; @@ -341,7 +345,7 @@ prefs_dialog_get_type (void) (GInstanceInitFunc) prefs_dialog_init }; - prefs_dialog_type = g_type_register_static (EPHY_DIALOG_TYPE, + prefs_dialog_type = g_type_register_static (EPHY_TYPE_DIALOG, "PrefsDialog", &our_info, 0); } @@ -353,9 +357,9 @@ prefs_dialog_get_type (void) EphyDialog * prefs_dialog_new (GtkWidget *parent) { - EphyDialog *dialog; + EphyDialog *dialog; - dialog = EPHY_DIALOG (g_object_new (PREFS_DIALOG_TYPE, + dialog = EPHY_DIALOG (g_object_new (EPHY_TYPE_PREFS_DIALOG, "ParentWindow", parent, NULL)); @@ -370,6 +374,8 @@ prefs_dialog_class_init (PrefsDialogClass *klass) parent_class = g_type_class_peek_parent (klass); object_class->finalize = prefs_dialog_finalize; + + g_type_class_add_private (object_class, sizeof(PrefsDialogPrivate)); } static void @@ -386,14 +392,7 @@ free_lang_item (EphyLangItem *item, gpointer user_data) static void prefs_dialog_finalize (GObject *object) { - PrefsDialog *pd; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_PREFS_DIALOG (object)); - - pd = PREFS_DIALOG (object); - - g_return_if_fail (pd->priv != NULL); + PrefsDialog *pd = EPHY_PREFS_DIALOG (object); g_list_foreach (pd->priv->langs, (GFunc) free_lang_item, NULL); g_list_free (pd->priv->langs); @@ -407,8 +406,6 @@ prefs_dialog_finalize (GObject *object) g_list_foreach (pd->priv->fonts_languages, (GFunc) g_free, NULL); g_list_free (pd->priv->fonts_languages); - g_free (pd->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -814,11 +811,11 @@ autodetect_encoding_menu_changed_cb (GtkOptionMenu *option_menu, gpointer data) guint i; EncodingAutodetectorInfo *info; - g_return_if_fail (IS_PREFS_DIALOG (data)); + g_return_if_fail (EPHY_IS_PREFS_DIALOG (data)); i = gtk_option_menu_get_history (option_menu); - l = g_list_nth (PREFS_DIALOG (data)->priv->autodetectors, i); + l = g_list_nth (EPHY_PREFS_DIALOG (data)->priv->autodetectors, i); if (l) { @@ -997,7 +994,7 @@ language_menu_changed_cb (GtkOptionMenu *option_menu, GSList *list = NULL; GList *lang = NULL; - g_return_if_fail (IS_PREFS_DIALOG (data)); + g_return_if_fail (EPHY_IS_PREFS_DIALOG (data)); list = eel_gconf_get_string_list (CONF_RENDERING_LANGUAGE); g_return_if_fail (list != NULL); @@ -1005,7 +1002,7 @@ language_menu_changed_cb (GtkOptionMenu *option_menu, /* Subst the first item according to the optionmenu */ i = gtk_option_menu_get_history (option_menu); - lang = g_list_nth (PREFS_DIALOG (data)->priv->langs, i); + lang = g_list_nth (EPHY_PREFS_DIALOG (data)->priv->langs, i); if (lang) { @@ -1082,7 +1079,7 @@ prefs_dialog_init (PrefsDialog *pd) EphyDialog *dialog = EPHY_DIALOG (pd); GdkPixbuf *icon; - pd->priv = g_new0 (PrefsDialogPrivate, 1); + pd->priv = EPHY_PREFS_DIALOG_GET_PRIVATE (pd); ephy_dialog_construct (EPHY_DIALOG (pd), properties, @@ -1152,7 +1149,7 @@ fonts_language_optionmenu_changed_cb (GtkWidget *optionmenu, EphyDialog *dialog) { guint i; - PrefsDialog *pd = PREFS_DIALOG (dialog); + PrefsDialog *pd = EPHY_PREFS_DIALOG (dialog); i = gtk_option_menu_get_history (GTK_OPTION_MENU (optionmenu)); @@ -1264,12 +1261,12 @@ prefs_language_more_button_clicked_cb (GtkWidget *button, GtkWidget *menu; GtkWidget *toplevel; - menu = general_prefs_new_language_menu (PREFS_DIALOG (dialog)); + menu = general_prefs_new_language_menu (EPHY_PREFS_DIALOG (dialog)); toplevel = gtk_widget_get_toplevel (button); editor = language_editor_new (toplevel); language_editor_set_menu (editor, menu); - fill_language_editor (editor, PREFS_DIALOG (dialog)); + fill_language_editor (editor, EPHY_PREFS_DIALOG (dialog)); ephy_dialog_set_modal (EPHY_DIALOG(editor), TRUE); g_signal_connect (editor, "changed", diff --git a/src/prefs-dialog.h b/src/prefs-dialog.h index 358886d10..f00535440 100644 --- a/src/prefs-dialog.h +++ b/src/prefs-dialog.h @@ -24,15 +24,17 @@ #include <glib-object.h> #include <glib.h> -typedef struct PrefsDialog PrefsDialog; -typedef struct PrefsDialogClass PrefsDialogClass; +G_BEGIN_DECLS -#define PREFS_DIALOG_TYPE (prefs_dialog_get_type ()) -#define PREFS_DIALOG(obj) (GTK_CHECK_CAST ((obj), PREFS_DIALOG_TYPE, PrefsDialog)) -#define PREFS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), PREFS_DIALOG, PrefsDialogClass)) -#define IS_PREFS_DIALOG(obj) (GTK_CHECK_TYPE ((obj), PREFS_DIALOG_TYPE)) -#define IS_PREFS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), PREFS_DIALOG)) +#define EPHY_TYPE_PREFS_DIALOG (prefs_dialog_get_type ()) +#define EPHY_PREFS_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_PREFS_DIALOG, PrefsDialog)) +#define EPHY_PREFS_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_PREFS_DIALOG, PrefsDialogClass)) +#define EPHY_IS_PREFS_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_PREFS_DIALOG)) +#define EPHY_IS_PREFS_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_PREFS_DIALOG)) +#define EPHY_PREFS_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_PREFS_DIALOG, PrefsDialogClass)) +typedef struct PrefsDialog PrefsDialog; +typedef struct PrefsDialogClass PrefsDialogClass; typedef struct PrefsDialogPrivate PrefsDialogPrivate; struct PrefsDialog @@ -50,4 +52,6 @@ GType prefs_dialog_get_type (void); EphyDialog *prefs_dialog_new (GtkWidget *parent); +G_END_DECLS + #endif diff --git a/src/session.c b/src/session.c index 7718586b3..647d9f939 100644 --- a/src/session.c +++ b/src/session.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 @@ -62,6 +64,8 @@ static void session_dispose (GObject *object); static GObjectClass *parent_class = NULL; +#define EPHY_SESSION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SESSION, SessionPrivate)) + struct SessionPrivate { GList *windows; @@ -137,6 +141,8 @@ session_class_init (SessionClass *klass) G_TYPE_NONE, 1, G_TYPE_OBJECT); + + g_type_class_add_private (object_class, sizeof(SessionPrivate)); } static char * @@ -347,7 +353,8 @@ gnome_session_init (Session *session) static void session_init (Session *session) { - session->priv = g_new0 (SessionPrivate, 1); + session->priv = EPHY_SESSION_GET_PRIVATE (session); + session->priv->windows = NULL; session->priv->dont_remove_crashed = FALSE; @@ -393,7 +400,7 @@ session_delete (Session *session, static void session_dispose (GObject *object) { - Session *session = SESSION(object); + Session *session = EPHY_SESSION(object); if (!session->priv->dont_remove_crashed) { @@ -404,19 +411,10 @@ session_dispose (GObject *object) static void session_finalize (GObject *object) { - Session *t; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_SESSION (object)); - - t = SESSION (object); - - g_return_if_fail (t->priv != NULL); + Session *t = EPHY_SESSION (object); g_list_free (t->priv->windows); - g_free (t->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -432,9 +430,7 @@ session_new (void) { Session *t; - t = SESSION (g_object_new (SESSION_TYPE, NULL)); - - g_return_val_if_fail (t->priv != NULL, NULL); + t = EPHY_SESSION (g_object_new (EPHY_TYPE_SESSION, NULL)); return t; } @@ -646,7 +642,7 @@ session_load (Session *session, const GList * session_get_windows (Session *session) { - g_return_val_if_fail (IS_SESSION (session), NULL); + g_return_val_if_fail (EPHY_IS_SESSION (session), NULL); return session->priv->windows; } diff --git a/src/session.h b/src/session.h index 9cba42628..0926a0f50 100644 --- a/src/session.h +++ b/src/session.h @@ -19,25 +19,25 @@ #ifndef SESSION_H #define SESSION_H -#define SESSION_CRASHED "type:session_crashed" -#define SESSION_GNOME "type:session_gnome" - #include "ephy-window.h" -G_BEGIN_DECLS - #include <glib-object.h> #include <glib.h> -typedef struct Session Session; -typedef struct SessionClass SessionClass; +G_BEGIN_DECLS + +#define EPHY_TYPE_SESSION (session_get_type ()) +#define EPHY_SESSION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_SESSION, Session)) +#define EPHY_SESSION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_SESSION, SessionClass)) +#define EPHY_IS_SESSION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_SESSION)) +#define EPHY_IS_SESSION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_SESSION)) +#define EPHY_SESSION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_SESSION, SessionClass)) -#define SESSION_TYPE (session_get_type ()) -#define SESSION(obj) (GTK_CHECK_CAST ((obj), SESSION_TYPE, Session)) -#define SESSION_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SESSION, SessionClass)) -#define IS_SESSION(obj) (GTK_CHECK_TYPE ((obj), SESSION_TYPE)) -#define IS_SESSION_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SESSION)) +#define SESSION_CRASHED "type:session_crashed" +#define SESSION_GNOME "type:session_gnome" +typedef struct Session Session; +typedef struct SessionClass SessionClass; typedef struct SessionPrivate SessionPrivate; struct Session diff --git a/src/statusbar.c b/src/statusbar.c index 1ea19d57b..ece07ece7 100755 --- a/src/statusbar.c +++ b/src/statusbar.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 "statusbar.h" @@ -34,6 +36,8 @@ static void statusbar_finalize (GObject *object); static GObjectClass *parent_class = NULL; +#define EPHY_STATUSBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_STATUSBAR, StatusbarPrivate)) + struct StatusbarPrivate { GtkWidget *security_icon; @@ -79,6 +83,8 @@ statusbar_class_init (StatusbarClass *klass) parent_class = g_type_class_peek_parent (klass); object_class->finalize = statusbar_finalize; + + g_type_class_add_private (object_class, sizeof(StatusbarPrivate)); } static void @@ -120,7 +126,7 @@ create_statusbar_progress (Statusbar *s) static void statusbar_init (Statusbar *t) { - t->priv = g_new0 (StatusbarPrivate, 1); + t->priv = EPHY_STATUSBAR_GET_PRIVATE (t); t->priv->tooltips = gtk_tooltips_new (); g_object_ref (G_OBJECT (t->priv->tooltips)); @@ -135,19 +141,10 @@ statusbar_init (Statusbar *t) static void statusbar_finalize (GObject *object) { - Statusbar *t; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_STATUSBAR (object)); - - t = STATUSBAR (object); - - g_return_if_fail (t->priv != NULL); + Statusbar *t = EPHY_STATUSBAR (object); g_object_unref (t->priv->tooltips); - g_free (t->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -156,7 +153,7 @@ statusbar_new (void) { GtkWidget *t; - t = GTK_WIDGET (g_object_new (STATUSBAR_TYPE, + t = GTK_WIDGET (g_object_new (EPHY_TYPE_STATUSBAR, NULL)); return t; diff --git a/src/statusbar.h b/src/statusbar.h index 27af4b315..55a04b75f 100644 --- a/src/statusbar.h +++ b/src/statusbar.h @@ -23,15 +23,15 @@ G_BEGIN_DECLS +#define EPHY_TYPE_STATUSBAR (statusbar_get_type ()) +#define EPHY_STATUSBAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_STATUSBAR, Statusbar)) +#define EPHY_STATUSBAR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_STATUSBAR, StatusbarClass)) +#define EPHY_IS_STATUSBAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_STATUSBAR)) +#define EPHY_IS_STATUSBAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_STATUSBAR)) +#define EPHY_STATUSBAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_STATUSBAR, StatusbarClass)) + typedef struct Statusbar Statusbar; typedef struct StatusbarClass StatusbarClass; - -#define STATUSBAR_TYPE (statusbar_get_type ()) -#define STATUSBAR(obj) (GTK_CHECK_CAST ((obj), STATUSBAR_TYPE, Statusbar)) -#define STATUSBAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), STATUSBAR, StatusbarClass)) -#define IS_STATUSBAR(obj) (GTK_CHECK_TYPE ((obj), STATUSBAR_TYPE)) -#define IS_STATUSBAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), STATUSBAR)) - typedef struct StatusbarPrivate StatusbarPrivate; struct Statusbar diff --git a/src/toolbar.c b/src/toolbar.c index d8d693b3a..10e03aa22 100755 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000 Marco Pesenti Gritti - * (C) 2001, 2002 Jorn Baayen + * Copyright (C) 2001, 2002 Jorn Baayen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -79,6 +79,8 @@ enum static GObjectClass *parent_class = NULL; +#define EPHY_TOOLBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TOOLBAR, ToolbarPrivate)) + struct ToolbarPrivate { EphyWindow *window; @@ -206,10 +208,8 @@ static void toolbar_class_init (ToolbarClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - EggEditableToolbarClass *eet_class; parent_class = g_type_class_peek_parent (klass); - eet_class = EGG_EDITABLE_TOOLBAR_CLASS (klass); object_class->finalize = toolbar_finalize; object_class->set_property = toolbar_set_property; @@ -220,8 +220,11 @@ toolbar_class_init (ToolbarClass *klass) g_param_spec_object ("EphyWindow", "EphyWindow", "Parent window", - EPHY_WINDOW_TYPE, - G_PARAM_READWRITE)); + EPHY_TYPE_WINDOW, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + + g_type_class_add_private (object_class, sizeof(ToolbarPrivate)); } static void @@ -230,7 +233,7 @@ toolbar_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - Toolbar *t = TOOLBAR (object); + Toolbar *t = EPHY_TOOLBAR (object); switch (prop_id) { @@ -246,7 +249,7 @@ toolbar_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - Toolbar *t = TOOLBAR (object); + Toolbar *t = EPHY_TOOLBAR (object); switch (prop_id) { @@ -360,7 +363,7 @@ action_request_cb (EggEditableToolbar *etoolbar, char *action_name, gpointer data) { - toolbar_ensure_action (TOOLBAR (etoolbar), action_name); + toolbar_ensure_action (EPHY_TOOLBAR (etoolbar), action_name); } static void @@ -448,7 +451,7 @@ location_user_changed_cb (GtkWidget *entry, Toolbar *t) char *address; tab = ephy_window_get_active_tab (t->priv->window); - g_return_if_fail (IS_EPHY_TAB (tab)); + g_return_if_fail (EPHY_IS_TAB (tab)); t->priv->can_set_location = FALSE; address = ephy_location_entry_get_location (EPHY_LOCATION_ENTRY (entry)); @@ -497,7 +500,7 @@ toolbar_set_window (Toolbar *t, EphyWindow *window) static void toolbar_init (Toolbar *t) { - t->priv = g_new0 (ToolbarPrivate, 1); + t->priv = EPHY_TOOLBAR_GET_PRIVATE (t); t->priv->window = NULL; t->priv->ui_merge = NULL; @@ -512,22 +515,16 @@ toolbar_finalize (GObject *object) ToolbarPrivate *p; GtkUIManager *merge; - g_return_if_fail (object != NULL); - g_return_if_fail (IS_TOOLBAR (object)); - - t = TOOLBAR (object); + t = EPHY_TOOLBAR (object); p = t->priv; merge = GTK_UI_MANAGER (t->priv->window->ui_merge); - g_return_if_fail (p != NULL); - + /* FIXME: why not at the end? */ G_OBJECT_CLASS (parent_class)->finalize (object); g_object_unref (t->priv->action_group); gtk_ui_manager_remove_action_group (merge, t->priv->action_group); - g_free (t->priv); - LOG ("Toolbar finalized") } @@ -536,11 +533,9 @@ toolbar_new (EphyWindow *window) { Toolbar *t; - t = TOOLBAR (g_object_new (TOOLBAR_TYPE, - "EphyWindow", window, - NULL)); - - g_return_val_if_fail (t->priv != NULL, NULL); + t = EPHY_TOOLBAR (g_object_new (EPHY_TYPE_TOOLBAR, + "EphyWindow", window, + NULL)); return t; } diff --git a/src/toolbar.h b/src/toolbar.h index 0f1dabb4c..1ca62e439 100644 --- a/src/toolbar.h +++ b/src/toolbar.h @@ -27,14 +27,14 @@ G_BEGIN_DECLS -typedef struct ToolbarClass ToolbarClass; - -#define TOOLBAR_TYPE (toolbar_get_type ()) -#define TOOLBAR(obj) (GTK_CHECK_CAST ((obj), TOOLBAR_TYPE, Toolbar)) -#define TOOLBAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TOOLBAR, ToolbarClass)) -#define IS_TOOLBAR(obj) (GTK_CHECK_TYPE ((obj), TOOLBAR_TYPE)) -#define IS_TOOLBAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TOOLBAR)) +#define EPHY_TYPE_TOOLBAR (toolbar_get_type ()) +#define EPHY_TOOLBAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_TOOLBAR, Toolbar)) +#define EPHY_TOOLBAR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_TOOLBAR, ToolbarClass)) +#define EPHY_IS_TOOLBAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_TOOLBAR)) +#define EPHY_IS_TOOLBAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_TOOLBAR)) +#define EPHY_TOOLBAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_TOOLBAR, ToolbarClass)) +typedef struct ToolbarClass ToolbarClass; typedef struct ToolbarPrivate ToolbarPrivate; struct Toolbar |