[epiphany] Drop gnome-desktop dependency by copying thumbnail factory bits



commit ec9671856f232a2276e8f269dec112ac033af2d3
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Fri Jan 5 17:58:15 2018 -0600

    Drop gnome-desktop dependency by copying thumbnail factory bits
    
    gnome-desktop is not supposed to be used by applications, that's why
    it's not in the runtime. And we have an Epiphany-specific security
    problem in the thumbnailer, which we cannot otherwise fix without adding
    new gnome-desktop API that would only be useful for Epiphany.
    
    The thumbnail factory is a lot of code, and we only need a small bit of
    it.
    
    In particular, get rid of the thumbnail mtime tracking code, which is
    unnecessary now that we control the thumbnailing code. For the past
    couple of years, it has only been used to convince the thumbnail factory
    to not discard our requests for thumbnails.
    
    Also, save the snapshots under ~/.cache/epiphany, so that we can delete
    them. Right now, we store undeletable snapshots of all the websites you
    view, which don't go away when clearing history (except, fortunately, in
    incognito mode). Now we can fix that.
    
    This commit also contains a minor memory leak fix, for good measure.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778578

 embed/ephy-embed-shell.c                      |   45 ++----
 embed/ephy-embed-shell.h                      |    1 -
 embed/ephy-web-view.c                         |   26 +--
 lib/ephy-snapshot-service.c                   |  216 +++++++++++++++++--------
 lib/ephy-snapshot-service.h                   |    2 -
 lib/history/ephy-history-service-urls-table.c |   22 +--
 lib/history/ephy-history-service.c            |   45 -----
 lib/history/ephy-history-service.h            |    1 -
 lib/history/ephy-history-types.c              |    1 -
 lib/history/ephy-history-types.h              |    1 -
 lib/meson.build                               |    1 -
 meson.build                                   |    1 -
 org.gnome.Epiphany.json                       |   10 --
 13 files changed, 176 insertions(+), 196 deletions(-)
---
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index d0751ff..bc9dc27 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -487,7 +487,6 @@ delayed_thumbnail_update_cb (DelayedThumbnailUpdateData *data)
 void
 ephy_embed_shell_set_thumbnail_path (EphyEmbedShell *shell,
                                      const char     *url,
-                                     time_t          mtime,
                                      const char     *path)
 {
   EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
@@ -504,30 +503,24 @@ ephy_embed_shell_set_thumbnail_path (EphyEmbedShell *shell,
   }
 }
 
-typedef struct {
-  char *url;
-  time_t mtime;
-} GetSnapshotPathAsyncData;
-
 static void
-got_snapshot_path_for_url_cb (EphySnapshotService      *service,
-                              GAsyncResult             *result,
-                              GetSnapshotPathAsyncData *data)
+got_snapshot_path_for_url_cb (EphySnapshotService *service,
+                              GAsyncResult        *result,
+                              char                *url)
 {
   char *snapshot;
   GError *error = NULL;
 
   snapshot = ephy_snapshot_service_get_snapshot_path_for_url_finish (service, result, &error);
   if (snapshot) {
-    ephy_embed_shell_set_thumbnail_path (ephy_embed_shell_get_default (), data->url, data->mtime, snapshot);
+    ephy_embed_shell_set_thumbnail_path (ephy_embed_shell_get_default (), url, snapshot);
     g_free (snapshot);
   } else {
     /* Bad luck, not something to warn about. */
-    g_info ("Failed to get snapshot for URL %s: %s", data->url, error->message);
+    g_info ("Failed to get snapshot for URL %s: %s", url, error->message);
     g_error_free (error);
   }
-  g_free (data->url);
-  g_free (data);
+  g_free (url);
 }
 
 void
@@ -541,16 +534,13 @@ ephy_embed_shell_schedule_thumbnail_update (EphyEmbedShell *shell,
   snapshot = ephy_snapshot_service_lookup_cached_snapshot_path (service, url->url);
 
   if (snapshot) {
-    ephy_embed_shell_set_thumbnail_path (shell, url->url, url->thumbnail_time, snapshot);
+    ephy_embed_shell_set_thumbnail_path (shell, url->url, snapshot);
   } else {
-    GetSnapshotPathAsyncData *data = g_new (GetSnapshotPathAsyncData, 1);
-
-    data->url = g_strdup (url->url);
-    data->mtime = url->thumbnail_time;
     ephy_snapshot_service_get_snapshot_path_for_url_async (service,
-                                                           url->url, url->thumbnail_time, NULL,
+                                                           url->url,
+                                                           NULL,
                                                            (GAsyncReadyCallback)got_snapshot_path_for_url_cb,
-                                                           data);
+                                                           g_strdup (url->url));
   }
 }
 
@@ -629,17 +619,6 @@ ephy_embed_shell_get_global_gsb_service (EphyEmbedShell *shell)
   return priv->global_gsb_service;
 }
 
-static void
-snapshot_saved_cb (EphySnapshotService *service,
-                   const char          *url,
-                   gint64               mtime,
-                   EphyEmbedShell      *shell)
-{
-  ephy_history_service_set_url_thumbnail_time (ephy_embed_shell_get_global_history_service (shell),
-                                               url, mtime,
-                                               NULL, NULL, NULL);
-}
-
 /**
  * ephy_embed_shell_get_encodings:
  * @shell: the #EphyEmbedShell
@@ -1184,10 +1163,6 @@ ephy_embed_shell_constructed (GObject *object)
     ephy_embed_shell_create_web_context (shell);
     priv->user_content = webkit_user_content_manager_new ();
   }
-
-  g_signal_connect_object (ephy_snapshot_service_get_default (),
-                           "snapshot-saved", G_CALLBACK (snapshot_saved_cb),
-                           shell, 0);
 }
 
 static void
diff --git a/embed/ephy-embed-shell.h b/embed/ephy-embed-shell.h
index c933d50..848ac95 100644
--- a/embed/ephy-embed-shell.h
+++ b/embed/ephy-embed-shell.h
@@ -79,7 +79,6 @@ gboolean           ephy_embed_shell_uri_looks_related_to_app   (EphyEmbedShell
 void               ephy_embed_shell_clear_cache                (EphyEmbedShell   *shell);
 void               ephy_embed_shell_set_thumbnail_path         (EphyEmbedShell   *shell,
                                                                 const char       *url,
-                                                                time_t            mtime,
                                                                 const char       *path);
 void               ephy_embed_shell_schedule_thumbnail_update  (EphyEmbedShell   *shell,
                                                                 EphyHistoryURL   *url);
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 77f688a..2aa3d67 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -608,30 +608,24 @@ ephy_web_view_history_cleared_cb (EphyHistoryService *history_service,
   ephy_web_view_clear_history (view);
 }
 
-typedef struct {
-  char *url;
-  time_t mtime;
-} GetSnapshotPathAsyncData;
-
 static void
-got_snapshot_path_cb (EphySnapshotService      *service,
-                      GAsyncResult             *result,
-                      GetSnapshotPathAsyncData *data)
+got_snapshot_path_cb (EphySnapshotService *service,
+                      GAsyncResult        *result,
+                      char                *url)
 {
   char *snapshot;
   GError *error = NULL;
 
   snapshot = ephy_snapshot_service_get_snapshot_path_finish (service, result, &error);
   if (snapshot) {
-    ephy_embed_shell_set_thumbnail_path (ephy_embed_shell_get_default (), data->url, data->mtime, snapshot);
+    ephy_embed_shell_set_thumbnail_path (ephy_embed_shell_get_default (), url, snapshot);
     g_free (snapshot);
   } else {
     /* Bad luck, not something to warn about. */
-    g_info ("Failed to get snapshot for URL %s: %s", data->url, error->message);
+    g_info ("Failed to get snapshot for URL %s: %s", url, error->message);
     g_error_free (error);
   }
-  g_free (data->url);
-  g_free (data);
+  g_free (url);
 }
 
 static gboolean
@@ -640,19 +634,15 @@ web_view_check_snapshot (WebKitWebView *web_view)
   EphyWebView *view = EPHY_WEB_VIEW (web_view);
   EphySnapshotService *service = ephy_snapshot_service_get_default ();
   const char *url = webkit_web_view_get_uri (web_view);
-  GetSnapshotPathAsyncData *data;
 
   view->snapshot_timeout_id = 0;
 
   if (view->error_page != EPHY_WEB_VIEW_ERROR_PAGE_NONE)
     return FALSE;
 
-  data = g_new (GetSnapshotPathAsyncData, 1);
-  data->url = g_strdup (url);
-  data->mtime = time (NULL);
-  ephy_snapshot_service_get_snapshot_path_async (service, web_view, data->mtime, NULL,
+  ephy_snapshot_service_get_snapshot_path_async (service, web_view, NULL,
                                                  (GAsyncReadyCallback)got_snapshot_path_cb,
-                                                 data);
+                                                 g_strdup (url));
 
   return FALSE;
 }
diff --git a/lib/ephy-snapshot-service.c b/lib/ephy-snapshot-service.c
index 5c4a91b..7495e7d 100644
--- a/lib/ephy-snapshot-service.c
+++ b/lib/ephy-snapshot-service.c
@@ -23,31 +23,22 @@
 
 #include "ephy-favicon-helpers.h"
 
-#ifndef GNOME_DESKTOP_USE_UNSTABLE_API
-#define GNOME_DESKTOP_USE_UNSTABLE_API
-#endif
-#include <libgnome-desktop/gnome-desktop-thumbnail.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
 #include <webkit2/webkit2.h>
 
 struct _EphySnapshotService {
   GObject parent_instance;
 
-  /* Disk cache */
-  GnomeDesktopThumbnailFactory *factory;
-
-  /* Memory cache */
   GHashTable *cache;
 };
 
 G_DEFINE_TYPE (EphySnapshotService, ephy_snapshot_service, G_TYPE_OBJECT)
 
-enum {
-  SNAPSHOT_SAVED,
-  LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
 typedef enum {
   SNAPSHOT_STALE,
   SNAPSHOT_FRESH
@@ -68,35 +59,148 @@ snapshot_path_cached_data_free (SnapshotPathCachedData *data)
 static void
 ephy_snapshot_service_class_init (EphySnapshotServiceClass *klass)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-  /**
-   * EphySnapshotService::snapshot-saved:
-   * @url: the URL the snapshot was saved for
-   * @mtime: the mtime embedded in the snapshot, needed to retrieve it
-   *
-   * The ::snapshot-saved signal is emitted when a new snapshot is saved.
-   **/
-  signals[SNAPSHOT_SAVED] = g_signal_new ("snapshot-saved",
-                                          G_OBJECT_CLASS_TYPE (object_class),
-                                          G_SIGNAL_RUN_LAST,
-                                          0,
-                                          NULL, NULL, NULL,
-                                          G_TYPE_NONE,
-                                          2,
-                                          G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
-                                          G_TYPE_INT64);
 }
 
 static void
 ephy_snapshot_service_init (EphySnapshotService *self)
 {
-  self->factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
   self->cache = g_hash_table_new_full (g_str_hash, g_str_equal,
                                        (GDestroyNotify)g_free,
                                        (GDestroyNotify)snapshot_path_cached_data_free);
 }
 
+static char *
+thumbnail_filename (const char *uri)
+{
+  GChecksum *checksum;
+  guint8 digest[16];
+  gsize digest_len = sizeof (digest);
+  char *file;
+
+  checksum = g_checksum_new (G_CHECKSUM_MD5);
+  g_checksum_update (checksum, (const guchar *)uri, strlen (uri));
+
+  g_checksum_get_digest (checksum, digest, &digest_len);
+  g_assert (digest_len == 16);
+
+  file = g_strconcat (g_checksum_get_string (checksum), ".png", NULL);
+
+  g_checksum_free (checksum);
+
+  return file;
+}
+
+static gboolean
+thumbnail_is_valid (GdkPixbuf  *pixbuf,
+                    const char *uri)
+{
+  const char *thumb_uri;
+
+  thumb_uri = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::URI");
+  if (g_strcmp0 (uri, thumb_uri) != 0)
+    return FALSE;
+
+  return TRUE;
+}
+
+static gboolean
+validate_thumbnail_path (const char *path,
+                         const char *uri)
+{
+  GdkPixbuf *pixbuf;
+
+  pixbuf = gdk_pixbuf_new_from_file (path, NULL);
+  if (pixbuf == NULL || !thumbnail_is_valid (pixbuf, uri))
+    return FALSE;
+
+  g_object_unref (pixbuf);
+
+  return TRUE;
+}
+
+static char *
+thumbnail_path (const char *uri)
+{
+  char *path, *file;
+
+  file = thumbnail_filename (uri);
+  path = g_build_filename (g_get_user_cache_dir (),
+                           "epiphany",
+                           "thumbnails",
+                           file,
+                           NULL);
+  g_free (file);
+
+  return path;
+}
+
+static gboolean
+save_thumbnail (GdkPixbuf  *pixbuf,
+                const char *uri)
+{
+  char *path;
+  char *dirname;
+  char *tmp_path = NULL;
+  int tmp_fd;
+  gboolean ret = FALSE;
+  GError *error = NULL;
+  const char *width, *height;
+
+  if (pixbuf == NULL)
+    return FALSE;
+
+  path = thumbnail_path (uri);
+  dirname = g_path_get_dirname (path);
+
+  if (g_mkdir_with_parents (dirname, 0700) != 0)
+    goto out;
+
+  tmp_path = g_strconcat (path, ".XXXXXX", NULL);
+  tmp_fd = g_mkstemp (tmp_path);
+
+  if (tmp_fd == -1)
+    goto out;
+  close (tmp_fd);
+
+  width = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Width");
+  height = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Height");
+
+  error = NULL;
+  if (width != NULL && height != NULL)
+    ret = gdk_pixbuf_save (pixbuf,
+                           tmp_path,
+                           "png", &error,
+                           "tEXt::Thumb::Image::Width", width,
+                           "tEXt::Thumb::Image::Height", height,
+                           "tEXt::Thumb::URI", uri,
+                           "tEXt::Software", "GNOME::Epiphany::ThumbnailFactory",
+                           NULL);
+  else
+    ret = gdk_pixbuf_save (pixbuf,
+                           tmp_path,
+                           "png", &error,
+                           "tEXt::Thumb::URI", uri,
+                           "tEXt::Software", "GNOME::Epiphany::ThumbnailFactory",
+                           NULL);
+
+  if (!ret)
+    goto out;
+
+  chmod (tmp_path, 0600);
+  rename (tmp_path, path);
+
+ out:
+  if (error != NULL) {
+    g_warning ("Failed to create thumbnail %s: %s", tmp_path, error->message);
+    g_error_free (error);
+  }
+  unlink (tmp_path);
+  g_free (path);
+  g_free (tmp_path);
+  g_free (dirname);
+  return ret;
+}
+
 static GdkPixbuf *
 ephy_snapshot_service_prepare_snapshot (cairo_surface_t *surface,
                                         cairo_surface_t *favicon)
@@ -164,7 +268,6 @@ typedef struct {
   EphySnapshotService *service;
   GdkPixbuf *snapshot;
   WebKitWebView *web_view;
-  time_t mtime;
   char *url;
 } SnapshotAsyncData;
 
@@ -172,7 +275,6 @@ static SnapshotAsyncData *
 snapshot_async_data_new (EphySnapshotService *service,
                          GdkPixbuf           *snapshot,
                          WebKitWebView       *web_view,
-                         time_t               mtime,
                          const char          *url)
 {
   SnapshotAsyncData *data;
@@ -181,7 +283,6 @@ snapshot_async_data_new (EphySnapshotService *service,
   data->service = g_object_ref (service);
   data->snapshot = snapshot ? g_object_ref (snapshot) : NULL;
   data->web_view = web_view;
-  data->mtime = mtime;
   data->url = g_strdup (url);
 
   if (web_view)
@@ -196,7 +297,6 @@ snapshot_async_data_copy (SnapshotAsyncData *data)
   SnapshotAsyncData *copy = snapshot_async_data_new (data->service,
                                                      data->snapshot,
                                                      data->web_view,
-                                                     data->mtime,
                                                      data->url);
   return copy;
 }
@@ -248,17 +348,6 @@ cache_snapshot_data_in_idle (EphySnapshotService  *service,
   g_idle_add (idle_cache_snapshot_path, data);
 }
 
-static gboolean
-idle_emit_snapshot_saved (gpointer user_data)
-{
-  SnapshotAsyncData *data = (SnapshotAsyncData *)user_data;
-
-  g_signal_emit (data->service, signals[SNAPSHOT_SAVED], 0, data->url, data->mtime);
-
-  snapshot_async_data_free (data);
-  return G_SOURCE_REMOVE;
-}
-
 static void
 save_snapshot_thread (GTask               *task,
                       EphySnapshotService *service,
@@ -267,13 +356,8 @@ save_snapshot_thread (GTask               *task,
 {
   char *path;
 
-  gnome_desktop_thumbnail_factory_save_thumbnail (service->factory,
-                                                  data->snapshot,
-                                                  data->url,
-                                                  data->mtime);
-  g_idle_add (idle_emit_snapshot_saved, snapshot_async_data_copy (data));
-
-  path = gnome_desktop_thumbnail_path_for_uri (data->url, GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
+  save_thumbnail (data->snapshot, data->url);
+  path = thumbnail_path (data->url);
   cache_snapshot_data_in_idle (service, data->url, path, SNAPSHOT_FRESH);
 
   g_task_return_pointer (task, path, g_free);
@@ -283,7 +367,6 @@ static void
 ephy_snapshot_service_save_snapshot_async (EphySnapshotService *service,
                                            GdkPixbuf           *snapshot,
                                            const char          *url,
-                                           time_t               mtime,
                                            GCancellable        *cancellable,
                                            GAsyncReadyCallback  callback,
                                            gpointer             user_data)
@@ -297,7 +380,7 @@ ephy_snapshot_service_save_snapshot_async (EphySnapshotService *service,
   task = g_task_new (service, cancellable, callback, user_data);
   g_task_set_priority (task, G_PRIORITY_LOW);
   g_task_set_task_data (task,
-                        snapshot_async_data_new (service, snapshot, NULL, mtime, url),
+                        snapshot_async_data_new (service, snapshot, NULL, url),
                         (GDestroyNotify)snapshot_async_data_free);
   g_task_run_in_thread (task, (GTaskThreadFunc)save_snapshot_thread);
   g_object_unref (task);
@@ -338,7 +421,6 @@ save_snapshot (cairo_surface_t *surface,
   ephy_snapshot_service_save_snapshot_async (g_task_get_source_object (task),
                                              data->snapshot,
                                              webkit_web_view_get_uri (data->web_view),
-                                             data->mtime,
                                              g_task_get_cancellable (task),
                                              (GAsyncReadyCallback)snapshot_saved,
                                              task);
@@ -523,12 +605,13 @@ get_snapshot_path_for_url_thread (GTask               *task,
 {
   char *path;
 
-  path = gnome_desktop_thumbnail_factory_lookup (service->factory, data->url, data->mtime);
-  if (!path) {
+  path = thumbnail_path (data->url);
+  if (!validate_thumbnail_path (path, data->url)) {
     g_task_return_new_error (task,
                              EPHY_SNAPSHOT_SERVICE_ERROR,
                              EPHY_SNAPSHOT_SERVICE_ERROR_NOT_FOUND,
                              "Snapshot for url \"%s\" not found in disk cache", data->url);
+    g_free (path);
     return;
   }
 
@@ -540,7 +623,6 @@ get_snapshot_path_for_url_thread (GTask               *task,
 void
 ephy_snapshot_service_get_snapshot_path_for_url_async (EphySnapshotService *service,
                                                        const char          *url,
-                                                       time_t               mtime,
                                                        GCancellable        *cancellable,
                                                        GAsyncReadyCallback  callback,
                                                        gpointer             user_data)
@@ -562,7 +644,7 @@ ephy_snapshot_service_get_snapshot_path_for_url_async (EphySnapshotService *serv
 
   g_task_set_priority (task, G_PRIORITY_LOW);
   g_task_set_task_data (task,
-                        snapshot_async_data_new (service, NULL, NULL, mtime, url),
+                        snapshot_async_data_new (service, NULL, NULL, url),
                         (GDestroyNotify)snapshot_async_data_free);
   g_task_run_in_thread (task, (GTaskThreadFunc)get_snapshot_path_for_url_thread);
   g_object_unref (task);
@@ -616,7 +698,6 @@ got_snapshot_path_for_url (EphySnapshotService *service,
 void
 ephy_snapshot_service_get_snapshot_path_async (EphySnapshotService *service,
                                                WebKitWebView       *web_view,
-                                               time_t               mtime,
                                                GCancellable        *cancellable,
                                                GAsyncReadyCallback  callback,
                                                gpointer             user_data)
@@ -636,15 +717,16 @@ ephy_snapshot_service_get_snapshot_path_async (EphySnapshotService *service,
 
   if (path) {
     take_fresh_snapshot_in_background_if_stale (service,
-                                                snapshot_async_data_new (service, NULL, web_view, mtime, 
uri));
+                                                snapshot_async_data_new (service, NULL, web_view, uri));
     g_task_return_pointer (task, g_strdup (path), g_free);
     g_object_unref (task);
   } else {
     g_task_set_task_data (task,
-                          snapshot_async_data_new (service, NULL, web_view, mtime, uri),
+                          snapshot_async_data_new (service, NULL, web_view, uri),
                           (GDestroyNotify)snapshot_async_data_free);
     ephy_snapshot_service_get_snapshot_path_for_url_async (service,
-                                                           uri, mtime, cancellable,
+                                                           uri,
+                                                           cancellable,
                                                            (GAsyncReadyCallback)got_snapshot_path_for_url,
                                                            task);
   }
diff --git a/lib/ephy-snapshot-service.h b/lib/ephy-snapshot-service.h
index c5aa56b..ac80bc3 100644
--- a/lib/ephy-snapshot-service.h
+++ b/lib/ephy-snapshot-service.h
@@ -52,7 +52,6 @@ const char          *ephy_snapshot_service_lookup_cached_snapshot_path      (Eph
 
 void                 ephy_snapshot_service_get_snapshot_path_for_url_async  (EphySnapshotService *service,
                                                                              const char *url,
-                                                                             time_t mtime,
                                                                              GCancellable *cancellable,
                                                                              GAsyncReadyCallback callback,
                                                                              gpointer user_data);
@@ -63,7 +62,6 @@ char                *ephy_snapshot_service_get_snapshot_path_for_url_finish (Eph
 
 void                 ephy_snapshot_service_get_snapshot_path_async          (EphySnapshotService *service,
                                                                              WebKitWebView *web_view,
-                                                                             time_t mtime,
                                                                              GCancellable *cancellable,
                                                                              GAsyncReadyCallback callback,
                                                                              gpointer user_data);
diff --git a/lib/history/ephy-history-service-urls-table.c b/lib/history/ephy-history-service-urls-table.c
index 6749b27..a8aeb70 100644
--- a/lib/history/ephy-history-service-urls-table.c
+++ b/lib/history/ephy-history-service-urls-table.c
@@ -41,7 +41,7 @@ ephy_history_service_initialize_urls_table (EphyHistoryService *self)
                                   "visit_count INTEGER DEFAULT 0 NOT NULL,"
                                   "typed_count INTEGER DEFAULT 0 NOT NULL,"
                                   "last_visit_time INTEGER,"
-                                  "thumbnail_update_time INTEGER DEFAULT 0,"
+                                  "thumbnail_update_time INTEGER DEFAULT 0," /* this column is legacy, 
unused */
                                   "hidden_from_overview INTEGER DEFAULT 0)", &error);
 
   if (error) {
@@ -68,11 +68,11 @@ ephy_history_service_get_url_row (EphyHistoryService *self, const char *url_stri
 
   if (url != NULL && url->id != -1) {
     statement = ephy_sqlite_connection_create_statement (self->history_database,
-                                                         "SELECT id, url, title, visit_count, typed_count, 
last_visit_time, hidden_from_overview, thumbnail_update_time, sync_id FROM urls "
+                                                         "SELECT id, url, title, visit_count, typed_count, 
last_visit_time, hidden_from_overview, sync_id FROM urls "
                                                          "WHERE id=?", &error);
   } else {
     statement = ephy_sqlite_connection_create_statement (self->history_database,
-                                                         "SELECT id, url, title, visit_count, typed_count, 
last_visit_time, hidden_from_overview, thumbnail_update_time, sync_id FROM urls "
+                                                         "SELECT id, url, title, visit_count, typed_count, 
last_visit_time, hidden_from_overview, sync_id FROM urls "
                                                          "WHERE url=?", &error);
   }
 
@@ -116,8 +116,7 @@ ephy_history_service_get_url_row (EphyHistoryService *self, const char *url_stri
   url->typed_count = ephy_sqlite_statement_get_column_as_int (statement, 4),
   url->last_visit_time = ephy_sqlite_statement_get_column_as_int64 (statement, 5);
   url->hidden = ephy_sqlite_statement_get_column_as_int (statement, 6);
-  url->thumbnail_time = ephy_sqlite_statement_get_column_as_int64 (statement, 7);
-  url->sync_id = g_strdup (ephy_sqlite_statement_get_column_as_string (statement, 8));
+  url->sync_id = g_strdup (ephy_sqlite_statement_get_column_as_string (statement, 7));
 
   g_object_unref (statement);
   return url;
@@ -175,7 +174,7 @@ ephy_history_service_update_url_row (EphyHistoryService *self, EphyHistoryURL *u
   g_assert (self->history_database != NULL);
 
   statement = ephy_sqlite_connection_create_statement (self->history_database,
-                                                       "UPDATE urls SET title=?, visit_count=?, 
typed_count=?, last_visit_time=?, hidden_from_overview=?, thumbnail_update_time=?, sync_id=? "
+                                                       "UPDATE urls SET title=?, visit_count=?, 
typed_count=?, last_visit_time=?, hidden_from_overview=?, sync_id=? "
                                                        "WHERE id=?", &error);
   if (error) {
     g_warning ("Could not build urls table modification statement: %s", error->message);
@@ -188,9 +187,8 @@ ephy_history_service_update_url_row (EphyHistoryService *self, EphyHistoryURL *u
       ephy_sqlite_statement_bind_int (statement, 2, url->typed_count, &error) == FALSE ||
       ephy_sqlite_statement_bind_int64 (statement, 3, url->last_visit_time, &error) == FALSE ||
       ephy_sqlite_statement_bind_int (statement, 4, url->hidden, &error) == FALSE ||
-      ephy_sqlite_statement_bind_int64 (statement, 5, url->thumbnail_time, &error) == FALSE ||
-      ephy_sqlite_statement_bind_string (statement, 6, url->sync_id, &error) == FALSE ||
-      ephy_sqlite_statement_bind_int (statement, 7, url->id, &error) == FALSE) {
+      ephy_sqlite_statement_bind_string (statement, 5, url->sync_id, &error) == FALSE ||
+      ephy_sqlite_statement_bind_int (statement, 6, url->id, &error) == FALSE) {
     g_warning ("Could not modify URL in urls table: %s", error->message);
     g_error_free (error);
     g_object_unref (statement);
@@ -217,9 +215,8 @@ create_url_from_statement (EphySQLiteStatement *statement)
   url->id = ephy_sqlite_statement_get_column_as_int (statement, 0);
   url->host = ephy_history_host_new (NULL, NULL, 0, 1.0);
   url->hidden = ephy_sqlite_statement_get_column_as_int (statement, 6);
-  url->thumbnail_time = ephy_sqlite_statement_get_column_as_int64 (statement, 7);
-  url->host->id = ephy_sqlite_statement_get_column_as_int (statement, 8);
-  url->sync_id = g_strdup (ephy_sqlite_statement_get_column_as_string (statement, 9));
+  url->host->id = ephy_sqlite_statement_get_column_as_int (statement, 7);
+  url->sync_id = g_strdup (ephy_sqlite_statement_get_column_as_string (statement, 8));
 
   return url;
 }
@@ -241,7 +238,6 @@ ephy_history_service_find_url_rows (EphyHistoryService *self, EphyHistoryQuery *
                                "urls.typed_count, "
                                "urls.last_visit_time, "
                                "urls.hidden_from_overview, "
-                               "urls.thumbnail_update_time, "
                                "urls.host, "
                                "urls.sync_id "
                                "FROM "
diff --git a/lib/history/ephy-history-service.c b/lib/history/ephy-history-service.c
index 2dcc8f9..6ce328e 100644
--- a/lib/history/ephy-history-service.c
+++ b/lib/history/ephy-history-service.c
@@ -38,7 +38,6 @@ typedef enum {
   SET_URL_TITLE,
   SET_URL_ZOOM_LEVEL,
   SET_URL_HIDDEN,
-  SET_URL_THUMBNAIL_TIME,
   ADD_VISIT,
   ADD_VISITS,
   DELETE_URLS,
@@ -943,49 +942,6 @@ ephy_history_service_set_url_hidden (EphyHistoryService    *self,
 }
 
 static gboolean
-ephy_history_service_execute_set_url_thumbnail_time (EphyHistoryService *self,
-                                                     EphyHistoryURL     *url,
-                                                     gpointer           *result)
-{
-  gint64 thumbnail_time;
-
-  if (self->read_only)
-    return FALSE;
-
-  thumbnail_time = url->thumbnail_time;
-
-  if (ephy_history_service_get_url_row (self, NULL, url) == NULL)
-    return FALSE;
-  else {
-    url->thumbnail_time = thumbnail_time;
-    ephy_history_service_update_url_row (self, url);
-    return TRUE;
-  }
-}
-
-void
-ephy_history_service_set_url_thumbnail_time (EphyHistoryService    *self,
-                                             const char            *orig_url,
-                                             gint64                 thumbnail_time,
-                                             GCancellable          *cancellable,
-                                             EphyHistoryJobCallback callback,
-                                             gpointer               user_data)
-{
-  EphyHistoryURL *url;
-  EphyHistoryServiceMessage *message;
-
-  g_assert (EPHY_IS_HISTORY_SERVICE (self));
-  g_assert (orig_url != NULL);
-
-  url = ephy_history_url_new (orig_url, NULL, 0, 0, 0);
-  url->thumbnail_time = thumbnail_time;
-  message = ephy_history_service_message_new (self, SET_URL_THUMBNAIL_TIME,
-                                              url, (GDestroyNotify)ephy_history_url_free,
-                                              cancellable, callback, user_data);
-  ephy_history_service_send_message (self, message);
-}
-
-static gboolean
 ephy_history_service_execute_get_url (EphyHistoryService *self,
                                       const gchar        *orig_url,
                                       gpointer           *result)
@@ -1207,7 +1163,6 @@ static EphyHistoryServiceMethod methods[] = {
   (EphyHistoryServiceMethod)ephy_history_service_execute_set_url_title,
   (EphyHistoryServiceMethod)ephy_history_service_execute_set_url_zoom_level,
   (EphyHistoryServiceMethod)ephy_history_service_execute_set_url_hidden,
-  (EphyHistoryServiceMethod)ephy_history_service_execute_set_url_thumbnail_time,
   (EphyHistoryServiceMethod)ephy_history_service_execute_add_visit,
   (EphyHistoryServiceMethod)ephy_history_service_execute_add_visits,
   (EphyHistoryServiceMethod)ephy_history_service_execute_delete_urls,
diff --git a/lib/history/ephy-history-service.h b/lib/history/ephy-history-service.h
index 82dbf59..b003a2e 100644
--- a/lib/history/ephy-history-service.h
+++ b/lib/history/ephy-history-service.h
@@ -43,7 +43,6 @@ void                     ephy_history_service_query_visits            (EphyHisto
 void                     ephy_history_service_query_urls              (EphyHistoryService *self, 
EphyHistoryQuery *query, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
 void                     ephy_history_service_set_url_title           (EphyHistoryService *self, const char 
*url, const char *title, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
 void                     ephy_history_service_set_url_hidden          (EphyHistoryService *self, const char 
*url, gboolean hidden, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
-void                     ephy_history_service_set_url_thumbnail_time  (EphyHistoryService *self, const char 
*orig_url, gint64 thumbnail_time, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer 
user_data);
 void                     ephy_history_service_set_url_zoom_level      (EphyHistoryService *self, const char 
*url, const double zoom_level, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer 
user_data);
 void                     ephy_history_service_get_host_for_url        (EphyHistoryService *self, const char 
*url, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
 void                     ephy_history_service_get_hosts               (EphyHistoryService *self, 
GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
diff --git a/lib/history/ephy-history-types.c b/lib/history/ephy-history-types.c
index 088d1cd..f8ed322 100644
--- a/lib/history/ephy-history-types.c
+++ b/lib/history/ephy-history-types.c
@@ -153,7 +153,6 @@ ephy_history_url_copy (EphyHistoryURL *url)
   copy->sync_id = g_strdup (url->sync_id);
   copy->hidden = url->hidden;
   copy->host = ephy_history_host_copy (url->host);
-  copy->thumbnail_time = url->thumbnail_time;
   copy->notify_visit = url->notify_visit;
   copy->notify_delete = url->notify_delete;
 
diff --git a/lib/history/ephy-history-types.h b/lib/history/ephy-history-types.h
index d9d1688..b2bca67 100644
--- a/lib/history/ephy-history-types.h
+++ b/lib/history/ephy-history-types.h
@@ -75,7 +75,6 @@ typedef struct _EphyHistoryURL
   int visit_count;
   int typed_count;
   gint64 last_visit_time; /* Microseconds */
-  gint64 thumbnail_time;  /* Seconds */
   gboolean hidden;
   EphyHistoryHost *host;
   gboolean notify_visit;
diff --git a/lib/meson.build b/lib/meson.build
index 298dd7e..c505667 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -57,7 +57,6 @@ libephymisc_deps = [
   gio_dep,
   gio_unix_dep,
   glib_dep,
-  gnome_desktop_dep,
   gtk_dep,
   icu_uc_dep,
   json_glib_dep,
diff --git a/meson.build b/meson.build
index accb655..f164964 100644
--- a/meson.build
+++ b/meson.build
@@ -68,7 +68,6 @@ gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: '>= 2.36.5')
 gio_dep = dependency('gio-2.0', version: glib_requirement)
 gio_unix_dep = dependency('gio-unix-2.0', version: glib_requirement)
 glib_dep = dependency('glib-2.0', version: glib_requirement)
-gnome_desktop_dep = dependency('gnome-desktop-3.0', version: '>= 2.91.2')
 gtk_dep = dependency('gtk+-3.0', version: gtk_requirement)
 gtk_unix_print_dep = dependency('gtk+-unix-print-3.0', version: gtk_requirement)
 hogweed_dep = dependency('hogweed', version: nettle_requirement)
diff --git a/org.gnome.Epiphany.json b/org.gnome.Epiphany.json
index 521b434..ce4d834 100644
--- a/org.gnome.Epiphany.json
+++ b/org.gnome.Epiphany.json
@@ -41,16 +41,6 @@
                 "*.la", "*.a"],
     "modules": [
         {
-            "name": "gnome-desktop",
-            "config-opts": ["--disable-debug-tools", "--disable-udev"],
-            "sources": [
-                {
-                    "type": "git",
-                    "url": "https://git.gnome.org/browse/gnome-desktop";
-                }
-            ]
-        },
-        {
             "name": "epiphany",
             "config-opts": ["-Dtech_preview=true"],
             "buildsystem": "meson",


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