diff options
Diffstat (limited to 'src')
50 files changed, 519 insertions, 633 deletions
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 |