diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-11-01 22:00:06 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-11-01 22:00:06 +0800 |
commit | f686d272ac4558e0ebda8f3aa873d2d9eefb17b5 (patch) | |
tree | a1acf44a816af5c379c39df916735dc2882fb1d1 /src/bookmarks/ephy-bookmarks.c | |
parent | a716fbc5466f2f33a094062745f2d07b60df340d (diff) | |
download | gsoc2013-epiphany-f686d272ac4558e0ebda8f3aa873d2d9eefb17b5.tar gsoc2013-epiphany-f686d272ac4558e0ebda8f3aa873d2d9eefb17b5.tar.gz gsoc2013-epiphany-f686d272ac4558e0ebda8f3aa873d2d9eefb17b5.tar.bz2 gsoc2013-epiphany-f686d272ac4558e0ebda8f3aa873d2d9eefb17b5.tar.lz gsoc2013-epiphany-f686d272ac4558e0ebda8f3aa873d2d9eefb17b5.tar.xz gsoc2013-epiphany-f686d272ac4558e0ebda8f3aa873d2d9eefb17b5.tar.zst gsoc2013-epiphany-f686d272ac4558e0ebda8f3aa873d2d9eefb17b5.zip |
Make sure there's only one bookmark properties dialogue for each bookmark.
2004-11-01 Christian Persch <chpe@cvs.gnome.org>
* src/bookmarks/ephy-bookmark-action.c: (properties_activate_cb),
(bookmark_destroy_cb), (ephy_bookmark_action_finalize):
* src/bookmarks/ephy-bookmark-properties.c:
(ephy_bookmark_properties_new):
* src/bookmarks/ephy-bookmark-properties.h:
* src/bookmarks/ephy-bookmarks-editor.c: (show_properties_dialog),
(ephy_bookmarks_editor_finalize), (ephy_bookmarks_editor_init):
* src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_init),
(ephy_bookmarks_finalize), (ephy_bookmarks_add_keyword),
(prop_dialog_destroy_cb), (bookmark_destroyed_cb),
(ephy_bookmarks_show_bookmark_properties):
* src/bookmarks/ephy-bookmarks.h:
Make sure there's only one bookmark properties dialogue for each
bookmark. Fixes bug #148398 and also bug #155880.
Diffstat (limited to 'src/bookmarks/ephy-bookmarks.c')
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c index ac2de3b28..ef4e37e47 100644 --- a/src/bookmarks/ephy-bookmarks.c +++ b/src/bookmarks/ephy-bookmarks.c @@ -34,6 +34,7 @@ #include "ephy-bookmarksbar-model.h" #include "ephy-bookmarks-export.h" #include "ephy-bookmarks-import.h" +#include "ephy-bookmark-properties.h" #include "ephy-prefs.h" #include "eel-gconf-extensions.h" @@ -65,7 +66,7 @@ struct EphyBookmarksPrivate EphyNode *smartbookmarks; EphyNode *lower_fav; double lower_score; - + GHashTable *props_dialogs; guint disable_bookmark_editing_notifier_id; }; @@ -689,6 +690,9 @@ 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); @@ -800,6 +804,8 @@ 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); @@ -1164,6 +1170,57 @@ 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) |