[gnome-documents] shellSearchProvider: use serialized GIcons
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] shellSearchProvider: use serialized GIcons
- Date: Wed, 24 Apr 2013 20:04:38 +0000 (UTC)
commit 0853d9f4c74d7e4d2f14fb9ef9d493d4b44f6f0c
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Apr 24 12:09:50 2013 -0400
shellSearchProvider: use serialized GIcons
Since GIO now has built-in support to serialize and deserialize generic
GIcon implementations to a GVariant, we can remove our custom code that
did that.
Bump the GLib required version to current git master for the new API.
configure.ac | 2 +-
src/lib/gd-utils.c | 28 ----------------------------
src/lib/gd-utils.h | 2 --
src/shellSearchProvider.js | 12 +++---------
4 files changed, 4 insertions(+), 40 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 74d5b80..94862f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,7 +61,7 @@ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:"$ac_top_build_prefix"egg-list-box
EVINCE_MIN_VERSION=3.7.4
WEBKITGTK_MIN_VERSION=1.10.0
-GLIB_MIN_VERSION=2.35.1
+GLIB_MIN_VERSION=2.37.0
GTK_MIN_VERSION=3.7.7
GOBJECT_INTROSPECTION_MIN_VERSION=1.31.6
GDATA_MIN_VERSION=0.13.3
diff --git a/src/lib/gd-utils.c b/src/lib/gd-utils.c
index 1d1e367..7d1ba82 100644
--- a/src/lib/gd-utils.c
+++ b/src/lib/gd-utils.c
@@ -346,34 +346,6 @@ gd_create_collection_icon (gint base_size,
return retval;
}
-/**
- * gd_create_variant_from_pixbuf:
- * @pixbuf:
- *
- * Returns: (transfer full):
- */
-GVariant *
-gd_create_variant_from_pixbuf (GdkPixbuf *pixbuf)
-{
- GVariant *variant;
- guchar *data;
- guint length;
-
- data = gdk_pixbuf_get_pixels_with_length (pixbuf, &length);
- variant = g_variant_new ("(iiibii ay)",
- gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf),
- gdk_pixbuf_get_rowstride (pixbuf),
- gdk_pixbuf_get_has_alpha (pixbuf),
- gdk_pixbuf_get_bits_per_sample (pixbuf),
- gdk_pixbuf_get_n_channels (pixbuf),
- g_variant_new_from_data (G_VARIANT_TYPE_BYTESTRING,
- data, length, TRUE,
- (GDestroyNotify)g_object_unref,
- g_object_ref (pixbuf)));
- return g_variant_ref_sink (variant);
-}
-
void
gd_ev_view_find_changed (EvView *view,
EvJobFind *job,
diff --git a/src/lib/gd-utils.h b/src/lib/gd-utils.h
index daac363..a9ae317 100644
--- a/src/lib/gd-utils.h
+++ b/src/lib/gd-utils.h
@@ -45,8 +45,6 @@ gchar *gd_iso8601_from_timestamp (gint64 timestamp);
GIcon *gd_create_collection_icon (gint base_size,
GList *pixbufs);
-GVariant *gd_create_variant_from_pixbuf (GdkPixbuf *pixbuf);
-
void gd_ev_view_find_changed (EvView *view,
EvJobFind *job,
gint page);
diff --git a/src/shellSearchProvider.js b/src/shellSearchProvider.js
index a43dc76..d61c43c 100644
--- a/src/shellSearchProvider.js
+++ b/src/shellSearchProvider.js
@@ -257,7 +257,7 @@ const FetchMetasJob = new Lang.Class({
job.run(Lang.bind(this,
function(icon) {
if (icon)
- meta.pixbuf = icon;
+ meta.icon = icon;
this._metas.push(meta);
this._jobCollector();
@@ -389,14 +389,8 @@ const ShellSearchProvider = new Lang.Class({
let meta = { id: GLib.Variant.new('s', this._cache[id].id),
name: GLib.Variant.new('s', this._cache[id].title) };
- let gicon = this._cache[id].icon;
- let pixbuf = this._cache[id].pixbuf;
- let iconstr = gicon ? gicon.to_string() : null;
- if (iconstr)
- meta['gicon'] = GLib.Variant.new('s', iconstr);
- else if (pixbuf)
- meta['icon-data'] = GdPrivate.create_variant_from_pixbuf(pixbuf);
-
+ let icon = this._cache[id].icon;
+ meta['icon'] = icon.serialize();
metas.push(meta);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]