+++ /dev/null
-/* $Id$
- * CORBA/ORBit client side of Directory object of sandbox_parent()
- * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; exactly version 2 of June 1991 is required
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "config.h"
-
-#include "captive/parent-Directory.h" /* self */
-#include <glib/gmessages.h>
-#include "split.h"
-#include "sandbox.h"
-#include "../client/directory.h"
-#include "../client/vfs.h"
-#include "FileInfo.h"
-#include "captive/macros.h"
-
-
-GnomeVFSResult captive_sandbox_parent_directory_new_open
- (CaptiveDirectoryObject *captive_directory_object,const gchar *pathname)
-{
-gboolean retried=FALSE;
-xmlNode *xml_action;
-
- g_return_val_if_fail(captive_directory_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(captive_directory_object->dir_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
-
-retry:
- xml_action=NULL;
- if (captive_directory_object->vfs->corba_bug_action) {
- xml_action=xmlNewTextChild(captive_directory_object->vfs->corba_bug_action,NULL,"directory_new_open",NULL);
- xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_directory_object));
- xmlNewProp(xml_action,"pathname",pathname);
- }
-
- captive_directory_object->corba_Directory_object=Captive_Vfs_directory_new_open(
- captive_directory_object->vfs->corba_Vfs_object,pathname,&captive_corba_ev);
- if (xml_action)
- xmlNewProp(xml_action,"result",(captive_corba_ev._major==CORBA_NO_EXCEPTION ? "1" : "0"));
-
- if (!retried && captive_sandbox_parent_query_vfs_retry(&captive_corba_ev,captive_directory_object->vfs)) {
- retried=TRUE;
- goto retry;
- }
-
- return captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev);
-}
-
-
-GnomeVFSResult captive_sandbox_parent_directory_new_make
- (CaptiveDirectoryObject *captive_directory_object,const gchar *pathname,guint perm)
-{
-gboolean retried=FALSE;
-xmlNode *xml_action;
-
- g_return_val_if_fail(captive_directory_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(captive_directory_object->dir_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
-
-retry:
- xml_action=NULL;
- if (captive_directory_object->vfs->corba_bug_action) {
- xml_action=xmlNewTextChild(captive_directory_object->vfs->corba_bug_action,NULL,"directory_new_make",NULL);
- xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_directory_object));
- xmlNewProp(xml_action,"pathname",pathname);
- xmlNewProp(xml_action,"perm",captive_printf_alloca("%u",(unsigned)perm));
- }
-
- captive_directory_object->corba_Directory_object=Captive_Vfs_directory_new_make(
- captive_directory_object->vfs->corba_Vfs_object,pathname,perm,&captive_corba_ev);
- if (xml_action)
- xmlNewProp(xml_action,"result",(captive_corba_ev._major==CORBA_NO_EXCEPTION ? "1" : "0"));
-
- if (!retried && captive_sandbox_parent_query_vfs_retry(&captive_corba_ev,captive_directory_object->vfs)) {
- retried=TRUE;
- goto retry;
- }
-
- return captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev);
-}
-
-
-GnomeVFSResult captive_sandbox_parent_directory_close(CaptiveDirectoryObject *captive_directory_object)
-{
-GnomeVFSResult r;
-xmlNode *xml_action=NULL;
-
- g_return_val_if_fail(captive_directory_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(captive_directory_object->dir_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
-
- if (captive_directory_object->vfs->corba_bug_action) {
- xml_action=xmlNewTextChild(captive_directory_object->vfs->corba_bug_action,NULL,"directory_close",NULL);
- xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_directory_object));
- }
-
- Captive_Directory_shutdown(captive_directory_object->corba_Directory_object,&captive_corba_ev);
- r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev);
- if (xml_action)
- xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
- if (r!=GNOME_VFS_OK)
- return r;
-
- CORBA_Object_release((CORBA_Object)captive_directory_object->corba_Directory_object,&captive_corba_ev);
- captive_directory_object->corba_Directory_object=CORBA_OBJECT_NIL;
-
- return captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev);
-}
-
-
-GnomeVFSResult captive_sandbox_parent_directory_read
- (CaptiveDirectoryObject *captive_directory_object,GnomeVFSFileInfo *file_info_captive)
-{
-Captive_GnomeVFSFileInfo *file_info_corba;
-GnomeVFSResult r;
-xmlNode *xml_action=NULL;
-
- g_return_val_if_fail(captive_directory_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(file_info_captive!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(captive_directory_object->dir_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
-
- if (captive_directory_object->vfs->corba_bug_action) {
- xml_action=xmlNewTextChild(captive_directory_object->vfs->corba_bug_action,NULL,"directory_read",NULL);
- xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_directory_object));
- }
-
- Captive_Directory_read(captive_directory_object->corba_Directory_object,&file_info_corba,&captive_corba_ev);
- r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev);
- if (xml_action)
- xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
- if (r!=GNOME_VFS_OK)
- return r;
-
- r=captive_sandbox_file_info_corba_to_captive(file_info_captive,file_info_corba);
- if (xml_action)
- xmlSetProp(xml_action,"result",gnome_vfs_result_to_string(r));
- if (r!=GNOME_VFS_OK)
- return r; /* 'file_info_corba' leak */
-
- Captive_GnomeVFSFileInfo__freekids(file_info_corba,NULL/* 'd'; meaning? */);
- CORBA_free(file_info_corba);
-
- return GNOME_VFS_OK;
-}
-
-
-GnomeVFSResult captive_sandbox_parent_directory_remove(CaptiveDirectoryObject *captive_directory_object)
-{
-GnomeVFSResult r;
-xmlNode *xml_action=NULL;
-
- g_return_val_if_fail(captive_directory_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
- g_return_val_if_fail(captive_directory_object->dir_Handle==NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
-
- if (captive_directory_object->vfs->corba_bug_action) {
- xml_action=xmlNewTextChild(captive_directory_object->vfs->corba_bug_action,NULL,"directory_remove",NULL);
- xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_directory_object));
- }
-
- Captive_Directory_remove(captive_directory_object->corba_Directory_object,&captive_corba_ev);
- r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev);
- if (xml_action)
- xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
- if (r!=GNOME_VFS_OK)
- return r;
-
- return GNOME_VFS_OK;
-}