[epiphany] Emit a signal when loading the homepage



commit ea394862505225b631b677d33aa6c9203f850486
Author: Xan Lopez <xan gnome org>
Date:   Mon May 3 13:35:12 2010 +0200

    Emit a signal when loading the homepage

 embed/ephy-web-view.c |   41 +++++++++++++++++++++++++++++------------
 1 files changed, 29 insertions(+), 12 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index c3fa53a..380dabd 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1776,6 +1776,21 @@ ephy_web_view_class_init (EphyWebViewClass *klass)
             1,
             G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
 
+/**
+ * EphyWebView::loading-homepage
+ * @view: the #EphyWebView that received the signal
+ *
+ * The ::loading-homepage signal is emitted when the @view is about to
+ * load the homepage set by the user.
+ **/
+    g_signal_new ("loading-homepage",
+            EPHY_TYPE_WEB_VIEW,
+            G_SIGNAL_RUN_FIRST,
+            NULL, NULL, NULL,
+            g_cclosure_marshal_VOID__VOID,
+            G_TYPE_NONE,
+            0);
+
   g_type_class_add_private (gobject_class, sizeof (EphyWebViewPrivate));
 }
 
@@ -3535,23 +3550,25 @@ ephy_web_view_save (EphyWebView *view, const char *uri)
 gboolean
 ephy_web_view_load_homepage (EphyWebView *view)
 {
-	char *home;
-	gboolean is_empty;
+  char *home;
+  gboolean is_empty;
 
-	home = eel_gconf_get_string (CONF_GENERAL_HOMEPAGE);
+  g_signal_emit_by_name (view, "loading-homepage");
 
-	if (home == NULL || home[0] == '\0')
-	{
-		g_free (home);
+  home = eel_gconf_get_string (CONF_GENERAL_HOMEPAGE);
 
-		home = g_strdup ("about:blank");
-	}
+  if (home == NULL || home[0] == '\0')
+  {
+    g_free (home);
+
+    home = g_strdup ("about:blank");
+  }
 
-	is_empty = ephy_embed_utils_url_is_empty (home);
-	ephy_web_view_load_url (view, home);
+  is_empty = ephy_embed_utils_url_is_empty (home);
+  ephy_web_view_load_url (view, home);
 
-	g_free (home);
+  g_free (home);
 
-	return is_empty;
+  return is_empty;
 }
 



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