summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2019-04-28 16:46:41 +0200
committerJörg Frings-Fürst <debian@jff.email>2019-04-28 16:46:41 +0200
commit6d3354ff2e7ce13feeae1b75d94a186d86f82d89 (patch)
tree2d908584bfb663268004e19a23e02ce6c65034c5 /src
parent6dd5e6966c6ec10d38d4b620a053ae262ac60d86 (diff)
parent7385922cd37e4ffe65f4af34b2795307a76670c4 (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'src')
-rw-r--r--src/AppWindow.vala2
-rw-r--r--src/NaturalCollate.vala8
-rw-r--r--src/Photo.vala16
-rw-r--r--src/Resources.vala14
-rw-r--r--src/SlideshowPage.vala8
-rw-r--r--src/direct/DirectPhotoPage.vala14
-rw-r--r--src/direct/DirectWindow.vala17
-rw-r--r--src/library/LibraryWindow.vala2
-rw-r--r--src/photos/PhotoMetadata.vala11
-rw-r--r--src/plugins/StandardHostInterface.vala3
-rw-r--r--src/publishing/Publishing.vala2
-rw-r--r--src/publishing/PublishingUI.vala1
12 files changed, 59 insertions, 39 deletions
diff --git a/src/AppWindow.vala b/src/AppWindow.vala
index 22b47c2..5c1496e 100644
--- a/src/AppWindow.vala
+++ b/src/AppWindow.vala
@@ -408,6 +408,8 @@ public abstract class AppWindow : PageWindow {
protected int pos_y = 0;
public AppWindow() {
+ base();
+
// although there are multiple AppWindow types, only one may exist per-process
assert(instance == null);
instance = this;
diff --git a/src/NaturalCollate.vala b/src/NaturalCollate.vala
index 4adb027..6d38a08 100644
--- a/src/NaturalCollate.vala
+++ b/src/NaturalCollate.vala
@@ -20,7 +20,7 @@ private const unichar SUPERDIGIT = ':';
private const unichar NUM_SENTINEL = 0x2; // glib uses these, so do we
private const string COLLATION_SENTINEL = "\x01\x01\x01";
-private static int read_number(owned string s, ref int byte_index) {
+private static int read_number(owned string s, ref long byte_index) {
/*
* Given a string in the form [numerals]*[everythingelse]*
* returns the int value of the first block and increments index
@@ -33,7 +33,7 @@ private static int read_number(owned string s, ref int byte_index) {
while (s.length != 0 && s.get_char(0).isdigit()) {
number = number*10;
number += s.get_char(0).digit_value();
- int second_char = s.index_of_nth_char(1);
+ var second_char = s.index_of_nth_char(1);
s = s.substring(second_char);
byte_index += second_char;
}
@@ -56,7 +56,7 @@ public static string collate_key(owned string str) {
while (!eos) {
assert(str.validate());
- int position = 0;
+ long position = 0L;
while (!(str.get_char(position).to_string() in "0123456789")) {
// We only care about plain old 0123456789, aping what g_utf8_collate_key_for_filename does
position++;
@@ -69,7 +69,7 @@ public static string collate_key(owned string str) {
str = str.substring(position);
eos = (str.length == 0);
- position = 0;
+ position = 0L;
if (!eos) {
// We have some numbers to handle in front of us
diff --git a/src/Photo.vala b/src/Photo.vala
index 0d8e955..ae0f489 100644
--- a/src/Photo.vala
+++ b/src/Photo.vala
@@ -429,7 +429,7 @@ public abstract class Photo : PhotoSource, Dateable {
// need to remove all transformations as they're keyed to the editable's
// coordinate system
- internal_remove_all_transformations(false);
+ remove_all_transformations(false);
}
}
@@ -1519,7 +1519,7 @@ public abstract class Photo : PhotoSource, Dateable {
row.master = original_master;
row.master.copy_from(reimport_state.row.master);
if (!reimport_state.metadata_only)
- internal_remove_all_transformations(false);
+ remove_all_transformations(false);
}
if (reimport_state.metadata != null)
@@ -1596,7 +1596,7 @@ public abstract class Photo : PhotoSource, Dateable {
lock (row) {
editable = reimport_state.backing_state;
set_orientation(reimport_state.backing_state.original_orientation);
- internal_remove_all_transformations(false);
+ remove_all_transformations(false);
}
} else {
set_orientation(reimport_state.backing_state.original_orientation);
@@ -2820,11 +2820,7 @@ public abstract class Photo : PhotoSource, Dateable {
return committed;
}
- public void remove_all_transformations() {
- internal_remove_all_transformations(true);
- }
-
- private void internal_remove_all_transformations(bool notify) {
+ public void remove_all_transformations(bool notify = true) {
bool is_altered = false;
lock (row) {
is_altered = PhotoTable.get_instance().remove_all_transformations(row.photo_id);
@@ -3907,7 +3903,7 @@ public abstract class Photo : PhotoSource, Dateable {
// transformations are in the master's coordinate system, not the editable's ... don't
// notify photo is altered *yet* because update_editable will notify, and want to avoid
// stacking them up
- internal_remove_all_transformations(false);
+ remove_all_transformations(false);
update_editable(false, file_format.create_reader(file.get_path()));
}
@@ -4077,7 +4073,7 @@ public abstract class Photo : PhotoSource, Dateable {
}
if (remove_transformations)
- internal_remove_all_transformations(false);
+ remove_all_transformations(false);
if (has_editable) {
notify_baseline_replaced();
diff --git a/src/Resources.vala b/src/Resources.vala
index 8fabbe4..801305c 100644
--- a/src/Resources.vala
+++ b/src/Resources.vala
@@ -88,7 +88,7 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc.,
public const int ICON_FILTER_UNRATED_OR_BETTER_FIXED_SIZE = 16;
public const int ICON_ZOOM_SCALE = 16;
- public const string ICON_CAMERAS = "camera-photo";
+ public const string ICON_CAMERAS = "camera-photo-symbolic";
public const string ICON_EVENTS = "multiple-events-symbolic";
public const string ICON_ONE_EVENT = "one-event-symbolic";
public const string ICON_NO_EVENT = "no-event-symbolic";
@@ -1038,11 +1038,13 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc.,
debug("Failed to find icon %s in theme, falling back to resources", name);
}
- try {
- var path = "/org/gnome/Shotwell/icons/%s".printf(name);
- pixbuf = new Gdk.Pixbuf.from_resource(path);
- } catch (Error err) {
- critical("Unable to load icon %s: %s", name, err.message);
+ if (pixbuf == null) {
+ try {
+ var path = "/org/gnome/Shotwell/icons/%s".printf(name);
+ pixbuf = new Gdk.Pixbuf.from_resource(path);
+ } catch (Error err) {
+ critical("Unable to load icon %s: %s", name, err.message);
+ }
}
if (pixbuf == null)
diff --git a/src/SlideshowPage.vala b/src/SlideshowPage.vala
index 18fef7f..9810236 100644
--- a/src/SlideshowPage.vala
+++ b/src/SlideshowPage.vala
@@ -340,6 +340,12 @@ class SlideshowPage : SinglePhotoPage {
public override bool key_press_event(Gdk.EventKey event) {
bool handled = true;
switch (Gdk.keyval_name(event.keyval)) {
+ // Block activating the toolbar on key down
+ // FIXME: Why is SinglePhotoPage not a PhotoPage which already does this?
+ case "Down":
+ case "KP_Down":
+ ;
+ break;
case "space":
on_play_pause();
break;
@@ -362,6 +368,7 @@ class SlideshowPage : SinglePhotoPage {
bool slideshow_playing = playing;
playing = false;
hide_toolbar();
+ suspend_cursor_hiding();
if (settings_dialog.run() == Gtk.ResponseType.OK) {
// sync with the config setting so it will persist
@@ -375,6 +382,7 @@ class SlideshowPage : SinglePhotoPage {
}
settings_dialog.destroy();
+ restore_cursor_hiding();
playing = slideshow_playing;
timer.start();
}
diff --git a/src/direct/DirectPhotoPage.vala b/src/direct/DirectPhotoPage.vala
index 14b54bc..8eb2e3f 100644
--- a/src/direct/DirectPhotoPage.vala
+++ b/src/direct/DirectPhotoPage.vala
@@ -218,6 +218,12 @@ public class DirectPhotoPage : EditingHostPage {
fs.close();
return true;
+ } else {
+ if (get_container() is DirectWindow) {
+ (get_container() as DirectWindow).do_fullscreen();
+
+ return true;
+ }
}
return base.on_double_click(event);
@@ -295,7 +301,7 @@ public class DirectPhotoPage : EditingHostPage {
base.update_actions(selected_count, count);
}
- private bool check_ok_to_close_photo(Photo? photo) {
+ private bool check_ok_to_close_photo(Photo? photo, bool notify = true) {
// Means we failed to load the photo for some reason. Do not block
// shutdown
if (photo == null)
@@ -307,7 +313,7 @@ public class DirectPhotoPage : EditingHostPage {
if (drop_if_dirty) {
// need to remove transformations, or else they stick around in memory (reappearing
// if the user opens the file again)
- photo.remove_all_transformations();
+ photo.remove_all_transformations(notify);
return true;
}
@@ -320,7 +326,7 @@ public class DirectPhotoPage : EditingHostPage {
_("Close _without Saving"));
if (response == Gtk.ResponseType.YES)
- photo.remove_all_transformations();
+ photo.remove_all_transformations(notify);
else if (response == Gtk.ResponseType.NO) {
if (is_writeable)
save(photo.get_file(), 0, ScaleConstraint.ORIGINAL, Jpeg.Quality.HIGH,
@@ -336,7 +342,7 @@ public class DirectPhotoPage : EditingHostPage {
}
public bool check_quit() {
- return check_ok_to_close_photo(get_photo());
+ return check_ok_to_close_photo(get_photo(), false);
}
protected override bool confirm_replace_photo(Photo? old_photo, Photo new_photo) {
diff --git a/src/direct/DirectWindow.vala b/src/direct/DirectWindow.vala
index e1cbf75..9eec5b1 100644
--- a/src/direct/DirectWindow.vala
+++ b/src/direct/DirectWindow.vala
@@ -8,6 +8,8 @@ public class DirectWindow : AppWindow {
private DirectPhotoPage direct_photo_page;
public DirectWindow(File file) {
+ base();
+
direct_photo_page = new DirectPhotoPage(file);
direct_photo_page.get_view().items_altered.connect(on_photo_changed);
direct_photo_page.get_view().items_state_changed.connect(on_photo_changed);
@@ -42,6 +44,11 @@ public class DirectWindow : AppWindow {
get_display_pathname(file.get_parent()), Resources.APP_TITLE);
}
+ // Expose on_fullscreen publicly so we can call it from the DirectPhotoPage
+ public void do_fullscreen() {
+ on_fullscreen();
+ }
+
protected override void on_fullscreen() {
File file = get_direct_page().get_current_file();
@@ -74,16 +81,6 @@ public class DirectWindow : AppWindow {
return (base.delete_event != null) ? base.delete_event(event) : false;
}
- public override bool button_press_event(Gdk.EventButton event) {
- if (event.type == Gdk.EventType.2BUTTON_PRESS) {
- on_fullscreen();
-
- return true;
- }
-
- return false;
- }
-
public override bool key_press_event(Gdk.EventKey event) {
// check for an escape
if (Gdk.keyval_name(event.keyval) == "Escape") {
diff --git a/src/library/LibraryWindow.vala b/src/library/LibraryWindow.vala
index b9acb22..99a1c67 100644
--- a/src/library/LibraryWindow.vala
+++ b/src/library/LibraryWindow.vala
@@ -162,6 +162,8 @@ public class LibraryWindow : AppWindow {
#endif
public LibraryWindow(ProgressMonitor progress_monitor) {
+ base();
+
// prep sidebar and add roots
sidebar_tree = new Sidebar.Tree(DND_TARGET_ENTRIES, Gdk.DragAction.ASK,
external_drop_handler);
diff --git a/src/photos/PhotoMetadata.vala b/src/photos/PhotoMetadata.vala
index 2c2d6c5..288a362 100644
--- a/src/photos/PhotoMetadata.vala
+++ b/src/photos/PhotoMetadata.vala
@@ -70,6 +70,8 @@ public class ACDSeeKeywordTransformer : KeywordTransformer {
}
public override Gee.List<string> transform (string input) throws Error {
+ this.stack.clear();
+ this.result.clear();
var ctx = new MarkupParseContext (this.parser, 0, this, null);
ctx.parse (input, input.length);
@@ -276,7 +278,11 @@ public class PhotoMetadata : MediaMetadata {
exiv2 = new GExiv2.Metadata();
exif = null;
+#if NEW_GEXIV2_API
+ exiv2.open_buf(buffer[0:length]);
+#else
exiv2.open_buf(buffer, length);
+#endif
exif = Exif.Data.new_from_data(buffer, length);
source_name = "<memory buffer %d bytes>".printf(length);
}
@@ -285,8 +291,11 @@ public class PhotoMetadata : MediaMetadata {
exiv2 = new GExiv2.Metadata();
exif = null;
- exiv2.from_app1_segment(buffer.get_data(), (long) buffer.get_size());
+#if NEW_GEXIV2_API
+ exiv2.from_app1_segment(buffer.get_data());
+#else
exif = Exif.Data.new_from_data(buffer.get_data(), buffer.get_size());
+#endif
source_name = "<app1 segment %zu bytes>".printf(buffer.get_size());
}
diff --git a/src/plugins/StandardHostInterface.vala b/src/plugins/StandardHostInterface.vala
index 857c8ff..d0f3ed4 100644
--- a/src/plugins/StandardHostInterface.vala
+++ b/src/plugins/StandardHostInterface.vala
@@ -26,9 +26,6 @@ public class StandardHostInterface : Object, Spit.HostInterface {
case "org.yorba.shotwell.publishing.facebook":
return "facebook";
- case "org.yorba.shotwell.publishing.picasa":
- return "picasa";
-
case "org.yorba.shotwell.publishing.flickr":
return "flickr";
diff --git a/src/publishing/Publishing.vala b/src/publishing/Publishing.vala
index 6c30b91..455013c 100644
--- a/src/publishing/Publishing.vala
+++ b/src/publishing/Publishing.vala
@@ -9,9 +9,9 @@ namespace Publishing {
public void init() throws Error {
string[] core_ids = new string[0];
core_ids += "org.yorba.shotwell.publishing.facebook";
- core_ids += "org.yorba.shotwell.publishing.picasa";
core_ids += "org.yorba.shotwell.publishing.flickr";
core_ids += "org.yorba.shotwell.publishing.youtube";
+ core_ids += "org.yorba.shotwell.publishing.gnome-photos";
Plugins.register_extension_point(typeof(Spit.Publishing.Service), _("Publishing"),
Resources.PUBLISH, core_ids);
diff --git a/src/publishing/PublishingUI.vala b/src/publishing/PublishingUI.vala
index 3d4f609..d3d4a69 100644
--- a/src/publishing/PublishingUI.vala
+++ b/src/publishing/PublishingUI.vala
@@ -527,6 +527,7 @@ public class PublishingDialog : Gtk.Dialog {
public void set_cancel_button_mode() {
close_cancel_button.set_label(_("_Cancel"));
+ set_default(null);
}
public void lock_service() {