[grilo-plugins] gravatar: Use new register_keys vfunc
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] gravatar: Use new register_keys vfunc
- Date: Tue, 27 Jan 2015 17:33:56 +0000 (UTC)
commit 344d797e625d20df4d333a01a95294380e90a03c
Author: Bastien Nocera <hadess hadess net>
Date: Tue Dec 2 12:17:59 2014 +0100
gravatar: Use new register_keys vfunc
https://bugzilla.gnome.org/show_bug.cgi?id=740943
src/gravatar/grl-gravatar.c | 38 ++++++++++++++++++++++----------------
1 files changed, 22 insertions(+), 16 deletions(-)
---
diff --git a/src/gravatar/grl-gravatar.c b/src/gravatar/grl-gravatar.c
index ff6e90e..6014b47 100644
--- a/src/gravatar/grl-gravatar.c
+++ b/src/gravatar/grl-gravatar.c
@@ -87,7 +87,24 @@ grl_gravatar_source_plugin_init (GrlRegistry *registry,
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- /* Register keys */
+ if (!GRL_METADATA_KEY_ARTIST_AVATAR &&
+ !GRL_METADATA_KEY_AUTHOR_AVATAR) {
+ GRL_WARNING ("Unable to register \"author-avatar\" nor \"artist-avatar\"");
+ return FALSE;
+ }
+
+ GrlGravatarSource *source = grl_gravatar_source_new ();
+ grl_registry_register_source (registry,
+ plugin,
+ GRL_SOURCE (source),
+ NULL);
+ return TRUE;
+}
+
+static void
+grl_gravatar_source_plugin_register_keys (GrlRegistry *registry,
+ GrlPlugin *plugin)
+{
GRL_METADATA_KEY_ARTIST_AVATAR =
register_gravatar_key (registry,
"artist-avatar",
@@ -99,11 +116,6 @@ grl_gravatar_source_plugin_init (GrlRegistry *registry,
"author-avatar",
"AuthorAvatar",
"Avatar for the author");
- if (!GRL_METADATA_KEY_ARTIST_AVATAR &&
- !GRL_METADATA_KEY_AUTHOR_AVATAR) {
- GRL_WARNING ("Unable to register \"author-avatar\" nor \"artist-avatar\"");
- return FALSE;
- }
/* Create relationship */
grl_registry_register_metadata_key_relation (registry,
@@ -113,18 +125,12 @@ grl_gravatar_source_plugin_init (GrlRegistry *registry,
grl_registry_register_metadata_key_relation (registry,
GRL_METADATA_KEY_AUTHOR,
GRL_METADATA_KEY_AUTHOR_AVATAR);
-
- GrlGravatarSource *source = grl_gravatar_source_new ();
- grl_registry_register_source (registry,
- plugin,
- GRL_SOURCE (source),
- NULL);
- return TRUE;
}
-GRL_PLUGIN_REGISTER (grl_gravatar_source_plugin_init,
- NULL,
- PLUGIN_ID);
+GRL_PLUGIN_REGISTER_FULL (grl_gravatar_source_plugin_init,
+ NULL,
+ grl_gravatar_source_plugin_register_keys,
+ PLUGIN_ID);
/* ================== Gravatar GObject ================ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]