Commit c8ad51c9 authored by Clint Rogers's avatar Clint Rogers

Said source-code supplement supplies Shotwell some simple subsystems to...

Said source-code supplement supplies Shotwell some simple subsystems to seamlessly strip sensitive stuff from published images; closes #5589.
parent 75efd7c6
......@@ -42,6 +42,12 @@
<summary>last photo size</summary>
<description>A numeric code representing the last photo size preset used when publishing to Piwigo.</description>
</key>
<key name="strip-metadata" type="b">
<default>false</default>
<summary>remove sensitive info from uploads</summary>
<description>Whether images being uploaded to Piwigo should have their metadata removed first</description>
</key>
</schema>
<schema id="org.yorba.shotwell.sharing.org-yorba-shotwell-publishing-yandex-fotki" path="/apps/shotwell/sharing/org-yorba-shotwell-publishing-yandex-fotki/">
......
......@@ -315,6 +315,12 @@
<summary>default size code</summary>
<description>A numeric code representing the default size for photos published to Facebook</description>
</key>
<key name="strip-metadata" type="b">
<default>false</default>
<summary>remove sensitive info from uploads</summary>
<description>Whether images being uploaded to Facebook should have their metadata removed first</description>
</key>
</schema>
<schema id="org.yorba.shotwell.sharing.flickr" path="/apps/shotwell/sharing/flickr/">
......@@ -347,6 +353,12 @@
<summary>default visibility</summary>
<description>A numeric code representing the default visibility for photos published to Flickr</description>
</key>
<key name="strip-metadata" type="b">
<default>false</default>
<summary>remove sensitive info from uploads</summary>
<description>Whether images being uploaded to Flickr should have their metadata removed first</description>
</key>
</schema>
<schema id="org.yorba.shotwell.sharing.picasa" path="/apps/shotwell/sharing/picasa/">
......@@ -367,6 +379,12 @@
<summary>last album</summary>
<description>The name of the last album the user published photos to, if any</description>
</key>
<key name="strip-metadata" type="b">
<default>false</default>
<summary>remove sensitive info from uploads</summary>
<description>Whether images being uploaded to Picasa should have their metadata removed first</description>
</key>
</schema>
<schema id="org.yorba.shotwell.sharing.youtube" path="/apps/shotwell/sharing/youtube/">
......
......@@ -166,6 +166,7 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
private WebAuthenticationPane web_auth_pane = null;
private Spit.Publishing.ProgressCallback progress_reporter = null;
private weak Spit.Publishing.Service service = null;
private bool strip_metadata = false;
private bool running = false;
private Resolution target_resolution = Resolution.HIGH;
......@@ -215,6 +216,10 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
private string? get_persistent_user_name() {
return host.get_config_string("user_name", null);
}
private bool get_persistent_strip_metadata() {
return host.get_config_bool("strip_metadata", false);
}
private void set_persistent_access_token(string access_token) {
host.set_config_string("access_token", access_token);
......@@ -227,6 +232,10 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
private void set_persistent_user_name(string user_name) {
host.set_config_string("user_name", user_name);
}
private void set_persistent_strip_metadata(bool strip_metadata) {
host.set_config_bool("strip_metadata", strip_metadata);
}
// Part of the fix for #3232. These have to be
// public so the legacy options pane may use them.
......@@ -376,7 +385,8 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
}
PublishingOptionsPane publishing_options_pane = new PublishingOptionsPane(
session.get_user_name(), albums, host.get_publishable_media_type(), this, builder);
session.get_user_name(), albums, host.get_publishable_media_type(), this, builder,
get_persistent_strip_metadata());
publishing_options_pane.logout.connect(on_publishing_options_pane_logout);
publishing_options_pane.publish.connect(on_publishing_options_pane_publish);
host.install_dialog_pane(publishing_options_pane,
......@@ -433,13 +443,16 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
set_persistent_user_name(session.get_user_name());
}
private void do_upload() {
private void do_upload(bool strip_metadata) {
this.strip_metadata = strip_metadata;
set_persistent_strip_metadata(this.strip_metadata);
debug("ACTION: uploading photos to album '%s'",
publish_to_album == NO_ALBUM ? "(none)" : albums[publish_to_album].name);
host.set_service_locked(true);
progress_reporter = host.serialize_publishables(target_resolution.get_pixels());
progress_reporter = host.serialize_publishables(target_resolution.get_pixels(), this.strip_metadata);
// Serialization is a long and potentially cancellable operation, so before we use
// the publishables, make sure that the publishing interaction is still running. If it
......@@ -635,7 +648,7 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
}
public void on_publishing_options_pane_publish(string? target_album, string privacy_setting,
Resolution target_resolution) {
Resolution target_resolution, bool strip_metadata) {
if (!is_running())
return;
......@@ -646,10 +659,10 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
if (target_album == null) {
publish_to_album = NO_ALBUM;
do_upload();
do_upload(strip_metadata);
} else if (lookup_album(target_album) != NO_ALBUM) {
publish_to_album = lookup_album(target_album);
do_upload();
do_upload(strip_metadata);
} else {
do_create_album(target_album);
}
......@@ -685,7 +698,7 @@ public class FacebookPublisher : Spit.Publishing.Publisher, GLib.Object {
debug("EVENT: successfully extracted aid.");
do_upload();
do_upload(this.strip_metadata);
}
private void on_upload_status_updated(int file_number, double completed_fraction) {
......@@ -1514,6 +1527,7 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
private Gtk.ComboBoxText existing_albums_combo = null;
private Gtk.ComboBoxText visibility_combo = null;
private Gtk.Entry new_album_entry = null;
private Gtk.CheckButton strip_metadata_check = null;
private Gtk.Button publish_button = null;
private Gtk.Button logout_button = null;
private Gtk.Label how_to_label = null;
......@@ -1533,7 +1547,7 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
private const int STANDARD_ACTION_BUTTON_WIDTH = 128;
public signal void logout();
public signal void publish(string? target_album, string privacy_setting, Resolution target_resolution);
public signal void publish(string? target_album, string privacy_setting, Resolution target_resolution, bool strip_metadata);
private class PrivacyDescription {
public string description;
......@@ -1546,7 +1560,8 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
}
public PublishingOptionsPane(string username, FacebookAlbum[] albums,
Spit.Publishing.Publisher.MediaType media_type, FacebookPublisher publisher, Gtk.Builder builder) {
Spit.Publishing.Publisher.MediaType media_type, FacebookPublisher publisher, Gtk.Builder builder,
bool strip_metadata) {
this.builder = builder;
assert(builder != null);
......@@ -1575,6 +1590,7 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
new_album_entry = (Gtk.Entry) this.builder.get_object("new_album_entry");
resolution_combo = (Gtk.ComboBoxText) this.builder.get_object("resolution_combo");
how_to_label = (Gtk.Label) this.builder.get_object("how_to_label");
strip_metadata_check = (Gtk.CheckButton) this.builder.get_object("strip_metadata_check");
create_new_radio.clicked.connect(on_create_new_toggled);
use_existing_radio.clicked.connect(on_use_existing_toggled);
......@@ -1583,6 +1599,7 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
if ((media_type & Spit.Publishing.Publisher.MediaType.PHOTO) != 0)
label_text += PHOTOS_LABEL_TEXT;
how_to_label.set_label(label_text);
strip_metadata_check.set_active(strip_metadata);
setup_visibility_combo();
visibility_combo.set_active(0);
......@@ -1674,7 +1691,7 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
album_name = null;
}
publish(album_name, privacy_setting, resolution_setting);
publish(album_name, privacy_setting, resolution_setting, strip_metadata_check.get_active());
}
private PrivacyDescription[] create_privacy_descriptions() {
......@@ -1735,7 +1752,7 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
}
private void notify_publish(string? target_album, string privacy_setting, Resolution target_resolution) {
publish(target_album, privacy_setting, target_resolution);
publish(target_album, privacy_setting, target_resolution, strip_metadata_check.get_active());
}
public Gtk.Widget get_widget() {
......
......@@ -159,6 +159,14 @@ public class FlickrPublisher : Spit.Publishing.Publisher, GLib.Object {
host.set_config_string("access_phase_token_secret", secret);
}
private bool get_persistent_strip_metadata() {
return host.get_config_bool("strip_metadata", false);
}
private void set_persistent_strip_metadata(bool strip_metadata) {
host.set_config_bool("strip_metadata", strip_metadata);
}
private void on_welcome_pane_login_clicked() {
if (!running)
return;
......@@ -293,7 +301,7 @@ public class FlickrPublisher : Spit.Publishing.Publisher, GLib.Object {
do_show_publishing_options_pane();
}
private void on_publishing_options_pane_publish() {
private void on_publishing_options_pane_publish(bool strip_metadata) {
publishing_options_pane.publish.disconnect(on_publishing_options_pane_publish);
publishing_options_pane.logout.disconnect(on_publishing_options_pane_logout);
......@@ -301,7 +309,7 @@ public class FlickrPublisher : Spit.Publishing.Publisher, GLib.Object {
return;
debug("EVENT: user clicked the 'Publish' button in the publishing options pane");
do_publish();
do_publish(strip_metadata);
}
private void on_publishing_options_pane_logout() {
......@@ -589,7 +597,7 @@ public class FlickrPublisher : Spit.Publishing.Publisher, GLib.Object {
}
publishing_options_pane = new PublishingOptionsPane(this, parameters,
host.get_publishable_media_type(), builder);
host.get_publishable_media_type(), builder, get_persistent_strip_metadata());
publishing_options_pane.publish.connect(on_publishing_options_pane_publish);
publishing_options_pane.logout.connect(on_publishing_options_pane_logout);
host.install_dialog_pane(publishing_options_pane);
......@@ -600,11 +608,12 @@ public class FlickrPublisher : Spit.Publishing.Publisher, GLib.Object {
return a.get_exposure_date_time().compare(b.get_exposure_date_time());
}
private void do_publish() {
private void do_publish(bool strip_metadata) {
set_persistent_strip_metadata(strip_metadata);
debug("ACTION: uploading media items to remote server.");
host.set_service_locked(true);
progress_reporter = host.serialize_publishables(parameters.photo_major_axis_size);
progress_reporter = host.serialize_publishables(parameters.photo_major_axis_size, strip_metadata);
// Serialization is a long and potentially cancellable operation, so before we use
// the publishables, make sure that the publishing interaction is still running. If it
......@@ -622,7 +631,7 @@ public class FlickrPublisher : Spit.Publishing.Publisher, GLib.Object {
}
sorted_list.sort((CompareFunc) flickr_date_time_compare_func);
Uploader uploader = new Uploader(session, sorted_list.to_array(), parameters);
Uploader uploader = new Uploader(session, sorted_list.to_array(), parameters, strip_metadata);
uploader.upload_complete.connect(on_upload_complete);
uploader.upload_error.connect(on_upload_error);
uploader.upload(on_upload_status_updated);
......@@ -1107,17 +1116,18 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
private Gtk.Button publish_button = null;
private Gtk.ComboBoxText visibility_combo = null;
private Gtk.ComboBoxText size_combo = null;
private Gtk.CheckButton strip_metadata_check = null;
private VisibilityEntry[] visibilities = null;
private SizeEntry[] sizes = null;
private PublishingParameters parameters = null;
private FlickrPublisher publisher = null;
private Spit.Publishing.Publisher.MediaType media_type;
public signal void publish();
public signal void publish(bool strip_metadata);
public signal void logout();
public PublishingOptionsPane(FlickrPublisher publisher, PublishingParameters parameters,
Spit.Publishing.Publisher.MediaType media_type, Gtk.Builder builder) {
Spit.Publishing.Publisher.MediaType media_type, Gtk.Builder builder, bool strip_metadata) {
this.builder = builder;
assert(builder != null);
assert(builder.get_objects().length() > 0);
......@@ -1131,7 +1141,8 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
visibility_combo = (Gtk.ComboBoxText) this.builder.get_object("visibility_combo");
size_combo = (Gtk.ComboBoxText) this.builder.get_object("size_combo");
size_label = (Gtk.Label) this.builder.get_object("size_label");
strip_metadata_check = (Gtk.CheckButton) this.builder.get_object("strip_metadata_check");
this.parameters = parameters;
this.publisher = publisher;
this.media_type = media_type;
......@@ -1169,6 +1180,8 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
size_combo.set_sensitive(false);
size_label.set_sensitive(false);
}
strip_metadata_check.set_active(strip_metadata);
logout_button.clicked.connect(on_logout_clicked);
publish_button.clicked.connect(on_publish_clicked);
......@@ -1185,7 +1198,7 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
if ((media_type & Spit.Publishing.Publisher.MediaType.PHOTO) != 0)
parameters.photo_major_axis_size = sizes[size_combo.get_active()].size;
publish();
publish(strip_metadata_check.get_active());
}
private VisibilityEntry[] create_visibilities() {
......@@ -1241,7 +1254,7 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
}
protected void notify_publish() {
publish();
publish(strip_metadata_check.get_active());
}
protected void notify_logout() {
......@@ -1269,12 +1282,14 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
internal class Uploader : Publishing.RESTSupport.BatchUploader {
private PublishingParameters parameters;
private bool strip_metadata;
public Uploader(Session session, Spit.Publishing.Publishable[] publishables,
PublishingParameters parameters) {
PublishingParameters parameters, bool strip_metadata) {
base(session, publishables);
this.parameters = parameters;
this.strip_metadata = strip_metadata;
}
private void preprocess_publishable(Spit.Publishing.Publishable publishable) {
......
......@@ -65,6 +65,7 @@ public class PicasaPublisher : Spit.Publishing.Publisher, GLib.Object {
private Spit.Publishing.ProgressCallback progress_reporter = null;
private weak Spit.Publishing.Service service = null;
private bool running = false;
private bool strip_metadata = false;
private Session session;
private string username = "[unknown]";
private Album[] albums = null;
......@@ -135,11 +136,19 @@ public class PicasaPublisher : Spit.Publishing.Publisher, GLib.Object {
internal string? get_persistent_refresh_token() {
return host.get_config_string("refresh_token", null);
}
internal void set_persistent_refresh_token(string token) {
host.set_config_string("refresh_token", token);
}
internal bool get_persistent_strip_metadata() {
return host.get_config_bool("strip_metadata", false);
}
internal void set_persistent_strip_metadata(bool strip_metadata) {
host.set_config_bool("strip_metadata", strip_metadata);
}
internal void invalidate_persistent_session() {
debug("invalidating persisted Picasa Web Albums session.");
......@@ -331,9 +340,12 @@ public class PicasaPublisher : Spit.Publishing.Publisher, GLib.Object {
do_show_service_welcome_pane();
}
private void on_publishing_options_publish(PublishingParameters parameters) {
private void on_publishing_options_publish(PublishingParameters parameters,
bool strip_metadata) {
if (!is_running())
return;
this.strip_metadata = strip_metadata;
debug("EVENT: user clicked 'Publish' in the publishing options pane.");
......@@ -342,7 +354,7 @@ public class PicasaPublisher : Spit.Publishing.Publisher, GLib.Object {
if (parameters.is_to_new_album()) {
do_create_album(parameters);
} else {
do_upload();
do_upload(this.strip_metadata);
}
}
......@@ -381,7 +393,7 @@ public class PicasaPublisher : Spit.Publishing.Publisher, GLib.Object {
}
parameters.convert(response_albums[0].url);
do_upload();
do_upload(this.strip_metadata);
}
private void on_album_creation_error(Publishing.RESTSupport.Transaction bad_txn,
......@@ -686,7 +698,8 @@ public class PicasaPublisher : Spit.Publishing.Publisher, GLib.Object {
return;
}
PublishingOptionsPane opts_pane = new PublishingOptionsPane(host, username, albums, media_type, builder);
PublishingOptionsPane opts_pane = new PublishingOptionsPane(host, username, albums, media_type, builder,
get_persistent_strip_metadata());
opts_pane.publish.connect(on_publishing_options_publish);
opts_pane.logout.connect(on_publishing_options_logout);
host.install_dialog_pane(opts_pane);
......@@ -714,12 +727,15 @@ public class PicasaPublisher : Spit.Publishing.Publisher, GLib.Object {
}
}
private void do_upload() {
private void do_upload(bool strip_metadata) {
set_persistent_strip_metadata(strip_metadata);
debug("ACTION: uploading media items to remote server.");
host.set_service_locked(true);
progress_reporter = host.serialize_publishables(parameters.get_photo_major_axis_size());
progress_reporter = host.serialize_publishables(parameters.get_photo_major_axis_size(),
strip_metadata);
// Serialization is a long and potentially cancellable operation, so before we use
// the publishables, make sure that the publishing interaction is still running. If it
......@@ -1079,6 +1095,7 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
private Gtk.Entry new_album_entry = null;
private Gtk.CheckButton public_check = null;
private Gtk.ComboBoxText size_combo = null;
private Gtk.CheckButton strip_metadata_check = null;
private Gtk.Button publish_button = null;
private Gtk.Button logout_button = null;
......@@ -1087,11 +1104,12 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
private string username;
private weak Spit.Publishing.PluginHost host;
public signal void publish(PublishingParameters parameters);
public signal void publish(PublishingParameters parameters, bool strip_metadata);
public signal void logout();
public PublishingOptionsPane(Spit.Publishing.PluginHost host, string username,
Album[] albums, Spit.Publishing.Publisher.MediaType media_type, Gtk.Builder builder) {
Album[] albums, Spit.Publishing.Publisher.MediaType media_type, Gtk.Builder builder,
bool strip_metadata) {
this.username = username;
this.albums = albums;
this.host = host;
......@@ -1111,11 +1129,14 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
new_album_entry = (Gtk.Entry) builder.get_object("new_album_entry");
public_check = (Gtk.CheckButton) builder.get_object("public_check");
size_combo = (Gtk.ComboBoxText) builder.get_object("size_combo");
strip_metadata_check = (Gtk.CheckButton) this.builder.get_object("strip_metadata_check");
publish_button = (Gtk.Button) builder.get_object("publish_button");
logout_button = (Gtk.Button) builder.get_object("logout_button");
// populate any widgets whose contents are programmatically-generated.
login_identity_label.set_label(_("You are logged into Picasa Web Albums as %s.").printf(username));
strip_metadata_check.set_active(strip_metadata);
if((media_type & Spit.Publishing.Publisher.MediaType.PHOTO) == 0) {
publish_to_label.set_label(_("Videos will appear in:"));
......@@ -1154,12 +1175,12 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
host.set_config_string(LAST_ALBUM_CONFIG_KEY, album_name);
bool is_public = public_check.get_active();
publish(new PublishingParameters.to_new_album(photo_major_axis_size, album_name,
is_public));
is_public), strip_metadata_check.get_active());
} else {
album_name = albums[existing_albums_combo.get_active()].name;
host.set_config_string(LAST_ALBUM_CONFIG_KEY, album_name);
string album_url = albums[existing_albums_combo.get_active()].url;
publish(new PublishingParameters.to_existing_album(photo_major_axis_size, album_url));
publish(new PublishingParameters.to_existing_album(photo_major_axis_size, album_url), strip_metadata_check.get_active());
}
}
......@@ -1239,7 +1260,7 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
}
protected void notify_publish(PublishingParameters parameters) {
publish(parameters);
publish(parameters, strip_metadata_check.get_active());
}
protected void notify_logout() {
......
......@@ -110,6 +110,7 @@ public class PiwigoPublisher : Spit.Publishing.Publisher, GLib.Object {
private Spit.Publishing.Service service;
private Spit.Publishing.PluginHost host;
private bool running = false;
private bool strip_metadata = false;
private Session session;
private Category[] categories = null;
private PublishingParameters parameters = null;
......@@ -223,6 +224,14 @@ public class PiwigoPublisher : Spit.Publishing.Publisher, GLib.Object {
host.set_config_int("last-photo-size", last_photo_size);
}
private bool get_metadata_removal_choice() {
return host.get_config_bool("strip_metadata", false);
}
private void set_metadata_removal_choice(bool strip_metadata) {
host.set_config_bool("strip_metadata", strip_metadata);
}
// Actions and events implementation
/**
......@@ -588,8 +597,8 @@ public class PiwigoPublisher : Spit.Publishing.Publisher, GLib.Object {
host.set_service_locked(false);
PublishingOptionsPane opts_pane = new PublishingOptionsPane(
this, categories, get_last_category(), get_last_permission_level(), get_last_photo_size()
);
this, categories, get_last_category(), get_last_permission_level(), get_last_photo_size(),
get_metadata_removal_choice());
opts_pane.logout.connect(on_publishing_options_pane_logout_clicked);
opts_pane.publish.connect(on_publishing_options_pane_publish_clicked);
host.install_dialog_pane(opts_pane, Spit.Publishing.PluginHost.ButtonMode.CLOSE);
......@@ -652,14 +661,16 @@ public class PiwigoPublisher : Spit.Publishing.Publisher, GLib.Object {
*
* @param parameters the publishing parameters
*/
private void on_publishing_options_pane_publish_clicked(PublishingParameters parameters) {
private void on_publishing_options_pane_publish_clicked(PublishingParameters parameters,
bool strip_metadata) {
debug("EVENT: on_publishing_options_pane_publish_clicked");
this.parameters = parameters;
this.strip_metadata = strip_metadata;
if (parameters.category.is_local()) {
do_create_category(parameters.category);
} else {
do_upload();
do_upload(this.strip_metadata);
}
}
......@@ -717,7 +728,7 @@ public class PiwigoPublisher : Spit.Publishing.Publisher, GLib.Object {
string id_string = id_node->get_content();
int id = int.parse(id_string);
parameters.category.id = id;
do_upload();
do_upload(strip_metadata);
} catch (Spit.Publishing.PublishingError err) {
debug("ERROR: on_category_add_complete");
do_show_error(err);
......@@ -740,7 +751,8 @@ public class PiwigoPublisher : Spit.Publishing.Publisher, GLib.Object {
/**
* Upload action: the big one, the one we've been waiting for!
*/
private void do_upload() {
private void do_upload(bool strip_metadata) {
this.strip_metadata = strip_metadata;
debug("ACTION: uploading pictures");
host.set_service_locked(true);
......@@ -748,8 +760,9 @@ public class PiwigoPublisher : Spit.Publishing.Publisher, GLib.Object {
set_last_category(parameters.category.id);
set_last_permission_level(parameters.perm_level.id);
set_last_photo_size(parameters.photo_size.id);
progress_reporter = host.serialize_publishables(parameters.photo_size.id);
set_metadata_removal_choice(strip_metadata);
progress_reporter = host.serialize_publishables(parameters.photo_size.id, this.strip_metadata);
Spit.Publishing.Publishable[] publishables = host.get_publishables();
Uploader uploader = new Uploader(session, publishables, parameters);
......@@ -1066,6 +1079,7 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, Object {
private Gtk.Entry new_category_entry;
private Gtk.ComboBoxText perms_combo;
private Gtk.ComboBoxText size_combo;
private Gtk.CheckButton strip_metadata_check = null;
private Gtk.Button logout_button;
private Gtk.Button publish_button;
......@@ -1077,12 +1091,13 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, Object {
private int last_permission_level;
private int last_photo_size;
public signal void publish(PublishingParameters parameters);
public signal void publish(PublishingParameters parameters, bool strip_metadata);
public signal void logout();
public PublishingOptionsPane(
PiwigoPublisher publisher, Category[] categories,
int last_category, int last_permission_level, int last_photo_size
int last_category, int last_permission_level, int last_photo_size,
bool strip_metadata_enabled
) {
this.pane_widget = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
this.last_category = last_category;
......@@ -1105,6 +1120,9 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, Object {
perms_combo = builder.get_object("perms_combo") as Gtk.ComboBoxText;
size_combo = builder.get_object("size_combo") as Gtk.ComboBoxText;
strip_metadata_check = builder.get_object("strip_metadata_check") as Gtk.CheckButton;
strip_metadata_check.set_active(strip_metadata_enabled);
logout_button = builder.get_object("logout_button") as Gtk.Button;
logout_button.clicked.connect(on_logout_button_clicked);
......@@ -1116,7 +1134,7 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, Object {
new_category_entry.changed.connect(on_new_category_entry_changed);
align.reparent(pane_widget);
pane_widget.set_child_packing(align, true, true, 0, Gtk.PackType.START);
pane_widget.set_child_packing(align, true, true, 0, Gtk.PackType.START);
} catch (Error e) {
warning("Could not load UI: %s", e.message);
}
......@@ -1167,7 +1185,7 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, Object {
} else {
params.category = existing_categories[existing_categories_combo.get_active()];
}
publish(params);
publish(params, strip_metadata_check.get_active());
}
// UI interaction
......@@ -1211,10 +1229,10 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, Object {
}
public void on_pane_installed() {
create_categories_combo();
create_permissions_combo();
create_size_combo();
//
create_categories_combo();
create_permissions_combo();
create_size_combo();
publish_button.can_default = true;
update_publish_button_sensitivity();
}
......
......@@ -31,7 +31,6 @@ anything put into this field won't display)</property>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">29</property>
<property name="row_spacing">8</property>
<property name="column_spacing">32</property>
<property name="column_homogeneous">True</property>
......@@ -175,6 +174,24 @@ anything put into this field won't display)</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="strip_metadata_check">
<property name="label" translatable="yes">_Remove location, tag and camera-identifying data before uploading</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.10000000149011612</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
......@@ -220,7 +237,7 @@ anything put into this field won't display)</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">2</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
</object>
......
......@@ -11,7 +11,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">40</property>
<property name="spacing">24</property>
<child>
<object class="GtkLabel" id="upload_info_label">
<property name="visible">True</property>
......@@ -34,6 +34,7 @@ so changes made here will not display)</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin_bottom">8</property>
<property name="row_spacing">8</property>
<property name="column_spacing">24</property>
<child>
......@@ -96,6 +97,27 @@ so changes made here will not display)</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="strip_metadata_check">
<property name="label" translatable="yes">_Remove location, tag and camera-identifying data before uploading</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">center</property>
<property name="margin_top">16</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0.17000000178813934</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>