From d443a3c2509889533ca812c163056bace396b586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 14 Jun 2023 20:35:58 +0200 Subject: New upstream version 0.32.1 --- src/dialogs/AdjustDateTimeDialog.vala | 71 +++++++++++++++------------------ src/dialogs/MultiTextEntryDialog.vala | 2 +- src/dialogs/Preferences.vala | 46 +++++++++++---------- src/dialogs/SetBackground.vala | 4 +- src/dialogs/SetBackgroundSlideshow.vala | 8 ++-- src/dialogs/TextEntry.vala | 4 +- src/dialogs/WelcomeDialog.vala | 4 +- 7 files changed, 66 insertions(+), 73 deletions(-) (limited to 'src/dialogs') diff --git a/src/dialogs/AdjustDateTimeDialog.vala b/src/dialogs/AdjustDateTimeDialog.vala index fc08a3f..f475773 100644 --- a/src/dialogs/AdjustDateTimeDialog.vala +++ b/src/dialogs/AdjustDateTimeDialog.vala @@ -14,7 +14,7 @@ public class AdjustDateTimeDialog : Gtk.Dialog { private const int CALENDAR_THUMBNAIL_SCALE = 1; - time_t original_time; + DateTime? original_time; Gtk.Label original_time_label; Gtk.Calendar calendar; Gtk.SpinButton hour; @@ -182,32 +182,33 @@ public class AdjustDateTimeDialog : Gtk.Dialog { original_time = source.get_exposure_time(); - if (original_time == 0) { - original_time = time_t(); + if (original_time == null) { + // This came from + original_time = new DateTime.now_utc(); no_original_time = true; } - set_time(Time.local(original_time)); + set_time(original_time.to_local()); set_original_time_label(Config.Facade.get_instance().get_use_24_hour_time()); } - private void set_time(Time time) { - calendar.select_month(time.month, time.year + YEAR_OFFSET); - calendar.select_day(time.day); + private void set_time(DateTime time) { + calendar.select_month(time.get_month() - 1, time.get_year()); + calendar.select_day(time.get_day_of_month()); calendar.notify_property("year"); calendar.notify_property("month"); if (Config.Facade.get_instance().get_use_24_hour_time()) { system.set_active(TimeSystem.24HR); - hour.set_value(time.hour); + hour.set_value(time.get_hour()); } else { - int AMPM_hour = time.hour % 12; + int AMPM_hour = time.get_hour() % 12; hour.set_value((AMPM_hour == 0) ? 12 : AMPM_hour); - system.set_active((time.hour >= 12) ? TimeSystem.PM : TimeSystem.AM); + system.set_active((time.get_hour() >= 12) ? TimeSystem.PM : TimeSystem.AM); } - minute.set_value(time.minute); - second.set_value(time.second); + minute.set_value(time.get_minute()); + second.set_value(time.get_second()); previous_time_system = (TimeSystem) system.get_active(); } @@ -217,43 +218,35 @@ public class AdjustDateTimeDialog : Gtk.Dialog { return; original_time_label.set_text(_("Original: ") + - Time.local(original_time).format(use_24_hr_format ? _("%m/%d/%Y, %H:%M:%S") : + original_time.to_local().format(use_24_hr_format ? _("%m/%d/%Y, %H:%M:%S") : _("%m/%d/%Y, %I:%M:%S %p"))); } - private time_t get_time() { - Time time = Time(); - - time.second = (int) second.get_value(); - time.minute = (int) minute.get_value(); - + private DateTime get_time() { // convert to 24 hr int hour = (int) hour.get_value(); - time.hour = (hour == 12 && system.get_active() != TimeSystem.24HR) ? 0 : hour; - time.hour += ((system.get_active() == TimeSystem.PM) ? 12 : 0); + hour = (hour == 12 && system.get_active() != TimeSystem.24HR) ? 0 : hour; + hour += ((system.get_active() == TimeSystem.PM) ? 12 : 0); uint year, month, day; calendar.get_date(out year, out month, out day); - time.year = ((int) year) - YEAR_OFFSET; - time.month = (int) month; - time.day = (int) day; - time.isdst = -1; - - return time.mktime(); + return new DateTime.local((int)year, (int)month + 1, (int)day, hour, (int)minute.get_value(), (int)second.get_value()); } - public bool execute(out int64 time_shift, out bool keep_relativity, + public bool execute(out TimeSpan time_shift, out bool keep_relativity, out bool modify_originals) { show_all(); bool response = false; if (run() == Gtk.ResponseType.OK) { - if (no_original_time) - time_shift = (int64) get_time(); - else - time_shift = (int64) (get_time() - original_time); + // Difference returns microseconds, so divide by 1000000, we need seconds + if (no_original_time) { + time_shift = get_time().difference(new DateTime.from_unix_utc(0)) / 1000 / 1000; + } else { + time_shift = (get_time().difference(original_time)) / 1000 / 1000; + } keep_relativity = relativity_radio_button.get_active(); @@ -286,7 +279,7 @@ public class AdjustDateTimeDialog : Gtk.Dialog { } private void on_time_changed() { - int64 time_shift = ((int64) get_time() - (int64) original_time); + var time_shift = get_time().difference (original_time); calendar.notify_property("year"); calendar.notify_property("month"); @@ -301,12 +294,12 @@ public class AdjustDateTimeDialog : Gtk.Dialog { time_shift = time_shift.abs(); - days = (int) (time_shift / SECONDS_IN_DAY); - time_shift = time_shift % SECONDS_IN_DAY; - hours = (int) (time_shift / SECONDS_IN_HOUR); - time_shift = time_shift % SECONDS_IN_HOUR; - minutes = (int) (time_shift / SECONDS_IN_MINUTE); - seconds = (int) (time_shift % SECONDS_IN_MINUTE); + days = (int) (time_shift / TimeSpan.DAY); + time_shift = time_shift % TimeSpan.DAY; + hours = (int) (time_shift / TimeSpan.HOUR); + time_shift = time_shift % TimeSpan.HOUR; + minutes = (int) (time_shift / TimeSpan.MINUTE); + seconds = (int) ((time_shift % TimeSpan.MINUTE) / TimeSpan.SECOND); string shift_status = (forward) ? _("Exposure time will be shifted forward by\n%d %s, %d %s, %d %s, and %d %s.") : diff --git a/src/dialogs/MultiTextEntryDialog.vala b/src/dialogs/MultiTextEntryDialog.vala index 42e5318..ddbd59b 100644 --- a/src/dialogs/MultiTextEntryDialog.vala +++ b/src/dialogs/MultiTextEntryDialog.vala @@ -11,7 +11,7 @@ public class MultiTextEntryDialog : Gtk.Dialog { private unowned OnModifyValidateType on_modify_validate; [GtkChild] - private Gtk.TextView entry; + private unowned Gtk.TextView entry; public MultiTextEntryDialog() { Object (use_header_bar: Resources.use_header_bar()); diff --git a/src/dialogs/Preferences.vala b/src/dialogs/Preferences.vala index 17b16cf..efd9589 100644 --- a/src/dialogs/Preferences.vala +++ b/src/dialogs/Preferences.vala @@ -19,49 +19,49 @@ public class PreferencesDialog : Gtk.Dialog { private static PreferencesDialog preferences_dialog; [GtkChild] - private Gtk.Switch switch_dark; + private unowned Gtk.Switch switch_dark; [GtkChild] - private Gtk.ComboBox photo_editor_combo; + private unowned Gtk.ComboBox photo_editor_combo; [GtkChild] - private Gtk.ComboBox raw_editor_combo; + private unowned Gtk.ComboBox raw_editor_combo; private SortedList external_raw_apps; private SortedList external_photo_apps; [GtkChild] - private Gtk.FileChooserButton library_dir_button; + private unowned Gtk.FileChooserButton library_dir_button; [GtkChild] - private Gtk.ComboBoxText dir_pattern_combo; + private unowned Gtk.ComboBoxText dir_pattern_combo; [GtkChild] - private Gtk.Entry dir_pattern_entry; + private unowned Gtk.Entry dir_pattern_entry; [GtkChild] - private Gtk.Label dir_pattern_example; + private unowned Gtk.Label dir_pattern_example; private bool allow_closing = false; private string? lib_dir = null; private Gee.ArrayList path_formats = new Gee.ArrayList(); private GLib.DateTime example_date = new GLib.DateTime.local(2009, 3, 10, 18, 16, 11); [GtkChild] - private Gtk.CheckButton lowercase; + private unowned Gtk.CheckButton lowercase; private Plugins.ManifestWidgetMediator plugins_mediator = new Plugins.ManifestWidgetMediator(); [GtkChild] - private Gtk.ComboBoxText default_raw_developer_combo; + private unowned Gtk.ComboBoxText default_raw_developer_combo; [GtkChild] - private Gtk.CheckButton autoimport; + private unowned Gtk.CheckButton autoimport; [GtkChild] - private Gtk.CheckButton write_metadata; + private unowned Gtk.CheckButton write_metadata; [GtkChild] - private Gtk.Label pattern_help; + private unowned Gtk.Label pattern_help; [GtkChild] - private Gtk.Notebook preferences_notebook; + private unowned Gtk.Stack preferences_stack; [GtkChild] - private Gtk.RadioButton transparent_checker_radio; + private unowned Gtk.RadioButton transparent_checker_radio; [GtkChild] - private Gtk.RadioButton transparent_solid_radio; + private unowned Gtk.RadioButton transparent_solid_radio; [GtkChild] - private Gtk.ColorButton transparent_solid_color; + private unowned Gtk.ColorButton transparent_solid_color; [GtkChild] - private Gtk.RadioButton transparent_none_radio; + private unowned Gtk.RadioButton transparent_none_radio; private PreferencesDialog() { Object (use_header_bar: Resources.use_header_bar()); @@ -81,7 +81,7 @@ public class PreferencesDialog : Gtk.Dialog { Gdk.RGBA color = Gdk.RGBA(); color.parse(Config.Facade.get_instance().get_transparent_background_color()); - (transparent_solid_color as Gtk.ColorChooser).rgba = color; + ((Gtk.ColorChooser) transparent_solid_color).rgba = color; transparent_solid_color.color_set.connect(on_color_changed); switch (Config.Facade.get_instance().get_transparent_background_type()) { @@ -105,11 +105,11 @@ public class PreferencesDialog : Gtk.Dialog { if (help_path == null) { // We're installed system-wide, so use the system help. - pattern_help.set_markup("" + _("(Help)") + ""); + pattern_help.set_markup("%s".printf(Resources.DIR_PATTERN_URI_SYSWIDE, _("(Help)"))); } else { // We're being run from the build directory; we'll have to handle clicks to this // link manually ourselves, due to a limitation of help: URIs. - pattern_help.set_markup("" + _("(Help)") + ""); + pattern_help.set_markup("%s".printf(_("(Help)"))); pattern_help.activate_link.connect(on_local_pattern_help); } @@ -126,7 +126,9 @@ public class PreferencesDialog : Gtk.Dialog { lowercase.toggled.connect(on_lowercase_toggled); - (preferences_notebook.get_nth_page (2) as Gtk.Container).add (plugins_mediator); + ((Gtk.Box)preferences_stack.get_child_by_name("plugins")).add(plugins_mediator); + ((Gtk.Box)preferences_stack.get_child_by_name("profiles")).add(new Shotwell.ProfileBrowser()); + populate_preference_options(); @@ -177,7 +179,7 @@ public class PreferencesDialog : Gtk.Dialog { } private void on_color_changed() { - var color = (transparent_solid_color as Gtk.ColorChooser).rgba.to_string(); + var color = ((Gtk.ColorChooser) transparent_solid_color).rgba.to_string(); Config.Facade.get_instance().set_transparent_background_color(color); } diff --git a/src/dialogs/SetBackground.vala b/src/dialogs/SetBackground.vala index d9a77c4..ec56502 100644 --- a/src/dialogs/SetBackground.vala +++ b/src/dialogs/SetBackground.vala @@ -8,9 +8,9 @@ [GtkTemplate (ui = "/org/gnome/Shotwell/ui/set_background_dialog.ui")] public class SetBackgroundPhotoDialog : Gtk.Dialog { [GtkChild] - private Gtk.CheckButton desktop_background_checkbox; + private unowned Gtk.CheckButton desktop_background_checkbox; [GtkChild] - private Gtk.CheckButton screensaver_checkbox; + private unowned Gtk.CheckButton screensaver_checkbox; public SetBackgroundPhotoDialog() { Object(use_header_bar: Resources.use_header_bar()); diff --git a/src/dialogs/SetBackgroundSlideshow.vala b/src/dialogs/SetBackgroundSlideshow.vala index 914af76..479b0c7 100644 --- a/src/dialogs/SetBackgroundSlideshow.vala +++ b/src/dialogs/SetBackgroundSlideshow.vala @@ -8,13 +8,13 @@ [GtkTemplate (ui = "/org/gnome/Shotwell/ui/set_background_slideshow_dialog.ui")] public class SetBackgroundSlideshowDialog : Gtk.Dialog { [GtkChild] - private Gtk.CheckButton desktop_background_checkbox; + private unowned Gtk.CheckButton desktop_background_checkbox; [GtkChild] - private Gtk.CheckButton screensaver_checkbox; + private unowned Gtk.CheckButton screensaver_checkbox; [GtkChild] - private Gtk.Scale delay_scale; + private unowned Gtk.Scale delay_scale; [GtkChild] - private Gtk.Label delay_value_label; + private unowned Gtk.Label delay_value_label; private int delay_value = 0; diff --git a/src/dialogs/TextEntry.vala b/src/dialogs/TextEntry.vala index d82fdbd..a2e4653 100644 --- a/src/dialogs/TextEntry.vala +++ b/src/dialogs/TextEntry.vala @@ -12,10 +12,10 @@ public class TextEntryDialog : Gtk.Dialog { private unowned OnModifyValidateType on_modify_validate; [GtkChild] - private Gtk.Entry entry; + private unowned Gtk.Entry entry; [GtkChild] - private Gtk.Label label; + private unowned Gtk.Label label; public TextEntryDialog() { Object (use_header_bar: Resources.use_header_bar()); diff --git a/src/dialogs/WelcomeDialog.vala b/src/dialogs/WelcomeDialog.vala index e40686d..7fa0b7c 100644 --- a/src/dialogs/WelcomeDialog.vala +++ b/src/dialogs/WelcomeDialog.vala @@ -60,11 +60,9 @@ public class WelcomeDialog : Gtk.Dialog { Gtk.Label instructions = new Gtk.Label(""); string indent_prefix = " "; // we can't tell what the indent prefix is going to be so assume we need one - string arrow_glyph = (get_direction() == Gtk.TextDirection.RTL) ? "◂" : "▸"; - instructions.set_markup(((indent_prefix + "• %s\n") + (indent_prefix + "• %s\n") + (indent_prefix + "• %s")).printf( - _("Choose File %s Import From Folder").printf(arrow_glyph), + _("Choose “Import From Folder” from the File menu"), _("Drag and drop photos onto the Shotwell window"), _("Connect a camera to your computer and import"))); instructions.xalign = 0.0f; -- cgit v1.2.3