Author: sdelcroix
Date: Fri Feb 15 07:29:30 2008
New Revision: 3680
URL: http://svn.gnome.org/viewvc/f-spot?rev=3680&view=rev

Log:
2008-02-14  Lorenzo Milesi <[EMAIL PROTECTED]>

        * ZipExport/ZipExport.addin.xml: 
        * ZipExport/ZipExport.cs: improve HACKING compliance, fix export in
        --view mode.


Modified:
   trunk/extensions/ChangeLog
   trunk/extensions/ZipExport/ZipExport.addin.xml
   trunk/extensions/ZipExport/ZipExport.cs

Modified: trunk/extensions/ZipExport/ZipExport.addin.xml
==============================================================================
--- trunk/extensions/ZipExport/ZipExport.addin.xml      (original)
+++ trunk/extensions/ZipExport/ZipExport.addin.xml      Fri Feb 15 07:29:30 2008
@@ -1,6 +1,6 @@
 <Addin namespace="FSpot"
        id="ZipExport"
-       version="0.3"
+       version="0.4"
        name="Zip export"
        description="Simple export to Zip file"
        author="Lorenzo Milesi"

Modified: trunk/extensions/ZipExport/ZipExport.cs
==============================================================================
--- trunk/extensions/ZipExport/ZipExport.cs     (original)
+++ trunk/extensions/ZipExport/ZipExport.cs     Fri Feb 15 07:29:30 2008
@@ -40,7 +40,7 @@
 
                public void Run (IBrowsableCollection p) {
                        Console.WriteLine ("Executing ZipExport extension");
-                       if (MainWindow.Toplevel.SelectedPhotos().Length == 0) {
+                       if (p.Count == 0) {
                                HigMessageDialog md = new HigMessageDialog 
(MainWindow.Toplevel.Window, DialogFlags.DestroyWithParent,
                                                          
Gtk.MessageType.Error, ButtonsType.Ok, 
                                                          Catalog.GetString 
("No selection available"), 
@@ -51,10 +51,10 @@
                                return;
                        }
                        photos = p.Items;
-                       ShowDialog();
+                       ShowDialog ();
                }
 
-               public void ShowDialog() {
+               public void ShowDialog () {
                        Glade.XML xml = new Glade.XML (null, "ZipExport.glade", 
"zipdiag", "f-spot");
                        xml.Autoconnect (this);
                        zipdiag.Modal = false;
@@ -63,16 +63,16 @@
                        uri_chooser = new Gtk.FileChooserButton 
(Catalog.GetString ("Select export folder"),
                                                                 
Gtk.FileChooserAction.SelectFolder);
                        uri_chooser.LocalOnly = true;
-                       uri_chooser.SetFilename(System.IO.Path.Combine 
(FSpot.Global.HomeDirectory, "Desktop"));
-                       dirchooser_hbox.PackStart(uri_chooser, false, false, 2);
+                       uri_chooser.SetFilename (System.IO.Path.Combine 
(FSpot.Global.HomeDirectory, "Desktop"));
+                       dirchooser_hbox.PackStart (uri_chooser, false, false, 
2);
                        filename.Text = "f-spot_export.zip";
 
                        zipdiag.Response += on_dialog_response;
                        filename.Changed += on_filename_change;
                        scale_check.Toggled += on_scalecheck_change;
-                       on_scalecheck_change(null, null);
+                       on_scalecheck_change (null, null);
 
-                       zipdiag.ShowAll();
+                       zipdiag.ShowAll ();
                }
 
                private void on_dialog_response (object sender, ResponseArgs 
args) {
@@ -91,12 +91,12 @@
 
                void zip () {
                        Gnome.Vfs.Uri dest = new Gnome.Vfs.Uri 
(uri_chooser.Uri);
-                       Crc32 crc = new Crc32();
+                       Crc32 crc = new Crc32 ();
                        string filedest = Gnome.Vfs.Uri.GetLocalPathFromUri 
(dest.ToString ()) + "/" + filename.Text;
-                       Console.WriteLine("Creating zip file {0}", filedest);
-                       ZipOutputStream s = new 
ZipOutputStream(File.Create(filedest));
+                       Console.WriteLine ("Creating zip file {0}", filedest);
+                       ZipOutputStream s = new ZipOutputStream 
(File.Create(filedest));
                        if (scale_check.Active)
-                               Console.WriteLine("Scaling to {0}", 
scale_size.ValueAsInt);
+                               Console.WriteLine ("Scaling to {0}", 
scale_size.ValueAsInt);
 
                        ProgressDialog progress_dialog = new ProgressDialog 
(Catalog.GetString ("Exporting files"),
                                                              
ProgressDialog.CancelButtonType.Stop,
@@ -105,7 +105,7 @@
                        //Pack up
                        for (int i = 0; i < photos.Length; i ++) {
                                if (progress_dialog.Update (String.Format 
(Catalog.GetString ("Preparing photo \"{0}\""), photos[i].Name))) {
-                                       progress_dialog.Destroy();
+                                       progress_dialog.Destroy ();
                                        return;
                                }
                                string f = null;
@@ -113,34 +113,34 @@
                                        FilterSet filters = new FilterSet ();
                                        filters.Add (new JpegFilter ());
                                        filters.Add (new ResizeFilter ((uint) 
scale_size.ValueAsInt));
-                                       FilterRequest freq = new 
FilterRequest(photos[i].DefaultVersionUri);
+                                       FilterRequest freq = new FilterRequest 
(photos [i].DefaultVersionUri);
                                        filters.Convert (freq);
                                        f = freq.Current.LocalPath;
                                } else {
-                                       f = 
photos[i].DefaultVersionUri.LocalPath;
+                                       f = photos 
[i].DefaultVersionUri.LocalPath;
                                }
-                               FileStream fs = File.OpenRead(f);
+                               FileStream fs = File.OpenRead (f);
 
-                               byte[] buffer = new byte[fs.Length];
-                               fs.Read(buffer, 0, buffer.Length);
-                               ZipEntry entry = new ZipEntry(photos[i].Name);
+                               byte [] buffer = new byte [fs.Length];
+                               fs.Read (buffer, 0, buffer.Length);
+                               ZipEntry entry = new ZipEntry (photos [i].Name);
                        
                                entry.DateTime = DateTime.Now;
                        
                                entry.Size = fs.Length;
-                               fs.Close();
+                               fs.Close ();
                        
-                               crc.Reset();
-                               crc.Update(buffer);
+                               crc.Reset ();
+                               crc.Update (buffer);
                        
-                               entry.Crc  = crc.Value;
+                               entry.Crc = crc.Value;
                        
-                               s.PutNextEntry(entry);
+                               s.PutNextEntry (entry);
                        
-                               s.Write(buffer, 0, buffer.Length);
+                               s.Write (buffer, 0, buffer.Length);
                        }
-                       s.Finish();
-                       s.Close();
+                       s.Finish ();
+                       s.Close ();
                        if (progress_dialog != null)
                                progress_dialog.Destroy ();
 
_______________________________________________
SVN-commits-list mailing list (read only)
http://mail.gnome.org/mailman/listinfo/svn-commits-list

Want to limit the commits to a few modules? Go to above URL, log in to edit 
your options and select the modules ('topics') you want.
Module maintainer? It is possible to set the reply-to to your development 
mailing list. Email [EMAIL PROTECTED] if interested.

Reply via email to