diff options
author | Christian Persch <chpe@src.gnome.org> | 2003-09-02 07:20:17 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-09-02 07:20:17 +0800 |
commit | 73a95385f4034998cc78199dc8bb9ee22d90d6aa (patch) | |
tree | 499d78ab52e8937f672e3659105dda083a34c988 /src/bookmarks | |
parent | 3375c1878c4c0ebf4f5067d128024ea484208f62 (diff) | |
download | gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar.gz gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar.bz2 gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar.lz gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar.xz gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar.zst gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.zip |
Mega-patch, changelog too long to paste here.
Diffstat (limited to 'src/bookmarks')
-rw-r--r-- | src/bookmarks/ephy-bookmark-action.c | 21 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmark-properties.c | 26 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.c | 19 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.h | 12 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-menu.c | 11 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 29 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks.h | 14 | ||||
-rw-r--r-- | src/bookmarks/ephy-new-bookmark.c | 20 | ||||
-rw-r--r-- | src/bookmarks/ephy-topic-action.c | 28 | ||||
-rw-r--r-- | src/bookmarks/ephy-topics-selector.c | 28 | ||||
-rw-r--r-- | src/bookmarks/ephy-topics-selector.h | 12 |
11 files changed, 76 insertions, 144 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; |