backport a few patches from master for totem

This commit is contained in:
Adam Williamson 2014-02-05 21:42:02 -08:00
parent 55f37a9c25
commit 8507b3ded5
5 changed files with 359 additions and 3 deletions

View File

@ -0,0 +1,87 @@
From f58647687b15766c60c7d1f22134316c0a9ac874 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 16 Jan 2014 17:08:55 +0000
Subject: core: Add grl_registry_add_config_from_resource()
https://bugzilla.gnome.org/show_bug.cgi?id=722358
---
diff --git a/src/grl-registry.c b/src/grl-registry.c
index 58073ba..5a203ea 100644
--- a/src/grl-registry.c
+++ b/src/grl-registry.c
@@ -1678,3 +1678,57 @@ grl_registry_add_config_from_file (GrlRegistry *registry,
return FALSE;
}
}
+
+/**
+ * grl_registry_add_config_from_resource:
+ * @registry: the registry instance
+ * @config_file: a key-value file containing the configuration
+ * @error: error return location or @NULL to ignore
+ *
+ * Load plugin configurations from a .ini-like resource file.
+ *
+ * Returns: %TRUE on success
+ *
+ * Since: 0.2.0
+ **/
+gboolean
+grl_registry_add_config_from_resource (GrlRegistry *registry,
+ const gchar *resource_path,
+ GError **error)
+{
+ GError *load_error = NULL;
+ GKeyFile *keyfile = NULL;
+ GBytes *bytes;
+ gboolean ret = FALSE;
+
+ g_return_val_if_fail (GRL_IS_REGISTRY (registry), FALSE);
+ g_return_val_if_fail (resource_path, FALSE);
+
+ bytes = g_resources_lookup_data (resource_path, 0, error);
+ if (bytes == NULL)
+ goto bail;
+
+ keyfile = g_key_file_new ();
+
+ if (g_key_file_load_from_data (keyfile,
+ g_bytes_get_data (bytes, NULL),
+ g_bytes_get_size (bytes),
+ G_KEY_FILE_NONE,
+ &load_error)) {
+ add_config_from_keyfile (keyfile, registry);
+ ret = TRUE;
+ } else {
+ GRL_WARNING ("Unable to load configuration. %s", load_error->message);
+ g_set_error_literal (error,
+ GRL_CORE_ERROR,
+ GRL_CORE_ERROR_CONFIG_LOAD_FAILED,
+ load_error->message);
+ g_error_free (load_error);
+ }
+
+bail:
+ g_clear_pointer (&keyfile, g_key_file_free);
+ g_clear_pointer (&bytes, g_bytes_unref);
+
+ return ret;
+}
diff --git a/src/grl-registry.h b/src/grl-registry.h
index db2e5cd..5a12335 100644
--- a/src/grl-registry.h
+++ b/src/grl-registry.h
@@ -269,6 +269,10 @@ gboolean grl_registry_add_config_from_file (GrlRegistry *registry,
const gchar *config_file,
GError **error);
+gboolean grl_registry_add_config_from_resource (GrlRegistry *registry,
+ const gchar *resource_path,
+ GError **error);
+
G_END_DECLS
#endif /* _GRL_REGISTRY_H_ */
--
cgit v0.9.2

View File

@ -0,0 +1,139 @@
From c8423dac910f41670754b0c18041854bcd64551d Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 19 Dec 2013 21:44:09 +0000
Subject: core: Add Icon property to GrlSource
https://bugzilla.gnome.org/show_bug.cgi?id=657926
Signed-off-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
---
diff --git a/doc/grilo/grilo-sections.txt b/doc/grilo/grilo-sections.txt
index 7438fc7..b5cbe29 100644
--- a/doc/grilo/grilo-sections.txt
+++ b/doc/grilo/grilo-sections.txt
@@ -76,6 +76,7 @@ grl_source_browse_sync
grl_source_get_auto_split_threshold
grl_source_get_caps
grl_source_get_description
+grl_source_get_icon
grl_source_get_id
grl_source_get_media_from_uri
grl_source_get_media_from_uri_sync
diff --git a/src/grl-source.c b/src/grl-source.c
index 60a1f4a..f85b565 100644
--- a/src/grl-source.c
+++ b/src/grl-source.c
@@ -64,6 +64,7 @@ enum {
PROP_ID,
PROP_NAME,
PROP_DESC,
+ PROP_ICON,
PROP_PLUGIN,
PROP_RANK,
PROP_AUTO_SPLIT_THRESHOLD,
@@ -89,6 +90,7 @@ struct _GrlSourcePrivate {
GrlMediaType supported_media;
guint auto_split_threshold;
GrlPlugin *plugin;
+ GIcon *icon;
};
typedef struct {
@@ -321,6 +323,22 @@ grl_source_class_init (GrlSourceClass *source_class)
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));
/**
+ * GrlSource:source-icon:
+ *
+ * #GIcon representing the source
+ *
+ * Since: 0.2.0
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_ICON,
+ g_param_spec_object ("source-icon",
+ "Source icon",
+ "Icon representing the source",
+ G_TYPE_ICON,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+ /**
* GrlSource:plugin:
*
* Plugin the source belongs to
@@ -453,6 +471,7 @@ grl_source_finalize (GObject *object)
{
GrlSource *source = GRL_SOURCE (object);
+ g_clear_object (&source->priv->icon);
g_free (source->priv->id);
g_free (source->priv->name);
g_free (source->priv->desc);
@@ -487,6 +506,10 @@ grl_source_set_property (GObject *object,
case PROP_DESC:
set_string_property (&source->priv->desc, value);
break;
+ case PROP_ICON:
+ g_clear_object (&source->priv->icon);
+ source->priv->icon = g_value_dup_object (value);
+ break;
case PROP_PLUGIN:
g_clear_object (&source->priv->plugin);
source->priv->plugin = g_value_dup_object (value);
@@ -526,6 +549,9 @@ grl_source_get_property (GObject *object,
case PROP_DESC:
g_value_set_string (value, source->priv->desc);
break;
+ case PROP_ICON:
+ g_value_set_object (value, source->priv->icon);
+ break;
case PROP_PLUGIN:
g_value_set_object (value, source->priv->plugin);
break;
@@ -2855,6 +2881,20 @@ grl_source_get_name (GrlSource *source)
}
/**
+ * grl_source_get_icon:
+ * @source: a source
+ *
+ * Returns: (transfer none): a #GIcon
+ */
+GIcon *
+grl_source_get_icon (GrlSource *source)
+{
+ g_return_val_if_fail (GRL_IS_SOURCE (source), NULL);
+
+ return source->priv->icon;
+}
+
+/**
* grl_source_get_description:
* @source: a source
*
diff --git a/src/grl-source.h b/src/grl-source.h
index 621e2d2..c0f9141 100644
--- a/src/grl-source.h
+++ b/src/grl-source.h
@@ -36,6 +36,7 @@
#include <glib.h>
#include <glib-object.h>
+#include <gio/gio.h>
/* Macros */
@@ -622,6 +623,8 @@ const gchar *grl_source_get_id (GrlSource *source);
const gchar *grl_source_get_name (GrlSource *source);
+GIcon *grl_source_get_icon (GrlSource *source);
+
const gchar *grl_source_get_description (GrlSource *source);
GrlPlugin *grl_source_get_plugin (GrlSource *source);
--
cgit v0.9.2

View File

@ -0,0 +1,96 @@
From 8eb5dac7799d6507ec62e4f694da892b169374b4 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 16 Jan 2014 16:30:35 +0000
Subject: core: Split up keyfile processing for config
Into a separate function, so it can be used to load from data instead.
https://bugzilla.gnome.org/show_bug.cgi?id=722358
---
(limited to 'src/grl-registry.c')
diff --git a/src/grl-registry.c b/src/grl-registry.c
index f846111..58073ba 100644
--- a/src/grl-registry.c
+++ b/src/grl-registry.c
@@ -1604,6 +1604,37 @@ grl_registry_add_config (GrlRegistry *registry,
return TRUE;
}
+static void
+add_config_from_keyfile (GKeyFile *keyfile,
+ GrlRegistry *registry)
+{
+ GrlConfig *config;
+ gchar **key;
+ gchar **keys;
+ gchar **plugin;
+ gchar **plugins;
+ gchar *value;
+
+ /* Look up for defined plugins */
+ plugins = g_key_file_get_groups (keyfile, NULL);
+ for (plugin = plugins; *plugin; plugin++) {
+ config = grl_config_new (*plugin, NULL);
+
+ /* Look up configuration keys for this plugin */
+ keys = g_key_file_get_keys (keyfile, *plugin, NULL, NULL);
+ for (key = keys; *key; key++) {
+ value = g_key_file_get_string (keyfile, *plugin, *key, NULL);
+ if (value) {
+ grl_config_set_string (config, *key, value);
+ g_free (value);
+ }
+ }
+ grl_registry_add_config (registry, config, NULL);
+ g_strfreev (keys);
+ }
+ g_strfreev (plugins);
+}
+
/**
* grl_registry_add_config_from_file:
* @registry: the registry instance
@@ -1623,12 +1654,6 @@ grl_registry_add_config_from_file (GrlRegistry *registry,
{
GError *load_error = NULL;
GKeyFile *keyfile;
- GrlConfig *config;
- gchar **key;
- gchar **keys;
- gchar **plugin;
- gchar **plugins;
- gchar *value;
g_return_val_if_fail (GRL_IS_REGISTRY (registry), FALSE);
g_return_val_if_fail (config_file, FALSE);
@@ -1639,25 +1664,7 @@ grl_registry_add_config_from_file (GrlRegistry *registry,
config_file,
G_KEY_FILE_NONE,
&load_error)) {
-
- /* Look up for defined plugins */
- plugins = g_key_file_get_groups (keyfile, NULL);
- for (plugin = plugins; *plugin; plugin++) {
- config = grl_config_new (*plugin, NULL);
-
- /* Look up configuration keys for this plugin */
- keys = g_key_file_get_keys (keyfile, *plugin, NULL, NULL);
- for (key = keys; *key; key++) {
- value = g_key_file_get_string (keyfile, *plugin, *key, NULL);
- if (value) {
- grl_config_set_string (config, *key, value);
- g_free (value);
- }
- }
- grl_registry_add_config (registry, config, NULL);
- g_strfreev (keys);
- }
- g_strfreev (plugins);
+ add_config_from_keyfile (keyfile, registry);
g_key_file_free (keyfile);
return TRUE;
} else {
--
cgit v0.9.2

View File

@ -0,0 +1,21 @@
From 5b0671d47f634b0dbb5dc9516a12a1fa6f7713d6 Mon Sep 17 00:00:00 2001
From: Victor Manuel Jaquez Leal <vjaquez@igalia.com>
Date: Fri, 17 Jan 2014 10:17:25 +0000
Subject: vala: add gio dependency
GIcon is provided in GIO module.
This fixes the Vala break introduced by previous commit.
https://bugzilla.gnome.org/show_bug.cgi?id=722407
---
diff --git a/bindings/vala/grilo-0.2.deps b/bindings/vala/grilo-0.2.deps
index 13f9b50..d03a373 100644
--- a/bindings/vala/grilo-0.2.deps
+++ b/bindings/vala/grilo-0.2.deps
@@ -1 +1,2 @@
gmodule-2.0
+gio-2.0
--
cgit v0.9.2

View File

@ -3,12 +3,17 @@
Name: grilo Name: grilo
Version: 0.2.7 Version: 0.2.7
Release: 1%{?dist} Release: 2%{?dist}
Summary: Content discovery framework Summary: Content discovery framework
Group: Applications/Multimedia Group: Applications/Multimedia
License: LGPLv2+ License: LGPLv2+
Source0: http://ftp.gnome.org/pub/GNOME/sources/grilo/%{release_version}/grilo-%{version}.tar.xz Source0: http://ftp.gnome.org/pub/GNOME/sources/grilo/%{release_version}/grilo-%{version}.tar.xz
# All these are upstream backports, needed for totem 3.11.5
Patch0: grilo-0.2.7-icon_grlsource.patch
Patch1: grilo-0.2.7-vala_gio.patch
Patch2: grilo-0.2.7-split_keyfile_processing.patch
Patch3: grilo-0.2.7-add_grl_registry_add_config_from_resource.patch
Url: http://live.gnome.org/Grilo Url: http://live.gnome.org/Grilo
BuildRequires: chrpath BuildRequires: chrpath
@ -19,6 +24,7 @@ BuildRequires: gtk-doc
BuildRequires: gobject-introspection-devel >= 0.9.0 BuildRequires: gobject-introspection-devel >= 0.9.0
BuildRequires: libxml2-devel BuildRequires: libxml2-devel
BuildRequires: libsoup-devel BuildRequires: libsoup-devel
BuildRequires: glib2-devel
# For the test UI # For the test UI
BuildRequires: gtk3-devel BuildRequires: gtk3-devel
@ -56,9 +62,13 @@ This package contains the Vala language bindings.
%prep %prep
%setup -q %setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
# Fix vala detection for version 0.22 # Fix vala detection for version 0.24
sed -i 's/libvala-0.20/libvala-0.22/g' configure* sed -i 's/libvala-0.20/libvala-0.24/g' configure*
%build %build
%configure \ %configure \
@ -115,6 +125,9 @@ rm -f $RPM_BUILD_ROOT%{_bindir}/grilo-simple-playlist
%{_datadir}/vala/vapi/* %{_datadir}/vala/vapi/*
%changelog %changelog
* Wed Feb 05 2014 Adam Williamson <awilliam@redhat.com> - 0.2.7-2
- backport some patches from upstream that are needed for totem
* Wed Sep 18 2013 Kalev Lember <kalevlember@gmail.com> - 0.2.7-1 * Wed Sep 18 2013 Kalev Lember <kalevlember@gmail.com> - 0.2.7-1
- Update to 0.2.7 - Update to 0.2.7