devhelp r1169 - in trunk: . src



Author: herzi
Date: Thu Oct  9 17:42:51 2008
New Revision: 1169
URL: http://svn.gnome.org/viewvc/devhelp?rev=1169&view=rev

Log:
2008-10-07  Sven Herzberg  <sven imendio com>

	Moved assistant_navigation_requested_cb into the DhAssistantView

	* src/dh-assistant-view.c: added assistant_navigation_requested_cb
	* src/dh-assistant.c: dropped assistant_navigation_requested_cb


Modified:
   trunk/ChangeLog
   trunk/src/dh-assistant-view.c
   trunk/src/dh-assistant.c

Modified: trunk/src/dh-assistant-view.c
==============================================================================
--- trunk/src/dh-assistant-view.c	(original)
+++ trunk/src/dh-assistant-view.c	Thu Oct  9 17:42:51 2008
@@ -22,10 +22,12 @@
  * USA
  */
 
-#include "dh-assistant-view.h"
-
+#include <string.h>
 #include <webkit/webkit.h>
 
+#include "dh-assistant-view.h"
+#include "dh-window.h"
+
 struct _DhAssistantView {
         WebKitWebView      base_instance;
         /* private - move to a private structure before publishing this struct */
@@ -54,12 +56,41 @@
         G_OBJECT_CLASS (dh_assistant_view_parent_class)->finalize (object);
 }
 
+static WebKitNavigationResponse
+assistant_navigation_requested_cb (WebKitWebView        *web_view,
+                                   WebKitWebFrame       *frame,
+                                   WebKitNetworkRequest *request)
+{
+        DhAssistantView *self;
+        const gchar     *uri;
+
+        self = DH_ASSISTANT_VIEW (web_view);
+
+        uri = webkit_network_request_get_uri (request);
+
+        if (strcmp (uri, "about:blank") == 0) {
+                return WEBKIT_NAVIGATION_RESPONSE_ACCEPT;
+        }
+
+        if (g_str_has_prefix (uri, "file://")) {
+                GtkWidget *window;
+
+                window = dh_base_get_window (self->base);
+                _dh_window_display_uri (DH_WINDOW (window), uri);
+        }
+
+        return WEBKIT_NAVIGATION_RESPONSE_IGNORE;
+}
+
 static void
 dh_assistant_view_class_init (DhAssistantViewClass* self_class)
 {
-        GObjectClass *object_class = G_OBJECT_CLASS (self_class);
+        GObjectClass       *object_class = G_OBJECT_CLASS (self_class);
+        WebKitWebViewClass *web_view_class = WEBKIT_WEB_VIEW_CLASS (self_class);
 
         object_class->finalize = view_finalize;
+
+        web_view_class->navigation_requested = assistant_navigation_requested_cb;
 }
 
 DhBase*

Modified: trunk/src/dh-assistant.c
==============================================================================
--- trunk/src/dh-assistant.c	(original)
+++ trunk/src/dh-assistant.c	Thu Oct  9 17:42:51 2008
@@ -46,33 +46,6 @@
 #define GET_PRIVATE(instance) G_TYPE_INSTANCE_GET_PRIVATE \
   (instance, DH_TYPE_ASSISTANT, DhAssistantPriv);
 
-static WebKitNavigationResponse
-assistant_navigation_requested_cb (WebKitWebView        *web_view,
-                                   WebKitWebFrame       *frame,
-                                   WebKitNetworkRequest *request,
-                                   DhAssistant          *assistant)
-{
-        DhAssistantPriv *priv;
-        const gchar     *uri;
-
-        priv = GET_PRIVATE (assistant);
-
-        uri = webkit_network_request_get_uri (request);
-
-        if (strcmp (uri, "about:blank") == 0) {
-                return WEBKIT_NAVIGATION_RESPONSE_ACCEPT;
-        }
-
-        if (g_str_has_prefix (uri, "file://")) {
-                GtkWidget *window;
-
-                window = dh_base_get_window (dh_assistant_view_get_base (DH_ASSISTANT_VIEW (priv->web_view)));
-                _dh_window_display_uri (DH_WINDOW (window), uri);
-        }
-
-        return WEBKIT_NAVIGATION_RESPONSE_IGNORE;
-}
-
 static gboolean
 assistant_key_press_event_cb (GtkWidget   *widget,
                               GdkEventKey *event,
@@ -138,9 +111,6 @@
 
         priv->web_view = dh_assistant_view_new ();
 
-        g_signal_connect (priv->web_view, "navigation-requested",
-                          G_CALLBACK (assistant_navigation_requested_cb),
-                          assistant);
         g_signal_connect (priv->web_view, "button-press-event",
                           G_CALLBACK (assistant_button_press_event_cb),
                           assistant);



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