aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmarks.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-03-26 03:53:58 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-03-26 03:53:58 +0800
commitb3320ef7127e9fa0ca93c6c024466e1e1f0ae1c7 (patch)
tree2db543911c8a7d013d10f3475e3eab6135f9b8f6 /src/bookmarks/ephy-bookmarks.c
parent4a0747542c21fa5660cbf09d4b3aca5520ef8ca9 (diff)
downloadgsoc2013-epiphany-b3320ef7127e9fa0ca93c6c024466e1e1f0ae1c7.tar
gsoc2013-epiphany-b3320ef7127e9fa0ca93c6c024466e1e1f0ae1c7.tar.gz
gsoc2013-epiphany-b3320ef7127e9fa0ca93c6c024466e1e1f0ae1c7.tar.bz2
gsoc2013-epiphany-b3320ef7127e9fa0ca93c6c024466e1e1f0ae1c7.tar.lz
gsoc2013-epiphany-b3320ef7127e9fa0ca93c6c024466e1e1f0ae1c7.tar.xz
gsoc2013-epiphany-b3320ef7127e9fa0ca93c6c024466e1e1f0ae1c7.tar.zst
gsoc2013-epiphany-b3320ef7127e9fa0ca93c6c024466e1e1f0ae1c7.zip
Make ids private
2003-03-25 Marco Pesenti Gritti <marco@it.gnome.org> * lib/ephy-dnd.c: * lib/ephy-dnd.h: Make ids private * lib/widgets/ephy-editable-toolbar.c: (impl_get_action_name), (impl_get_action), (drag_data_received_cb), (setup_toolbar), (setup_item), (ensure_action), (ephy_editable_toolbar_class_init), (update_editor_sheet), (ephy_editable_toolbar_get_action_name), (ephy_editable_toolbar_get_action): * lib/widgets/ephy-editable-toolbar.h: Rework special actions api. * lib/widgets/ephy-tree-model-sort.c: (ephy_tree_model_sort_init), (ephy_tree_model_sort_set_drag_property), (each_url_get_data_binder), (ephy_tree_model_sort_multi_drag_data_get): * lib/widgets/ephy-tree-model-sort.h: Support nodes dnd. Need more work, see FIXME * src/bookmarks/Makefile.am: * src/bookmarks/ephy-bookmarks-editor.c: (ephy_bookmarks_editor_construct): * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_init), (ephy_bookmarks_finalize), (ephy_bookmarks_find_keyword): * src/bookmarks/ephy-node-view.c: (ephy_node_view_enable_drag_source): * src/bookmarks/ephy-node-view.h: * src/history-dialog.c: (history_dialog_setup_view): * src/toolbar.c: (toolbar_get_action_name), (toolbar_get_action), (toolbar_class_init): Support for topics dnd. The menu is still not implemented but the hard part is done. Cant finish it until the weekend :/
Diffstat (limited to 'src/bookmarks/ephy-bookmarks.c')
-rw-r--r--src/bookmarks/ephy-bookmarks.c95
1 files changed, 20 insertions, 75 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index a5d978de4..7441057d3 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -38,8 +38,6 @@ struct EphyBookmarksPrivate
EphyNode *favorites;
EphyNode *lower_fav;
double lower_score;
- GHashTable *keywords_hash;
- GStaticRWLock *keywords_hash_lock;
};
static void
@@ -364,33 +362,6 @@ ephy_setup_history_notifiers (EphyBookmarks *eb)
}
static void
-keywords_added_cb (EphyNode *node,
- EphyNode *child,
- EphyBookmarks *eb)
-{
- g_static_rw_lock_writer_lock (eb->priv->keywords_hash_lock);
-
- g_hash_table_insert (eb->priv->keywords_hash,
- (char *) ephy_node_get_property_string (child, EPHY_NODE_KEYWORD_PROP_NAME),
- child);
-
- g_static_rw_lock_writer_unlock (eb->priv->keywords_hash_lock);
-}
-
-static void
-keywords_removed_cb (EphyNode *node,
- EphyNode *child,
- EphyBookmarks *eb)
-{
- g_static_rw_lock_writer_lock (eb->priv->keywords_hash_lock);
-
- g_hash_table_remove (eb->priv->keywords_hash,
- ephy_node_get_property_string (child, EPHY_NODE_KEYWORD_PROP_NAME));
-
- g_static_rw_lock_writer_unlock (eb->priv->keywords_hash_lock);
-}
-
-static void
bookmarks_changed_cb (EphyNode *node,
EphyNode *child,
EphyBookmarks *eb)
@@ -417,11 +388,6 @@ ephy_bookmarks_init (EphyBookmarks *eb)
"bookmarks.xml",
NULL);
- eb->priv->keywords_hash = g_hash_table_new (g_str_hash,
- g_str_equal);
- eb->priv->keywords_hash_lock = g_new0 (GStaticRWLock, 1);
- g_static_rw_lock_init (eb->priv->keywords_hash_lock);
-
/* Bookmarks */
eb->priv->bookmarks = ephy_node_new_with_id (BOOKMARKS_NODE_ID);
ephy_node_ref (eb->priv->bookmarks);
@@ -454,16 +420,6 @@ ephy_bookmarks_init (EphyBookmarks *eb)
ephy_node_add_child (eb->priv->keywords,
eb->priv->bookmarks);
- g_signal_connect_object (G_OBJECT (eb->priv->keywords),
- "child_added",
- G_CALLBACK (keywords_added_cb),
- G_OBJECT (eb),
- 0);
- g_signal_connect_object (G_OBJECT (eb->priv->keywords),
- "child_removed",
- G_CALLBACK (keywords_removed_cb),
- G_OBJECT (eb),
- 0);
/* Favorites */
eb->priv->favorites = ephy_node_new_with_id (FAVORITES_NODE_ID);
@@ -506,9 +462,6 @@ ephy_bookmarks_finalize (GObject *object)
ephy_node_unref (eb->priv->keywords);
ephy_node_unref (eb->priv->favorites);
- g_hash_table_destroy (eb->priv->keywords_hash);
- g_static_rw_lock_free (eb->priv->keywords_hash_lock);
-
g_free (eb->priv);
LOG ("Bookmarks finalized")
@@ -797,43 +750,35 @@ ephy_bookmarks_find_keyword (EphyBookmarks *eb,
gboolean partial_match)
{
EphyNode *node;
+ GPtrArray *children;
+ int i;
g_return_val_if_fail (name != NULL, NULL);
- if (!partial_match)
+
+ if (g_utf8_strlen (name, -1) == 0)
{
- g_static_rw_lock_reader_lock (eb->priv->keywords_hash_lock);
- node = g_hash_table_lookup (eb->priv->keywords_hash, name);
- g_static_rw_lock_reader_unlock (eb->priv->keywords_hash_lock);
+ LOG ("Empty name, no keyword matches.")
+ return NULL;
}
- else
- {
- GPtrArray *children;
- int i;
-
- if (g_utf8_strlen (name, -1) == 0)
- {
- LOG ("Empty name, no keyword matches.")
- return NULL;
- }
- children = ephy_node_get_children (eb->priv->keywords);
- node = NULL;
- for (i = 0; i < children->len; i++)
- {
- EphyNode *kid;
- const char *key;
+ children = ephy_node_get_children (eb->priv->keywords);
+ node = NULL;
+ for (i = 0; i < children->len; i++)
+ {
+ EphyNode *kid;
+ const char *key;
- kid = g_ptr_array_index (children, i);
- key = ephy_node_get_property_string (kid, EPHY_NODE_KEYWORD_PROP_NAME);
+ kid = g_ptr_array_index (children, i);
+ key = ephy_node_get_property_string (kid, EPHY_NODE_KEYWORD_PROP_NAME);
- if (g_str_has_prefix (key, name) > 0)
- {
- node = kid;
- }
- }
- ephy_node_thaw (eb->priv->keywords);
+ if ((partial_match && g_str_has_prefix (key, name) > 0) ||
+ (!partial_match && strcmp (key, name) == 0))
+ {
+ node = kid;
+ }
}
+ ephy_node_thaw (eb->priv->keywords);
return node;
}