From d6350b598732e34420261238b01d2bfb187349c1 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Tue, 13 Nov 2007 23:15:57 +0000 Subject: Add icon-updated signal to EphyHistory. Use it to update the bookmarks icon, as it was done in EphyTab before. svn path=/trunk/; revision=7687 --- embed/ephy-base-embed.c | 5 ----- embed/ephy-history.c | 16 +++++++++++++++- embed/ephy-history.h | 45 ++++++++++++++++++++++++--------------------- 3 files changed, 39 insertions(+), 27 deletions(-) (limited to 'embed') diff --git a/embed/ephy-base-embed.c b/embed/ephy-base-embed.c index 2ca7a1490..6b348c394 100644 --- a/embed/ephy-base-embed.c +++ b/embed/ephy-base-embed.c @@ -1190,7 +1190,6 @@ ephy_base_embed_set_icon_address (EphyBaseEmbed *embed, GObject *object = G_OBJECT (embed); EphyBaseEmbedPrivate *priv = embed->priv; EphyHistory *history; - /* EphyBookmarks *eb;*/ g_free (priv->icon_address); priv->icon_address = g_strdup (address); @@ -1205,10 +1204,6 @@ ephy_base_embed_set_icon_address (EphyBaseEmbed *embed, if (priv->icon_address) { history = EPHY_HISTORY (ephy_embed_shell_get_global_history (embed_shell)); ephy_history_set_icon (history, priv->address, priv->icon_address); - /* - eb = ephy_shell_get_bookmarks (ephy_shell); - ephy_bookmarks_set_icon (eb, priv->address, - priv->icon_address);*/ ephy_base_embed_load_icon (embed); } diff --git a/embed/ephy-history.c b/embed/ephy-history.c index a59314865..57f4bc0ca 100644 --- a/embed/ephy-history.c +++ b/embed/ephy-history.c @@ -84,7 +84,8 @@ enum VISITED, CLEARED, REDIRECT, - LAST_SIGNAL + ICON_UPDATED, + LAST_SIGNAL }; static guint signals[LAST_SIGNAL] = { 0 }; @@ -223,6 +224,17 @@ ephy_history_class_init (EphyHistoryClass *klass) G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE, G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE); + signals[ICON_UPDATED] = + g_signal_new ("icon_updated", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (EphyHistoryClass, icon_updated), + NULL, NULL, + ephy_marshal_VOID__STRING_STRING, + G_TYPE_NONE, + 2, + G_TYPE_STRING, G_TYPE_STRING); + g_type_class_add_private (object_class, sizeof (EphyHistoryPrivate)); } @@ -965,6 +977,8 @@ ephy_history_set_icon (EphyHistory *gh, ephy_node_set_property_string (host, EPHY_NODE_PAGE_PROP_ICON, icon); } + + g_signal_emit (gh, signals[ICON_UPDATED], 0, url, icon); } void diff --git a/embed/ephy-history.h b/embed/ephy-history.h index a65bd93aa..151ea6394 100644 --- a/embed/ephy-history.h +++ b/embed/ephy-history.h @@ -63,60 +63,63 @@ struct _EphyHistory struct _EphyHistoryClass { - GObjectClass parent_class; + GObjectClass parent_class; /* Signals */ - gboolean (* add_page) (EphyHistory *history, - const char *url, - gboolean redirect, - gboolean toplevel); - void (* visited) (EphyHistory *history, - const char *url); - void (* cleared) (EphyHistory *history); - - void (* redirect) (EphyHistory *history, - const char *from_uri, - const char *to_uri); + gboolean (* add_page) (EphyHistory *history, + const char *url, + gboolean redirect, + gboolean toplevel); + void (* visited) (EphyHistory *history, + const char *url); + void (* cleared) (EphyHistory *history); + + void (* redirect) (EphyHistory *history, + const char *from_uri, + const char *to_uri); + void (* icon_updated) (EphyHistory *history, + const char *address + const char *icon); }; GType ephy_history_get_type (void); EphyHistory *ephy_history_new (void); -EphyNode *ephy_history_get_hosts (EphyHistory *gh); +EphyNode *ephy_history_get_hosts (EphyHistory *gh); EphyNode *ephy_history_get_host (EphyHistory *gh, const char *url); -EphyNode *ephy_history_get_pages (EphyHistory *gh); +EphyNode *ephy_history_get_pages (EphyHistory *gh); -EphyNode *ephy_history_get_page (EphyHistory *gh, +EphyNode *ephy_history_get_page (EphyHistory *gh, const char *url); -void ephy_history_add_page (EphyHistory *gh, +void ephy_history_add_page (EphyHistory *gh, const char *url, gboolean redirect, gboolean toplevel); -gboolean ephy_history_is_page_visited (EphyHistory *gh, +gboolean ephy_history_is_page_visited (EphyHistory *gh, const char *url); -int ephy_history_get_page_visits (EphyHistory *gh, +int ephy_history_get_page_visits (EphyHistory *gh, const char *url); -void ephy_history_set_page_title (EphyHistory *gh, +void ephy_history_set_page_title (EphyHistory *gh, const char *url, const char *title); const char *ephy_history_get_last_page (EphyHistory *gh); -void ephy_history_set_icon (EphyHistory *gh, +void ephy_history_set_icon (EphyHistory *gh, const char *url, const char *icon); const char *ephy_history_get_icon (EphyHistory *gh, const char *url); -void ephy_history_clear (EphyHistory *gh); +void ephy_history_clear (EphyHistory *gh); gboolean ephy_history_is_enabled (EphyHistory *history); -- cgit v1.2.3