[evolution] Disable/remove WebKit1 left artifacts of ENABLE_CONTACT_MAPS



commit 2e90abe1e3e856279a956db5a2b7ff0965b0d29b
Author: Milan Crha <mcrha redhat com>
Date:   Mon Oct 10 18:39:47 2016 +0200

    Disable/remove WebKit1 left artifacts of ENABLE_CONTACT_MAPS
    
    The code which showed contact map in the contact preview required
    WebKit1 functionality (gtk+ widgets inside webview), but it's gone
    in WebKit2. This didn't break in the compile time, but in runtime
    a critical warnings about missing signal had been shown on the console.
    Let's disable/remove the related code for now and enable contact
    maps in the preview once there's available a good replacement.
    All the other functionality still works, thus the overall configure
    option is left there.

 addressbook/gui/widgets/eab-contact-display.c   |   68 -----------------------
 addressbook/gui/widgets/eab-contact-formatter.c |    5 ++
 modules/addressbook/e-book-shell-view-actions.c |    8 ++-
 3 files changed, 12 insertions(+), 69 deletions(-)
---
diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c
index 20801ab..28cb9e9 100644
--- a/addressbook/gui/widgets/eab-contact-display.c
+++ b/addressbook/gui/widgets/eab-contact-display.c
@@ -320,69 +320,6 @@ contact_display_link_clicked (EWebView *web_view,
                link_clicked (web_view, uri);
 }
 
-#ifdef ENABLE_CONTACT_MAPS
-/* XXX Clutter event handling workaround. Clutter-gtk propagates events down
- *     to parent widgets.  In this case it leads to GtkHTML scrolling up and
- *     down while user's trying to zoom in the champlain widget. This
- *     workaround stops the propagation from map widget down to GtkHTML. */
-static gboolean
-handle_map_scroll_event (GtkWidget *widget,
-                         GdkEvent *event)
-{
-       return TRUE;
-}
-
-static GtkWidget *
-contact_display_object_requested (WebKitWebView *web_view,
-                                  gchar *mime_type,
-                                  gchar *uri,
-                                  GHashTable *param,
-                                  EABContactDisplay *display)
-{
-       EContact *contact = display->priv->contact;
-       const gchar *name = e_contact_get_const (contact, E_CONTACT_FILE_AS);
-       const gchar *contact_uid = e_contact_get_const (contact, E_CONTACT_UID);
-       gchar *full_name = NULL;
-       EContactAddress *address = NULL;
-       GtkWidget *map = NULL;
-
-       if (strstr (mime_type, "work") != NULL) {
-               address = e_contact_get (contact, E_CONTACT_ADDRESS_WORK);
-               full_name = g_strconcat (name, " (", _("Work"), ")", NULL);
-       } else if (strstr (mime_type, "home") != NULL) {
-               address = e_contact_get (contact, E_CONTACT_ADDRESS_HOME);
-               full_name = g_strconcat (name, " (", _("Home"), ")", NULL);
-       }
-
-       if (address) {
-               map = e_contact_map_new ();
-               gtk_widget_set_size_request (map, 250, 250);
-               g_signal_connect (
-                       E_CONTACT_MAP (map), "contact-added",
-                       G_CALLBACK (e_contact_map_zoom_on_marker), NULL);
-               g_signal_connect_swapped (
-                       E_CONTACT_MAP (map), "contact-added",
-                       G_CALLBACK (gtk_widget_show_all), map);
-               g_signal_connect (
-                       GTK_CHAMPLAIN_EMBED (map), "scroll-event",
-                       G_CALLBACK (handle_map_scroll_event), NULL);
-
-               /* No need to display photo in contact preview. */
-               e_contact_map_add_marker (
-                       E_CONTACT_MAP (map), full_name,
-                       contact_uid, address, NULL);
-
-               gtk_widget_show_all (map);
-
-               e_contact_address_free (address);
-       }
-
-       g_free (full_name);
-
-       return map;
-}
-#endif
-
 static void
 contact_display_load_changed (WebKitWebView *web_view,
                               WebKitLoadEvent load_event,
@@ -516,11 +453,6 @@ eab_contact_display_init (EABContactDisplay *display)
        web_view = E_WEB_VIEW (display);
        ui_manager = e_web_view_get_ui_manager (web_view);
 
-#ifdef ENABLE_CONTACT_MAPS
-       g_signal_connect (
-               web_view, "create-plugin-widget",
-               G_CALLBACK (contact_display_object_requested), display);
-#endif
        e_signal_connect_notify (
                web_view, "notify::load-changed",
                G_CALLBACK (contact_display_load_changed), NULL);
diff --git a/addressbook/gui/widgets/eab-contact-formatter.c b/addressbook/gui/widgets/eab-contact-formatter.c
index eaf842d..aa8188a 100644
--- a/addressbook/gui/widgets/eab-contact-formatter.c
+++ b/addressbook/gui/widgets/eab-contact-formatter.c
@@ -778,6 +778,10 @@ accum_address_map (GString *buffer,
                    EContact *contact,
                    gint map_type)
 {
+/* Disabled, due to the code depending on WebKit1 functionality (gtk+ widgets inside webview).
+   Re-enable once there is a good replacement. See also ACTION (CONTACT_PREVIEW_SHOW_MAPS) usage.
+*/
+#if 0
 #ifdef ENABLE_CONTACT_MAPS
        g_string_append (buffer, "<tr><td colspan=\"3\">");
 
@@ -795,6 +799,7 @@ accum_address_map (GString *buffer,
 
        g_string_append (buffer, "</td></tr>");
 #endif /* ENABLE_CONTACT_MAPS */
+#endif /* 0 */
 }
 
 static void
diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c
index 1a66aca..348a57c 100644
--- a/modules/addressbook/e-book-shell-view-actions.c
+++ b/modules/addressbook/e-book-shell-view-actions.c
@@ -1392,8 +1392,14 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view)
        e_web_view_set_print_proxy (web_view, ACTION (CONTACT_PRINT));
        e_web_view_set_save_as_proxy (web_view, ACTION (CONTACT_SAVE_AS));
 
-#ifndef ENABLE_CONTACT_MAPS
+       /* Never show the action for the preview panel, the feature required
+          WebKit1 functionality (gtk+ widgets inside webview).
+          Re-enable once there is a good replacement.
+          See also accum_address_map() in eab-contact-formatter.cpp.
+       */
        gtk_action_set_visible (ACTION (CONTACT_PREVIEW_SHOW_MAPS), FALSE);
+
+#ifndef ENABLE_CONTACT_MAPS
        gtk_action_set_visible (ACTION (ADDRESS_BOOK_MAP), FALSE);
        gtk_action_set_visible (ACTION (ADDRESS_BOOK_POPUP_MAP), FALSE);
 #endif


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