f-spot r4269 - in trunk: . src



Author: rubenv
Date: Thu Aug 14 13:43:45 2008
New Revision: 4269
URL: http://svn.gnome.org/viewvc/f-spot?rev=4269&view=rev

Log:
2008-08-14  Ruben Vermeersch  <ruben savanne be>

	Eliminate the final bits of the editing toolbar: the navigation arrows.
	These are now in the unused part of the top toolbar, to the right.

	* src/MainWindow.cs: Move the navigation buttons to the top toolbar.

	* src/PhotoView.cs: Eliminate the empty toolbar.


Modified:
   trunk/ChangeLog
   trunk/src/MainWindow.cs
   trunk/src/PhotoView.cs

Modified: trunk/src/MainWindow.cs
==============================================================================
--- trunk/src/MainWindow.cs	(original)
+++ trunk/src/MainWindow.cs	Thu Aug 14 13:43:45 2008
@@ -149,6 +149,11 @@
 	
 	ToolButton rl_button;
 	ToolButton rr_button;
+
+	Label count_label;
+
+	Gtk.ToolButton display_next_button;
+	Gtk.ToolButton display_previous_button;
 	
 	ModeType view_mode;
 	bool write_metadata = false;
@@ -305,6 +310,26 @@
 		ss_button.SetTooltip (ToolTips, Catalog.GetString ("View photos in a slideshow"), null);
 		toolbar.Insert (ss_button, -1);
 
+		SeparatorToolItem white_space = new SeparatorToolItem ();
+		white_space.Draw = false;
+		white_space.Expand = true;
+		toolbar.Insert (white_space, -1);
+
+		ToolItem label_item = new ToolItem ();
+		count_label = new Label (String.Empty);
+		label_item.Child = count_label;
+		toolbar.Insert (label_item, -1);
+
+		display_previous_button = new ToolButton (Stock.GoBack);
+		toolbar.Insert (display_previous_button, -1);
+		display_previous_button.SetTooltip (ToolTips, Catalog.GetString ("Previous photo"), String.Empty);
+		display_previous_button.Clicked += new EventHandler (HandleDisplayPreviousButtonClicked);
+
+		display_next_button = new ToolButton (Stock.GoForward);
+		toolbar.Insert (display_next_button, -1);
+		display_next_button.SetTooltip (ToolTips, Catalog.GetString ("Next photo"), String.Empty);
+		display_next_button.Clicked += new EventHandler (HandleDisplayNextButtonClicked);
+
 		sidebar = new Sidebar ();
 		ViewModeChanged += sidebar.HandleMainWindowViewModeChanged;
 		sidebar_vbox.Add (sidebar);
@@ -501,6 +526,16 @@
 		Banshee.Kernel.Scheduler.Resume ();
 	}
 
+	private void HandleDisplayNextButtonClicked (object sender, EventArgs args)
+	{
+		PhotoView.View.Item.MoveNext ();
+	}
+
+	private void HandleDisplayPreviousButtonClicked (object sender, EventArgs args)
+	{
+		PhotoView.View.Item.MovePrevious ();
+	}
+
 	private void OnSidebarExtensionChanged (object s, ExtensionNodeEventArgs args) {
 		// FIXME: No sidebar page removal yet!
 		if (args.Change == ExtensionChange.Add)
@@ -587,6 +622,35 @@
 			if (edit_button.Active != state)
 				edit_button.Active = state;
 		}
+
+		if (view_mode == ModeType.PhotoView) {
+			display_previous_button.Visible = true;
+			display_next_button.Visible = true;
+			count_label.Visible = true;
+
+			bool valid = photo_view.View.Item.IsValid;
+			bool prev = valid && photo_view.View.Item.Index > 0;
+			bool next = valid && photo_view.View.Item.Index < query.Count - 1;
+
+			if (valid) {
+				Gnome.Vfs.Uri vfs = new Gnome.Vfs.Uri (photo_view.View.Item.Current.DefaultVersionUri.ToString ());
+				valid = vfs.Scheme == "file";
+			}
+
+			display_previous_button.Sensitive = prev;
+			display_next_button.Sensitive = next;
+
+			if (Query == null)
+				count_label.Text = String.Empty;
+			else
+				// Note for translators: This indicates the current photo is photo {0} of {1} out of photos
+				count_label.Text = String.Format (Catalog.GetString ("{0} of {1}"), Query.Count == 0 ? 0 : photo_view.View.Item.Index + 1, Query.Count == 0 ? 0 : Query.Count);
+		} else {
+			display_previous_button.Visible = false;
+			display_next_button.Visible = false;
+			count_label.Visible = false;
+		}
+
 	}
 
 	private void HandleExportActivated (object o, EventArgs e)
@@ -777,7 +841,8 @@
 	{
 		UpdateMenus ();
 		UpdateTagEntryFromSelection ();
-		UpdateStatusLabel();	
+		UpdateStatusLabel ();
+		UpdateToolbar ();
 
 		info_box.Photos = SelectedPhotos ();
 	}

Modified: trunk/src/PhotoView.cs
==============================================================================
--- trunk/src/PhotoView.cs	(original)
+++ trunk/src/PhotoView.cs	Thu Aug 14 13:43:45 2008
@@ -37,8 +37,6 @@
 	
 		private Widgets.TagView tag_view;
 		
-		private Gtk.ToolButton display_next_button, display_previous_button;
-		private Label count_label;
 		private Entry description_entry;
 		private Widgets.Rating rating;
 	
@@ -87,30 +85,6 @@
 			photo_view.Reload ();
 		}
 	
-		private void UpdateButtonSensitivity ()
-		{
-			bool valid = photo_view.Item.IsValid;
-			bool prev = valid && Item.Index > 0;
-			bool next = valid && Item.Index < query.Count - 1;
-	
-			if (valid) {
-				Gnome.Vfs.Uri vfs = new Gnome.Vfs.Uri (photo_view.Item.Current.DefaultVersionUri.ToString ());
-				valid = vfs.Scheme == "file";
-			}
-	
-			display_previous_button.Sensitive = prev;
-			display_next_button.Sensitive = next;
-		}
-	
-		private void UpdateCountLabel ()
-		{
-			if (query == null)
-				count_label.Text = String.Empty;
-			else
-				// Note for translators: This indicates the current photo is photo {0} of {1} out of photos
-				count_label.Text = String.Format (Catalog.GetString ("{0} of {1}"), query.Count == 0 ? 0 : Item.Index + 1, query.Count == 0 ? 0 : query.Count);
-		}
-	
 		private void UpdateDescriptionEntry ()
 		{
 			description_entry.Changed -= HandleDescriptionChanged;
@@ -150,8 +124,6 @@
 			if (UpdateStarted != null)
 				UpdateStarted (this);
 	
-			UpdateButtonSensitivity ();
-			UpdateCountLabel ();
 			UpdateDescriptionEntry ();
 			UpdateRating ();
 
@@ -188,16 +160,6 @@
 			return true;
 		}
 	
-		private void HandleDisplayNextButtonClicked (object sender, EventArgs args)
-		{
-			View.Item.MoveNext ();
-		}
-	
-		private void HandleDisplayPreviousButtonClicked (object sender, EventArgs args)
-		{
-			View.Item.MovePrevious ();
-		}
-	
 		private void ShowError (System.Exception e, Photo photo)
 		{
 			string msg = Catalog.GetString ("Error editing photo");
@@ -269,16 +231,6 @@
 				PhotoChanged (this);
 		}
 	
-		private void HandleSelectionChanged ()
-		{
-			int x, y, width, height;
-			bool old = has_selection;
-			has_selection = photo_view.GetSelection (out x, out y, out width, out height);
-		
-			if (has_selection != old)
-				UpdateButtonSensitivity ();
-		}
-	
 		private void HandleDestroy (object sender, System.EventArgs args)
 		{
 			CommitPendingChanges ();
@@ -327,7 +279,6 @@
 			inner_vbox.PackStart (filmstrip, false, false, 0);
 	
 			photo_view.PhotoChanged += HandlePhotoChanged;
-			photo_view.SelectionChanged += HandleSelectionChanged;
 	
 			photo_view_scrolled = new ScrolledWindow (null, null);
 
@@ -358,33 +309,6 @@
 			
 			inner_vbox.PackStart (inner_hbox, false, true, 0);
 	
-			Toolbar toolbar = new Toolbar ();
-			toolbar.IconSize = IconSize.SmallToolbar;
-			toolbar.ToolbarStyle = ToolbarStyle.Icons;
-			vbox.PackStart (toolbar, false, true, 0);
-	
-			SeparatorToolItem white_space = new SeparatorToolItem ();
-			white_space.Draw = false;
-			white_space.Expand = true;
-			toolbar.Insert (white_space, -1);
-	
-			ToolItem label_item = new ToolItem ();
-			count_label = new Label (String.Empty);
-			label_item.Child = count_label;
-			toolbar.Insert (label_item, -1);
-	
-			display_previous_button = new ToolButton (Stock.GoBack);
-			toolbar.Insert (display_previous_button, -1);
-			display_previous_button.SetTooltip (tips, Catalog.GetString ("Previous photo"), String.Empty);
-			display_previous_button.Clicked += new EventHandler (HandleDisplayPreviousButtonClicked);
-	
-			display_next_button = new ToolButton (Stock.GoForward);
-			toolbar.Insert (display_next_button, -1);
-			display_next_button.SetTooltip (tips, Catalog.GetString ("Next photo"), String.Empty);
-			display_next_button.Clicked += new EventHandler (HandleDisplayNextButtonClicked);
-	
-			UpdateButtonSensitivity ();
-	
 			vbox.ShowAll ();
 	
 			Realized += delegate (object o, EventArgs e) {SetColors ();};



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