browse/edit toggle button patch



I sent an email a few days ago about some questions and problems I was
having with f-spot.  I didn't hear much back but I figured everyone
was still dizzy from all the tryptophan so I started poking around the
code.  I know java so C# isn't all that far away.

Here is my first ( amazingly trivial ) patch.

The Browse/Edit toggle buttons have an odd behavior.  When you click
the browse button it is set to active and view_mode is set to
ModeType.PhotoView.  However if you click it again, the button becomes
inactive.  Same thing for the Edit button.

I know this is a very small thing but I wanted to get my feet wet. 
The attached patch just makes sure that the buttons stay synced up
with whatever the current view_mode is.

I was thinking that this might be better implemented with radio
buttons but I didn't want to make waves and this worked.

Hope all is well.

John
--- MainWindow.cs	29 Nov 2005 23:11:16 -0500	1.238
+++ MainWindow.cs	29 Nov 2005 23:19:32 -0500	
@@ -1700,23 +1700,31 @@
 
 	void HandleToggleViewBrowse (object sender, EventArgs args)
 	{
-	        ToggleButton toggle = sender as ToggleButton;
-		if (toggle != null) {
-			if (toggle.Active)
+		if (view_mode == ModeType.IconView){
+			browse_button.Active = true;
+		}else{
+			ToggleButton toggle = sender as ToggleButton;
+			if (toggle != null) {
+				if (toggle.Active)
+					SetViewMode (ModeType.IconView);
+			} else
 				SetViewMode (ModeType.IconView);
-		} else
-			SetViewMode (ModeType.IconView);
+		}
 	}
 
 	void HandleToggleViewPhoto (object sender, EventArgs args)
 	{
-	        ToggleButton toggle = sender as ToggleButton;
-		
-		if (toggle != null) {
-			if (toggle.Active)
-				SetViewMode (ModeType.PhotoView);
-		} else
-			SetViewMode (ModeType.IconView);
+		if (view_mode == ModeType.PhotoView){
+			view_button.Active = true;
+		}else{
+			ToggleButton toggle = sender as ToggleButton;
+		
+			if (toggle != null) {
+				if (toggle.Active)
+					SetViewMode (ModeType.PhotoView);
+			} else
+				SetViewMode (ModeType.IconView);
+		}
 	}
 
 	void HandleViewBrowse (object sender, EventArgs args)


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