From 9a5ae9f50b41fbbb7ace5799af81324581a0a6b7 Mon Sep 17 00:00:00 2001 From: "Zeeshan Ali (Khattak)" Date: Sat, 14 Feb 2009 15:32:44 +0000 Subject: [PATCH] Put TrackerGetMetadataResult in separate file. svn path=/trunk/; revision=594 --- src/plugins/tracker/Makefile.am | 5 ++ src/plugins/tracker/rygel-tracker-container.vala | 59 --------------- .../tracker/rygel-tracker-get-metadata-result.vala | 83 ++++++++++++++++++++++ 3 files changed, 88 insertions(+), 59 deletions(-) create mode 100644 src/plugins/tracker/rygel-tracker-get-metadata-result.vala diff --git a/src/plugins/tracker/Makefile.am b/src/plugins/tracker/Makefile.am index 542b19a..0f0250b 100644 --- a/src/plugins/tracker/Makefile.am +++ b/src/plugins/tracker/Makefile.am @@ -24,6 +24,8 @@ BUILT_SOURCES = rygel-media-tracker.stamp \ rygel-tracker-image-container.c \ rygel-tracker-search-result.h \ rygel-tracker-search-result.c \ + rygel-tracker-get-metadata-result.h \ + rygel-tracker-get-metadata-result.c \ rygel-tracker-item.h \ rygel-tracker-item.c \ rygel-tracker-video-item.h \ @@ -56,6 +58,9 @@ librygel_media_tracker_la_SOURCES = rygel-media-tracker.h \ rygel-tracker-search-result.h \ rygel-tracker-search-result.c \ rygel-tracker-search-result.vala \ + rygel-tracker-get-metadata-result.h \ + rygel-tracker-get-metadata-result.c \ + rygel-tracker-get-metadata-result.vala \ rygel-tracker-item.h \ rygel-tracker-item.c \ rygel-tracker-item.vala \ diff --git a/src/plugins/tracker/rygel-tracker-container.vala b/src/plugins/tracker/rygel-tracker-container.vala index 61985d3..d7eaf32 100644 --- a/src/plugins/tracker/rygel-tracker-container.vala +++ b/src/plugins/tracker/rygel-tracker-container.vala @@ -219,62 +219,3 @@ public abstract class Rygel.TrackerContainer : MediaContainer { protected abstract MediaItem? create_item (string path, string[] metadata); } -/** - * Handles Tracker Metadata.Get method results. - * - * FIXME: This should inherit from Rygel.SimpleAsyncResult once bug#567319 is - * fixed. - */ -public class Rygel.TrackerGetMetadataResult : GLib.Object, GLib.AsyncResult { - protected GLib.Object source_object; - protected AsyncReadyCallback callback; - protected string item_id; - - public MediaObject data; - public GLib.Error error; - - public TrackerGetMetadataResult (TrackerContainer container, - AsyncReadyCallback callback, - string item_id) { - this.source_object = container; - this.callback = callback; - this.item_id = item_id; - } - - public void ready (string[] metadata, GLib.Error error) { - if (error != null) { - this.error = error; - - this.complete (); - } - - TrackerContainer container = (TrackerContainer) this.source_object; - - string path = container.get_item_path (item_id); - this.data = container.create_item (path, metadata); - - this.complete (); - } - - public unowned GLib.Object get_source_object () { - return this.source_object; - } - - public void* get_user_data () { - return null; - } - - public void complete () { - this.callback (this.source_object, this); - } - - public void complete_in_idle () { - Idle.add_full (Priority.DEFAULT, idle_func); - } - - private bool idle_func () { - this.complete (); - - return false; - } -} diff --git a/src/plugins/tracker/rygel-tracker-get-metadata-result.vala b/src/plugins/tracker/rygel-tracker-get-metadata-result.vala new file mode 100644 index 0000000..fc77360 --- /dev/null +++ b/src/plugins/tracker/rygel-tracker-get-metadata-result.vala @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2009 Nokia Corporation, all rights reserved. + * + * Author: Zeeshan Ali (Khattak) + * + * This file is part of Rygel. + * + * Rygel 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) any later version. + * + * Rygel 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 this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +using Rygel; + +/** + * Handles Tracker Metadata.Get method results. + * + * FIXME: This should inherit from Rygel.SimpleAsyncResult once bug#567319 is + * fixed. + */ +public class Rygel.TrackerGetMetadataResult : GLib.Object, GLib.AsyncResult { + protected Object source_object; + protected AsyncReadyCallback callback; + protected string item_id; + + public MediaObject data; + public Error error; + + public TrackerGetMetadataResult (TrackerContainer container, + AsyncReadyCallback callback, + string item_id) { + this.source_object = container; + this.callback = callback; + this.item_id = item_id; + } + + public void ready (string[] metadata, Error error) { + if (error != null) { + this.error = error; + + this.complete (); + } + + TrackerContainer container = (TrackerContainer) this.source_object; + + string path = container.get_item_path (item_id); + this.data = container.create_item (path, metadata); + + this.complete (); + } + + public unowned Object get_source_object () { + return this.source_object; + } + + public void* get_user_data () { + return null; + } + + public void complete () { + this.callback (this.source_object, this); + } + + public void complete_in_idle () { + Idle.add_full (Priority.DEFAULT, idle_func); + } + + private bool idle_func () { + this.complete (); + + return false; + } +} -- 2.7.4