diff options
author | Peter Harvey <peter.a.harvey@gmail.com> | 2006-01-17 07:03:28 +0800 |
---|---|---|
committer | Peter Anthony Harvey <paharvey@src.gnome.org> | 2006-01-17 07:03:28 +0800 |
commit | fc06f146e376e09becdfcdd1076dcf08b6ef7626 (patch) | |
tree | 2549619c6cd66f391b201add3cec286af77e41bf /src/bookmarks/ephy-bookmarks.c | |
parent | 7eff391d24a75404504a52ef7b7d2b38ca6d76f6 (diff) | |
download | gsoc2013-epiphany-fc06f146e376e09becdfcdd1076dcf08b6ef7626.tar gsoc2013-epiphany-fc06f146e376e09becdfcdd1076dcf08b6ef7626.tar.gz gsoc2013-epiphany-fc06f146e376e09becdfcdd1076dcf08b6ef7626.tar.bz2 gsoc2013-epiphany-fc06f146e376e09becdfcdd1076dcf08b6ef7626.tar.lz gsoc2013-epiphany-fc06f146e376e09becdfcdd1076dcf08b6ef7626.tar.xz gsoc2013-epiphany-fc06f146e376e09becdfcdd1076dcf08b6ef7626.tar.zst gsoc2013-epiphany-fc06f146e376e09becdfcdd1076dcf08b6ef7626.zip |
src/Makefile.am
2006-01-17 Peter Harvey <peter.a.harvey@gmail.com>
* src/Makefile.am
Removed ephy-new-bookmark and ephy-topics-selector from the Makefile.
* src/ephy-history-window.c
* src/popup-commands.c
* src/window-commands.c
* src/bookmarks/ephy-bookmarks-editor.c
Removed all the slightly different bits of code to create a
bookmark and called ephy_bookmarks_ui_add_bookmark instead.
* src/bookmarks/ephy-bookmarks.c
* src/bookmarks/ephy-bookmarks.h
Moved the hashtable for bookmark windows to ephy-bookmarks-ui.
Added a new field "usericon" to the ephynode/bookmarks database,
to store the URL of the user-defined icon (if any). It can be
NULL (use site icon), "" (use none), or a URL.
* src/bookmarks/ephy-bookmark-properties.c
* src/bookmarks/ephy-bookmark-properties.h
Large changes to the bookmark properties window to handle different
use cases (adding or changing a bookmark), to use the new topics
palette widget, and to support the new usericon.
* src/bookmarks/ephy-bookmarks-ui.c
* src/bookmarks/ephy-bookmarks-ui.h
Large additions to ephy-bookmarks-ui to replace ephy-new-bookmark.
Fixed some bugs in the datatype handlers for the toolbar which
are supplied by ephy-bookmarks-ui.
Diffstat (limited to 'src/bookmarks/ephy-bookmarks.c')
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 111 |
1 files changed, 47 insertions, 64 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c index 69f01df19..f6f6acd89 100644 --- a/src/bookmarks/ephy-bookmarks.c +++ b/src/bookmarks/ephy-bookmarks.c @@ -70,7 +70,6 @@ struct _EphyBookmarksPrivate EphyNode *smartbookmarks; EphyNode *lower_fav; double lower_score; - GHashTable *props_dialogs; guint disable_bookmark_editing_notifier_id; #ifdef ENABLE_ZEROCONF @@ -861,9 +860,6 @@ ephy_bookmarks_init (EphyBookmarks *eb) "bookmarks.rdf", NULL); - eb->priv->props_dialogs = g_hash_table_new (g_direct_hash, - g_direct_equal); - /* Bookmarks */ eb->priv->bookmarks = ephy_node_new_with_id (db, BOOKMARKS_NODE_ID); g_value_init (&value, G_TYPE_STRING); @@ -1016,8 +1012,6 @@ ephy_bookmarks_finalize (GObject *object) eel_gconf_notification_remove (eb->priv->disable_bookmark_editing_notifier_id); - g_hash_table_destroy (eb->priv->props_dialogs); - if (eb->priv->save_timeout_id != 0) { g_source_remove (eb->priv->save_timeout_id); @@ -1098,25 +1092,43 @@ ephy_bookmarks_add (EphyBookmarks *eb, const char *title, const char *url) { + EphyHistory *history; EphyNode *bm; GValue value = { 0, }; bm = ephy_node_new (eb->priv->db); if (bm == NULL) return NULL; - + + if (url == NULL) return NULL; g_value_init (&value, G_TYPE_STRING); - g_value_set_string (&value, title); - ephy_node_set_property (bm, EPHY_NODE_BMK_PROP_TITLE, - &value); + g_value_set_string (&value, url); + ephy_node_set_property (bm, EPHY_NODE_BMK_PROP_LOCATION, &value); g_value_unset (&value); + if (title == NULL || title[0] == '\0') + { + title = _("Untitled"); + } g_value_init (&value, G_TYPE_STRING); - g_value_set_string (&value, url); - ephy_node_set_property (bm, EPHY_NODE_BMK_PROP_LOCATION, - &value); + g_value_set_string (&value, title); + ephy_node_set_property (bm, EPHY_NODE_BMK_PROP_TITLE, &value); g_value_unset (&value); + history = EPHY_HISTORY (ephy_embed_shell_get_global_history (embed_shell)); + if (history != NULL) + { + const char *icon = ephy_history_get_icon (history, url); + if (icon != NULL) + { + g_value_init (&value, G_TYPE_STRING); + g_value_set_string (&value, icon); + ephy_node_set_property (bm, EPHY_NODE_BMK_PROP_ICON, + &value); + g_value_unset (&value); + } + } + update_has_smart_address (eb, bm, url); update_bookmark_keywords (eb, bm); @@ -1194,6 +1206,28 @@ ephy_bookmarks_set_icon (EphyBookmarks *eb, g_value_unset (&value); } + +void +ephy_bookmarks_set_usericon (EphyBookmarks *eb, + const char *url, + const char *icon) +{ + EphyNode *node; + GValue value = { 0, }; + + g_return_if_fail (icon != NULL); + + node = ephy_bookmarks_find_bookmark (eb, url); + if (node == NULL) return; + + g_value_init (&value, G_TYPE_STRING); + g_value_set_string (&value, icon); + ephy_node_set_property (node, EPHY_NODE_BMK_PROP_USERICON, + &value); + g_value_unset (&value); +} + + /* name must end with '=' */ static char * get_option (char *start, @@ -1354,57 +1388,6 @@ ephy_bookmarks_add_keyword (EphyBookmarks *eb, return key; } - -static void -prop_dialog_destroy_cb (EphyBookmarkProperties *dialog, - EphyBookmarks *bookmarks) -{ - EphyNode *bookmark; - - bookmark = ephy_bookmark_properties_get_node (dialog); - - g_hash_table_remove (bookmarks->priv->props_dialogs, bookmark); -} - -static void -bookmark_destroyed_cb (EphyNode *bookmark, - GtkWidget *dialog) -{ - gtk_widget_destroy (dialog); -} - -GtkWidget * -ephy_bookmarks_show_bookmark_properties (EphyBookmarks *bookmarks, - EphyNode *bookmark, - GtkWidget *parent) -{ - GtkWidget *dialog = NULL; - - g_return_val_if_fail (EPHY_IS_BOOKMARKS (bookmarks), NULL); - g_return_val_if_fail (EPHY_IS_NODE (bookmark), NULL); - - dialog = g_hash_table_lookup (bookmarks->priv->props_dialogs, bookmark); - - if (dialog == NULL) - { - dialog = ephy_bookmark_properties_new (bookmarks, bookmark, parent); - - ephy_node_signal_connect_object (bookmark, - EPHY_NODE_DESTROY, - (EphyNodeCallback) bookmark_destroyed_cb, - G_OBJECT (dialog)); - - g_signal_connect (dialog, "destroy", - G_CALLBACK (prop_dialog_destroy_cb), bookmarks); - g_hash_table_insert (bookmarks->priv->props_dialogs, - bookmark, dialog); - } - - gtk_window_present (GTK_WINDOW (dialog)); - - return dialog; -} - void ephy_bookmarks_remove_keyword (EphyBookmarks *eb, EphyNode *keyword) |