Commit 8f623030 authored by Pierre Wieser's avatar Pierre Wieser

Remove unused nact_window_is_item_writable() function

parent ef1a3645
2011-01-22 Pierre Wieser <pwieser@trychlos.org>
* src/nact/nact-window.c:
* src/nact/nact-window.h
(nact_window_is_item_writable): Remove unused function.
* src/nact/base-window.c:
* src/nact/base-window.h
(runtime_init_toplevel): Renamed as initialize_base_window().
......
......@@ -212,106 +212,6 @@ nact_window_has_writable_providers( NactWindow *window )
return( has_writables );
}
#if 0
/**
* nact_window_is_item_writable:
* @window: this #NactWindow object.
* @item: the #NAObjectItem to be evaluated.
* @reason: the reason for what @item may not be writable.
*
* Returns: %TRUE: if @item is actually writable, given the current
* status of its provider, %FALSE else.
*
* For an item be actually writable:
* - the item must not be itself in a read-only store, which has been
* checked when first reading it
* - the provider must be willing (resp. able) to write
* - the provider must not has been locked by the admin
* - the writability of the provider must not have been removed by the user
* - the whole configuration must not have been locked by the admin.
*/
gboolean
nact_window_is_item_writable( const NactWindow *window, const NAObjectItem *item, guint *reason )
{
gboolean writable;
NactApplication *application;
NAUpdater *updater;
NAIOProvider *provider;
g_return_val_if_fail( NA_IS_OBJECT_ITEM( item ), FALSE );
writable = FALSE;
if( reason ){
*reason = NA_IIO_PROVIDER_STATUS_UNDETERMINED;
}
if( !window->private->dispose_has_run ){
application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
updater = nact_application_get_updater( application );
writable = TRUE;
if( reason ){
*reason = NA_IIO_PROVIDER_STATUS_WRITABLE;
}
if( writable ){
if( na_object_is_readonly( item )){
writable = FALSE;
if( reason ){
*reason = NA_IIO_PROVIDER_STATUS_ITEM_READONLY;
}
}
}
if( writable ){
provider = na_object_get_provider( item );
if( provider ){
if( !na_io_provider_is_willing_to_write( provider )){
writable = FALSE;
if( reason ){
*reason = NA_IIO_PROVIDER_STATUS_PROVIDER_NOT_WILLING_TO;
}
} else if( na_io_provider_is_locked_by_admin( provider, NA_IPREFS( updater ))){
writable = FALSE;
if( reason ){
*reason = NA_IIO_PROVIDER_STATUS_PROVIDER_LOCKED_BY_ADMIN;
}
} else if( !na_io_provider_is_conf_writable( provider, NA_IPREFS( updater ))){
writable = FALSE;
if( reason ){
*reason = NA_IIO_PROVIDER_STATUS_PROVIDER_LOCKED_BY_USER;
}
} else if( na_pivot_is_configuration_locked_by_admin( NA_PIVOT( updater ))){
writable = FALSE;
if( reason ){
*reason = NA_IIO_PROVIDER_STATUS_CONFIGURATION_LOCKED_BY_ADMIN;
}
} else if( !na_io_provider_has_write_api( provider )){
writable = FALSE;
if( reason ){
*reason = NA_IIO_PROVIDER_STATUS_NO_API;
}
}
/* the get_writable_provider() api already takes above checks
*/
} else {
provider = na_io_provider_find_writable_io_provider( NA_PIVOT( updater ));
if( !provider ){
writable = FALSE;
if( reason ){
*reason = NA_IIO_PROVIDER_STATUS_NO_PROVIDER_FOUND;
}
}
}
}
}
return( writable );
}
#endif
/**
* nact_window_save_item:
* @window: this #NactWindow instance.
......
......@@ -32,12 +32,14 @@
#define __NACT_WINDOW_H__
/**
* SECTION: nact_window
* @short_description: #NactWindow class definition.
* @include: nact/nact-window.h
* SECTION: nact-window
* @title: NactWindow
* @short_description: The NactWindow base class definition.
* @include: nact-window.h
*
* This class is derived from BaseWindow class.
* It is a common base class for all Nautilus-Actions window documents.
* It is a common base class for all Nautilus-Actions window documents
* (aka main frame windows).
*/
#include <api/na-object-item.h>
......@@ -75,10 +77,6 @@ GType nact_window_get_type( void );
gboolean nact_window_has_writable_providers( NactWindow *window );
#if 0
gboolean nact_window_is_item_writable( const NactWindow *window, const NAObjectItem *item, guint *reason );
#endif
gboolean nact_window_save_item ( NactWindow *window, NAObjectItem *item, gchar **msgerr );
gboolean nact_window_delete_item( NactWindow *window, const NAObjectItem *item, gchar **msgerr );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment