diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-05-27 03:02:39 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-05-27 03:02:39 +0800 |
commit | 5ff8f7cb898f02ddf1f2dfe0370e90c1c8d3e061 (patch) | |
tree | f1a60e760e06a39a3966e301fc520e90aed00263 /src/ephy-toolbars-model.c | |
parent | 70183cca32190c0d2b038441c01bd927e11b8148 (diff) | |
download | gsoc2013-epiphany-5ff8f7cb898f02ddf1f2dfe0370e90c1c8d3e061.tar gsoc2013-epiphany-5ff8f7cb898f02ddf1f2dfe0370e90c1c8d3e061.tar.gz gsoc2013-epiphany-5ff8f7cb898f02ddf1f2dfe0370e90c1c8d3e061.tar.bz2 gsoc2013-epiphany-5ff8f7cb898f02ddf1f2dfe0370e90c1c8d3e061.tar.lz gsoc2013-epiphany-5ff8f7cb898f02ddf1f2dfe0370e90c1c8d3e061.tar.xz gsoc2013-epiphany-5ff8f7cb898f02ddf1f2dfe0370e90c1c8d3e061.tar.zst gsoc2013-epiphany-5ff8f7cb898f02ddf1f2dfe0370e90c1c8d3e061.zip |
s/DESTROYED/DESTROY which is more useulf
2003-05-26 Marco Pesenti Gritti <marco@it.gnome.org>
* lib/ephy-node.c: (callback), (ephy_node_dispose):
* lib/ephy-node.h:
s/DESTROYED/DESTROY which is more useulf
* lib/widgets/ephy-tree-model-node.c:
(ephy_tree_model_node_set_property), (root_destroy_cb):
* src/bookmarks/ephy-bookmarks-editor.c:
(ephy_bookmarks_editor_update_menu):
* src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_init_defaults),
(ephy_bookmarks_set_toolbars_model), (ephy_bookmarks_set_property),
(ephy_bookmarks_get_property), (ephy_bookmarks_class_init),
(bookmarks_removed_cb), (topics_removed_cb), (ephy_bookmarks_init),
(ephy_bookmarks_finalize):
* src/ephy-shell.c: (ephy_shell_get_toolbars_model):
* src/ephy-toolbars-model.c: (impl_add_item),
(ephy_toolbars_model_set_bookmarks),
(ephy_toolbars_model_set_property),
(ephy_toolbars_model_get_property),
(ephy_toolbars_model_class_init), (ephy_toolbars_model_init),
(ephy_toolbars_model_finalize), (ephy_toolbars_model_new):
* src/ephy-toolbars-model.h:
* src/toolbar.c: (topic_destroy_cb), (bookmark_destroy_cb),
(toolbar_ensure_action), (toolbar_init):
Better way to remove unrefed bookmarks from the toolbar.
Ref bookmarks in toolbars model and weak reaf toolbars model
in bookmarks. So setting defaults really works.
Diffstat (limited to 'src/ephy-toolbars-model.c')
-rwxr-xr-x | src/ephy-toolbars-model.c | 73 |
1 files changed, 67 insertions, 6 deletions
diff --git a/src/ephy-toolbars-model.c b/src/ephy-toolbars-model.c index f2eacbe20..475de34f7 100755 --- a/src/ephy-toolbars-model.c +++ b/src/ephy-toolbars-model.c @@ -34,11 +34,17 @@ enum LAST_SIGNAL }; +enum +{ + PROP_0, + PROP_BOOKMARKS +}; + static GObjectClass *parent_class = NULL; struct EphyToolbarsModelPrivate { - gpointer dummy; + EphyBookmarks *bookmarks; }; GType @@ -75,7 +81,6 @@ impl_add_item (EggToolbarsModel *t, GdkAtom type, const char *name) { - EphyBookmarks *bookmarks; char *action_name = NULL; const char *res; gboolean topic = FALSE, normal_item = FALSE; @@ -83,8 +88,6 @@ impl_add_item (EggToolbarsModel *t, LOG ("Add item %s", name) - bookmarks = ephy_shell_get_bookmarks (ephy_shell); - if (gdk_atom_intern (EPHY_DND_TOPIC_TYPE, FALSE) == type) { GList *nodes; @@ -122,6 +125,49 @@ impl_add_item (EggToolbarsModel *t, } static void +ephy_toolbars_model_set_bookmarks (EphyToolbarsModel *model, EphyBookmarks *bookmarks) +{ + model->priv->bookmarks = bookmarks; + g_object_ref (model->priv->bookmarks); +} + +static void +ephy_toolbars_model_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + EphyToolbarsModel *model; + + model = EPHY_TOOLBARS_MODEL (object); + + switch (prop_id) + { + case PROP_BOOKMARKS: + ephy_toolbars_model_set_bookmarks (model, g_value_get_object (value)); + break; + } +} + +static void +ephy_toolbars_model_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + EphyToolbarsModel *model; + + model = EPHY_TOOLBARS_MODEL (object); + + switch (prop_id) + { + case PROP_BOOKMARKS: + g_value_set_object (value, model->priv->bookmarks); + break; + } +} + +static void ephy_toolbars_model_class_init (EphyToolbarsModelClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -132,14 +178,25 @@ ephy_toolbars_model_class_init (EphyToolbarsModelClass *klass) parent_class = g_type_class_peek_parent (klass); object_class->finalize = ephy_toolbars_model_finalize; + object_class->set_property = ephy_toolbars_model_set_property; + object_class->get_property = ephy_toolbars_model_get_property; etm_class->add_item = impl_add_item; + + g_object_class_install_property (object_class, + PROP_BOOKMARKS, + g_param_spec_object ("bookmarks", + "Bookmarks", + "Bookmarks", + EPHY_BOOKMARKS_TYPE, + G_PARAM_READWRITE)); } static void ephy_toolbars_model_init (EphyToolbarsModel *t) { t->priv = g_new0 (EphyToolbarsModelPrivate, 1); + t->priv->bookmarks = NULL; } static void @@ -150,17 +207,21 @@ ephy_toolbars_model_finalize (GObject *object) g_return_if_fail (object != NULL); g_return_if_fail (IS_EPHY_TOOLBARS_MODEL (object)); + g_object_unref (t->priv->bookmarks); + g_free (t->priv); G_OBJECT_CLASS (parent_class)->finalize (object); } EphyToolbarsModel * -ephy_toolbars_model_new (void) +ephy_toolbars_model_new (EphyBookmarks *bookmarks) { EphyToolbarsModel *t; - t = EPHY_TOOLBARS_MODEL (g_object_new (EPHY_TOOLBARS_MODEL_TYPE, NULL)); + t = EPHY_TOOLBARS_MODEL (g_object_new (EPHY_TOOLBARS_MODEL_TYPE, + "bookmarks", bookmarks, + NULL)); g_return_val_if_fail (t->priv != NULL, NULL); |