aboutsummaryrefslogtreecommitdiffstats
path: root/modules/gravatar/e-photo-cache-gravatar-loader.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-04-26 00:30:11 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-04-26 08:17:20 +0800
commit91aee2a805d70c9f7a5f0d089139fbfc710939c1 (patch)
treebec4108805f99ca0f244a26180b0c487b9f4eaca /modules/gravatar/e-photo-cache-gravatar-loader.c
parent009ac971e069ced92547800a78ab3119f733c333 (diff)
downloadgsoc2013-evolution-91aee2a805d70c9f7a5f0d089139fbfc710939c1.tar
gsoc2013-evolution-91aee2a805d70c9f7a5f0d089139fbfc710939c1.tar.gz
gsoc2013-evolution-91aee2a805d70c9f7a5f0d089139fbfc710939c1.tar.bz2
gsoc2013-evolution-91aee2a805d70c9f7a5f0d089139fbfc710939c1.tar.lz
gsoc2013-evolution-91aee2a805d70c9f7a5f0d089139fbfc710939c1.tar.xz
gsoc2013-evolution-91aee2a805d70c9f7a5f0d089139fbfc710939c1.tar.zst
gsoc2013-evolution-91aee2a805d70c9f7a5f0d089139fbfc710939c1.zip
Add a gravatar module.
This is a new EPhotoSource that obtains images from gravatar.com.
Diffstat (limited to 'modules/gravatar/e-photo-cache-gravatar-loader.c')
-rw-r--r--modules/gravatar/e-photo-cache-gravatar-loader.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/modules/gravatar/e-photo-cache-gravatar-loader.c b/modules/gravatar/e-photo-cache-gravatar-loader.c
new file mode 100644
index 0000000000..33dd39b471
--- /dev/null
+++ b/modules/gravatar/e-photo-cache-gravatar-loader.c
@@ -0,0 +1,88 @@
+/*
+ * e-photo-cache-gravatar-loader.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "e-photo-cache-gravatar-loader.h"
+
+#include "e-gravatar-photo-source.h"
+
+G_DEFINE_DYNAMIC_TYPE (
+ EPhotoCacheGravatarLoader,
+ e_photo_cache_gravatar_loader,
+ E_TYPE_EXTENSION)
+
+static EPhotoCache *
+photo_cache_gravatar_loader_get_photo_cache (EPhotoCacheGravatarLoader *loader)
+{
+ EExtensible *extensible;
+
+ extensible = e_extension_get_extensible (E_EXTENSION (loader));
+
+ return E_PHOTO_CACHE (extensible);
+}
+
+static void
+photo_cache_gravatar_loader_constructed (GObject *object)
+{
+ EPhotoCacheGravatarLoader *loader;
+ EPhotoCache *photo_cache;
+ EPhotoSource *photo_source;
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_photo_cache_gravatar_loader_parent_class)->
+ constructed (object);
+
+ loader = E_PHOTO_CACHE_GRAVATAR_LOADER (object);
+ photo_cache = photo_cache_gravatar_loader_get_photo_cache (loader);
+
+ photo_source = e_gravatar_photo_source_new ();
+ e_photo_cache_add_photo_source (photo_cache, photo_source);
+ g_object_unref (photo_source);
+}
+
+static void
+e_photo_cache_gravatar_loader_class_init (EPhotoCacheGravatarLoaderClass *class)
+{
+ GObjectClass *object_class;
+ EExtensionClass *extension_class;
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = photo_cache_gravatar_loader_constructed;
+
+ extension_class = E_EXTENSION_CLASS (class);
+ extension_class->extensible_type = E_TYPE_PHOTO_CACHE;
+}
+
+static void
+e_photo_cache_gravatar_loader_class_finalize (EPhotoCacheGravatarLoaderClass *class)
+{
+}
+
+static void
+e_photo_cache_gravatar_loader_init (EPhotoCacheGravatarLoader *loader)
+{
+}
+
+void
+e_photo_cache_gravatar_loader_type_register (GTypeModule *type_module)
+{
+ /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+ * function, so we have to wrap it with a public function in
+ * order to register types from a separate compilation unit. */
+ e_photo_cache_gravatar_loader_register_type (type_module);
+}
+