diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bookmarks/ephy-bookmark-action.c | 8 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmark-properties.c | 11 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.c | 25 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-export.c | 2 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 51 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks.h | 7 | ||||
-rw-r--r-- | src/bookmarks/ephy-topic-action.c | 23 | ||||
-rw-r--r-- | src/bookmarks/ephy-topics-selector.c | 13 | ||||
-rw-r--r-- | src/ephy-history-window.c | 11 | ||||
-rw-r--r-- | src/ephy-shell.c | 2 | ||||
-rwxr-xr-x | src/ephy-toolbars-model.c | 4 |
11 files changed, 76 insertions, 81 deletions
diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c index cbb49007f..8c2862534 100644 --- a/src/bookmarks/ephy-bookmark-action.c +++ b/src/bookmarks/ephy-bookmark-action.c @@ -427,9 +427,9 @@ ephy_bookmark_action_init (EphyBookmarkAction *action) bookmarks = ephy_shell_get_bookmarks (ephy_shell); node = ephy_bookmarks_get_bookmarks (bookmarks); - g_signal_connect_object (node, "child_changed", - G_CALLBACK (bookmarks_child_changed_cb), - action, 0); + ephy_node_signal_connect_object (node, EPHY_NODE_CHILD_CHANGED, + (EphyNodeCallback) bookmarks_child_changed_cb, + G_OBJECT (action)); } EggAction * @@ -441,7 +441,7 @@ ephy_bookmark_action_new (const char *name, guint id) bookmarks = ephy_shell_get_bookmarks (ephy_shell); - bmk = ephy_node_get_from_id (id); + bmk = ephy_bookmarks_get_from_id (bookmarks, id); g_return_val_if_fail (bmk != NULL, NULL); action = EGG_ACTION (g_object_new (EPHY_TYPE_BOOKMARK_ACTION, diff --git a/src/bookmarks/ephy-bookmark-properties.c b/src/bookmarks/ephy-bookmark-properties.c index f2b20f931..ad8afff56 100644 --- a/src/bookmarks/ephy-bookmark-properties.c +++ b/src/bookmarks/ephy-bookmark-properties.c @@ -122,11 +122,10 @@ ephy_bookmark_properties_class_init (EphyBookmarkPropertiesClass *klass) g_object_class_install_property (object_class, PROP_BOOKMARK, - g_param_spec_object ("bookmark", - "Bookmark", - "Bookmark", - EPHY_TYPE_NODE, - G_PARAM_READWRITE)); + g_param_spec_pointer ("bookmark", + "Bookmark", + "Bookmark", + G_PARAM_READWRITE)); } static void @@ -172,7 +171,7 @@ ephy_bookmark_properties_set_property (GObject *object, break; case PROP_BOOKMARK: ephy_bookmark_properties_set_bookmark - (selector, g_value_get_object (value)); + (selector, g_value_get_pointer (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c index ce4898f78..940c7595b 100644 --- a/src/bookmarks/ephy-bookmarks-editor.c +++ b/src/bookmarks/ephy-bookmarks-editor.c @@ -315,7 +315,7 @@ cmd_show_in_bookmarks_bar (EggAction *action, return; } - node = EPHY_NODE (selection->data); + node = selection->data; id = ephy_node_get_id (node); state = EGG_TOGGLE_ACTION (action)->active; @@ -346,7 +346,7 @@ cmd_open_bookmarks_in_tabs (EggAction *action, for (l = selection; l; l = l->next) { - EphyNode *node = EPHY_NODE (l->data); + EphyNode *node = l->data; const char *location; location = ephy_node_get_property_string (node, @@ -372,7 +372,7 @@ cmd_open_bookmarks_in_browser (EggAction *action, for (l = selection; l; l = l->next) { - EphyNode *node = EPHY_NODE (l->data); + EphyNode *node = l->data; const char *location; location = ephy_node_get_property_string (node, @@ -400,7 +400,7 @@ cmd_delete (EggAction *action, EphyNode *node; selected = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->key_view)); - node = EPHY_NODE (selected->data); + node = selected->data; priority = ephy_node_get_property_int (node, EPHY_NODE_KEYWORD_PROP_PRIORITY); if (priority == -1) priority = EPHY_NODE_NORMAL_PRIORITY; @@ -452,7 +452,7 @@ cmd_bookmark_properties (EggAction *action, for (l = selection; l; l = l->next) { - EphyNode *node = EPHY_NODE (l->data); + EphyNode *node = l->data; show_properties_dialog (editor, node); } @@ -491,7 +491,7 @@ cmd_copy (EggAction *action, if (g_list_length (selection) == 1) { const char *tmp; - EphyNode *node = EPHY_NODE (selection->data); + EphyNode *node = selection->data; tmp = ephy_node_get_property_string (node, EPHY_NODE_BMK_PROP_LOCATION); gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), tmp, -1); } @@ -632,7 +632,6 @@ ephy_bookmarks_editor_node_activated_cb (GtkWidget *view, const char *location; EphyWindow *window; - g_return_if_fail (EPHY_IS_NODE (node)); location = ephy_node_get_property_string (node, EPHY_NODE_BMK_PROP_LOCATION); g_return_if_fail (location != NULL); @@ -707,7 +706,7 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor) selected = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->key_view)); if (key_focus && selected) { - EphyNode *node = EPHY_NODE (selected->data); + EphyNode *node = selected->data; EphyNodePriority priority; gulong id; @@ -726,7 +725,7 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor) selected = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->bm_view)); if (bmk_focus && selected) { - EphyNode *node = EPHY_NODE (selected->data); + EphyNode *node = selected->data; gulong id; id = ephy_node_get_id (node); @@ -874,7 +873,7 @@ ephy_bookmarks_editor_dispose (GObject *object) return; } - selected_id = ephy_node_get_id (EPHY_NODE (selection->data)); + selected_id = ephy_node_get_id (selection->data); if (selected_id >= 0) { selected_id_str = g_strdup_printf ("%ld", selected_id); @@ -1065,11 +1064,9 @@ node_dropped_cb (EphyNodeView *view, EphyNode *node, { GList *l; - g_return_if_fail (EPHY_IS_NODE (node)); - for (l = nodes; l != NULL; l = l->next) { - EphyNode *bmk = EPHY_NODE (l->data); + EphyNode *bmk = l->data; ephy_bookmarks_set_keyword (editor->priv->bookmarks, node, bmk); } @@ -1290,7 +1287,7 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor) return; } - selected_node = ephy_node_get_from_id (selected_id); + selected_node = ephy_bookmarks_get_from_id (editor->priv->bookmarks, selected_id); if (selected_node != NULL) { ephy_node_view_select_node (EPHY_NODE_VIEW (key_view), selected_node); diff --git a/src/bookmarks/ephy-bookmarks-export.c b/src/bookmarks/ephy-bookmarks-export.c index e450250a5..3403a1931 100644 --- a/src/bookmarks/ephy-bookmarks-export.c +++ b/src/bookmarks/ephy-bookmarks-export.c @@ -57,7 +57,7 @@ add_topics_list (EphyNode *topics, EphyNode *bmk, xmlNodePtr parent) for (l = bmks; l != NULL; l = l->next) { const char *name; - EphyNode *node = EPHY_NODE (l->data); + EphyNode *node = l->data; name = ephy_node_get_property_string (node, EPHY_NODE_KEYWORD_PROP_NAME); diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c index 791440049..b43b1f981 100644 --- a/src/bookmarks/ephy-bookmarks.c +++ b/src/bookmarks/ephy-bookmarks.c @@ -43,6 +43,7 @@ struct EphyBookmarksPrivate { char *xml_file; + EphyNodeDb *db; EphyNode *bookmarks; EphyNode *keywords; EphyNode *favorites; @@ -284,7 +285,7 @@ ephy_bookmarks_load (EphyBookmarks *eb) { EphyNode *node; - node = ephy_node_new_from_xml (child); + node = ephy_node_new_from_xml (eb->priv->db, child); } xmlFreeDoc (doc); @@ -581,15 +582,19 @@ static void ephy_bookmarks_init (EphyBookmarks *eb) { GValue value = { 0, }; + EphyNodeDb *db; eb->priv = g_new0 (EphyBookmarksPrivate, 1); + db = ephy_node_db_new ("EphyBookmarks"); + eb->priv->db = db; + eb->priv->xml_file = g_build_filename (ephy_dot_dir (), "bookmarks.xml", NULL); /* Bookmarks */ - eb->priv->bookmarks = ephy_node_new_with_id (BOOKMARKS_NODE_ID); + eb->priv->bookmarks = ephy_node_new_with_id (db, BOOKMARKS_NODE_ID); ephy_node_ref (eb->priv->bookmarks); g_value_init (&value, G_TYPE_STRING); g_value_set_string (&value, _("All")); @@ -597,19 +602,17 @@ ephy_bookmarks_init (EphyBookmarks *eb) EPHY_NODE_KEYWORD_PROP_NAME, &value); g_value_unset (&value); - g_signal_connect_object (G_OBJECT (eb->priv->bookmarks), - "child_removed", - G_CALLBACK (bookmarks_removed_cb), - G_OBJECT (eb), - 0); - g_signal_connect_object (G_OBJECT (eb->priv->bookmarks), - "child_changed", - G_CALLBACK (bookmarks_changed_cb), - G_OBJECT (eb), - 0); + ephy_node_signal_connect_object (eb->priv->bookmarks, + EPHY_NODE_CHILD_REMOVED, + (EphyNodeCallback) bookmarks_removed_cb, + G_OBJECT (eb)); + ephy_node_signal_connect_object (eb->priv->bookmarks, + EPHY_NODE_CHILD_CHANGED, + (EphyNodeCallback) bookmarks_changed_cb, + G_OBJECT (eb)); /* Keywords */ - eb->priv->keywords = ephy_node_new_with_id (KEYWORDS_NODE_ID); + eb->priv->keywords = ephy_node_new_with_id (db, KEYWORDS_NODE_ID); ephy_node_ref (eb->priv->keywords); g_value_init (&value, G_TYPE_INT); g_value_set_int (&value, EPHY_NODE_ALL_PRIORITY); @@ -617,17 +620,16 @@ ephy_bookmarks_init (EphyBookmarks *eb) EPHY_NODE_KEYWORD_PROP_PRIORITY, &value); g_value_unset (&value); - g_signal_connect_object (G_OBJECT (eb->priv->keywords), - "child_removed", - G_CALLBACK (topics_removed_cb), - G_OBJECT (eb), - 0); + ephy_node_signal_connect_object (eb->priv->keywords, + EPHY_NODE_CHILD_REMOVED, + (EphyNodeCallback) topics_removed_cb, + G_OBJECT (eb)); ephy_node_add_child (eb->priv->keywords, eb->priv->bookmarks); /* Favorites */ - eb->priv->favorites = ephy_node_new_with_id (FAVORITES_NODE_ID); + eb->priv->favorites = ephy_node_new_with_id (db, FAVORITES_NODE_ID); ephy_node_ref (eb->priv->favorites); g_value_init (&value, G_TYPE_STRING); g_value_set_string (&value, _("Most Visited")); @@ -644,7 +646,7 @@ ephy_bookmarks_init (EphyBookmarks *eb) ephy_node_add_child (eb->priv->keywords, eb->priv->favorites); /* Not categorized */ - eb->priv->notcategorized = ephy_node_new_with_id (BMKS_NOTCATEGORIZED_NODE_ID); + eb->priv->notcategorized = ephy_node_new_with_id (db, BMKS_NOTCATEGORIZED_NODE_ID); ephy_node_ref (eb->priv->notcategorized); g_value_init (&value, G_TYPE_STRING); g_value_set_string (&value, _("Not Categorized")); @@ -715,7 +717,7 @@ ephy_bookmarks_add (EphyBookmarks *eb, EphyNode *bm; GValue value = { 0, }; - bm = ephy_node_new (); + bm = ephy_node_new (eb->priv->db); g_value_init (&value, G_TYPE_STRING); g_value_set_string (&value, title); @@ -952,7 +954,7 @@ ephy_bookmarks_add_keyword (EphyBookmarks *eb, EphyNode *key; GValue value = { 0, }; - key = ephy_node_new (); + key = ephy_node_new (eb->priv->db); g_value_init (&value, G_TYPE_STRING); g_value_set_string (&value, name); @@ -1094,3 +1096,8 @@ ephy_bookmarks_get_favorites (EphyBookmarks *eb) return eb->priv->favorites; } +EphyNode * +ephy_bookmarks_get_from_id (EphyBookmarks *eb, long id) +{ + return ephy_node_db_get_node_from_id (eb->priv->db, id); +} diff --git a/src/bookmarks/ephy-bookmarks.h b/src/bookmarks/ephy-bookmarks.h index 8cf8a4bf9..8ef47ce7d 100644 --- a/src/bookmarks/ephy-bookmarks.h +++ b/src/bookmarks/ephy-bookmarks.h @@ -67,11 +67,14 @@ GType ephy_bookmarks_get_type (void); EphyBookmarks *ephy_bookmarks_new (void); +EphyNode *ephy_bookmarks_get_from_id (EphyBookmarks *eb, + long id); + /* Bookmarks */ -void ephy_bookmarks_save (EphyBookmarks *eb); +void ephy_bookmarks_save (EphyBookmarks *eb); -EphyNode *ephy_bookmarks_add (EphyBookmarks *eb, +EphyNode *ephy_bookmarks_add (EphyBookmarks *eb, const char *title, const char *url, const char *smart_url); diff --git a/src/bookmarks/ephy-topic-action.c b/src/bookmarks/ephy-topic-action.c index 448e7ffb6..1670c099f 100644 --- a/src/bookmarks/ephy-topic-action.c +++ b/src/bookmarks/ephy-topic-action.c @@ -130,7 +130,7 @@ menu_activate_cb (GtkWidget *item, EggAction *action) EphyNode *node; const char *location; - node = EPHY_NODE (g_object_get_data (G_OBJECT (item), "node")); + node = g_object_get_data (G_OBJECT (item), "node"); location = ephy_node_get_property_string (node, EPHY_NODE_BMK_PROP_LOCATION); g_signal_emit (action, ephy_topic_action_signals[GO_LOCATION], @@ -159,9 +159,6 @@ sort_bookmarks (gconstpointer a, gconstpointer b) char *str_b = NULL; int retval; - g_return_val_if_fail (EPHY_IS_NODE (node_a), 1); - g_return_val_if_fail (EPHY_IS_NODE (node_b), -1); - str_a = g_utf8_casefold (ephy_node_get_property_string (node_a, EPHY_NODE_BMK_PROP_TITLE), -1); str_b = g_utf8_casefold (ephy_node_get_property_string (node_b, EPHY_NODE_BMK_PROP_TITLE), @@ -264,9 +261,6 @@ sort_topics (gconstpointer a, gconstpointer b) char *str_b = NULL; int retval; - g_return_val_if_fail (EPHY_IS_NODE (node_a), 1); - g_return_val_if_fail (EPHY_IS_NODE (node_b), -1); - priority_a = ephy_node_get_property_int (node_a, EPHY_NODE_KEYWORD_PROP_PRIORITY); priority_b = ephy_node_get_property_int (node_b, EPHY_NODE_KEYWORD_PROP_PRIORITY); @@ -366,21 +360,20 @@ static GtkWidget * build_menu (EphyTopicAction *action) { EphyNode *node; + EphyBookmarks *bookmarks; + bookmarks = ephy_shell_get_bookmarks (ephy_shell); if (action->priv->topic_id == BOOKMARKS_NODE_ID) { - EphyBookmarks *bookmarks; - LOG ("Build all bookmarks crap menu") - bookmarks = ephy_shell_get_bookmarks (ephy_shell); node = ephy_bookmarks_get_keywords (bookmarks); return build_topics_menu (action, node); } else { - node = ephy_node_get_from_id (action->priv->topic_id); + node = ephy_bookmarks_get_from_id (bookmarks, action->priv->topic_id); return build_bookmarks_menu (action, node); } } @@ -546,9 +539,9 @@ ephy_topic_action_init (EphyTopicAction *action) bookmarks = ephy_shell_get_bookmarks (ephy_shell); node = ephy_bookmarks_get_keywords (bookmarks); - g_signal_connect_object (node, "child_changed", - G_CALLBACK (topic_child_changed_cb), - action, 0); + ephy_node_signal_connect_object (node, EPHY_NODE_CHILD_CHANGED, + (EphyNodeCallback) topic_child_changed_cb, + G_OBJECT (action)); } EggAction * @@ -560,7 +553,7 @@ ephy_topic_action_new (const char *name, guint id) bookmarks = ephy_shell_get_bookmarks (ephy_shell); - bmk = ephy_node_get_from_id (id); + bmk = ephy_bookmarks_get_from_id (bookmarks, id); g_return_val_if_fail (bmk != NULL, NULL); action = EGG_ACTION (g_object_new (EPHY_TYPE_TOPIC_ACTION, diff --git a/src/bookmarks/ephy-topics-selector.c b/src/bookmarks/ephy-topics-selector.c index d97a9449f..994ed302e 100644 --- a/src/bookmarks/ephy-topics-selector.c +++ b/src/bookmarks/ephy-topics-selector.c @@ -114,11 +114,10 @@ ephy_topics_selector_class_init (EphyTopicsSelectorClass *klass) g_object_class_install_property (object_class, PROP_BOOKMARK, - g_param_spec_object ("bookmark", - "Bookmark", - "Bookmark", - EPHY_TYPE_NODE, - G_PARAM_READWRITE)); + g_param_spec_pointer ("bookmark", + "Bookmark", + "Bookmark", + G_PARAM_READWRITE)); } static void @@ -164,7 +163,7 @@ ephy_topics_selector_set_property (GObject *object, break; case PROP_BOOKMARK: ephy_topics_selector_set_bookmark - (selector, g_value_get_object (value)); + (selector, g_value_get_pointer (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -183,7 +182,7 @@ ephy_topics_selector_get_property (GObject *object, switch (prop_id) { case PROP_BOOKMARK: - g_value_set_object (value, selector); + g_value_set_pointer (value, selector); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c index 5921cde12..cd90e330e 100644 --- a/src/ephy-history-window.c +++ b/src/ephy-history-window.c @@ -321,7 +321,7 @@ cmd_open_bookmarks_in_tabs (EggAction *action, for (l = selection; l; l = l->next) { - EphyNode *node = EPHY_NODE (l->data); + EphyNode *node = l->data; const char *location; location = ephy_node_get_property_string (node, @@ -347,7 +347,7 @@ cmd_open_bookmarks_in_browser (EggAction *action, for (l = selection; l; l = l->next) { - EphyNode *node = EPHY_NODE (l->data); + EphyNode *node = l->data; const char *location; location = ephy_node_get_property_string (node, @@ -392,7 +392,7 @@ cmd_copy (EggAction *action, if (g_list_length (selection) == 1) { const char *tmp; - EphyNode *node = EPHY_NODE (selection->data); + EphyNode *node = selection->data; tmp = ephy_node_get_property_string (node, EPHY_NODE_PAGE_PROP_LOCATION); gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), tmp, -1); } @@ -463,7 +463,7 @@ cmd_bookmark_link (EggAction *action, const char *title; EphyNode *node; - node = EPHY_NODE (selection->data); + node = selection->data; location = ephy_node_get_property_string (node, EPHY_NODE_PAGE_PROP_LOCATION); title = ephy_node_get_property_string (node, EPHY_NODE_PAGE_PROP_TITLE); if (ephy_new_bookmark_is_unique (bookmarks, GTK_WINDOW (window), @@ -577,7 +577,6 @@ ephy_history_window_node_activated_cb (GtkWidget *view, const char *location; EphyWindow *window; - g_return_if_fail (EPHY_IS_NODE (node)); location = ephy_node_get_property_string (node, EPHY_NODE_PAGE_PROP_LOCATION); g_return_if_fail (location != NULL); @@ -683,7 +682,7 @@ ephy_history_window_update_menu (EphyHistoryWindow *editor) g_object_set (action, "sensitive", select_all, NULL); action = egg_action_group_get_action (action_group, "Delete"); g_object_set (action, "sensitive", delete, NULL); - action = egg_action_group_get_action (action_group, "BookmarkPage"); + action = egg_action_group_get_action (action_group, "BookmarkLink"); g_object_set (action, "sensitive", bookmark_page, NULL); } diff --git a/src/ephy-shell.c b/src/ephy-shell.c index daf5f4513..373b9711c 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -248,7 +248,6 @@ ephy_shell_init (EphyShell *gs) ephy_debug_init (); ephy_thread_helpers_init (); - ephy_node_system_init (EPHY_NODE_RESERVED_IDS); ephy_file_helpers_init (); ephy_stock_icons_init (); ephy_ensure_dir_exists (ephy_dot_dir ()); @@ -342,7 +341,6 @@ ephy_shell_finalize (GObject *object) ephy_state_save (); ephy_file_helpers_shutdown (); - ephy_node_system_shutdown (); LOG ("Ephy shell finalized") diff --git a/src/ephy-toolbars-model.c b/src/ephy-toolbars-model.c index 43a081e22..f2eacbe20 100755 --- a/src/ephy-toolbars-model.c +++ b/src/ephy-toolbars-model.c @@ -91,7 +91,7 @@ impl_add_item (EggToolbarsModel *t, topic = TRUE; nodes = ephy_dnd_node_list_extract_nodes (name); - id = ephy_node_get_id (EPHY_NODE (nodes->data)); + id = ephy_node_get_id (nodes->data); action_name = g_strdup_printf ("GoTopicId%d", id); g_list_free (nodes); } @@ -100,7 +100,7 @@ impl_add_item (EggToolbarsModel *t, GList *nodes; nodes = ephy_dnd_node_list_extract_nodes (name); - id = ephy_node_get_id (EPHY_NODE (nodes->data)); + id = ephy_node_get_id (nodes->data); action_name = g_strdup_printf ("GoBookmarkId%d", id); g_list_free (nodes); } |