diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2023-06-28 21:35:52 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2023-06-28 21:35:52 +0200 |
commit | b86540b743f1a87a163ffb811c8fe22a01fefa38 (patch) | |
tree | b47cb3bb83c2377234226fb3987ab3320a987dd9 /src/AppWindow.vala | |
parent | ac6e0b731b9f0b2efd392e3309a5c07e2a66adad (diff) | |
parent | e905d8e16eec152d19797937f13ba3cf4b8f8aca (diff) |
Merge branch 'release/debian/0.32.1-1'debian/0.32.1-1
Diffstat (limited to 'src/AppWindow.vala')
-rw-r--r-- | src/AppWindow.vala | 56 |
1 files changed, 20 insertions, 36 deletions
diff --git a/src/AppWindow.vala b/src/AppWindow.vala index a5b27a4..438806c 100644 --- a/src/AppWindow.vala +++ b/src/AppWindow.vala @@ -6,7 +6,7 @@ public class FullscreenWindow : PageWindow { public const int TOOLBAR_INVOCATION_MSEC = 250; - public const int TOOLBAR_DISMISSAL_SEC = 2; + public const int TOOLBAR_DISMISSAL_SEC = 2 * 1000000; public const int TOOLBAR_CHECK_DISMISSAL_MSEC = 500; private Gtk.Overlay overlay = new Gtk.Overlay(); @@ -15,7 +15,7 @@ public class FullscreenWindow : PageWindow { private Gtk.ToggleToolButton pin_button = new Gtk.ToggleToolButton(); private bool is_toolbar_shown = false; private bool waiting_for_invoke = false; - private time_t left_toolbar_time = 0; + private int64 left_toolbar_time = 0; private bool switched_to = false; private bool is_toolbar_dismissal_enabled; @@ -246,13 +246,13 @@ public class FullscreenWindow : PageWindow { // if this is the first time noticed, start the timer and keep checking if (left_toolbar_time == 0) { - left_toolbar_time = time_t(); + left_toolbar_time = GLib.get_monotonic_time(); return true; } // see if enough time has elapsed - time_t now = time_t(); + int64 now = GLib.get_monotonic_time(); assert(now >= left_toolbar_time); if (now - left_toolbar_time < TOOLBAR_DISMISSAL_SEC) @@ -367,7 +367,6 @@ public abstract class PageWindow : Gtk.ApplicationWindow { var display = get_window ().get_display (); var cursor = new Gdk.Cursor.for_display (display, Gdk.CursorType.WATCH); get_window().set_cursor (cursor); - spin_event_loop(); } public void set_normal_cursor() { @@ -381,7 +380,6 @@ public abstract class PageWindow : Gtk.ApplicationWindow { var display = get_window ().get_display (); var cursor = new Gdk.Cursor.for_display (display, Gdk.CursorType.LEFT_PTR); get_window().set_cursor (cursor); - spin_event_loop(); } } @@ -415,7 +413,7 @@ public abstract class AppWindow : PageWindow { instance = this; title = Resources.APP_TITLE; - set_default_icon_name("shotwell"); + set_default_icon_name("org.gnome.Shotwell"); // restore previous size and maximization state if (this is LibraryWindow) { @@ -441,10 +439,6 @@ public abstract class AppWindow : PageWindow { // with each ActionGroup while we're adding the groups to the UIManager. add_actions (); - - Gtk.CssProvider provider = new Gtk.CssProvider(); - provider.load_from_resource("/org/gnome/Shotwell/misc/org.gnome.Shotwell.css"); - Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); } private const GLib.ActionEntry[] common_actions = { @@ -475,19 +469,6 @@ public abstract class AppWindow : PageWindow { return fullscreen_window; } - public static Gtk.Builder create_builder(string glade_filename = "shotwell.ui", void *user = null) { - Gtk.Builder builder = new Gtk.Builder(); - try { - builder.add_from_resource(Resources.get_ui(glade_filename)); - } catch(GLib.Error error) { - warning("Unable to create Gtk.Builder: %s\n", error.message); - } - - builder.connect_signals(user); - - return builder; - } - public static void error_message(string message, Gtk.Window? parent = null) { error_message_with_title(Resources.APP_TITLE, message, parent); } @@ -560,27 +541,26 @@ public abstract class AppWindow : PageWindow { return (Gtk.ResponseType) response; } - public static Gtk.ResponseType negate_affirm_all_cancel_question(string message, - string negative, string affirmative, string affirmative_all, string? title = null, - Gtk.Window? parent = null) { + public static int export_overwrite_or_replace_question(string message, + string alt1, string alt2, string alt3, string alt4, string alt5, string alt6, + string? title = null, Gtk.Window? parent = null) { Gtk.MessageDialog dialog = new Gtk.MessageDialog((parent != null) ? parent : get_instance(), Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE, "%s", message); dialog.title = (title != null) ? title : Resources.APP_TITLE; - dialog.add_buttons(negative, Gtk.ResponseType.NO, affirmative, Gtk.ResponseType.YES, - affirmative_all, Gtk.ResponseType.APPLY, _("_Cancel"), Gtk.ResponseType.CANCEL); + dialog.add_buttons(alt1, 1, alt2, 2, alt3, 3, alt4, 4, alt5, 5, alt6, 6); int response = dialog.run(); dialog.destroy(); - return (Gtk.ResponseType) response; + return response; } - - public static void database_error(DatabaseError err) { + + public static void database_error(Error err) { panic(_("A fatal error occurred when accessing Shotwell’s library. Shotwell cannot continue.\n\n%s").printf( err.message)); } - + public static void panic(string msg) { critical(msg); error_message(msg); @@ -591,9 +571,13 @@ public abstract class AppWindow : PageWindow { public abstract string get_app_role(); protected void on_about() { - const string[] artists = { "Celler Schloss created by Hajotthu, CC BY-SA 3.0, https://commons.wikimedia.org/wiki/File:Celler_Schloss_April_2010.jpg#file", null }; + var hash = ""; + if (Resources.GIT_VERSION != null && Resources.GIT_VERSION != "" && Resources.GIT_VERSION != Resources.APP_VERSION) { + hash = " (%s)".printf(Resources.GIT_VERSION.substring(0,7)); + } + string[] artists = {"Image of the Delmenhorst Town Hall by Charlie1965nrw, source: https://commons.wikimedia.org/wiki/File:Delmenhorst_Rathaus.jpg", null}; Gtk.show_about_dialog(this, - "version", Resources.APP_VERSION + " \u2013 “Celle”", + "version", Resources.APP_VERSION + hash + " — Delmenhorst", "comments", get_app_role(), "copyright", Resources.COPYRIGHT, "website", Resources.HOME_URL, @@ -601,8 +585,8 @@ public abstract class AppWindow : PageWindow { "website-label", _("Visit the Shotwell web site"), "authors", Resources.AUTHORS, "logo", Resources.get_icon(Resources.ICON_ABOUT_LOGO, -1), - "artists", artists, "translator-credits", _("translator-credits"), + "artists", artists, null ); } |