Hi! I've made some additions to the original exporter. Things work rather nicely, but somehow I get a strange nullpointer: (F-Spot:12733): Gtk-CRITICAL **: gtk_text_attributes_ref: assertion `values != NULL' failed (F-Spot:12733): Gtk-CRITICAL **: gtk_text_attributes_ref: assertion `values != NULL' failed Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object in (unmanaged) (wrapper managed-to-native) Gtk.Application:gtk_main () in <0x00004> (wrapper managed-to-native) Gtk.Application:gtk_main () in <0x00007> Gtk.Application:Run () in <0x00007> Gnome.Program:Run () in [0x00076] (at /home/kriberg/skole/gnome-greier/f-spot/src/main.cs:30) Driver:Main (string[]) My glade-foo isn't all that great either, as the description textview expands the dialog window, allthough it shouldn't do. -- Kristian Berg
? original-fixes.patch ? src/f-spot.gladep Index: src/OriginalExport.cs =================================================================== RCS file: /cvs/gnome/f-spot/src/OriginalExport.cs,v retrieving revision 1.4 diff -u -r1.4 OriginalExport.cs --- src/OriginalExport.cs 22 Jan 2005 02:09:35 -0000 1.4 +++ src/OriginalExport.cs 24 Jan 2005 01:33:46 -0000 @@ -38,16 +38,27 @@ //[Glade.Widget] Gtk.CheckButton meta_check; [Glade.Widget] Gtk.CheckButton scale_check; [Glade.Widget] Gtk.CheckButton open_check; + [Glade.Widget] Gtk.CheckButton high_quality_check; + [Glade.Widget] Gtk.CheckButton medium_quality_check; + [Glade.Widget] Gtk.CheckButton zip_check; [Glade.Widget] Gtk.Entry width_entry; [Glade.Widget] Gtk.Entry height_entry; + [Glade.Widget] Gtk.Entry title_entry; + + [Glade.Widget] Gtk.TextView description_textview; + Gnome.Vfs.Uri dest; int photo_index; bool open; + bool high_quality; + bool medium_quality; + bool zip_files; string gallery_name = "web-gallery"; - // FIME this needs to be a real temp directory + string description = ""; + // FIXME this needs to be a real temp directory string gallery_path = Path.Combine (Path.GetTempPath (), "f-spot-original-" + System.DateTime.Now.Ticks.ToString ()); FSpot.ThreadProgressDialog progress_dialog; @@ -112,7 +123,7 @@ if (dest.IsLocal) gallery_path = Gnome.Vfs.Uri.GetLocalPathFromUri (dest.ToString ()); - OriginalGallery gallery = new OriginalGallery(selection, gallery_path, gallery_name); + OriginalGallery gallery = new OriginalGallery(selection, gallery_path, gallery_name, high_quality, medium_quality, zip_files, description); gallery.StartProcessing (); // we've created the structure, now if the destination was local we are done @@ -204,7 +215,19 @@ dest = new Gnome.Vfs.Uri (uri_entry.Text); open = open_check.Active; + high_quality = high_quality_check.Active; + medium_quality = medium_quality_check.Active; + zip_files = zip_check.Active; + + if (title_entry.Text != "") { + this.gallery_name = title_entry.Text; + } + + if (description_textview.Buffer.Text != "") { + this.description = description_textview.Buffer.Text; + } + command_thread = new System.Threading.Thread (new System.Threading.ThreadStart (Upload)); command_thread.Name = Mono.Posix.Catalog.GetString ("Transfering Pictures"); @@ -213,8 +236,7 @@ // 2: zipfiles // 9: directories + info.txt + .htaccess // this should actually be 1 anyway, because we transfer just one dir - progress_dialog = new FSpot.ThreadProgressDialog (command_thread, - 1); + progress_dialog = new FSpot.ThreadProgressDialog (command_thread, 1); progress_dialog.Start (); } } @@ -224,17 +246,25 @@ private IPhotoCollection selection; private string gallery_name; private string gallery_path; + private string description = ""; + private bool high_quality; + private bool medium_quality; + private bool zip_files; private bool setmtime = false; private int photo_index = 1; //used to name files FSpot.ThreadProgressDialog progress_dialog; System.Threading.Thread command_thread; - public OriginalGallery (IPhotoCollection selection, string path, string gallery_name) + public OriginalGallery (IPhotoCollection selection, string path, string gallery_name, bool high_quality, bool medium_quality, bool zip_files, string description) { this.selection = selection; this.gallery_name = gallery_name; this.gallery_path = Path.Combine (path, gallery_name); + this.high_quality = high_quality; + this.medium_quality = medium_quality; + this.zip_files = zip_files; + this.description = description; } public void StartProcessing() @@ -254,7 +284,7 @@ CreateImages(photo.Path); CreateComments(photo.Path); - //Set the directory's mtime sa the oldest photo's one. + //Set the directory's mtime as the oldest photo's one. if (!setmtime) { try { @@ -265,8 +295,10 @@ photo_index++; } - CreateZipFile("mq"); - CreateZipFile("hq"); + if (zip_files) { + CreateZipFile("mq"); + CreateZipFile("hq"); + } } catch (System.Exception e) { System.Console.WriteLine (e.ToString ()); @@ -279,11 +311,17 @@ try { Directory.CreateDirectory(gallery_path); Directory.CreateDirectory(SubdirPath ("thumbs")); - Directory.CreateDirectory(SubdirPath ("lq")); - Directory.CreateDirectory(SubdirPath ("mq")); - Directory.CreateDirectory(SubdirPath ("hq")); Directory.CreateDirectory(SubdirPath ("comments")); - Directory.CreateDirectory(SubdirPath ("zip")); + Directory.CreateDirectory(SubdirPath ("lq")); + if (medium_quality) { + Directory.CreateDirectory(SubdirPath ("mq")); + } + if (high_quality) { + Directory.CreateDirectory(SubdirPath ("hq")); + } + if (zip_files) { + Directory.CreateDirectory(SubdirPath ("zip")); + } } catch { Console.WriteLine("Error in creating directory" + gallery_path); } @@ -296,15 +334,20 @@ string [] keys = {"quality"}; string [] values = {"75"}; + string path; // scale the images to different sizes - // High quality is the orignal image - File.Copy(photo_path, SubdirPath ("hq", img_name), true); + if (high_quality) { + // High quality is the orignal image + File.Copy(photo_path, SubdirPath ("hq", img_name), true); + } - // Medium Quality - string path = SubdirPath ("mq", img_name); - source_image.Savev(path, "jpeg", keys, values); + if (medium_quality) { + // Medium Quality + path = SubdirPath ("mq", img_name); + source_image.Savev(path, "jpeg", keys, values); + } //low quality Gdk.Pixbuf scaled = PixbufUtils.ScaleToMaxSize (source_image, 640, 480); @@ -393,6 +436,8 @@ { StreamWriter info = File.CreateText(Path.Combine (gallery_path, "info.txt")); info.WriteLine("date|" + selection.Photos[0].Time.Date.ToString ("dd.MM.yyyy")); + if (description != "") + info.WriteLine("description|" + description); info.Close(); } Index: src/f-spot.glade =================================================================== RCS file: /cvs/gnome/f-spot/src/f-spot.glade,v retrieving revision 1.66 diff -u -r1.66 f-spot.glade --- src/f-spot.glade 21 Jan 2005 23:44:23 -0000 1.66 +++ src/f-spot.glade 24 Jan 2005 01:33:46 -0000 @@ -8791,79 +8791,107 @@ <property name="shadow_type">GTK_SHADOW_NONE</property> <child> - <widget class="GtkAlignment" id="alignment40"> + <widget class="GtkVBox" id="vbox52"> <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">12</property> - <property name="right_padding">0</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> <child> - <widget class="GtkVBox" id="vbox52"> + <widget class="GtkAlignment" id="alignment41"> <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> <child> - <widget class="GtkHBox" id="hbox44"> + <widget class="GtkHBox" id="hbox45"> <property name="visible">True</property> <property name="homogeneous">False</property> - <property name="spacing">0</property> + <property name="spacing">6</property> <child> - <widget class="GtkCheckButton" id="scale_check"> + <widget class="GtkLabel" id="label135"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Scale images to no larger than: </property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">True</property> - <property name="draw_indicator">True</property> + <property name="label" translatable="yes">Album title:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> - <property name="fill">True</property> + <property name="fill">False</property> </packing> </child> <child> - <widget class="GtkEntry" id="width_entry"> + <widget class="GtkEntry" id="title_entry"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">True</property> <property name="visibility">True</property> - <property name="max_length">3</property> - <property name="text" translatable="yes"></property> + <property name="max_length">0</property> + <property name="text" translatable="yes">Web-gallery</property> <property name="has_frame">True</property> <property name="invisible_char">*</property> <property name="activates_default">False</property> - <property name="width_chars">5</property> </widget> <packing> <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> + <property name="expand">True</property> + <property name="fill">True</property> </packing> </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment50"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkHBox" id="hbox46"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> <child> - <widget class="GtkLabel" id="label132"> + <widget class="GtkLabel" id="label136"> <property name="visible">True</property> - <property name="label" translatable="yes">x</property> + <property name="label" translatable="yes">Description:</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> - <property name="yalign">0.5</property> + <property name="yalign">0</property> <property name="xpad">0</property> <property name="ypad">0</property> </widget> @@ -8875,32 +8903,267 @@ </child> <child> - <widget class="GtkEntry" id="height_entry"> + <widget class="GtkScrolledWindow" id="scrolledwindow5"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">*</property> - <property name="activates_default">False</property> - <property name="width_chars">5</property> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="shadow_type">GTK_SHADOW_IN</property> + <property name="window_placement">GTK_CORNER_TOP_LEFT</property> + + <child> + <widget class="GtkTextView" id="description_textview"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="overwrite">False</property> + <property name="accepts_tab">True</property> + <property name="justification">GTK_JUSTIFY_LEFT</property> + <property name="wrap_mode">GTK_WRAP_WORD</property> + <property name="cursor_visible">True</property> + <property name="pixels_above_lines">0</property> + <property name="pixels_below_lines">0</property> + <property name="pixels_inside_wrap">0</property> + <property name="left_margin">0</property> + <property name="right_margin">0</property> + <property name="indent">0</property> + <property name="text" translatable="yes"></property> + </widget> + </child> </widget> <packing> <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment45"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkCheckButton" id="high_quality_check"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Create high quality images using original size</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment46"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkCheckButton" id="medium_quality_check"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Create medium quality images</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment40"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">24</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkVBox" id="vbox52"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkHBox" id="hbox44"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkCheckButton" id="scale_check"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Scale images to no larger than: </property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">True</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="width_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">3</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char">*</property> + <property name="activates_default">False</property> + <property name="width_chars">5</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label132"> + <property name="visible">True</property> + <property name="label" translatable="yes">x</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="height_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char">*</property> + <property name="activates_default">False</property> + <property name="width_chars">5</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> </packing> </child> </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> </child> </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment48"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkCheckButton" id="zip_check"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Create zip files.</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> </child> </widget> </child> @@ -8908,7 +9171,7 @@ <child> <widget class="GtkLabel" id="label133"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Style</b></property> + <property name="label" translatable="yes"><b>Options</b></property> <property name="use_underline">False</property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_LEFT</property>
Attachment:
signature.asc
Description: This is a digitally signed message part