diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-12-27 18:32:42 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-12-27 18:32:42 +0800 |
commit | a9863f3bfeb5d8852304d4c92e284e0653dc8ee6 (patch) | |
tree | fe4f9832b6d522a5c758cf2386c9e435168e436c /lib/egg/egg-toolbars-model.c | |
parent | bde4c29f92204eafbe4f953353730946486dc474 (diff) | |
download | gsoc2013-epiphany-a9863f3bfeb5d8852304d4c92e284e0653dc8ee6.tar gsoc2013-epiphany-a9863f3bfeb5d8852304d4c92e284e0653dc8ee6.tar.gz gsoc2013-epiphany-a9863f3bfeb5d8852304d4c92e284e0653dc8ee6.tar.bz2 gsoc2013-epiphany-a9863f3bfeb5d8852304d4c92e284e0653dc8ee6.tar.lz gsoc2013-epiphany-a9863f3bfeb5d8852304d4c92e284e0653dc8ee6.tar.xz gsoc2013-epiphany-a9863f3bfeb5d8852304d4c92e284e0653dc8ee6.tar.zst gsoc2013-epiphany-a9863f3bfeb5d8852304d4c92e284e0653dc8ee6.zip |
Brought type macros in line with the rest of libegg; and use gobject
2003-12-27 Christian Persch <chpe@cvs.gnome.org>
* lib/egg/egg-editable-toolbar.c: (find_action),
(drag_data_delete_cb), (drag_data_get_cb),
(egg_editable_toolbar_set_model), (egg_editable_toolbar_set_merge),
(egg_editable_toolbar_class_init), (egg_editable_toolbar_init),
(egg_editable_toolbar_finalize), (egg_editable_toolbar_new):
* lib/egg/egg-editable-toolbar.h:
* lib/egg/egg-toolbar-editor.c: (find_action),
(egg_toolbar_editor_set_merge), (egg_toolbar_editor_set_model),
(egg_toolbar_editor_class_init), (egg_toolbar_editor_finalize),
(egg_toolbar_editor_new), (editor_drag_data_received_cb),
(editor_drag_data_delete_cb), (update_editor_sheet),
(setup_editor), (egg_toolbar_editor_init):
* lib/egg/egg-toolbar-editor.h:
* lib/egg/egg-toolbars-model.c: (egg_toolbars_model_to_xml),
(egg_toolbars_model_save), (egg_toolbars_model_add_separator),
(impl_add_item), (egg_toolbars_model_add_toolbar),
(egg_toolbars_model_load), (egg_toolbars_model_class_init),
(egg_toolbars_model_init), (egg_toolbars_model_finalize),
(egg_toolbars_model_new), (egg_toolbars_model_remove_toolbar),
(egg_toolbars_model_remove_item):
* lib/egg/egg-toolbars-model.h:
Brought type macros in line with the rest of libegg; and use
gobject instance private data.
* src/ephy-toolbars-model.c: (ephy_toolbars_model_get_type),
(update_toolbar_removeable_flag),
(ephy_toolbars_model_set_bookmarks), (toolbar_added),
(toolbar_removed), (ephy_toolbars_model_new),
(ephy_toolbars_model_has_bookmark):
* src/ephy-toolbars-model.h:
* src/toolbar.c: (toolbar_get_type), (init_normal_mode):
Fix crasher bug #129991.
Diffstat (limited to 'lib/egg/egg-toolbars-model.c')
-rwxr-xr-x | lib/egg/egg-toolbars-model.c | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/lib/egg/egg-toolbars-model.c b/lib/egg/egg-toolbars-model.c index ff0fa3315..8e44d9365 100755 --- a/lib/egg/egg-toolbars-model.c +++ b/lib/egg/egg-toolbars-model.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 Marco Pesenti Gritti + * Copyright (C) 2002-2003 Marco Pesenti Gritti * * 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 @@ -55,6 +55,8 @@ static guint egg_toolbars_model_signals[LAST_SIGNAL] = { 0 }; static GObjectClass *parent_class = NULL; +#define EGG_TOOLBARS_MODEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EGG_TYPE_TOOLBARS_MODEL, EggToolbarsModelPrivate)) + struct EggToolbarsModelPrivate { GNode *toolbars; @@ -94,7 +96,7 @@ egg_toolbars_model_to_xml (EggToolbarsModel *t) GNode *l1, *l2, *tl; xmlDocPtr doc; - g_return_val_if_fail (IS_EGG_TOOLBARS_MODEL (t), NULL); + g_return_val_if_fail (EGG_IS_TOOLBARS_MODEL (t), NULL); tl = t->priv->toolbars; @@ -199,7 +201,7 @@ egg_toolbars_model_save (EggToolbarsModel *t, xmlDocPtr doc; xmlNodePtr root; - g_return_if_fail (IS_EGG_TOOLBARS_MODEL (t)); + g_return_if_fail (EGG_IS_TOOLBARS_MODEL (t)); doc = egg_toolbars_model_to_xml (t); root = xmlDocGetRootElement (doc); @@ -301,7 +303,7 @@ egg_toolbars_model_add_separator (EggToolbarsModel *t, EggToolbarsItem *item; int real_position; - g_return_if_fail (IS_EGG_TOOLBARS_MODEL (t)); + g_return_if_fail (EGG_IS_TOOLBARS_MODEL (t)); parent_node = g_node_nth_child (t->priv->toolbars, toolbar_position); item = toolbars_item_new ("separator", "separator", TRUE); @@ -326,7 +328,7 @@ impl_add_item (EggToolbarsModel *t, EggToolbarsItem *item; int real_position; - g_return_val_if_fail (IS_EGG_TOOLBARS_MODEL (t), FALSE); + g_return_val_if_fail (EGG_IS_TOOLBARS_MODEL (t), FALSE); g_return_val_if_fail (id != NULL, FALSE); g_return_val_if_fail (type != NULL, FALSE); @@ -388,7 +390,7 @@ egg_toolbars_model_add_toolbar (EggToolbarsModel *t, GNode *node; int real_position; - g_return_val_if_fail (IS_EGG_TOOLBARS_MODEL (t), -1); + g_return_val_if_fail (EGG_IS_TOOLBARS_MODEL (t), -1); node = g_node_new (toolbars_toolbar_new (name)); g_node_insert (t->priv->toolbars, position, node); @@ -438,7 +440,7 @@ egg_toolbars_model_load (EggToolbarsModel *t, xmlDocPtr doc; xmlNodePtr root; - g_return_val_if_fail (IS_EGG_TOOLBARS_MODEL (t), FALSE); + g_return_val_if_fail (EGG_IS_TOOLBARS_MODEL (t), FALSE); doc = xmlParseFile (xml_file); if (doc == NULL) @@ -543,12 +545,14 @@ egg_toolbars_model_class_init (EggToolbarsModelClass *klass) G_STRUCT_OFFSET (EggToolbarsModelClass, toolbar_changed), NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); + + g_type_class_add_private (object_class, sizeof (EggToolbarsModelPrivate)); } static void egg_toolbars_model_init (EggToolbarsModel *t) { - t->priv = g_new0 (EggToolbarsModelPrivate, 1); + t->priv =EGG_TOOLBARS_MODEL_GET_PRIVATE (t); t->priv->toolbars = NULL; } @@ -558,27 +562,16 @@ egg_toolbars_model_finalize (GObject *object) { EggToolbarsModel *t = EGG_TOOLBARS_MODEL (object); - g_return_if_fail (object != NULL); - g_return_if_fail (IS_EGG_TOOLBARS_MODEL (object)); - /* FIXME free nodes */ g_node_destroy (t->priv->toolbars); - g_free (t->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } EggToolbarsModel * egg_toolbars_model_new (void) { - EggToolbarsModel *t; - - t = EGG_TOOLBARS_MODEL (g_object_new (EGG_TOOLBARS_MODEL_TYPE, NULL)); - - g_return_val_if_fail (t->priv != NULL, NULL); - - return t; + return EGG_TOOLBARS_MODEL (g_object_new (EGG_TYPE_TOOLBARS_MODEL, NULL)); } void @@ -588,7 +581,7 @@ egg_toolbars_model_remove_toolbar (EggToolbarsModel *t, GNode *node; EggTbModelFlags flags; - g_return_if_fail (IS_EGG_TOOLBARS_MODEL (t)); + g_return_if_fail (EGG_IS_TOOLBARS_MODEL (t)); flags = egg_toolbars_model_get_flags (t, position); @@ -612,7 +605,7 @@ egg_toolbars_model_remove_item (EggToolbarsModel *t, { GNode *node, *toolbar; - g_return_if_fail (IS_EGG_TOOLBARS_MODEL (t)); + g_return_if_fail (EGG_IS_TOOLBARS_MODEL (t)); toolbar = g_node_nth_child (t->priv->toolbars, toolbar_position); g_return_if_fail (toolbar != NULL); |