Equals() public méthode

public Equals ( object o ) : bool
o object
Résultat bool
Exemple #1
0
        public PreferenceDialog(Window parent)
            : base("PreferenceDialog.ui", "preference_dialog")
        {
            TransientFor = parent;

            //Photos Folder
            photosdir_chooser.SetCurrentFolderUri (FSpot.Core.Global.PhotoUri);

            SafeUri storage_path = new SafeUri (Preferences.Get<string> (Preferences.STORAGE_PATH));

            //If the user has set a photo directory on the commandline then don't let it be changed in Preferences
            if (storage_path.Equals(FSpot.Core.Global.PhotoUri))
                photosdir_chooser.CurrentFolderChanged += HandlePhotosdirChanged;
            else
                photosdir_chooser.Sensitive = false;

            //Write Metadata
            LoadPreference (Preferences.METADATA_EMBED_IN_IMAGE);
            LoadPreference (Preferences.METADATA_ALWAYS_USE_SIDECAR);

            //Screen profile
            ListStore sprofiles = new ListStore (typeof (string), typeof (int));
            sprofiles.AppendValues (Catalog.GetString ("None"), 0);
            if (FSpot.ColorManagement.XProfile != null)
                sprofiles.AppendValues (Catalog.GetString ("System profile"), -1);
            sprofiles.AppendValues (null, 0);

            //Pick the display profiles from the full list, avoid _x_profile_
            var dprofs = from profile in FSpot.ColorManagement.Profiles
                where (profile.Value.DeviceClass == Cms.IccProfileClass.Display && profile.Key != "_x_profile_")
                select profile;
            foreach (var p in dprofs)
                sprofiles.AppendValues (p.Key, 1);

            CellRendererText profilecellrenderer = new CellRendererText ();
            profilecellrenderer.Ellipsize = Pango.EllipsizeMode.End;

            screenprofile_combo.Model = sprofiles;
            screenprofile_combo.PackStart (profilecellrenderer, true);
            screenprofile_combo.RowSeparatorFunc = ProfileSeparatorFunc;
            screenprofile_combo.SetCellDataFunc (profilecellrenderer, ProfileCellFunc);
            LoadPreference (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE);

            //Print profile
            ListStore pprofiles = new ListStore (typeof (string), typeof (int));
            pprofiles.AppendValues (Catalog.GetString ("None"), 0);
            pprofiles.AppendValues (null, 0);

            var pprofs = from profile in FSpot.ColorManagement.Profiles
                where (profile.Value.DeviceClass == Cms.IccProfileClass.Output && profile.Key != "_x_profile_")
                select profile;
            foreach (var p in pprofs)
                pprofiles.AppendValues (p.Key, 1);

            printprofile_combo.Model = pprofiles;
            printprofile_combo.PackStart (profilecellrenderer, true);
            printprofile_combo.RowSeparatorFunc = ProfileSeparatorFunc;
            printprofile_combo.SetCellDataFunc (profilecellrenderer, ProfileCellFunc);
            LoadPreference (Preferences.COLOR_MANAGEMENT_OUTPUT_PROFILE);

            //Theme chooser
            ListStore themes = new ListStore (typeof (string), typeof (string));
            themes.AppendValues (Catalog.GetString ("Standard theme"), null);
            themes.AppendValues (null, null); //Separator
            string gtkrc = System.IO.Path.Combine ("gtk-2.0", "gtkrc");
            string [] search = {System.IO.Path.Combine (FSpot.Core.Global.HomeDirectory, ".themes"), "/usr/share/themes"};
            foreach (string path in search)
                if (System.IO.Directory.Exists (path))
                    foreach (string dir in System.IO.Directory.GetDirectories (path))
                        if (File.Exists (System.IO.Path.Combine (dir, gtkrc)))
                            themes.AppendValues (System.IO.Path.GetFileName (dir), System.IO.Path.Combine (dir, gtkrc));
            CellRenderer themecellrenderer = new CellRendererText ();
            theme_combo.Model = themes;
            theme_combo.PackStart (themecellrenderer, true);
            theme_combo.RowSeparatorFunc = ThemeSeparatorFunc;
            theme_combo.SetCellDataFunc (themecellrenderer, ThemeCellFunc);
            LoadPreference (Preferences.GTK_RC);

            ConnectEvents ();
        }
        private bool RenameFile (DatabaseTrackInfo track)
        {
            SafeUri old_uri = track.Uri;
            bool in_library = old_uri.AbsolutePath.StartsWith (musicLibrarySource.BaseDirectoryWithSeparator);

            if (!in_library) {
                return false;
            }

            string new_filename = track.PathPattern.BuildFull (musicLibrarySource.BaseDirectory, track, System.IO.Path.GetExtension (old_uri.ToString ()));
            SafeUri new_uri = new SafeUri (new_filename);

            if (!new_uri.Equals (old_uri) && !Banshee.IO.File.Exists (new_uri)) {
                Banshee.IO.File.Move (old_uri, new_uri);
                Banshee.IO.Utilities.TrimEmptyDirectories (old_uri);
                track.Uri = new_uri;
                return true;
            }

            return false;
        }
            private void SetCoverArt (TrackInfo track, string path)
            {
                if (track == null)
                    return;

                var from_uri = new SafeUri (new System.Uri (path));

                var to_uri = new SafeUri (CoverArtSpec.GetPathForNewFile (track.ArtworkId, from_uri.AbsoluteUri));
                if (to_uri != null) {
                    // Make sure it's not the same file we already have
                    if (from_uri.Equals (to_uri)) {
                        return;
                    }

                    // Make sure the incoming file exists
                    if (!Banshee.IO.File.Exists (from_uri)) {
                        Hyena.Log.WarningFormat ("New cover art file not found: {0}", path);
                        return;
                    }

                    DeleteCoverArt (track);
                    Banshee.IO.File.Copy (from_uri, to_uri, true);
                    NotifyUpdated (track);

                    Hyena.Log.DebugFormat ("Got new cover art file for {0}: {1}", track.DisplayAlbumTitle, path);
                }
            }