public RatingFilterDialog(FSpot.PhotoQuery query, Gtk.Window parent_window) : base("RatingFilterDialog.ui", "rating_filter_dialog") { this.query = query; this.parent_window = parent_window; TransientFor = parent_window; DefaultResponse = ResponseType.Ok; ok_button.GrabFocus (); if (query.RatingRange != null) { minrating_value = (int) query.RatingRange.MinRating; maxrating_value = (int) query.RatingRange.MaxRating; } minrating = new Rating (minrating_value); maxrating = new Rating (maxrating_value); minrating_hbox.PackStart (minrating, false, false, 0); maxrating_hbox.PackStart (maxrating, false, false, 0); ResponseType response = (ResponseType) Run (); if (response == ResponseType.Ok) { query.RatingRange = new RatingRange ((uint) minrating.Value, (uint) maxrating.Value); } Destroy (); }
public void Run (FSpot.IBrowsableCollection photos) { if (null == photos) { throw new ArgumentNullException ("photos"); } this.photos = photos; Glade.XML glade_xml = new Glade.XML ( null, "TabbloExport.glade", DialogName, "f-spot"); glade_xml.Autoconnect (this); dialog = (Gtk.Dialog) glade_xml.GetWidget (DialogName); FSpot.Widgets.IconView icon_view = new FSpot.Widgets.IconView (photos); icon_view.DisplayDates = false; icon_view.DisplayTags = false; username_entry.Changed += HandleAccountDataChanged; password_entry.Changed += HandleAccountDataChanged; ReadAccountData (); HandleAccountDataChanged (null, null); dialog.Modal = false; dialog.TransientFor = null; dialog.Response += HandleResponse; thumb_scrolled_window.Add (icon_view); icon_view.Show (); dialog.Show (); }
public override int IndexFromPhoto(FSpot.IBrowsableItem photo) { if (order_ascending) return IndexFromDateAscending (photo.Time); return IndexFromDateDescending (photo.Time); }
internal FSpotUploadProgress ( Picture [] pictures, FSpot.ThreadProgressDialog progress_dialog) : base (pictures) { this.progress_dialog = progress_dialog; }
public TrayView (FSpot.IBrowsableCollection query) : base (query) { DisplayDates = false; DisplayTags = false; cell_border_width = 10; tag_icon_vspacing = 0; tag_icon_size = 0; }
public UriList (FSpot.IBrowsableItem [] photos) { foreach (FSpot.IBrowsableItem p in photos) { Uri uri; try { uri = p.DefaultVersionUri; } catch { continue; } Add (uri); } }
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, 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 (); }
public void Run(FSpot.IBrowsableCollection photos) { if (null == photos || null == photos.Items) { throw new ArgumentNullException ("photos"); } main_dialog = new TabbloExportView (photos); InitBindings (); model.Deserialize (); model.PhotoCollection = photos; // Model deserialization triggers the various event // handlers, which can cause the default widget to lose // focus (it can be invalid, and hence disabled, for a // moment). main_dialog.ResetFocus (); main_dialog.Show (); }
internal TabbloExportView(FSpot.IBrowsableCollection photos) : base(Assembly.GetExecutingAssembly (), "TabbloExport.ui", DialogName) { // Thumbnails FSpot.Widgets.IconView icon_view = new FSpot.Widgets.IconView (photos); icon_view.DisplayDates = false; icon_view.DisplayTags = false; thumb_scrolled_window.Add (icon_view); icon_view.Show (); // Tags attached_tags_view = new FSpot.Widgets.TagView (); attached_tags_alignment.Add (attached_tags_view); attached_tags_view.Show (); removed_tags_view = new FSpot.Widgets.TagView (); removed_tags_alignment.Add (removed_tags_view); removed_tags_view.Show (); }
private static FSpot.Xmp.XmpFile UpdateXmp (FSpot.IBrowsableItem item, FSpot.Xmp.XmpFile xmp) { if (xmp == null) xmp = new FSpot.Xmp.XmpFile (); Tag [] tags = item.Tags; string [] names = new string [tags.Length]; for (int i = 0; i < tags.Length; i++) names [i] = tags [i].Name; xmp.Store.Update ("dc:subject", "rdf:Bag", names); if ((item as Photo).Rating > 0) { xmp.Store.Update ("xmp:Rating", (item as Photo).Rating.ToString()); // FIXME - Should we also store/overwrite the Urgency field? // uint urgency_value = (item as Photo).Rating + 1; // Urgency valid values 1 - 8 // xmp.Store.Update ("photoshop:Urgency", urgency_value.ToString()); } else { xmp.Store.Delete ("xmp:Rating"); } xmp.Dump (); return xmp; }
private void HandlePixbufLoaded (FSpot.PixbufCache cache, FSpot.PixbufCache.CacheEntry entry) { Gdk.Pixbuf result = entry.ShallowCopyPixbuf (); int order = (int) entry.Data; if (order >= 0 && order < collection.Count) { System.Uri uri = collection [order].DefaultVersionUri; if (result == null && !System.IO.File.Exists (FSpot.ThumbnailGenerator.ThumbnailPath (uri))) FSpot.ThumbnailGenerator.Default.Request (uri, 0, 256, 256); if (result == null) return; if (!FSpot.PhotoLoader.ThumbnailIsValid (uri, result)) FSpot.ThumbnailGenerator.Default.Request (uri, 0, 256, 256); } if (result == null) return; // We have to do the scaling here rather than on load because we need to preserve the // Pixbuf option iformation to verify the thumbnail validity later int width, height; PixbufUtils.Fit (result, ThumbnailWidth, ThumbnailHeight, false, out width, out height); if (result.Width > width && result.Height > height) { // System.Console.WriteLine ("scaling"); Gdk.Pixbuf temp = PixbufUtils.ScaleDown (result, width, height); result.Dispose (); result = temp; } else if (result.Width < ThumbnailWidth && result.Height < ThumbnailHeight) { // FIXME this is a workaround to handle images whose actual size is smaller than // the thumbnail size, it needs to be fixed at a different level. Gdk.Pixbuf temp = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, ThumbnailWidth, ThumbnailHeight); temp.Fill (0x00000000); result.CopyArea (0, 0, result.Width, result.Height, temp, (temp.Width - result.Width)/ 2, temp.Height - result.Height); result.Dispose (); result = temp; } cache.Update (entry, result); InvalidateCell (order); }
private void OnPhotoUploaded(FSpot.IBrowsableItem item) { Debug.Assert (null != item); if (!model.AttachTags && !model.RemoveTags) { return; } PhotoStore photo_store = FSpot.App.Instance.Database.Photos; FSpot.Photo photo = photo_store.GetByUri ( item.DefaultVersionUri); Debug.Assert (null != photo); if (null == photo) { return; } if (model.AttachTags) { photo.AddTag (model.AttachedTags); } if (model.RemoveTags) { photo.RemoveTag (model.RemovedTags); } photo_store.Commit (photo); }
public Filmstrip (FSpot.BrowsablePointer selection) : this (selection, true) { }
public QueryView (FSpot.IBrowsableCollection query) : base (query) {}
private void HandleTraySelectionChanged (FSpot.IBrowsableCollection coll) { if (tray.Selection.Count > 0) photo_view.Item.Index = tray.Selection.Ids[0]; }
private void HandleItemsChanged (FSpot.IBrowsableCollection sender, BrowsableArgs args) { foreach (int item in args.Items) { UpdateThumbnail (item); InvalidateCell (item); } }
public Filmstrip (FSpot.BrowsablePointer selection, bool squared_thumbs) : base () { CanFocus = true; this.selection = selection; this.selection.Changed += HandlePointerChanged; this.selection.Collection.Changed += HandleCollectionChanged; this.selection.Collection.ItemsChanged += HandleCollectionItemsChanged; this.squared_thumbs = squared_thumbs; thumb_cache = new DisposableCache<string, Pixbuf> (30); ThumbnailGenerator.Default.OnPixbufLoaded += HandlePixbufLoaded; }
public HttpWebResponse Submit (string url, FSpot.ProgressItem item) { return Submit (new Uri (url), item); }
private static int[] ToIds(FSpot.Tag [] tags) { if (null == tags) { return null; } int [] ids = new int [tags.Length]; for (int i = 0; i < ids.Length; ++i) { ids [i] = (int) tags [i].Id; } return ids; }
public void HandlePhotoChanged (FSpot.PhotoImageView sender) { int item = image_view.Item.Index; photo_label.Text = String.Format (Catalog.GetString ("Photo {0} of {1}"), item + 1, query.Count); photo_spin_button.Value = item + 1; }
public HttpWebResponse Submit (Uri uri, FSpot.ProgressItem progress_item) { this.Progress = progress_item; Request = (HttpWebRequest) WebRequest.Create (uri); CookieCollection cookie_collection = Cookies.GetCookies (uri); if (uri.UserInfo != null && uri.UserInfo != String.Empty) { NetworkCredential cred = new NetworkCredential (); cred.GetCredential (uri, "basic"); CredentialCache credcache = new CredentialCache(); credcache.Add(uri, "basic", cred); Request.PreAuthenticate = true; Request.Credentials = credcache; } Request.ServicePoint.Expect100Continue = expect_continue; Request.CookieContainer = new CookieContainer (); foreach (Cookie c in cookie_collection) { if (SuppressCookiePath) Request.CookieContainer.Add (new Cookie (c.Name, c.Value)); else Request.CookieContainer.Add (c); } Request.Method = "POST"; Request.Headers["Accept-Charset"] = "utf-8;"; //Request.UserAgent = "F-Spot Gallery Remote Client"; Request.UserAgent = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040626 Firefox/0.9.1"; Request.Proxy = WebProxy.GetDefaultProxy (); if (multipart) { GenerateBoundary (); Request.ContentType = "multipart/form-data; boundary=" + boundary; Request.Timeout = Request.Timeout * 3; long length = 0; for (int i = 0; i < Items.Count; i++) { FormItem item = (FormItem)Items[i]; length += MultipartLength (item); } length += end_boundary.Length + 2; //Request.Headers["My-Content-Length"] = length.ToString (); if (Buffer == false) { Request.ContentLength = length; Request.AllowWriteStreamBuffering = false; } } else { Request.ContentType = "application/x-www-form-urlencoded"; } stream_writer = new StreamWriter (Request.GetRequestStream ()); first_item = true; for (int i = 0; i < Items.Count; i++) { FormItem item = (FormItem)Items[i]; Write (item); } if (multipart) stream_writer.Write (end_boundary + "\r\n"); stream_writer.Flush (); stream_writer.Close (); HttpWebResponse response; try { response = (HttpWebResponse) Request.GetResponse (); //Console.WriteLine ("found {0} cookies", response.Cookies.Count); foreach (Cookie c in response.Cookies) { Cookies.Add (c); } } catch (WebException e) { if (e.Status == WebExceptionStatus.ProtocolError && ((HttpWebResponse)e.Response).StatusCode == HttpStatusCode.ExpectationFailed && expect_continue) { e.Response.Close (); expect_continue = false; return Submit (uri, progress_item); } throw new WebException (Mono.Unix.Catalog.GetString ("Unhandled exception"), e); } return response; }
private void HandlePixbufLoaded(FSpot.PixbufCache Cache, FSpot.PixbufCache.CacheEntry entry) { Gdk.Pixbuf result = entry.ShallowCopyPixbuf (); int order = (int) entry.Data; if (result == null) return; // We have to do the scaling here rather than on load because we need to preserve the // Pixbuf option iformation to verify the thumbnail validity later int width, height; PixbufUtils.Fit (result, ThumbnailWidth, ThumbnailHeight, false, out width, out height); if (result.Width > width && result.Height > height) { // Log.Debug ("scaling"); Gdk.Pixbuf temp = PixbufUtils.ScaleDown (result, width, height); result.Dispose (); result = temp; } else if (result.Width < ThumbnailWidth && result.Height < ThumbnailHeight) { // FIXME this is a workaround to handle images whose actual size is smaller than // the thumbnail size, it needs to be fixed at a different level. Gdk.Pixbuf temp = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, ThumbnailWidth, ThumbnailHeight); temp.Fill (0x00000000); result.CopyArea (0, 0, result.Width, result.Height, temp, (temp.Width - result.Width)/ 2, temp.Height - result.Height); result.Dispose (); result = temp; } Cache.Update (entry, result); InvalidateCell (order); }
public void Add (FSpot.IBrowsableItem item) { Add (item.DefaultVersionUri); }
public IconView (FSpot.IBrowsableCollection collection) : this () { this.collection = collection; this.selection = new SelectionCollection (collection); Name = "ImageContainer"; collection.Changed += HandleChanged; collection.ItemsChanged += HandleItemsChanged; selection.DetailedChanged += HandleSelectionChanged; }
public int Add (FSpot.IBrowsableItem item, string path) { if (item == null) Console.WriteLine ("NO PHOTO"); return gallery.AddItem (this, path, Path.GetFileName (item.DefaultVersionUri.LocalPath), item.Name, item.Description, true); }
public void Add (FSpot.IBrowsableItem item) { Add (item, item.DefaultVersionUri.LocalPath); }
private void HandleSelectionChanged (FSpot.IBrowsableCollection collection, int [] ids) { if (ids == null) QueueDraw (); else foreach (int id in ids) InvalidateCell (id); }
public Set (FSpot.PhotoQuery query, Gtk.Window parent_window) { this.query = query; this.parent_window = parent_window; }
private void HandleChanged (FSpot.IBrowsableCollection sender) { // FIXME we should probably try to merge the selection forward // but it needs some thought to be efficient. suppress_scroll = true; QueueResize (); }