diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2004-02-11 22:38:12 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2004-02-11 22:38:12 +0800 |
commit | 79ccb3d443d31072de5718da6a3883aa35df9211 (patch) | |
tree | 27bba5a8d7442f6a0ae896e5f582721fbb3bc499 /lib | |
parent | f842ea4bfff7c63fbc4f21d6c21e2b6ede6d35d0 (diff) | |
download | gsoc2013-epiphany-79ccb3d443d31072de5718da6a3883aa35df9211.tar gsoc2013-epiphany-79ccb3d443d31072de5718da6a3883aa35df9211.tar.gz gsoc2013-epiphany-79ccb3d443d31072de5718da6a3883aa35df9211.tar.bz2 gsoc2013-epiphany-79ccb3d443d31072de5718da6a3883aa35df9211.tar.lz gsoc2013-epiphany-79ccb3d443d31072de5718da6a3883aa35df9211.tar.xz gsoc2013-epiphany-79ccb3d443d31072de5718da6a3883aa35df9211.tar.zst gsoc2013-epiphany-79ccb3d443d31072de5718da6a3883aa35df9211.zip |
Pass the property id to the changed signal.
2004-02-11 Marco Pesenti Gritti <marco@gnome.org>
* lib/ephy-node.c: (callback), (child_changed),
(ephy_node_set_property):
Pass the property id to the changed signal.
* lib/ephy-node.h:
Cleanup.
* embed/ephy-history.c: (hosts_changed_cb), (pages_changed_cb):
* lib/widgets/ephy-location-entry.c: (completion_func):
* lib/widgets/ephy-tree-model-node.c: (root_child_changed_cb):
* src/bookmarks/ephy-bookmark-action.c:
(bookmarks_child_changed_cb):
* src/bookmarks/ephy-bookmarks-menu.c: (topic_child_changed_cb):
* src/bookmarks/ephy-topic-action.c: (topic_child_changed_cb):
* src/ephy-completion-model.c: (root_child_changed_cb):
* src/ephy-location-action.c: (actions_child_changed_cb):
Fixup changed signals signature.
* src/bookmarks/ephy-bookmarks.c: (update_bookmark_keywords),
(bookmarks_changed_cb), (bookmark_is_categorized),
(topics_removed_cb), (ephy_bookmarks_set_keyword),
(ephy_bookmarks_unset_keyword):
Cleanup keywords building, normalize and case fold it, add
the title words as keywords too.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ephy-node.c | 35 | ||||
-rw-r--r-- | lib/ephy-node.h | 26 | ||||
-rw-r--r-- | lib/widgets/ephy-location-entry.c | 18 | ||||
-rw-r--r-- | lib/widgets/ephy-tree-model-node.c | 1 |
4 files changed, 46 insertions, 34 deletions
diff --git a/lib/ephy-node.c b/lib/ephy-node.c index c99ea9a0a..b8d5f8959 100644 --- a/lib/ephy-node.c +++ b/lib/ephy-node.c @@ -50,6 +50,12 @@ typedef struct guint index; } EphyNodeParent; +typedef struct +{ + EphyNode *node; + guint property_id; +} EphyNodeChange; + struct EphyNode { int ref_count; @@ -106,8 +112,25 @@ callback (long id, EphyNodeSignalData *data, gpointer *dummy) break; case EPHY_NODE_CHILD_ADDED: + { + EphyNode *node; + + node = va_arg (valist, EphyNode *); + + data->callback (data->node, node, data->data); + } + break; + case EPHY_NODE_CHILD_CHANGED: - data->callback (data->node, va_arg (valist, EphyNode *), data->data); + { + EphyNode *node; + guint property_id; + + node = va_arg (valist, EphyNode *); + property_id = va_arg (valist, guint); + + data->callback (data->node, node, property_id, data->data); + } break; case EPHY_NODE_CHILD_REMOVED: @@ -365,9 +388,10 @@ ephy_node_unref (EphyNode *node) static void child_changed (gulong id, EphyNodeParent *node_info, - EphyNode *node) + EphyNodeChange *change) { - ephy_node_emit_signal (node_info->node, EPHY_NODE_CHILD_CHANGED, node); + ephy_node_emit_signal (node_info->node, EPHY_NODE_CHILD_CHANGED, + change->node, change->property_id); } static inline void @@ -396,6 +420,7 @@ ephy_node_set_property (EphyNode *node, const GValue *value) { GValue *new; + EphyNodeChange change; g_return_if_fail (EPHY_IS_NODE (node)); g_return_if_fail (property_id >= 0); @@ -409,9 +434,11 @@ ephy_node_set_property (EphyNode *node, real_set_property (node, property_id, new); + change.node = node; + change.property_id = property_id; g_hash_table_foreach (node->parents, (GHFunc) child_changed, - node); + &change); } gboolean diff --git a/lib/ephy-node.h b/lib/ephy-node.h index 0e664bed4..b87b56649 100644 --- a/lib/ephy-node.h +++ b/lib/ephy-node.h @@ -36,12 +36,12 @@ typedef struct EphyNode EphyNode; typedef enum { - EPHY_NODE_DESTROY, /* RBNode *node */ - EPHY_NODE_RESTORED, /* RBNode *node */ - EPHY_NODE_CHILD_ADDED, /* RBNode *node, RBNode *child */ - EPHY_NODE_CHILD_CHANGED, /* RBNode *node, RBNode *child */ - EPHY_NODE_CHILD_REMOVED, /* RBNode *node, RBNode *child, guint old_index */ - EPHY_NODE_CHILDREN_REORDERED /* RBNode *node, int *new_order */ + EPHY_NODE_DESTROY, /* EphyNode *node */ + EPHY_NODE_RESTORED, /* EphyNode *node */ + 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 */ + EPHY_NODE_CHILDREN_REORDERED /* EphyNode *node, int *new_order */ } EphyNodeSignalType; #include "ephy-node-db.h" @@ -104,20 +104,16 @@ EphyNode *ephy_node_new_from_xml (EphyNodeDb *db, xmlNodePtr xml_node); /* DAG structure */ -void ephy_node_add_child (EphyNode *node, +void ephy_node_add_child (EphyNode *node, EphyNode *child); -void ephy_node_remove_child (EphyNode *node, +void ephy_node_remove_child (EphyNode *node, EphyNode *child); -void ephy_node_sort_children (EphyNode *node, +void ephy_node_sort_children (EphyNode *node, GCompareFunc compare_func); -gboolean ephy_node_has_child (EphyNode *node, +gboolean ephy_node_has_child (EphyNode *node, EphyNode *child); - -void ephy_node_reorder_children (EphyNode *node, +void ephy_node_reorder_children (EphyNode *node, int *new_order); - -/* Note that ephy_node_get_children freezes the node; you'll have to thaw it when done. - * This is to prevent the data getting changed from another thread. */ GPtrArray *ephy_node_get_children (EphyNode *node); int ephy_node_get_n_children (EphyNode *node); EphyNode *ephy_node_get_nth_child (EphyNode *node, diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c index 8d0a95bf1..36b1b4d8c 100644 --- a/lib/widgets/ephy-location-entry.c +++ b/lib/widgets/ephy-location-entry.c @@ -201,8 +201,6 @@ completion_func (GtkEntryCompletion *completion, int i; char *item = NULL; char *keywords = NULL; - char *normalized_string, *normalized_keywords; - char *case_normalized_string, *case_normalized_keywords; gboolean ret = FALSE; EphyLocationEntry *le = EPHY_LOCATION_ENTRY (data); GtkTreeModel *model; @@ -214,16 +212,11 @@ completion_func (GtkEntryCompletion *completion, gtk_tree_model_get (model, iter, le->priv->keywords_col, &keywords, -1); - normalized_string = g_utf8_normalize (item, -1, G_NORMALIZE_ALL); - case_normalized_string = g_utf8_casefold (normalized_string, -1); - normalized_keywords = g_utf8_normalize (keywords, -1, G_NORMALIZE_ALL); - case_normalized_keywords = g_utf8_casefold (normalized_keywords, -1); - - if (!strncmp (key, case_normalized_string, strlen (key))) + if (!strncmp (key, item, strlen (key))) { ret = TRUE; } - else if (strstr (case_normalized_keywords, key)) + else if (strstr (keywords, key)) { ret = TRUE; } @@ -235,8 +228,7 @@ completion_func (GtkEntryCompletion *completion, key_prefixed = g_strconcat (web_prefixes[i], key, NULL); - if (!strncmp (key_prefixed, case_normalized_string, - strlen (key_prefixed))) + if (!strncmp (key_prefixed, item, strlen (key_prefixed))) { g_free (key_prefixed); @@ -249,11 +241,7 @@ completion_func (GtkEntryCompletion *completion, } g_free (item); - g_free (normalized_string); - g_free (case_normalized_string); g_free (keywords); - g_free (normalized_keywords); - g_free (case_normalized_keywords); return ret; } diff --git a/lib/widgets/ephy-tree-model-node.c b/lib/widgets/ephy-tree-model-node.c index 872fa7702..b60783af9 100644 --- a/lib/widgets/ephy-tree-model-node.c +++ b/lib/widgets/ephy-tree-model-node.c @@ -174,6 +174,7 @@ ephy_tree_model_node_update_node (EphyTreeModelNode *model, static void root_child_changed_cb (EphyNode *node, EphyNode *child, + guint property_id, EphyTreeModelNode *model) { ephy_tree_model_node_update_node (model, child, -1); |