aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-10-25 02:18:23 +0800
committerChristian Persch <chpe@src.gnome.org>2004-10-25 02:18:23 +0800
commitebe9e8c7f0333591c5120d9645f9a0c1d7ebd0a9 (patch)
treeb78754814536f84e45bf147f06edcc7e2c2b7bce /lib
parentb215d12909f4fb3e27a146b03caa896a1f95d38c (diff)
downloadgsoc2013-epiphany-ebe9e8c7f0333591c5120d9645f9a0c1d7ebd0a9.tar
gsoc2013-epiphany-ebe9e8c7f0333591c5120d9645f9a0c1d7ebd0a9.tar.gz
gsoc2013-epiphany-ebe9e8c7f0333591c5120d9645f9a0c1d7ebd0a9.tar.bz2
gsoc2013-epiphany-ebe9e8c7f0333591c5120d9645f9a0c1d7ebd0a9.tar.lz
gsoc2013-epiphany-ebe9e8c7f0333591c5120d9645f9a0c1d7ebd0a9.tar.xz
gsoc2013-epiphany-ebe9e8c7f0333591c5120d9645f9a0c1d7ebd0a9.tar.zst
gsoc2013-epiphany-ebe9e8c7f0333591c5120d9645f9a0c1d7ebd0a9.zip
Add EPHY_NODE_CHANGED signal. Patch by Peter Harvey.
2004-10-24 Christian Persch <chpe@cvs.gnome.org> * lib/ephy-node.c: (callback), (ephy_node_set_property), (ephy_node_signal_connect_object), (match_signal_data), (ephy_node_signal_disconnect_object): * lib/ephy-node.h: Add EPHY_NODE_CHANGED signal. Patch by Peter Harvey. * src/bookmarks/ephy-bookmark-action.c: (favicon_cache_changed_cb), (ephy_bookmark_action_sync_icon), (ephy_bookmark_action_sync_label), (open_in_tab_activate_cb), (open_in_window_activate_cb), (activate_cb), (drag_data_get_cb), (properties_activate_cb), (bookmark_changed_cb), (bookmark_destroy_cb), (ephy_bookmark_action_set_bookmark), (ephy_bookmark_action_set_property), (ephy_bookmark_action_get_property), (ephy_bookmark_action_finalize), (ephy_bookmark_action_class_init), (smart_child_added_cb), (smart_child_removed_cb), (ephy_bookmark_action_init), (ephy_bookmark_action_new): * src/bookmarks/ephy-bookmark-action.h: * src/bookmarks/ephy-bookmarks-menu.c: (add_action_for_bookmark): * src/bookmarks/ephy-bookmarksbar.c: (ephy_bookmarksbar_action_request): * src/bookmarks/ephy-favorites-menu.c: (ephy_favorites_menu_rebuild): * src/bookmarks/ephy-topic-action.c: (build_menu), (topic_changed_cb), (ephy_topic_action_set_topic), (ephy_topic_action_set_property), (ephy_topic_action_get_property), (ephy_topic_action_class_init), (ephy_topic_action_init), (ephy_topic_action_new): * src/bookmarks/ephy-topic-action.h: Changed ephy_[bookmark|topic]_action_new from node-id to node. Saves one round-trip node->node-id->node. Save lots of strdups by using the node's properties directly, instead of storing them again in the action. Listen to changes on the node itself, not for child-changed on the bookmarks node.
Diffstat (limited to 'lib')
-rw-r--r--lib/ephy-node.c41
-rw-r--r--lib/ephy-node.h6
2 files changed, 47 insertions, 0 deletions
diff --git a/lib/ephy-node.c b/lib/ephy-node.c
index db9990147..63210f2a6 100644
--- a/lib/ephy-node.c
+++ b/lib/ephy-node.c
@@ -111,6 +111,16 @@ callback (long id, EphyNodeSignalData *data, gpointer *dummy)
data->callback (data->node, data->data);
break;
+ case EPHY_NODE_CHANGED:
+ {
+ guint property_id;
+
+ property_id = va_arg (valist, guint);
+
+ data->callback (data->node, property_id, data->data);
+ }
+ break;
+
case EPHY_NODE_CHILD_ADDED:
{
EphyNode *node;
@@ -428,6 +438,8 @@ ephy_node_set_property (EphyNode *node,
g_hash_table_foreach (node->parents,
(GHFunc) child_changed,
&change);
+
+ ephy_node_emit_signal (node, EPHY_NODE_CHANGED, property_id);
}
gboolean
@@ -1151,6 +1163,35 @@ ephy_node_signal_connect_object (EphyNode *node,
return ret;
}
+static gboolean
+match_signal_data (gpointer key, EphyNodeSignalData *signal_data,
+ EphyNodeSignalData *user_data)
+{
+ return (user_data->data == signal_data->data &&
+ user_data->type == signal_data->type &&
+ user_data->callback == signal_data->callback);
+
+}
+
+guint
+ephy_node_signal_disconnect_object (EphyNode *node,
+ EphyNodeSignalType type,
+ EphyNodeCallback callback,
+ GObject *object)
+{
+ EphyNodeSignalData user_data;
+
+ g_return_val_if_fail (node->signals, 0);
+
+ user_data.callback = callback;
+ user_data.type = type;
+ user_data.data = object;
+
+ return g_hash_table_foreach_remove (node->signals,
+ (GHRFunc)match_signal_data,
+ &user_data);
+}
+
void
ephy_node_signal_disconnect (EphyNode *node,
int signal_id)
diff --git a/lib/ephy-node.h b/lib/ephy-node.h
index b2c13225e..9bbe5343a 100644
--- a/lib/ephy-node.h
+++ b/lib/ephy-node.h
@@ -38,6 +38,7 @@ typedef enum
{
EPHY_NODE_DESTROY, /* EphyNode *node */
EPHY_NODE_RESTORED, /* EphyNode *node */
+ EPHY_NODE_CHANGED, /* EphyNode *node, guint property_id */
EPHY_NODE_CHILD_ADDED, /* EphyNode *node, EphyNode *child */
EPHY_NODE_CHILD_CHANGED, /* EphyNode *node, EphyNode *child, guint property_id */
EPHY_NODE_CHILD_REMOVED, /* EphyNode *node, EphyNode *child, guint old_index */
@@ -68,6 +69,11 @@ int ephy_node_signal_connect_object (EphyNode *node,
EphyNodeCallback callback,
GObject *object);
+guint ephy_node_signal_disconnect_object (EphyNode *node,
+ EphyNodeSignalType type,
+ EphyNodeCallback callback,
+ GObject *object);
+
void ephy_node_signal_disconnect (EphyNode *node,
int signal_id);