From f460e4b8e7ab36fc1deeb753a1ca8baa7d6116b8 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Mon, 1 Mar 2004 21:30:47 +0000 Subject: Correctly sync the smarturl property of EphyBookmarksAction when it 2004-03-01 Christian Persch * src/bookmarks/ephy-bookmark-action.c: (smart_child_added_cb), (smart_child_removed_cb), (ephy_bookmark_action_init): Correctly sync the smarturl property of EphyBookmarksAction when it changes. Fixes incorrect show/hide of the entry on the bookmarks toolbar. --- src/bookmarks/ephy-bookmark-action.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/bookmarks/ephy-bookmark-action.c') diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c index ee2104506..68bad78fd 100644 --- a/src/bookmarks/ephy-bookmark-action.c +++ b/src/bookmarks/ephy-bookmark-action.c @@ -524,6 +524,29 @@ bookmarks_child_changed_cb (EphyNode *node, } } +static void +smart_child_added_cb (EphyNode *smart_bmks, + EphyNode *child, + EphyBookmarkAction *action) +{ + if (action->priv->bookmark_id == ephy_node_get_id (child)) + { + g_object_set (action, "smarturl", TRUE, NULL); + } +} + +static void +smart_child_removed_cb (EphyNode *smart_bmks, + EphyNode *child, + guint old_index, + EphyBookmarkAction *action) +{ + if (action->priv->bookmark_id == ephy_node_get_id (child)) + { + g_object_set (action, "smarturl", FALSE, NULL); + } +} + static void ephy_bookmark_action_init (EphyBookmarkAction *action) { @@ -540,6 +563,13 @@ ephy_bookmark_action_init (EphyBookmarkAction *action) ephy_node_signal_connect_object (node, EPHY_NODE_CHILD_CHANGED, (EphyNodeCallback) bookmarks_child_changed_cb, G_OBJECT (action)); + node = ephy_bookmarks_get_smart_bookmarks (bookmarks); + ephy_node_signal_connect_object (node, EPHY_NODE_CHILD_ADDED, + (EphyNodeCallback) smart_child_added_cb, + G_OBJECT (action)); + ephy_node_signal_connect_object (node, EPHY_NODE_CHILD_REMOVED, + (EphyNodeCallback) smart_child_removed_cb, + G_OBJECT (action)); } GtkAction * -- cgit v1.2.3