]> git.0d.be Git - empathy.git/commitdiff
Merge branch 'fix-navigation-handling'
authorGustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
Fri, 28 Aug 2009 12:54:09 +0000 (09:54 -0300)
committerGustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
Fri, 28 Aug 2009 12:54:09 +0000 (09:54 -0300)
1  2 
libempathy-gtk/empathy-theme-adium.c

index 59d5583d1846aaa17de9dd6ec3451b7c893a1f0b,34c06adfd5788801d40fbf76e6ae48904f62969b..f557d07bb49fd611c97b20d5bab33e606f98927f
@@@ -24,7 -24,7 +24,7 @@@
  #include <string.h>
  #include <glib/gi18n.h>
  
- #include <webkit/webkitnetworkrequest.h>
+ #include <webkit/webkit.h>
  #include <telepathy-glib/dbus.h>
  #include <telepathy-glib/util.h>
  
@@@ -128,18 -128,28 +128,28 @@@ theme_adium_notify_enable_webkit_develo
        theme_adium_update_enable_webkit_developer_tools (theme);
  }
  
- static WebKitNavigationResponse
- theme_adium_navigation_requested_cb (WebKitWebView        *view,
-                                    WebKitWebFrame       *frame,
-                                    WebKitNetworkRequest *request,
-                                    gpointer              user_data)
+ static gboolean
+ theme_adium_navigation_policy_decision_requested_cb (WebKitWebView             *view,
+                                                    WebKitWebFrame            *web_frame,
+                                                    WebKitNetworkRequest      *request,
+                                                    WebKitWebNavigationAction *action,
+                                                    WebKitWebPolicyDecision   *decision,
+                                                    gpointer                   data)
  {
        const gchar *uri;
  
+       /* Only call url_show on clicks */
+       if (webkit_web_navigation_action_get_reason (action) !=
+           WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) {
+               webkit_web_policy_decision_use (decision);
+               return TRUE;
+       }
        uri = webkit_network_request_get_uri (request);
        empathy_url_show (GTK_WIDGET (view), uri);
  
-       return WEBKIT_NAVIGATION_RESPONSE_IGNORE;
+       webkit_web_policy_decision_ignore (decision);
+       return TRUE;
  }
  
  static void
@@@ -547,8 -557,6 +557,8 @@@ theme_adium_append_message (EmpathyChat
        account = empathy_contact_get_account (sender);
        service_name = empathy_protocol_name_to_display_name
                (empathy_account_get_protocol (account));
 +      if (service_name == NULL)
 +              service_name = empathy_account_get_protocol (account);
        timestamp = empathy_message_get_timestamp (msg);
        body = empathy_message_get_body (msg);
        dup_body = theme_adium_parse_body (theme, body);
@@@ -1074,8 -1082,8 +1084,8 @@@ empathy_theme_adium_init (EmpathyThemeA
        g_signal_connect (theme, "load-finished",
                          G_CALLBACK (theme_adium_load_finished_cb),
                          NULL);
-       g_signal_connect (theme, "navigation-requested",
-                         G_CALLBACK (theme_adium_navigation_requested_cb),
+       g_signal_connect (theme, "navigation-policy-decision-requested",
+                         G_CALLBACK (theme_adium_navigation_policy_decision_requested_cb),
                          NULL);
        g_signal_connect (theme, "populate-popup",
                          G_CALLBACK (theme_adium_populate_popup_cb),