f-spot r3938 - in trunk: . po src src/UI.Dialog
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r3938 - in trunk: . po src src/UI.Dialog
- Date: Mon, 19 May 2008 13:29:41 +0000 (UTC)
Author: sdelcroix
Date: Mon May 19 13:29:40 2008
New Revision: 3938
URL: http://svn.gnome.org/viewvc/f-spot?rev=3938&view=rev
Log:
2008-05-19 Stephane Delcroix <sdelcroix novell com>
* src/Makefile.am:
* src/UI.Dialog/RepairDbDialog.cs:
* src/MainWindow.cs:
* src/Core.cs:
* po/POTFILES.in: new RepairDbDialog, handle more db errors, like
in bgo #529380.
Added:
trunk/src/UI.Dialog/RepairDbDialog.cs
Modified:
trunk/ChangeLog
trunk/po/POTFILES.in
trunk/src/Core.cs
trunk/src/MainWindow.cs
trunk/src/Makefile.am
Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in (original)
+++ trunk/po/POTFILES.in Mon May 19 13:29:40 2008
@@ -75,6 +75,7 @@
src/UI.Dialog/ColorDialog.cs
src/UI.Dialog/EditExceptionDialog.cs
src/UI.Dialog/ExceptionDialog.cs
+src/UI.Dialog/RepairDbDialog.cs
src/UI.Dialog/SelectionRatioDialog.cs
src/Updater.cs
src/Util.cs
Modified: trunk/src/Core.cs
==============================================================================
--- trunk/src/Core.cs (original)
+++ trunk/src/Core.cs Mon May 19 13:29:40 2008
@@ -4,6 +4,8 @@
using NDesk.DBus;
using org.freedesktop.DBus;
+using FSpot.UI.Dialog;
+
namespace FSpot {
[Interface ("org.gnome.FSpot.Core")]
public interface ICore {
@@ -45,7 +47,12 @@
Directory.CreateDirectory (base_directory);
db = new Db ();
- db.Init (Path.Combine (base_directory, "photos.db"), true);
+ try {
+ db.Init (Path.Combine (base_directory, "photos.db"), true);
+ } catch (System.Exception e) {
+ new RepairDbDialog (e, db.Repair (), null);
+ db.Init (Path.Combine (base_directory, "photos.db"), true);
+ }
}
return db;
}
Modified: trunk/src/MainWindow.cs
==============================================================================
--- trunk/src/MainWindow.cs (original)
+++ trunk/src/MainWindow.cs Mon May 19 13:29:40 2008
@@ -326,7 +326,7 @@
query = new FSpot.PhotoQuery (db.Photos);
} catch (System.Exception e) {
//FIXME assume any exception here is due to a corrupt db and handle that.
- RestoreDb (e);
+ new RepairDbDialog (e, db.Repair (), main_window);
query = new FSpot.PhotoQuery (db.Photos);
}
@@ -870,21 +870,6 @@
args.RetVal = true;
}
- void RestoreDb (System.Exception e)
- {
- string backup = db.Repair ();
- string short_msg = Catalog.GetString ("Error loading database.");
- string long_msg = Catalog.GetString ("F-Spot encountered an error while loading the photo database. " +
- "The old database has be moved to {0} and a new database has been created.");
-
- HigMessageDialog md = new HigMessageDialog (main_window, DialogFlags.DestroyWithParent,
- MessageType.Error, ButtonsType.Ok,
- short_msg, String.Format (long_msg, backup));
- Console.WriteLine (e);
- md.Run ();
- md.Destroy ();
- }
-
void HandleTagSelectionDragBegin (object sender, DragBeginArgs args)
{
Tag [] tags = tag_selection_widget.TagHighlight;
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Mon May 19 13:29:40 2008
@@ -157,7 +157,6 @@
$(srcdir)/ProgressDialog.cs \
$(srcdir)/RatingFilter.cs \
$(srcdir)/QueuedSqliteDatabase.cs \
- $(srcdir)/RepairDialog.cs \
$(srcdir)/RotateCommand.cs \
$(srcdir)/RollStore.cs \
$(srcdir)/SendEmail.cs \
@@ -186,6 +185,7 @@
$(srcdir)/UI.Dialog/HigMessageDialog.cs \
$(srcdir)/UI.Dialog/PreferenceDialog.cs \
$(srcdir)/UI.Dialog/SelectionRatioDialog.cs \
+ $(srcdir)/UI.Dialog/RepairDbDialog.cs \
$(srcdir)/Updater.cs \
$(srcdir)/UriCollection.cs \
$(srcdir)/Util.cs \
Added: trunk/src/UI.Dialog/RepairDbDialog.cs
==============================================================================
--- (empty file)
+++ trunk/src/UI.Dialog/RepairDbDialog.cs Mon May 19 13:29:40 2008
@@ -0,0 +1,29 @@
+/*
+ * FSpot.UI.Dialog.RepairDbDialog
+ *
+ * Author(s):
+ * Stephane Delcroix <stephane delcroix org>
+ *
+ * This is free software. See COPYING for details.
+ */
+
+using System;
+using Gtk;
+using Mono.Unix;
+
+namespace FSpot.UI.Dialog
+{
+ public class RepairDbDialog : HigMessageDialog
+ {
+ public RepairDbDialog (System.Exception e, string backup_path, Window parent) :
+ base (parent, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok,
+ Catalog.GetString ("Error loading database."),
+ String.Format (Catalog.GetString ("F-Spot encountered an error while loading the photo database. " +
+ "The old database has be moved to {0} and a new database has been created."), backup_path))
+ {
+ Console.WriteLine (e);
+ Run ();
+ Destroy ();
+ }
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]