예제 #1
0
        public static bool CopyRecursive(this GLib.File source, GLib.File target, GLib.FileCopyFlags flags, GLib.Cancellable cancellable, GLib.FileProgressCallback callback)
        {
            bool result = true;

            GLib.FileType ft = source.QueryFileType(GLib.FileQueryInfoFlags.None, cancellable);

            if (ft != GLib.FileType.Directory)
            {
                Hyena.Log.DebugFormat("Copying \"{0}\" to \"{1}\"", source.Path, target.Path);
                return(source.Copy(target, flags, cancellable, callback));
            }

            if (!target.Exists)
            {
                Hyena.Log.DebugFormat("Creating directory: \"{0}\"", target.Path);
                result = result && target.MakeDirectoryWithParents(cancellable);
            }

            GLib.FileEnumerator fe = source.EnumerateChildren("standard::name", GLib.FileQueryInfoFlags.None, cancellable);
            GLib.FileInfo       fi = fe.NextFile();
            while (fi != null)
            {
                GLib.File source_file = GLib.FileFactory.NewForPath(Path.Combine(source.Path, fi.Name));
                GLib.File target_file = GLib.FileFactory.NewForPath(Path.Combine(target.Path, fi.Name));
                result = result && source_file.CopyRecursive(target_file, flags, cancellable, callback);
                fi     = fe.NextFile();
            }
            fe.Close(cancellable);
            fe.Dispose();
            return(result);
        }
예제 #2
0
 public Enumerator(FileEnumerator file_enumerator)
 {
     this.file_enumerator = file_enumerator;
 }
예제 #3
0
 public Enumerator(FileEnumerator file_enumerator)
 {
     this.file_enumerator = file_enumerator;
 }
예제 #4
0
        static void gtml_reload()
        {
            GLib.IFile   applications = GLib.FileFactory.NewForPath("./gtml");
            GLib.KeyFile programs     = new GLib.KeyFile();
            bool         load         = false;

            if (GLib.FileFactory.NewForPath("./data").Exists)
            {
                if (GLib.FileFactory.NewForPath("./data/programs.gkf").Exists)
                {
                    load = programs.LoadFromFile("./data/programs.gkf", gkfflags);
                }
            }
            else
            {
                GLib.FileFactory.NewForPath("./data").MakeDirectoryWithParents(null);
            }
            if (load == true)
            {
                if (programs.HasGroup("Programs"))
                {
                    string[] names = programs.GetKeys("Programs");
                    int      x     = 0;
                    while (names[x].Equals("") != true || names[x] != null)
                    {
                        string location = programs.GetString("Programs", names[x]);
                        create_stacks(names[x], location);
                        location = null;
                        x++;
                        break;
                    }
                }
                else
                {
                    System.Console.WriteLine("No linked programs in data.");
                }
            }
            else
            {
                System.Console.WriteLine("No linked programs\n");
            }

            GLib.FileEnumerator apps = applications.EnumerateChildren("*", feflags, null);
            while (true)
            {
                GLib.FileInfo info = apps.NextFile();
                if (info == null)
                {
                    apps.Dispose();
                    break;
                }
                else
                {
                    GLib.IFile outf = applications.GetChildForDisplayName(info.DisplayName);
                    string     name = info.DisplayName;
                    if ((name.Equals(".") && name.Equals("..")) == false && (name.Length != 0 || name != null))
                    {
                        string path = outf.Path;
                        if (info.FileType == GLib.FileType.Directory)
                        {
                            create_stacks(name, path);

                            /*
                             * if (!gtk_stack_get_child_by_name (GTK_STACK(stack),path)) {
                             *      create_stacks (name,path);
                             * }
                             *
                             *
                             *
                             *
                             */
                        }
                    }
                }
            }

            if (stack.CurrentPageWidget == null)
            {
                ;                                             //gtml_import_full ();
            }
        }