[nautilus-actions] na_io_provider_find_io_provider_by_id(): new function



commit dddff50ec56acb5627ff870f4faedb5fe63a8e34
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sun Jan 16 14:04:40 2011 +0100

    na_io_provider_find_io_provider_by_id(): new function

 ChangeLog                 |    4 ++++
 src/core/na-io-provider.c |   31 +++++++++++++++++++++++++++++++
 src/core/na-io-provider.h |    1 +
 3 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a0d956d..920ee7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,10 @@
 	* Makefile.am:
 	* configure.ac: configure in tools/.
 
+	* src/core/na-io-provider.c:
+	* src/core/na-io-provider.h (na_io_provider_find_io_provider_by_id):
+	New function.
+
 	* src/utils/nautilus-actions-print.c: Move program summary as a global def.
 
 2011-01-15 Pierre Wieser <pwieser trychlos org>
diff --git a/src/core/na-io-provider.c b/src/core/na-io-provider.c
index a4eeba2..6f90c74 100644
--- a/src/core/na-io-provider.c
+++ b/src/core/na-io-provider.c
@@ -323,6 +323,37 @@ na_io_provider_find_writable_io_provider( const NAPivot *pivot )
 }
 
 /*
+ * na_io_provider_find_io_provider_by_id:
+ * @pivot: the #NAPivot instance.
+ * @id: the identifier of the searched I/O provider.
+ *
+ * Returns: the I/O provider, or NULL.
+ *
+ * The returned provider is owned by NAIOProvider class, and should not
+ * be released by the caller.
+ */
+NAIOProvider *
+na_io_provider_find_io_provider_by_id( const NAPivot *pivot, const gchar *id )
+{
+	const GList *providers;
+	const GList *ip;
+	NAIOProvider *provider;
+	NAIOProvider *found;
+
+	providers = na_io_provider_get_io_providers_list( pivot );
+	found = NULL;
+
+	for( ip = providers ; ip && !found ; ip = ip->next ){
+		provider = NA_IO_PROVIDER( ip->data );
+		if( !strcmp( provider->private->id, id )){
+			found = provider;
+		}
+	}
+
+	return( found );
+}
+
+/*
  * na_io_provider_get_io_providers_list:
  * @pivot: the current #NAPivot instance.
  *
diff --git a/src/core/na-io-provider.h b/src/core/na-io-provider.h
index 453a6ba..ed7afe9 100644
--- a/src/core/na-io-provider.h
+++ b/src/core/na-io-provider.h
@@ -96,6 +96,7 @@ typedef struct {
 GType         na_io_provider_get_type ( void );
 
 NAIOProvider *na_io_provider_find_writable_io_provider( const NAPivot *pivot );
+NAIOProvider *na_io_provider_find_io_provider_by_id   ( const NAPivot *pivot, const gchar *id );
 const GList  *na_io_provider_get_io_providers_list    ( const NAPivot *pivot );
 void          na_io_provider_unref_io_providers_list  ( void );
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]