Exemple #1
0
        public void Run(object o, EventArgs e)
        {
            Photo[] photos = App.Instance.Organizer.SelectedPhotos();

            if (photos.Length == 0)
            {
                Log.Debug("no photos selected, returning");
                return;
            }

            DateTime import_time = photos[0].Time;

            foreach (Photo p in photos)
            {
                if (p.Time > import_time)
                {
                    import_time = p.Time;
                }
            }

            RollStore rolls = App.Instance.Database.Rolls;
            Roll      roll  = rolls.Create(import_time);

            foreach (Photo p in photos)
            {
                HyenaSqliteCommand cmd = new HyenaSqliteCommand("UPDATE photos SET roll_id = ? " +
                                                                "WHERE id = ? ", roll.Id, p.Id);
                App.Instance.Database.Database.Execute(cmd);
                p.RollId = roll.Id;
            }
            Log.Debug("RetroactiveRoll done: " + photos.Length + " photos in roll " + roll.Id);
        }
    public void Init(string path, bool create_if_missing)
    {
        bool new_db = !File.Exists(path);

        this.path = path;

        if (new_db && !create_if_missing)
        {
            throw new Exception(path + ": File not found");
        }

        database = new QueuedSqliteDatabase(path);

        // Load or create the meta table
        meta_store = new MetaStore(Database, new_db);

        // Update the database schema if necessary
        FSpot.Database.Updater.Run(this);

        Database.BeginTransaction();

        face_store   = new FaceStore(Database, new_db);
        tag_store    = new TagStore(Database, new_db);
        roll_store   = new RollStore(Database, new_db);
        export_store = new ExportStore(Database, new_db);
        job_store    = new JobStore(Database, new_db);
        photo_store  = new PhotoStore(Database, new_db);

        Database.CommitTransaction();

        empty = new_db;
    }
Exemple #3
0
        public LastRolls(FSpot.PhotoQuery query, RollStore rollstore, Gtk.Window parent_window) : base("last_import_rolls_filter")
        {
            this.query         = query;
            this.rollstore     = rollstore;
            this.parent_window = parent_window;
            rolls = rollstore.GetRolls(FSpot.Preferences.Get <int> (FSpot.Preferences.IMPORT_GUI_ROLL_HISTORY));

            PopulateCombos();

            combo_filter.Active = 0;
            combo_roll_1.Active = 0;
            combo_roll_2.Active = 0;

            Dialog.DefaultResponse = ResponseType.Ok;
            Dialog.Response       += HandleResponse;
            Dialog.Show();
        }
		public LastRolls (FSpot.PhotoQuery query, RollStore rollstore, Gtk.Window parent_window) : base ("last_import_rolls_filter") 
		{
			this.query = query;
			this.rollstore = rollstore;
			this.parent_window = parent_window;
			rolls = rollstore.GetRolls (FSpot.Preferences.Get<int> (FSpot.Preferences.IMPORT_GUI_ROLL_HISTORY));

			PopulateCombos ();
			
			combo_filter.Active = 0;
			combo_roll_1.Active = 0;
			combo_roll_2.Active = 0;
			
			Dialog.DefaultResponse = ResponseType.Ok;
			Dialog.Response += HandleResponse;
			Dialog.Show ();
		}
Exemple #5
0
        void CreateRolls(Roll [] rolls)
        {
            if (rolls == null)
            {
                rolls = from_db.Rolls.GetRolls();
            }
            RollStore from_store = from_db.Rolls;
            RollStore to_store   = to_db.Rolls;

            foreach (Roll roll in rolls)
            {
                if (from_store.PhotosInRoll(roll) == 0)
                {
                    continue;
                }
                roll_map [roll.Id] = (to_store.Create(roll.Time).Id);
            }
        }
#pragma warning restore 649

        public LastRolls(PhotoQuery query, RollStore rollstore, Window parent) : base("LastImportRollFilterDialog.ui", "last_import_rolls_filter")
        {
            this.query     = query;
            this.rollstore = rollstore;
            rolls          = rollstore.GetRolls(Preferences.Get <int> (Preferences.IMPORT_GUI_ROLL_HISTORY));

            TransientFor = parent;

            PopulateCombos();

            combo_filter.Active = 0;
            combo_roll_1.Active = 0;
            combo_roll_2.Active = 0;

            DefaultResponse = ResponseType.Ok;
            Response       += HandleResponse;
            Show();
        }
        public LastRolls(FSpot.PhotoQuery query, RollStore rollstore, Window parent)
            : base("LastImportRollFilterDialog.ui", "last_import_rolls_filter")
        {
            this.query = query;
            this.rollstore = rollstore;
            rolls = rollstore.GetRolls (FSpot.Preferences.Get<int> (FSpot.Preferences.IMPORT_GUI_ROLL_HISTORY));

            TransientFor = parent;

            PopulateCombos ();

            combo_filter.Active = 0;
            combo_roll_1.Active = 0;
            combo_roll_2.Active = 0;

            DefaultResponse = ResponseType.Ok;
            Response += HandleResponse;
            Show ();
        }
Exemple #8
0
    public void Init(string path, bool create_if_missing)
    {
        uint timer  = Log.DebugTimerStart();
        bool new_db = !File.Exists(path);

        this.path = path;

        if (new_db && !create_if_missing)
        {
            throw new Exception(path + ": File not found");
        }

        database = new QueuedSqliteDatabase(path);
        database.ExceptionThrown += HandleDbException;

        if (database.GetFileVersion(path) == 2)
        {
            SqliteUpgrade();
        }

        // Load or create the meta table
        meta_store = new MetaStore(Database, new_db);

        // Update the database schema if necessary
        FSpot.Database.Updater.Run(this);

        Database.BeginTransaction();

        tag_store    = new TagStore(Database, new_db);
        roll_store   = new RollStore(Database, new_db);
        export_store = new ExportStore(Database, new_db);
        job_store    = new JobStore(Database, new_db);
        photo_store  = new PhotoStore(Database, new_db);

        Database.CommitTransaction();

        empty = new_db;
        Log.DebugTimerPrint(timer, "Db Initialization took {0}");
    }
Exemple #9
0
        public void Init(string path, bool create_if_missing)
        {
            uint timer = Log.DebugTimerStart ();
            bool new_db = !File.Exists (path);
            this.path = path;

            if (new_db && !create_if_missing)
                throw new Exception (path + ": File not found");

            Database = new FSpotDatabaseConnection (path);

            // Load or create the meta table
            Meta = new MetaStore (Database, new_db);

            // Update the database schema if necessary
            FSpot.Database.Updater.Run (Database);

            Database.BeginTransaction ();

            Tags = new TagStore (Database, new_db);
            Rolls = new RollStore (Database, new_db);
            Exports = new ExportStore (Database, new_db);
            Jobs = new JobStore (Database, new_db);
            Photos = new PhotoStore (Database, new_db);

            Database.CommitTransaction ();

            Empty = new_db;
            Log.DebugTimerPrint (timer, "Db Initialization took {0}");
        }
Exemple #10
0
	public void Init (string path, bool create_if_missing)
	{
		bool new_db = ! File.Exists (path);
		this.path = path;

		if (new_db && ! create_if_missing)
			throw new Exception (path + ": File not found");

		database = new QueuedSqliteDatabase(path);	

		// Load or create the meta table
 		meta_store = new MetaStore (Database, new_db);

		// Update the database schema if necessary
		FSpot.Database.Updater.Run (this);

		Database.BeginTransaction ();
		
		face_store = new FaceStore (Database, new_db);
		tag_store = new TagStore (Database, new_db);
		roll_store = new RollStore (Database, new_db);
		export_store = new ExportStore (Database, new_db);
		job_store = new JobStore (Database, new_db);
 		photo_store = new PhotoStore (Database, new_db);
		
		Database.CommitTransaction ();

		empty = new_db;
	}
	public void Init (string path, bool create_if_missing)
	{
		uint timer = Log.DebugTimerStart ();
		bool new_db = ! File.Exists (path);
		this.path = path;

		if (new_db && ! create_if_missing)
			throw new Exception (path + ": File not found");

		database = new QueuedSqliteDatabase(path);
		database.ExceptionThrown += HandleDbException;

		if (database.GetFileVersion(path) == 2)
			SqliteUpgrade ();

		// Load or create the meta table
 		meta_store = new MetaStore (Database, new_db);

		// Update the database schema if necessary
		FSpot.Database.Updater.Run (this);

		Database.BeginTransaction ();

		tag_store = new TagStore (Database, new_db);
		roll_store = new RollStore (Database, new_db);
		export_store = new ExportStore (Database, new_db);
		job_store = new JobStore (Database, new_db);
 		photo_store = new PhotoStore (Database, new_db);

		Database.CommitTransaction ();

		empty = new_db;
		Log.DebugTimerPrint (timer, "Db Initialization took {0}");
	}