Re: Transition from MainWindow.Toplevel to App.Instance.Organizer



Hello again,

* Resolving the dependency in InfoBox is quite easy. See https://bugzilla.gnome.org/show_bug.cgi?id=601565

* Resolving the dependency of FolderQueryWidget can be done as it is done with QueryWidget and LogicWidget: Giving the query to the ctor. See diff attached and pasted here:

diff --git a/src/FolderQueryWidget.cs b/src/FolderQueryWidget.cs
index 3ce26c5..5a446d9 100644
--- a/src/FolderQueryWidget.cs
+++ b/src/FolderQueryWidget.cs
@@ -26,10 +26,10 @@ namespace FSpot
 		PhotoQuery query;
 		FolderSet folder_set;
 		
-		public FolderQueryWidget () : base ()
+		public FolderQueryWidget (PhotoQuery query) : base ()
 		{
 			folder_set = new FolderSet ();
-			query = MainWindow.Toplevel.Query;
+			this.query = query;
 			
 			query.SetCondition (folder_set);
 			
diff --git a/src/QueryWidget.cs b/src/QueryWidget.cs
index df9f5a3..c77e5e5 100644
--- a/src/QueryWidget.cs
+++ b/src/QueryWidget.cs
@@ -81,7 +81,7 @@ namespace FSpot {
 			rollfilter.Visible = false;
 			box.PackStart (rollfilter, false, false, 0);

-			folder_query_widget = new FolderQueryWidget ();
+			folder_query_widget = new FolderQueryWidget (query);
 			folder_query_widget.Visible = false;
 			box.PackStart (folder_query_widget, false, false, 0);
 			
* Getting rid of the MainWindow.Toplevel in QueryWidget's methods HideBar () ist not as easy. I am not sure what would be the best way to do this without duplicating code or introducing some weird method parameters. Perhaps giving QueryWidget a reference to it's menu item FindByTag?

The cause is the call of UpdateFindByTagMenu (); in MainWindow.cs:530. And, later, the lines 543 and 544:

	query_widget.HandleChanged (query);
	query_widget.Close ();

I don't understand the need of those two lines. Are they really needed?

Regards
Paul.


Paul Wellner Bou wrote:
Hi,

As some of the changes in f-spot's git source broke my tabbed sidebar addon I tried to look a bit deeper into what had changed and why the transition is not as easy as replacing MainWindow.Toplevel with App.Instance.Organizer. (And, of course, MainWindow.Toplevel.Database with App.Instance.Databes -- which is absolutely no problem).

I'd really like to do something here -- so /please let me know/ if this is complete nonsense and/or there is another strategy for the transition to use unique#'s App exclusively and/or there is another reason why my thoughts and suggestions to remove some of the constructor dependencies are not welcome.

In theory, the MainWindow.Toplevel is referencing the same MainWindow instance as App.Instance.Organizer (see http://gitorious.org/f-spot/paulwbs-clone). The only problem is at startup. The constructor of MainWindow is doing tons of stuff and if there is any reference to App.Instance.Organizer in any method which is called by the constructur this causes an infinite recursive loop of MainWindow instantiations.

I discovered a few lines where it is now not possible to use App.Instance.Organizer instead of MainWindow.Toplevel. For example:

src/Widgets/InfoBox.cs:191: InfoBox() is instantiated in the MainWindow constructor. The constructor of InfoBox is calling SetupWidgets(), and SetupWidgets is using MainWindow.Toplevel.Window to get out the Gdk.Color to draw the histogram widget. To get rid of the MainWindow.Toplevel dependency, which would be nice, I think, would be either to use default colors and create a method to set the colors afterwards or to create a InfoBox ctor parameter accepting a Gdk.Color.

Other affected lines:

src/QueryWidget.cs:155,161
src/Widgets/InfoBox.cs:191
src/FolderQueryWidget.cs:32

What do you think?

Regards
Paul.
_______________________________________________
F-spot-list mailing list
F-spot-list gnome org
http://mail.gnome.org/mailman/listinfo/f-spot-list
diff --git a/src/FolderQueryWidget.cs b/src/FolderQueryWidget.cs
index 3ce26c5..5a446d9 100644
--- a/src/FolderQueryWidget.cs
+++ b/src/FolderQueryWidget.cs
@@ -26,10 +26,10 @@ namespace FSpot
 		PhotoQuery query;
 		FolderSet folder_set;
 		
-		public FolderQueryWidget () : base ()
+		public FolderQueryWidget (PhotoQuery query) : base ()
 		{
 			folder_set = new FolderSet ();
-			query = MainWindow.Toplevel.Query;
+			this.query = query;
 			
 			query.SetCondition (folder_set);
 			
diff --git a/src/QueryWidget.cs b/src/QueryWidget.cs
index df9f5a3..c77e5e5 100644
--- a/src/QueryWidget.cs
+++ b/src/QueryWidget.cs
@@ -81,7 +81,7 @@ namespace FSpot {
 			rollfilter.Visible = false;
 			box.PackStart (rollfilter, false, false, 0);
 
-			folder_query_widget = new FolderQueryWidget ();
+			folder_query_widget = new FolderQueryWidget (query);
 			folder_query_widget.Visible = false;
 			box.PackStart (folder_query_widget, false, false, 0);
 			


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]