diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-05-20 01:25:12 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-05-20 01:25:12 +0800 |
commit | cc8f3060b3c57453f2128a573391add2a0bb47d4 (patch) | |
tree | a2f1965dfbadb7e8d0de464575abdf02ba6c3641 /embed | |
parent | f9f7a48a13d9e876cb641af773a2eb88a4a0aaf6 (diff) | |
download | gsoc2013-epiphany-cc8f3060b3c57453f2128a573391add2a0bb47d4.tar gsoc2013-epiphany-cc8f3060b3c57453f2128a573391add2a0bb47d4.tar.gz gsoc2013-epiphany-cc8f3060b3c57453f2128a573391add2a0bb47d4.tar.bz2 gsoc2013-epiphany-cc8f3060b3c57453f2128a573391add2a0bb47d4.tar.lz gsoc2013-epiphany-cc8f3060b3c57453f2128a573391add2a0bb47d4.tar.xz gsoc2013-epiphany-cc8f3060b3c57453f2128a573391add2a0bb47d4.tar.zst gsoc2013-epiphany-cc8f3060b3c57453f2128a573391add2a0bb47d4.zip |
2003-05-19 Marco Pesenti Gritti <marco@it.gnome.org>
* lib/Makefile.am:
* lib/ephy-dnd.c: (ephy_dnd_node_list_extract_nodes):
* lib/ephy-node.c: (write_lock_to_read_lock),
(read_lock_to_write_lock), (lock_gdk), (unlock_gdk), (callback),
(ephy_node_emit_signal), (ephy_node_finalize), (real_remove_child),
(remove_child), (signal_object_weak_notify),
(unref_signal_objects), (ephy_node_dispose), (ephy_node_new),
(ephy_node_new_with_id), (ephy_node_get_id), (ephy_node_ref),
(ephy_node_unref), (ephy_node_freeze), (ephy_node_thaw),
(child_changed), (real_set_property), (ephy_node_set_property),
(ephy_node_get_property), (ephy_node_get_property_string),
(ephy_node_get_property_boolean), (ephy_node_get_property_long),
(ephy_node_get_property_int), (ephy_node_get_property_double),
(ephy_node_get_property_float), (ephy_node_get_property_node),
(save_parent), (ephy_node_save_to_xml), (real_add_child),
(ephy_node_new_from_xml), (ephy_node_add_child),
(ephy_node_remove_child), (ephy_node_has_child),
(ephy_node_real_get_child_index), (ephy_node_sort_children),
(ephy_node_reorder_children), (ephy_node_get_children),
(ephy_node_get_n_children), (ephy_node_get_nth_child),
(get_child_index_real), (ephy_node_get_child_index),
(ephy_node_get_next_child), (ephy_node_get_previous_child),
(ephy_node_signal_connect_object), (ephy_node_signal_disconnect):
* lib/ephy-node.h:
* lib/ephy-state.c: (ephy_states_load), (ensure_states),
(ephy_state_add_window), (ephy_state_add_paned), (ephy_state_save):
* lib/widgets/ephy-node-view.c: (ephy_node_view_class_init),
(ephy_node_view_selection_changed_cb),
(ephy_node_view_set_property), (ephy_node_view_get_property),
(ephy_node_view_remove):
* lib/widgets/ephy-tree-model-node.c:
(ephy_tree_model_node_class_init),
(ephy_tree_model_node_set_property),
(ephy_tree_model_node_get_property),
(ephy_tree_model_node_get_value), (ephy_tree_model_node_get_path),
(ephy_tree_model_node_iter_next),
(ephy_tree_model_node_node_from_iter):
* src/bookmarks/ephy-bookmark-action.c:
(ephy_bookmark_action_init), (ephy_bookmark_action_new):
* src/bookmarks/ephy-bookmark-properties.c:
(ephy_bookmark_properties_class_init),
(ephy_bookmark_properties_set_property):
* src/bookmarks/ephy-bookmarks-editor.c:
(cmd_show_in_bookmarks_bar), (cmd_open_bookmarks_in_tabs),
(cmd_open_bookmarks_in_browser), (cmd_delete),
(cmd_bookmark_properties), (cmd_copy),
(ephy_bookmarks_editor_node_activated_cb),
(ephy_bookmarks_editor_update_menu),
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-favicon-cache.c | 32 | ||||
-rw-r--r-- | embed/ephy-history.c | 64 |
2 files changed, 54 insertions, 42 deletions
diff --git a/embed/ephy-favicon-cache.c b/embed/ephy-favicon-cache.c index 3b3efef40..6ae56c3f9 100644 --- a/embed/ephy-favicon-cache.c +++ b/embed/ephy-favicon-cache.c @@ -41,6 +41,7 @@ struct EphyFaviconCachePrivate { char *directory; char *xml_file; + EphyNodeDb *db; EphyNode *icons; GHashTable *icons_hash; GStaticRWLock *icons_hash_lock; @@ -141,7 +142,7 @@ ephy_favicon_cache_load (EphyFaviconCache *eb) { EphyNode *node; - node = ephy_node_new_from_xml (child); + node = ephy_node_new_from_xml (eb->priv->db, child); } xmlFreeDoc (doc); @@ -258,8 +259,13 @@ ephy_favicon_cache_save (EphyFaviconCache *eb) static void ephy_favicon_cache_init (EphyFaviconCache *cache) { + EphyNodeDb *db; + cache->priv = g_new0 (EphyFaviconCachePrivate, 1); + db = ephy_node_db_new ("EphyFaviconCache"); + cache->priv->db = db; + cache->priv->xml_file = g_build_filename (ephy_dot_dir (), "ephy-favicon-cache.xml", NULL); @@ -286,18 +292,16 @@ ephy_favicon_cache_init (EphyFaviconCache *cache) NULL); /* Icons */ - cache->priv->icons = ephy_node_new_with_id (ICONS_NODE_ID); + cache->priv->icons = ephy_node_new_with_id (db, ICONS_NODE_ID); ephy_node_ref (cache->priv->icons); - g_signal_connect_object (G_OBJECT (cache->priv->icons), - "child_added", - G_CALLBACK (icons_added_cb), - G_OBJECT (cache), - 0); - g_signal_connect_object (G_OBJECT (cache->priv->icons), - "child_removed", - G_CALLBACK (icons_removed_cb), - G_OBJECT (cache), - 0); + ephy_node_signal_connect_object (cache->priv->icons, + EPHY_NODE_CHILD_ADDED, + (EphyNodeCallback) icons_added_cb, + G_OBJECT (cache)); + ephy_node_signal_connect_object (cache->priv->icons, + EPHY_NODE_CHILD_REMOVED, + (EphyNodeCallback) icons_removed_cb, + G_OBJECT (cache)); ephy_favicon_cache_load (cache); } @@ -345,6 +349,8 @@ ephy_favicon_cache_finalize (GObject *object) g_return_if_fail (cache->priv != NULL); + g_object_unref (cache->priv->db); + cleanup_downloads_hash (cache); remove_obsolete_icons (cache); ephy_favicon_cache_save (cache); @@ -447,7 +453,7 @@ ephy_favicon_cache_get (EphyFaviconCache *cache, filename = favicon_name_build (url); - icon = ephy_node_new (); + icon = ephy_node_new (cache->priv->db); g_value_init (&value, G_TYPE_STRING); g_value_set_string (&value, url); ephy_node_set_property (icon, EPHY_NODE_FAVICON_PROP_URL, diff --git a/embed/ephy-history.c b/embed/ephy-history.c index f59e9169b..c9541c618 100644 --- a/embed/ephy-history.c +++ b/embed/ephy-history.c @@ -42,6 +42,7 @@ struct EphyHistoryPrivate { char *xml_file; + EphyNodeDb *db; EphyNode *hosts; EphyNode *pages; EphyNode *last_page; @@ -142,7 +143,7 @@ ephy_history_autocompletion_source_foreach (EphyAutocompletionSource *source, guint32 score; kid = g_ptr_array_index (children, i); - g_assert (EPHY_IS_NODE (kid)); + g_assert (kid != NULL); url = ephy_node_get_property_string (kid, EPHY_NODE_PAGE_PROP_LOCATION); @@ -218,7 +219,7 @@ ephy_history_load (EphyHistory *eb) { EphyNode *node; - node = ephy_node_new_from_xml (child); + node = ephy_node_new_from_xml (eb->priv->db, child); } xmlFreeDoc (doc); @@ -370,7 +371,7 @@ pages_removed_cb (EphyNode *node, g_static_rw_lock_writer_unlock (eb->priv->pages_hash_lock); host_id = ephy_node_get_property_int (child, EPHY_NODE_PAGE_PROP_HOST_ID); - host = ephy_node_get_from_id (host_id); + host = ephy_node_db_get_node_from_id (eb->priv->db, host_id); children = ephy_node_get_n_children (host); LOG ("Check host children: %d", children) @@ -394,9 +395,13 @@ static void ephy_history_init (EphyHistory *eb) { GValue value = { 0, }; + EphyNodeDb *db; eb->priv = g_new0 (EphyHistoryPrivate, 1); + db = ephy_node_db_new ("EphyHistory"); + eb->priv->db = db; + eb->priv->xml_file = g_build_filename (ephy_dot_dir (), "ephy-history.xml", NULL); @@ -412,7 +417,7 @@ ephy_history_init (EphyHistory *eb) g_static_rw_lock_init (eb->priv->hosts_hash_lock); /* Pages */ - eb->priv->pages = ephy_node_new_with_id (PAGES_NODE_ID); + eb->priv->pages = ephy_node_new_with_id (db, PAGES_NODE_ID); ephy_node_ref (eb->priv->pages); g_value_init (&value, G_TYPE_STRING); g_value_set_string (&value, _("All")); @@ -429,30 +434,26 @@ ephy_history_init (EphyHistory *eb) EPHY_NODE_PAGE_PROP_PRIORITY, &value); g_value_unset (&value); - g_signal_connect_object (G_OBJECT (eb->priv->pages), - "child_added", - G_CALLBACK (pages_added_cb), - G_OBJECT (eb), - 0); - g_signal_connect_object (G_OBJECT (eb->priv->pages), - "child_removed", - G_CALLBACK (pages_removed_cb), - G_OBJECT (eb), - 0); + ephy_node_signal_connect_object (eb->priv->pages, + EPHY_NODE_CHILD_ADDED, + (EphyNodeCallback) pages_added_cb, + G_OBJECT (eb)); + ephy_node_signal_connect_object (eb->priv->pages, + EPHY_NODE_CHILD_REMOVED, + (EphyNodeCallback) pages_removed_cb, + G_OBJECT (eb)); /* Hosts */ - eb->priv->hosts = ephy_node_new_with_id (HOSTS_NODE_ID); + eb->priv->hosts = ephy_node_new_with_id (db, HOSTS_NODE_ID); ephy_node_ref (eb->priv->hosts); - g_signal_connect_object (G_OBJECT (eb->priv->hosts), - "child_added", - G_CALLBACK (hosts_added_cb), - G_OBJECT (eb), - 0); - g_signal_connect_object (G_OBJECT (eb->priv->hosts), - "child_removed", - G_CALLBACK (hosts_removed_cb), - G_OBJECT (eb), - 0); + ephy_node_signal_connect_object (eb->priv->hosts, + EPHY_NODE_CHILD_ADDED, + (EphyNodeCallback) hosts_added_cb, + G_OBJECT (eb)); + ephy_node_signal_connect_object (eb->priv->hosts, + EPHY_NODE_CHILD_REMOVED, + (EphyNodeCallback) hosts_removed_cb, + G_OBJECT (eb)); ephy_node_add_child (eb->priv->hosts, eb->priv->pages); @@ -482,6 +483,8 @@ ephy_history_finalize (GObject *object) ephy_node_unref (eb->priv->pages); ephy_node_unref (eb->priv->hosts); + g_object_unref (eb->priv->db); + g_hash_table_destroy (eb->priv->pages_hash); g_static_rw_lock_free (eb->priv->pages_hash_lock); g_hash_table_destroy (eb->priv->hosts_hash); @@ -610,7 +613,7 @@ ephy_history_add_host (EphyHistory *eh, EphyNode *page) if (!host) { - host = ephy_node_new (); + host = ephy_node_new (eh->priv->db); g_value_init (&value, G_TYPE_STRING); g_value_set_string (&value, host_name); ephy_node_set_property (host, EPHY_NODE_PAGE_PROP_TITLE, @@ -656,7 +659,7 @@ ephy_history_visited (EphyHistory *eh, EphyNode *node) now = time (NULL); - g_assert (EPHY_IS_NODE (node)); + g_assert (node != NULL); url = ephy_node_get_property_string (node, EPHY_NODE_PAGE_PROP_LOCATION); @@ -686,7 +689,10 @@ ephy_history_visited (EphyHistory *eh, EphyNode *node) host_id = ephy_node_get_property_int (node, EPHY_NODE_PAGE_PROP_HOST_ID); if (host_id >= 0) { - ephy_history_host_visited (eh, ephy_node_get_from_id (host_id), now); + EphyNode *host; + + host = ephy_node_db_get_node_from_id (eh->priv->db, host_id); + ephy_history_host_visited (eh, host, now); } eh->priv->last_page = node; @@ -727,7 +733,7 @@ ephy_history_add_page (EphyHistory *eb, return; } - bm = ephy_node_new (); + bm = ephy_node_new (eb->priv->db); g_value_init (&value, G_TYPE_STRING); g_value_set_string (&value, url); |