[shotwell/wip/gtk4: 43/45] Fix Trash page and more dialogs
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell/wip/gtk4: 43/45] Fix Trash page and more dialogs
- Date: Wed, 13 Apr 2022 18:21:22 +0000 (UTC)
commit 5e9c14ef8e669de906d75dd51f0da208eea3a129
Author: Jens Georg <mail jensge org>
Date: Tue Apr 12 21:07:29 2022 +0200
Fix Trash page and more dialogs
data/ui/trash.ui | 87 ++++++++++++----------------
meson.build | 2 +-
src/.unitize/_SidebarInternals.vala | 4 +-
src/CollectionPage.vala | 23 ++++----
src/Commands.vala | 31 ++++++----
src/Dialogs.vala | 112 +++++++++++++++++++++++++-----------
src/MediaPage.vala | 2 +-
src/PhotoPage.vala | 36 +++++++-----
src/dialogs/Preferences.vala | 2 +-
src/faces/Faces.vala | 4 +-
src/faces/FacesBranch.vala | 7 ++-
src/library/Library.vala | 4 +-
src/library/LibraryBranch.vala | 14 +++--
src/library/LibraryWindow.vala | 34 ++++++-----
src/library/OfflinePage.vala | 48 +++++++++-------
src/library/TrashPage.vala | 2 +-
src/meson.build | 8 +++
src/plugins/meson.build | 3 +-
18 files changed, 244 insertions(+), 179 deletions(-)
---
diff --git a/data/ui/trash.ui b/data/ui/trash.ui
index 75009686..d04a69eb 100644
--- a/data/ui/trash.ui
+++ b/data/ui/trash.ui
@@ -1,5 +1,6 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<interface domain="shotwell">
+ <requires lib="gtk" version="4.0"/>
<menu id="MenuBar">
<submenu>
<attribute name="label" translatable="yes">_File</attribute>
@@ -240,79 +241,67 @@
</item>
</section>
</menu>
- <object class="GtkToolbar" id="TrashToolbar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="toolbar_style">both-horiz</property>
+ <object class="GtkBox" id="TrashToolbar">
+ <style>
+ <class name="toolbar"/>
+ </style>
+ <property name="can_focus">0</property>
<child>
- <object class="GtkToolButton" id="ToolDelete">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkButton" id="ToolDelete">
+ <property name="can_focus">0</property>
<property name="tooltip_text" translatable="yes">Remove the selected photos from the trash</property>
- <property name="is_important">True</property>
<property name="action_name">win.Delete</property>
<property name="label" translatable="yes">_Delete</property>
- <property name="use_underline">True</property>
+ <property name="use_underline">1</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
<child>
- <object class="GtkToolButton" id="ToolRestore">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkButton" id="ToolRestore">
+ <property name="can_focus">0</property>
<property name="tooltip_text" translatable="yes">Move the selected photos back into the
library</property>
- <property name="is_important">True</property>
<property name="action_name">win.Restore</property>
<property name="label" translatable="yes">_Restore</property>
- <property name="use_underline">True</property>
+ <property name="use_underline">1</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
<child>
- <object class="GtkToolButton" id="ToolEmptyTrash">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkButton" id="ToolEmptyTrash">
+ <property name="can_focus">0</property>
<property name="tooltip_text" translatable="yes">Delete all photos in the trash</property>
- <property name="is_important">True</property>
<property name="action_name">win.CommonEmptyTrash</property>
<property name="label" translatable="yes">Empty Trash</property>
- <property name="use_underline">True</property>
+ <property name="use_underline">1</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
<child>
- <object class="GtkSeparatorToolItem">
- <property name="can_focus">False</property>
+ <object class="GtkSeparator">
+ <property name="orientation">vertical</property>
+ <property name="can_focus">0</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">False</property>
- </packing>
</child>
<child>
- <object class="GtkToolButton" id="ToolFind">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkButton" id="ToolFind">
+ <child>
+ <object class="GtkBox">
+ <property name="orientation">horizontal</property>
+ <property name="spacing">6</property>
+ <child type="start">
+ <object class="GtkImage">
+ <property name="icon_name">edit-find-symbolic</property>
+ </object>
+ </child>
+ <child type="end">
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Find</property>
+ <property name="use_underline">1</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <property name="can_focus">0</property>
<property name="tooltip_text" translatable="yes">Find an image by typing text that appears in its
name or tags</property>
- <property name="is_important">True</property>
<property name="action_name">win.CommonDisplaySearchbar</property>
- <property name="label" translatable="yes">Find</property>
- <property name="use_underline">True</property>
- <property name="icon_name">edit-find-symbolic</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
</object>
</interface>
diff --git a/meson.build b/meson.build
index d869d730..838d4636 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
project('shotwell', ['vala', 'c'],
- version : '33.0',
+ version : '33.alpha',
meson_version : '>= 0.43.0',
default_options : ['buildtype=debugoptimized'])
diff --git a/src/.unitize/_SidebarInternals.vala b/src/.unitize/_SidebarInternals.vala
index 2f5a531b..0940c438 100644
--- a/src/.unitize/_SidebarInternals.vala
+++ b/src/.unitize/_SidebarInternals.vala
@@ -16,14 +16,14 @@ public void init_entry() throws Error {
Unit.init_entry();
- //Sidebar.init();
+ Sidebar.init();
}
public void terminate_entry() {
if (_unit_init_count == 0 || --_unit_init_count != 0)
return;
- //Sidebar.terminate();
+ Sidebar.terminate();
Unit.terminate_entry();
}
diff --git a/src/CollectionPage.vala b/src/CollectionPage.vala
index 183c0de1..ffb3e1a9 100644
--- a/src/CollectionPage.vala
+++ b/src/CollectionPage.vala
@@ -533,17 +533,20 @@ public abstract class CollectionPage : MediaPage {
return;
if (can_revert_editable_selected()) {
- if (!revert_editable_dialog(AppWindow.get_instance(),
- (Gee.Collection<Photo>) get_view().get_selected_sources())) {
- return;
- }
-
- foreach (DataObject object in get_view().get_selected_sources())
- ((Photo) object).revert_to_master();
+ revert_editable_dialog.begin(AppWindow.get_instance(),
+ (Gee.Collection<Photo>) get_view().get_selected_sources(), (source, res) => {
+ if (revert_editable_dialog.end(res)) {
+ foreach (DataObject object in get_view().get_selected_sources())
+ ((Photo) object).revert_to_master();
+
+ RevertMultipleCommand command = new RevertMultipleCommand(get_view().get_selected());
+ get_command_manager().execute(command);
+ }
+ });
+ } else {
+ RevertMultipleCommand command = new RevertMultipleCommand(get_view().get_selected());
+ get_command_manager().execute(command);
}
-
- RevertMultipleCommand command = new RevertMultipleCommand(get_view().get_selected());
- get_command_manager().execute(command);
}
public void on_copy_adjustments() {
diff --git a/src/Commands.vala b/src/Commands.vala
index c6b46212..bc968878 100644
--- a/src/Commands.vala
+++ b/src/Commands.vala
@@ -1390,17 +1390,7 @@ public class AdjustDateTimePhotosCommand : MultipleDataSourceCommand {
old_times = new Gee.HashMap<Dateable, time_t?>();
}
- public override void execute() {
- error_list = new Gee.ArrayList<Dateable>();
- base.execute();
-
- if (error_list.size > 0) {
- multiple_object_error_dialog(error_list,
- ngettext("One original photo could not be adjusted.",
- "The following original photos could not be adjusted.", error_list.size),
- _("Time Adjustment Error"));
- }
-
+ private void continue_execute() {
ViewCollection all_events = new ViewCollection("tmp");
foreach (Dateable d in prev_events.keys) {
@@ -1414,12 +1404,29 @@ public class AdjustDateTimePhotosCommand : MultipleDataSourceCommand {
}
}
+ public override void execute() {
+ error_list = new Gee.ArrayList<Dateable>();
+ base.execute();
+
+ if (error_list.size > 0) {
+ multiple_object_error_dialog.begin(error_list,
+ ngettext("One original photo could not be adjusted.",
+ "The following original photos could not be adjusted.", error_list.size),
+ _("Time Adjustment Error"), (source, res) => {
+ multiple_object_error_dialog.end(res);
+ continue_execute();
+ });
+ } else {
+ continue_execute();
+ }
+ }
+
public override void undo() {
error_list = new Gee.ArrayList<Dateable>();
base.undo();
if (error_list.size > 0) {
- multiple_object_error_dialog(error_list,
+ multiple_object_error_dialog.begin(error_list,
ngettext("Time adjustments could not be undone on the following photo file.",
"Time adjustments could not be undone on the following photo files.",
error_list.size), _("Time Adjustment Error"));
diff --git a/src/Dialogs.vala b/src/Dialogs.vala
index 4acef8e3..12bcdfe3 100644
--- a/src/Dialogs.vala
+++ b/src/Dialogs.vala
@@ -711,30 +711,36 @@ public class EditCommentDialog : MultiTextEntryDialogMediator {
// Returns: Gtk.ResponseType.YES (trash photos), Gtk.ResponseType.NO (only remove photos) and
// Gtk.ResponseType.CANCEL.
-public Gtk.ResponseType remove_from_library_dialog(Gtk.Window owner, string title,
+public async Gtk.ResponseType remove_from_library_dialog(Gtk.Window owner, string title,
string user_message, int count) {
string trash_action = ngettext("Remove and _Trash File", "Remove and _Trash Files", count);
Gtk.MessageDialog dialog = new Gtk.MessageDialog(owner, Gtk.DialogFlags.MODAL,
Gtk.MessageType.WARNING, Gtk.ButtonsType.CANCEL, "%s", user_message);
+ dialog.set_transient_for(owner);
dialog.add_button(_("_Remove From Library"), Gtk.ResponseType.NO);
dialog.add_button(trash_action, Gtk.ResponseType.YES);
-
// This dialog was previously created outright; we now 'hijack'
// dialog's old title and use it as the primary text, along with
// using the message as the secondary text.
dialog.set_markup(build_alert_body_text(title, user_message));
-
- // TODO
- Gtk.ResponseType result = (Gtk.ResponseType) 0;//dialog.run();
-
- dialog.destroy();
+ dialog.show();
+
+ int result = 0;
+ SourceFunc continue_cb = remove_from_library_dialog.callback;
+ dialog.response.connect((source, res) => {
+ dialog.hide();
+ result = res;
+ dialog.destroy();
+ continue_cb();
+ });
+ yield;
return result;
}
// Returns: Gtk.ResponseType.YES (delete photos), Gtk.ResponseType.NO (keep photos)
-public Gtk.ResponseType remove_from_filesystem_dialog(Gtk.Window owner, string title,
+public async Gtk.ResponseType remove_from_filesystem_dialog(Gtk.Window owner, string title,
string user_message) {
Gtk.MessageDialog dialog = new Gtk.MessageDialog(owner, Gtk.DialogFlags.MODAL,
Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE, "%s", user_message);
@@ -743,16 +749,22 @@ public Gtk.ResponseType remove_from_filesystem_dialog(Gtk.Window owner, string t
dialog.set_default_response( Gtk.ResponseType.NO);
dialog.set_markup(build_alert_body_text(title, user_message));
+ dialog.show();
- // TODO
- Gtk.ResponseType result = (Gtk.ResponseType) 0; //dialog.run();
-
- dialog.destroy();
+ int result = 0;
+ SourceFunc continue_cb = remove_from_filesystem_dialog.callback;
+ dialog.response.connect((source, res) => {
+ dialog.hide();
+ result = res;
+ dialog.destroy();
+ continue_cb();
+ });
+ yield;
return result;
}
-public bool revert_editable_dialog(Gtk.Window owner, Gee.Collection<Photo> photos) {
+public async bool revert_editable_dialog(Gtk.Window owner, Gee.Collection<Photo> photos) {
int count = 0;
foreach (Photo photo in photos) {
if (photo.has_editable())
@@ -774,17 +786,25 @@ public bool revert_editable_dialog(Gtk.Window owner, Gee.Collection<Photo> photo
Gtk.MessageType.WARNING, Gtk.ButtonsType.NONE, "%s", msg);
dialog.add_button(_("_Cancel"), Gtk.ResponseType.CANCEL);
dialog.add_button(action, Gtk.ResponseType.YES);
+ dialog.set_transient_for(owner);
dialog.set_markup(build_alert_body_text(headline, msg));
-
- Gtk.ResponseType result = (Gtk.ResponseType) 0; // TODO dialog.run();
-
- dialog.destroy();
+ dialog.show();
+
+ int result = 0;
+ SourceFunc continue_cb = revert_editable_dialog.callback;
+ dialog.response.connect((source, res) => {
+ dialog.hide();
+ result = res;
+ dialog.destroy();
+ continue_cb();
+ });
+ yield;
return result == Gtk.ResponseType.YES;
}
-public bool remove_offline_dialog(Gtk.Window owner, int count) {
+public async bool remove_offline_dialog(Gtk.Window owner, int count) {
if (count == 0)
return false;
@@ -798,16 +818,24 @@ public bool remove_offline_dialog(Gtk.Window owner, int count) {
dialog.add_button(_("_Cancel"), Gtk.ResponseType.CANCEL);
dialog.add_button(_("_Remove"), Gtk.ResponseType.OK);
dialog.title = (count == 1) ? _("Remove Photo From Library") : _("Remove Photos From Library");
+ dialog.set_transient_for (owner);
+ dialog.show();
- Gtk.ResponseType result = (Gtk.ResponseType) 0; // TODO dialog.run();
-
- dialog.destroy();
+ int result = 0;
+ SourceFunc continue_cb = remove_offline_dialog.callback;
+ dialog.response.connect((source, res) => {
+ dialog.hide();
+ result = res;
+ dialog.destroy();
+ continue_cb();
+ });
+ yield;
return result == Gtk.ResponseType.OK;
}
public const int MAX_OBJECTS_DISPLAYED = 3;
-public void multiple_object_error_dialog(Gee.ArrayList<DataObject> objects, string message,
+public async void multiple_object_error_dialog(Gee.ArrayList<DataObject> objects, string message,
string title) {
string dialog_message = message + "\n";
@@ -825,10 +853,18 @@ public void multiple_object_error_dialog(Gee.ArrayList<DataObject> objects, stri
Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, "%s", dialog_message);
dialog.title = title;
-
+ dialog.set_transient_for (AppWindow.get_instance());
dialog.show();
- // TODO
- dialog.destroy();
+
+ int result = 0;
+ SourceFunc continue_cb = multiple_object_error_dialog.callback;
+ dialog.response.connect((source, res) => {
+ dialog.hide();
+ result = res;
+ dialog.destroy();
+ continue_cb();
+ });
+ yield;
}
public abstract class TagsDialog : TextEntryDialogMediator {
@@ -927,7 +963,7 @@ public class ModifyTagsDialog : TagsDialog {
// This function is used to determine whether or not files should be copied or linked when imported.
// Returns ACCEPT for copy, REJECT for link, and CANCEL for (drum-roll) cancel.
-public Gtk.ResponseType copy_files_dialog() {
+public async Gtk.ResponseType copy_files_dialog() {
string msg = _("Shotwell can copy the photos into your library folder or it can import them without
copying.");
Gtk.MessageDialog dialog = new Gtk.MessageDialog(AppWindow.get_instance(), Gtk.DialogFlags.MODAL,
@@ -936,20 +972,28 @@ public Gtk.ResponseType copy_files_dialog() {
dialog.add_button(_("Co_py Photos"), Gtk.ResponseType.ACCEPT);
dialog.add_button(_("_Import in Place"), Gtk.ResponseType.REJECT);
dialog.title = _("Import to Library");
-
- Gtk.ResponseType result = (Gtk.ResponseType) 0; //dialog.run();
+ dialog.set_transient_for(AppWindow.get_instance());
+ dialog.show();
- dialog.destroy();
+ int result = 0;
+ SourceFunc continue_cb = copy_files_dialog.callback;
+ dialog.response.connect((source, res) => {
+ dialog.hide();
+ result = res;
+ dialog.destroy();
+ continue_cb();
+ });
+ yield;
return result;
}
-public void remove_photos_from_library(Gee.Collection<LibraryPhoto> photos) {
- remove_from_app(photos, _("Remove From Library"),
+public async void remove_photos_from_library(Gee.Collection<LibraryPhoto> photos) {
+ yield remove_from_app(photos, _("Remove From Library"),
ngettext("Removing Photo From Library", "Removing Photos From Library", photos.size));
}
-public void remove_from_app(Gee.Collection<MediaSource> sources, string dialog_title,
+public async void remove_from_app(Gee.Collection<MediaSource> sources, string dialog_title,
string progress_dialog_text) {
if (sources.size == 0)
return;
@@ -973,7 +1017,7 @@ public void remove_from_app(Gee.Collection<MediaSource> sources, string dialog_t
sources.size).printf(sources.size);
}
- Gtk.ResponseType result = remove_from_library_dialog(AppWindow.get_instance(), dialog_title,
+ Gtk.ResponseType result = yield remove_from_library_dialog(AppWindow.get_instance(), dialog_title,
user_message, sources.size);
if (result != Gtk.ResponseType.YES && result != Gtk.ResponseType.NO)
return;
@@ -1003,7 +1047,7 @@ public void remove_from_app(Gee.Collection<MediaSource> sources, string dialog_t
ngettext("The photo or video cannot be moved to your desktop trash. Delete this file?",
"%d photos/videos cannot be moved to your desktop trash. Delete these files?",
num_not_removed).printf(num_not_removed);
- Gtk.ResponseType result_delete = remove_from_filesystem_dialog(AppWindow.get_instance(),
+ Gtk.ResponseType result_delete = yield remove_from_filesystem_dialog(AppWindow.get_instance(),
dialog_title, not_deleted_message);
if (Gtk.ResponseType.YES == result_delete) {
diff --git a/src/MediaPage.vala b/src/MediaPage.vala
index df875d69..c814fcad 100644
--- a/src/MediaPage.vala
+++ b/src/MediaPage.vala
@@ -683,7 +683,7 @@ public abstract class MediaPage : CheckerboardPage {
}
private void on_remove_from_library() {
- remove_photos_from_library((Gee.Collection<LibraryPhoto>) get_view().get_selected_sources());
+ remove_photos_from_library.begin((Gee.Collection<LibraryPhoto>) get_view().get_selected_sources());
}
protected virtual void on_move_to_trash() {
diff --git a/src/PhotoPage.vala b/src/PhotoPage.vala
index d97a9af1..e5fcf5d3 100644
--- a/src/PhotoPage.vala
+++ b/src/PhotoPage.vala
@@ -1972,6 +1972,16 @@ public abstract class EditingHostPage : SinglePhotoPage {
rotate(Rotation.UPSIDE_DOWN, Resources.VFLIP_LABEL, "");
}
+ private void do_revert () {
+ cancel_zoom();
+
+ set_photo_missing(false);
+
+ RevertSingleCommand command = new RevertSingleCommand(get_photo());
+ get_command_manager().execute(command);
+
+ }
+
public void on_revert() {
if (photo_missing)
return;
@@ -1982,20 +1992,16 @@ public abstract class EditingHostPage : SinglePhotoPage {
return;
if (get_photo().has_editable()) {
- if (!revert_editable_dialog(AppWindow.get_instance(),
- (Gee.Collection<Photo>) get_view().get_sources())) {
- return;
- }
-
- get_photo().revert_to_master();
- }
-
- cancel_zoom();
-
- set_photo_missing(false);
-
- RevertSingleCommand command = new RevertSingleCommand(get_photo());
- get_command_manager().execute(command);
+ revert_editable_dialog.begin(AppWindow.get_instance(),
+ (Gee.Collection<Photo>) get_view().get_sources(), (source, res) => {
+ if (revert_editable_dialog.end(res)) {
+ get_photo().revert_to_master();
+ do_revert();
+ }
+ });
+ } else {
+ do_revert ();
+ }
}
public void on_edit_title() {
@@ -2933,7 +2939,7 @@ public class LibraryPhotoPage : EditingHostPage {
Gee.Collection<LibraryPhoto> photos = new Gee.ArrayList<LibraryPhoto>();
photos.add(photo);
- remove_from_app(photos, _("Remove From Library"), _("Removing Photo From Library"));
+ remove_from_app.begin(photos, _("Remove From Library"), _("Removing Photo From Library"));
}
private void on_move_to_trash() {
diff --git a/src/dialogs/Preferences.vala b/src/dialogs/Preferences.vala
index 7fdc8a11..3b4cb24a 100644
--- a/src/dialogs/Preferences.vala
+++ b/src/dialogs/Preferences.vala
@@ -45,7 +45,7 @@ public class PreferencesDialog : Gtk.Dialog {
private unowned Gtk.CheckButton lowercase;
private Plugins.ManifestWidgetMediator plugins_mediator = new Plugins.ManifestWidgetMediator();
[GtkChild]
- private Gtk.Box plugins_box;
+ private unowned Gtk.Box plugins_box;
[GtkChild]
private unowned Gtk.ComboBoxText default_raw_developer_combo;
diff --git a/src/faces/Faces.vala b/src/faces/Faces.vala
index 839e0ac0..3f0623a7 100644
--- a/src/faces/Faces.vala
+++ b/src/faces/Faces.vala
@@ -9,11 +9,11 @@
namespace Faces {
public void init() throws Error {
- //Faces.SidebarEntry.init();
+ Faces.SidebarEntry.init();
}
public void terminate() {
- //Faces.SidebarEntry.terminate();
+ Faces.SidebarEntry.terminate();
}
}
diff --git a/src/faces/FacesBranch.vala b/src/faces/FacesBranch.vala
index 1eb25cf4..0cd30803 100644
--- a/src/faces/FacesBranch.vala
+++ b/src/faces/FacesBranch.vala
@@ -138,8 +138,11 @@ public class Faces.SidebarEntry : Sidebar.SimplePageEntry, Sidebar.RenameableEnt
}
public void destroy_source() {
- if (Dialogs.confirm_delete_face(face))
- AppWindow.get_command_manager().execute(new DeleteFaceCommand(face));
+ Dialogs.confirm_delete_face.begin(face, (source, res) => {
+ if (Dialogs.confirm_delete_face.end(res)) {
+ AppWindow.get_command_manager().execute(new DeleteFaceCommand(face));
+ }
+ });
}
}
diff --git a/src/library/Library.vala b/src/library/Library.vala
index 7c1b1680..48eb721a 100644
--- a/src/library/Library.vala
+++ b/src/library/Library.vala
@@ -7,12 +7,12 @@
namespace Library {
public void init() throws Error {
- //Library.TrashSidebarEntry.init();
+ Library.TrashSidebarEntry.init();
Photo.develop_raw_photos_to_files = true;
}
public void terminate() {
- //Library.TrashSidebarEntry.terminate();
+ Library.TrashSidebarEntry.terminate();
}
}
diff --git a/src/library/LibraryBranch.vala b/src/library/LibraryBranch.vala
index e25a183d..7ecd00d6 100644
--- a/src/library/LibraryBranch.vala
+++ b/src/library/LibraryBranch.vala
@@ -10,11 +10,13 @@ public class Library.Branch : Sidebar.Branch {
public Library.PhotosEntry photos_entry { get; private set; }
#if 0
public Library.FlaggedSidebarEntry flagged_entry { get; private set; }
+ #endif
public Library.LastImportSidebarEntry last_imported_entry { get; private set; }
+ #if 0
public Library.ImportQueueSidebarEntry import_queue_entry { get; private set; }
public Library.OfflineSidebarEntry offline_entry { get; private set; }
- public Library.TrashSidebarEntry trash_entry { get; private set; }
#endif
+ public Library.TrashSidebarEntry trash_entry { get; private set; }
// This lists the order of the library items in the sidebar. To re-order, simply move
// the item in this list to a new position. These numbers should *not* persist anywhere
@@ -33,22 +35,22 @@ public class Library.Branch : Sidebar.Branch {
Sidebar.Branch.Options.STARTUP_OPEN_GROUPING, comparator);
photos_entry = new Library.PhotosEntry();
- #if 0
trash_entry = new Library.TrashSidebarEntry();
last_imported_entry = new Library.LastImportSidebarEntry();
+ #if 0
flagged_entry = new Library.FlaggedSidebarEntry();
offline_entry = new Library.OfflineSidebarEntry();
import_queue_entry = new Library.ImportQueueSidebarEntry();
#endif
insert(photos_entry, EntryPosition.PHOTOS);
- //insert(trash_entry, EntryPosition.TRASH);
+ insert(trash_entry, EntryPosition.TRASH);
//flagged_entry.visibility_changed.connect(on_flagged_visibility_changed);
//on_flagged_visibility_changed();
- //last_imported_entry.visibility_changed.connect(on_last_imported_visibility_changed);
- //on_last_imported_visibility_changed();
+ last_imported_entry.visibility_changed.connect(on_last_imported_visibility_changed);
+ on_last_imported_visibility_changed();
//import_queue_entry.visibility_changed.connect(on_import_queue_visibility_changed);
//on_import_queue_visibility_changed();
@@ -67,7 +69,7 @@ public class Library.Branch : Sidebar.Branch {
}
private void on_last_imported_visibility_changed() {
- //update_entry_visibility(last_imported_entry, EntryPosition.LAST_IMPORTED);
+ update_entry_visibility(last_imported_entry, EntryPosition.LAST_IMPORTED);
}
private void on_import_queue_visibility_changed() {
diff --git a/src/library/LibraryWindow.vala b/src/library/LibraryWindow.vala
index 66a9537d..9fc4bca0 100644
--- a/src/library/LibraryWindow.vala
+++ b/src/library/LibraryWindow.vala
@@ -108,17 +108,18 @@ public class LibraryWindow : AppWindow {
private Sidebar.Tree sidebar_tree;
private Library.Branch library_branch = new Library.Branch();
private Tags.Branch tags_branch = new Tags.Branch();
+ private Folders.Branch folders_branch = new Folders.Branch();
+#if ENABLE_FACES
+ private Faces.Branch faces_branch = new Faces.Branch();
+#endif
private Events.Branch events_branch = new Events.Branch();
private Camera.Branch camera_branch = new Camera.Branch();
private Searches.Branch saved_search_branch = new Searches.Branch();
- private Folders.Branch folders_branch = new Folders.Branch();
-#if DOES_NOT_WORK_WITH_GTK4
- private Faces.Branch faces_branch = new Faces.Branch();
private ImportRoll.Branch import_roll_branch = new ImportRoll.Branch();
-
-#endif
- private Gee.HashMap<Page, Sidebar.Entry> page_map = new Gee.HashMap<Page, Sidebar.Entry>();
+
private bool page_switching_enabled = true;
+
+ private Gee.HashMap<Page, Sidebar.Entry> page_map = new Gee.HashMap<Page, Sidebar.Entry>();
private LibraryPhotoPage photo_page = null;
@@ -169,9 +170,7 @@ public class LibraryWindow : AppWindow {
sidebar_tree.graft(events_branch, SidebarRootPosition.EVENTS);
sidebar_tree.graft(camera_branch, SidebarRootPosition.CAMERAS);
sidebar_tree.graft(saved_search_branch, SidebarRootPosition.SAVED_SEARCH);
- #if 0
sidebar_tree.graft(import_roll_branch, SidebarRootPosition.IMPORT_ROLL);
- #endif
properties_scheduler = new OneShotScheduler("LibraryWindow properties",
on_update_properties_now);
@@ -223,10 +222,10 @@ public class LibraryWindow : AppWindow {
}
~LibraryWindow() {
- //sidebar_tree.page_created.disconnect(on_page_created);
- //sidebar_tree.destroying_page.disconnect(on_destroying_page);
- //sidebar_tree.entry_selected.disconnect(on_sidebar_entry_selected);
- //sidebar_tree.selected_entry_removed.disconnect(on_sidebar_selected_entry_removed);
+ sidebar_tree.page_created.disconnect(on_page_created);
+ sidebar_tree.destroying_page.disconnect(on_destroying_page);
+ sidebar_tree.entry_selected.disconnect(on_sidebar_entry_selected);
+ sidebar_tree.selected_entry_removed.disconnect(on_sidebar_selected_entry_removed);
unsubscribe_from_basic_information(get_current_page());
@@ -605,9 +604,10 @@ public class LibraryWindow : AppWindow {
to_remove.add_all(LibraryPhoto.global.get_trashcan_contents());
to_remove.add_all(Video.global.get_trashcan_contents());
- remove_from_app(to_remove, _("Empty Trash"), _("Emptying Trash…"));
-
- AppWindow.get_command_manager().reset();
+ remove_from_app.begin(to_remove, _("Empty Trash"), _("Emptying Trash…"), (source, res) => {
+ remove_from_app.end(res);
+ AppWindow.get_command_manager().reset();
+ });
}
private void on_new_search() {
@@ -923,7 +923,7 @@ public class LibraryWindow : AppWindow {
#endif
public void switch_to_library_page() {
- //switch_to_page(library_branch.photos_entry.get_page());
+ switch_to_page(library_branch.photos_entry.get_page());
}
public void switch_to_event(Event event) {
@@ -1287,7 +1287,6 @@ public class LibraryWindow : AppWindow {
private void on_sidebar_selected_entry_removed(Sidebar.SelectableEntry selectable) {
// if the currently selected item is removed, want to jump to fallback page (which
// depends on the item that was selected)
- #if 0
Library.LastImportSidebarEntry last_import_entry = library_branch.last_imported_entry;
// Importing... -> Last Import (if available)
@@ -1296,7 +1295,6 @@ public class LibraryWindow : AppWindow {
return;
}
- #endif
// Event page -> Events (master event directory)
if (selectable is Events.EventEntry && events_branch.get_show_branch()) {
diff --git a/src/library/OfflinePage.vala b/src/library/OfflinePage.vala
index 1982618e..6488516a 100644
--- a/src/library/OfflinePage.vala
+++ b/src/library/OfflinePage.vala
@@ -100,31 +100,35 @@ public class OfflinePage : CheckerboardPage {
if (sources.size == 0)
return;
- if (!remove_offline_dialog(AppWindow.get_instance(), sources.size))
- return;
-
- AppWindow.get_instance().set_busy_cursor();
-
- ProgressDialog progress = null;
- if (sources.size >= 20)
- progress = new ProgressDialog(AppWindow.get_instance(), _("Deleting…"));
+ remove_offline_dialog.begin(AppWindow.get_instance(), sources.size, (source, res) => {
+ if (!remove_offline_dialog.end(res)) {
+ return;
+ }
- Gee.ArrayList<LibraryPhoto> photos = new Gee.ArrayList<LibraryPhoto>();
- Gee.ArrayList<Video> videos = new Gee.ArrayList<Video>();
- MediaSourceCollection.filter_media(sources, photos, videos);
-
- if (progress != null) {
- LibraryPhoto.global.remove_from_app(photos, false, progress.monitor);
- Video.global.remove_from_app(videos, false, progress.monitor);
- } else {
- LibraryPhoto.global.remove_from_app(photos, false);
- Video.global.remove_from_app(videos, false);
- }
+ AppWindow.get_instance().set_busy_cursor();
- if (progress != null)
- progress.close();
+ ProgressDialog progress = null;
+ if (sources.size >= 20)
+ progress = new ProgressDialog(AppWindow.get_instance(), _("Deleting…"));
+
+ Gee.ArrayList<LibraryPhoto> photos = new Gee.ArrayList<LibraryPhoto>();
+ Gee.ArrayList<Video> videos = new Gee.ArrayList<Video>();
+ MediaSourceCollection.filter_media(sources, photos, videos);
+
+ if (progress != null) {
+ LibraryPhoto.global.remove_from_app(photos, false, progress.monitor);
+ Video.global.remove_from_app(videos, false, progress.monitor);
+ } else {
+ LibraryPhoto.global.remove_from_app(photos, false);
+ Video.global.remove_from_app(videos, false);
+ }
+
+ if (progress != null)
+ progress.close();
+
+ AppWindow.get_instance().set_normal_cursor();
+ });
- AppWindow.get_instance().set_normal_cursor();
}
public override SearchViewFilter get_search_view_filter() {
diff --git a/src/library/TrashPage.vala b/src/library/TrashPage.vala
index 1e72f07a..a7820259 100644
--- a/src/library/TrashPage.vala
+++ b/src/library/TrashPage.vala
@@ -111,7 +111,7 @@ public class TrashPage : CheckerboardPage {
}
private void on_delete() {
- remove_from_app((Gee.Collection<MediaSource>) get_view().get_selected_sources(), _("Delete"),
+ remove_from_app.begin((Gee.Collection<MediaSource>) get_view().get_selected_sources(), _("Delete"),
(get_view().get_selected_count() == 1) ? ("Deleting a Photo") : _("Deleting Photos"));
}
diff --git a/src/meson.build b/src/meson.build
index de2055b8..bac1d984 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -24,6 +24,7 @@ face_obj = ''
if get_option('face_detection')
face_sources = [
+ 'faces/FacesBranch.vala',
'faces/FacePage.vala',
#'faces/FaceShape.vala',
'faces/FaceDetect.vala',
@@ -96,6 +97,11 @@ executable(
'library/Library.vala',
'library/LibraryWindow.vala',
'library/LibraryBranch.vala',
+ 'library/TrashSidebarEntry.vala',
+ 'library/OfflineSidebarEntry.vala',
+ 'library/FlaggedSidebarEntry.vala',
+ 'library/LastImportSidebarEntry.vala',
+ 'library/ImportQueueSidebarEntry.vala',
'library/FlaggedPage.vala',
'library/ImportQueuePage.vala',
'library/LastImportPage.vala',
@@ -155,6 +161,8 @@ executable(
'folders/Folders.vala',
'folders/FoldersBranch.vala',
'folders/FoldersPage.vala',
+ 'import-roll/ImportRollBranch.vala',
+ 'import-roll/ImportRollEntry.vala',
'main.vala',
'AppWindow.vala',
'CollectionPage.vala',
diff --git a/src/plugins/meson.build b/src/plugins/meson.build
index e5bce923..d43c15ae 100644
--- a/src/plugins/meson.build
+++ b/src/plugins/meson.build
@@ -1,10 +1,11 @@
+sw_plugin_library_version = '0.33'
# Plugin helper library
sw_plugin_dev = library('shotwell-plugin-dev-1.0',
['DataImportsInterfaces.vala',
'PublishingInterfaces.vala',
'SpitInterfaces.vala',
'TransitionsInterfaces.vala'],
- version: meson.project_version(),
+ version: sw_plugin_library_version,
vala_header : 'shotwell-plugin-dev-1.0.h',
vala_vapi : 'shotwell-plugin-dev-1.0.vapi',
dependencies : [gmodule, gtk, gio, gee],
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]