[gnome-control-center] Revert "background: Add support for Flickr pictures"



commit 24670aebb072f531e02dd53c55601c9e3b9f15a0
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Feb 17 19:58:50 2014 +0100

    Revert "background: Add support for Flickr pictures"
    
    This was never meant to be pushed.
    
    This reverts commit 725b85db775ab8226d3b77b549a2daa2f96044b4.

 configure.ac                           |    5 +-
 panels/background/bg-pictures-source.c |  141 ++------------------------------
 2 files changed, 7 insertions(+), 139 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 76ba9f5..bcac063 100644
--- a/configure.ac
+++ b/configure.ac
@@ -105,7 +105,6 @@ ACCOUNTSSERVICE_REQUIRED_VERSION=0.6.30
 COLORD_REQUIRED_VERSION=0.1.34
 COLORD_GTK_REQUIRED_VERSION=0.1.24
 PWQUALITY_REQUIRED_VERSION=1.2.2
-GRILO_REQUIRED_VERSION=0.2.6
 
 COMMON_MODULES="gtk+-3.0 >= $GTK_REQUIRED_VERSION
  glib-2.0 >= $GLIB_REQUIRED_VERSION
@@ -120,9 +119,7 @@ PKG_CHECK_MODULES(LIBLANGUAGE, $COMMON_MODULES gnome-desktop-3.0 fontconfig)
 PKG_CHECK_MODULES(LIBSHORTCUTS, $COMMON_MODULES x11)
 PKG_CHECK_MODULES(SHELL, $COMMON_MODULES x11 polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION)
 PKG_CHECK_MODULES(BACKGROUND_PANEL, $COMMON_MODULES libxml-2.0 gnome-desktop-3.0
-                  gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED_VERSION
-                  goa-1.0 >= $GOA_REQUIRED_VERSION
-                  grilo-0.2 >= $GRILO_REQUIRED_VERSION)
+                  gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED_VERSION)
 PKG_CHECK_MODULES(DATETIME_PANEL, $COMMON_MODULES
                   gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION
                   polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION
diff --git a/panels/background/bg-pictures-source.c b/panels/background/bg-pictures-source.c
index 0304868..73e32b7 100644
--- a/panels/background/bg-pictures-source.c
+++ b/panels/background/bg-pictures-source.c
@@ -23,12 +23,10 @@
 
 #include "bg-pictures-source.h"
 
-#include "cc-background-grilo-miner.h"
 #include "cc-background-item.h"
 
 #include <string.h>
 #include <gio/gio.h>
-#include <grilo.h>
 #include <libgnome-desktop/gnome-desktop-thumbnail.h>
 #include <gdesktop-enums.h>
 
@@ -45,8 +43,6 @@ struct _BgPicturesSourcePrivate
 {
   GCancellable *cancellable;
 
-  CcBackgroundGriloMiner *grl_miner;
-
   GnomeDesktopThumbnailFactory *thumb_factory;
 
   GFileMonitor *picture_dir_monitor;
@@ -109,7 +105,6 @@ bg_pictures_source_dispose (GObject *object)
       g_clear_object (&priv->cancellable);
     }
 
-  g_clear_object (&priv->grl_miner);
   g_clear_object (&priv->thumb_factory);
 
   G_OBJECT_CLASS (bg_pictures_source_parent_class)->dispose (object);
@@ -199,8 +194,6 @@ picture_scaled (GObject *source_object,
   bg_source = BG_PICTURES_SOURCE (user_data);
   store = bg_source_get_liststore (BG_SOURCE (bg_source));
   uri = cc_background_item_get_uri (item);
-  if (uri == NULL)
-    uri = cc_background_item_get_source_url (item);
 
   /* Ignore screenshots */
   software = gdk_pixbuf_get_option (pixbuf, "tEXt::Software");
@@ -283,47 +276,6 @@ picture_opened_for_read (GObject *source_object,
   g_object_unref (stream);
 }
 
-static void
-picture_copied_for_read (GObject *source_object,
-                         GAsyncResult *res,
-                         gpointer user_data)
-{
-  BgPicturesSource *bg_source;
-  CcBackgroundItem *item;
-  GError *error = NULL;
-  GFile *thumbnail_file = G_FILE (source_object);
-  GFile *native_file;
-
-  if (!g_file_copy_finish (thumbnail_file, res, &error))
-    {
-      if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-        goto out;
-      else if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS))
-        {
-          gchar *uri;
-
-          uri = g_file_get_uri (thumbnail_file);
-          g_warning ("Failed to download '%s': %s", uri, error->message);
-          g_free (uri);
-          goto out;
-        }
-    }
-
-  bg_source = BG_PICTURES_SOURCE (user_data);
-
-  native_file = g_object_get_data (G_OBJECT (thumbnail_file), "native-file");
-  item = g_object_get_data (G_OBJECT (thumbnail_file), "item");
-  g_object_set_data_full (G_OBJECT (native_file), "item", g_object_ref (item), g_object_unref);
-  g_file_read_async (native_file,
-                     G_PRIORITY_DEFAULT,
-                     bg_source->priv->cancellable,
-                     picture_opened_for_read,
-                     bg_source);
-
- out:
-  g_clear_error (&error);
-}
-
 static gboolean
 in_content_types (const char *content_type)
 {
@@ -351,7 +303,6 @@ add_single_file (BgPicturesSource *bg_source,
 {
   const gchar *content_type;
   CcBackgroundItem *item = NULL;
-  CcBackgroundItemFlags flags = 0;
   GError *error = NULL;
   GdkPixbuf *pixbuf = NULL;
   GtkIconInfo *icon_info = NULL;
@@ -380,10 +331,7 @@ add_single_file (BgPicturesSource *bg_source,
 
   is_native = g_file_is_native (file);
   if (is_native)
-    {
-      source_uri = g_strdup (uri);
-      flags |= CC_BACKGROUND_ITEM_HAS_URI;
-    }
+    source_uri = g_strdup (uri);
   else
     {
       source_uri = uri;
@@ -391,9 +339,8 @@ add_single_file (BgPicturesSource *bg_source,
     }
 
   item = cc_background_item_new (uri);
-  flags |= CC_BACKGROUND_ITEM_HAS_SHADING;
   g_object_set (G_OBJECT (item),
-               "flags", flags,
+               "flags", CC_BACKGROUND_ITEM_HAS_URI | CC_BACKGROUND_ITEM_HAS_SHADING,
                "shading", G_DESKTOP_BACKGROUND_SHADING_SOLID,
                "placement", G_DESKTOP_BACKGROUND_STYLE_ZOOM,
                 "modified", mtime,
@@ -436,63 +383,11 @@ add_single_file (BgPicturesSource *bg_source,
   g_object_set_data_full (G_OBJECT (item), "row-ref", row_ref, (GDestroyNotify) gtk_tree_row_reference_free);
 
  read_file:
-  if (is_native)
-    {
-      g_object_set_data_full (G_OBJECT (file), "item", g_object_ref (item), g_object_unref);
-      g_file_read_async (file, G_PRIORITY_DEFAULT,
-                         bg_source->priv->cancellable,
-                         picture_opened_for_read, bg_source);
-    }
-  else
-    {
-      GFile *native_file;
-      GFile *thumbnail_file = NULL;
-      GrlMedia *media;
-      gchar *native_dir;
-      gchar *native_path;
-
-      media = g_object_get_data (G_OBJECT (file), "grl-media");
-      if (media != NULL)
-        {
-          const gchar *title;
-          const gchar *thumbnail_uri;
+  g_object_set_data_full (G_OBJECT (file), "item", g_object_ref (item), g_object_unref);
 
-          title = grl_media_get_title (media);
-          g_object_set (G_OBJECT (item), "name", title, NULL);
-
-          thumbnail_uri = grl_media_get_thumbnail (media);
-          thumbnail_file = g_file_new_for_uri (thumbnail_uri);
-        }
-
-      native_path = gnome_desktop_thumbnail_path_for_uri (source_uri, GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
-      native_file = g_file_new_for_path (native_path);
-
-      native_dir = g_path_get_dirname (native_path);
-      g_mkdir_with_parents (native_dir, USER_DIR_MODE);
-
-      if (thumbnail_file != NULL)
-        {
-          g_object_set_data_full (G_OBJECT (thumbnail_file), "item", g_object_ref (item), g_object_unref);
-          g_object_set_data_full (G_OBJECT (thumbnail_file),
-                                  "native-file",
-                                  g_object_ref (native_file),
-                                  g_object_unref);
-          g_file_copy_async (thumbnail_file,
-                             native_file,
-                             G_FILE_COPY_ALL_METADATA,
-                             G_PRIORITY_DEFAULT,
-                             bg_source->priv->cancellable,
-                             NULL,
-                             NULL,
-                             picture_copied_for_read,
-                             bg_source);
-        }
-
-      g_clear_object (&thumbnail_file);
-      g_object_unref (native_file);
-      g_free (native_dir);
-      g_free (native_path);
-    }
+  g_file_read_async (file, G_PRIORITY_DEFAULT,
+                     bg_source->priv->cancellable,
+                     picture_opened_for_read, bg_source);
 
   retval = TRUE;
 
@@ -816,26 +711,6 @@ files_changed_cb (GFileMonitor      *monitor,
 }
 
 static void
-media_found_cb (BgPicturesSource *self, GrlMedia *media)
-{
-  GFile *file = NULL;
-  const gchar *uri;
-
-  uri = grl_media_get_url (media);
-  file = g_file_new_for_uri (uri);
-  g_object_set_data_full (G_OBJECT (file), "grl-media", g_object_ref (media), g_object_unref);
-  g_file_query_info_async (file,
-                           ATTRIBUTES,
-                           G_FILE_QUERY_INFO_NONE,
-                           G_PRIORITY_DEFAULT,
-                           self->priv->cancellable,
-                           file_info_ready,
-                           self);
-
-  g_clear_object (&file);
-}
-
-static void
 bg_pictures_source_init (BgPicturesSource *self)
 {
   const gchar *pictures_path;
@@ -900,10 +775,6 @@ bg_pictures_source_init (BgPicturesSource *self)
 
   g_object_unref (dir);
 
-  priv->grl_miner = cc_background_grilo_miner_new ();
-  g_signal_connect_swapped (priv->grl_miner, "media-found", G_CALLBACK (media_found_cb), self);
-  cc_background_grilo_miner_start (priv->grl_miner);
-
   priv->thumb_factory =
     gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
 


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