[nautilus-actions] Define na_io_provider_are_writings_authorized() new function
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Define na_io_provider_are_writings_authorized() new function
- Date: Wed, 19 Jan 2011 21:47:40 +0000 (UTC)
commit 2e3dcae43dad7409e951b861a125f56a4f749fd8
Author: Pierre Wieser <pwieser trychlos org>
Date: Mon Jan 3 05:23:24 2011 +0100
Define na_io_provider_are_writings_authorized() new function
ChangeLog | 4 ++++
src/core/na-io-provider.c | 31 ++++++++++++++++++++++---------
src/core/na-io-provider.h | 2 ++
3 files changed, 28 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 175657a..73edcf2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -135,6 +135,10 @@
2011-01-03 Pierre Wieser <pwieser trychlos org>
+ * src/core/na-io-provider.c:
+ * src/core/na-io-provider.h (na_io_provider_are_writings_authorized):
+ New function.
+
* configure.ac: Define a conditional if we have both GSettings and GConf.
* src/core/na-gsettings-migrate.c:
diff --git a/src/core/na-io-provider.c b/src/core/na-io-provider.c
index b7cf959..4c98554 100644
--- a/src/core/na-io-provider.c
+++ b/src/core/na-io-provider.c
@@ -609,15 +609,8 @@ na_io_provider_get_writable_provider( const NAPivot *pivot )
provider = NULL;
for( ip = providers ; ip && !provider ; ip = ip->next ){
-
- if( na_io_provider_is_willing_to_write( NA_IO_PROVIDER( ip->data )) &&
- na_io_provider_is_able_to_write( NA_IO_PROVIDER( ip->data )) &&
- na_io_provider_has_write_api( NA_IO_PROVIDER( ip->data )) &&
- na_io_provider_is_user_writable( NA_IO_PROVIDER( ip->data ), NA_IPREFS( pivot )) &&
- !na_io_provider_is_locked_by_admin( NA_IO_PROVIDER( ip->data ), NA_IPREFS( pivot )) &&
- !na_pivot_is_configuration_locked_by_admin( pivot )){
-
- provider = NA_IO_PROVIDER( ip->data );
+ if( na_io_provider_are_writings_authorized( NA_IO_PROVIDER( ip->data ), pivot )){
+ provider = NA_IO_PROVIDER( ip->data );
}
}
@@ -1180,6 +1173,26 @@ na_io_provider_has_write_api( const NAIOProvider *provider )
}
/*
+ * na_io_provider_get_writable_provider:
+ * @pivot: the #NAPivot instance.
+ *
+ * Returns: the first willing and able to write I/O provider, or NULL.
+ *
+ * The returned provider should not be g_object_unref() by the caller.
+ */
+gboolean
+na_io_provider_are_writings_authorized( const NAIOProvider *provider, const NAPivot *pivot )
+{
+
+ return( na_io_provider_is_willing_to_write( provider ) &&
+ na_io_provider_is_able_to_write( provider ) &&
+ na_io_provider_has_write_api( provider ) &&
+ na_io_provider_is_user_writable( provider , NA_IPREFS( pivot )) &&
+ !na_io_provider_is_locked_by_admin( provider , NA_IPREFS( pivot )) &&
+ !na_pivot_is_configuration_locked_by_admin( pivot ));
+}
+
+/*
* na_io_provider_write_item:
* @provider: this #NAIOProvider object.
* @item: a #NAObjectItem to be written to the storage subsystem.
diff --git a/src/core/na-io-provider.h b/src/core/na-io-provider.h
index c61d36f..88c48ed 100644
--- a/src/core/na-io-provider.h
+++ b/src/core/na-io-provider.h
@@ -103,6 +103,8 @@ gboolean na_io_provider_is_willing_to_write ( const NAIOProvider *p
gboolean na_io_provider_is_able_to_write ( const NAIOProvider *provider );
gboolean na_io_provider_has_write_api ( const NAIOProvider *provider );
+gboolean na_io_provider_are_writings_authorized ( const NAIOProvider *provider, const NAPivot *pivot );
+
guint na_io_provider_write_item ( const NAIOProvider *provider, const NAObjectItem *item, GSList **messages );
guint na_io_provider_delete_item ( const NAIOProvider *provider, const NAObjectItem *item, GSList **messages );
guint na_io_provider_duplicate_data( const NAIOProvider *provider, NAObjectItem *dest, const NAObjectItem *source, GSList **messages );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]