[epiphany] ephy-history-service: add a "cleared" signal for the clear method



commit ca8957ac91d2da67e8ccf42ee297ec30056052b8
Author: Xan Lopez <xan igalia com>
Date:   Mon Mar 5 19:18:30 2012 +0100

    ephy-history-service: add a "cleared" signal for the clear method
    
    And use it in EphyEmbed instead of the legacy signal.

 embed/ephy-embed.c                 |    6 +++---
 lib/history/ephy-history-service.c |   14 ++++++++++++++
 2 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index fa355b4..36e0e43 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -371,7 +371,7 @@ zoom_changed_cb (WebKitWebView *web_view,
 }
 
 static void
-ephy_embed_history_cleared_cb (EphyHistory *history,
+ephy_embed_history_cleared_cb (EphyHistoryService *history_service,
                                EphyEmbed *embed)
 {
   ephy_web_view_clear_history (EPHY_WEB_VIEW (embed->priv->web_view));
@@ -450,7 +450,7 @@ ephy_embed_finalize (GObject *object)
   }
   g_slist_free (priv->destroy_on_transition_list);
 
-  g_signal_handlers_disconnect_by_func (priv->history,
+  g_signal_handlers_disconnect_by_func (priv->history_service,
                                         ephy_embed_history_cleared_cb,
                                         embed);
 
@@ -828,7 +828,7 @@ ephy_embed_constructed (GObject *object)
   priv->history = EPHY_HISTORY (ephy_embed_shell_get_global_history (ephy_embed_shell_get_default ()));
   priv->history_service = EPHY_HISTORY_SERVICE (ephy_embed_shell_get_global_history_service (ephy_embed_shell_get_default ()));
 
-  g_signal_connect (priv->history,
+  g_signal_connect (priv->history_service,
                     "cleared", G_CALLBACK (ephy_embed_history_cleared_cb),
                     embed);
 }
diff --git a/lib/history/ephy-history-service.c b/lib/history/ephy-history-service.c
index 8d4e188..fb02c80 100644
--- a/lib/history/ephy-history-service.c
+++ b/lib/history/ephy-history-service.c
@@ -44,6 +44,7 @@ typedef enum {
 
 enum {
   VISIT_URL,
+  CLEARED,
   LAST_SIGNAL
 };
 
@@ -156,6 +157,15 @@ ephy_history_service_class_init (EphyHistoryServiceClass *klass)
                   1,
                   G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
 
+  signals[CLEARED] =
+    g_signal_new ("cleared",
+                  G_OBJECT_CLASS_TYPE (gobject_class),
+                  G_SIGNAL_RUN_LAST,
+                  0, NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE,
+                  0);
+
   g_object_class_install_property (gobject_class,
                                    PROP_HISTORY_FILENAME,
                                    g_param_spec_string ("history-filename",
@@ -408,6 +418,10 @@ ephy_history_service_execute_job_callback (gpointer data)
 
   g_assert (message->callback);
   message->callback (message->service, message->success, message->result, message->user_data);
+
+  if (message->type == CLEAR)
+    g_signal_emit (message->service, signals[CLEARED], 0);
+    
   ephy_history_service_message_free (message);
 
   return FALSE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]