From 138bb5f7ea5ea3dc8090bde3fefc1ca5093c91d2 Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Sun, 11 Feb 2024 07:56:13 +0000 Subject: [PATCH 1/3] Translated using Weblate (Japanese) Currently translated at 100.0% (20 of 20 strings) Translation: Desktop/Greeter Translate-URL: https://l10n.elementary.io/projects/desktop/greeter/ja/ --- po/ja.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/po/ja.po b/po/ja.po index 8a4105a45..d32b67f56 100644 --- a/po/ja.po +++ b/po/ja.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: pantheon-greeter\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-06-19 17:04+0000\n" -"PO-Revision-Date: 2023-03-07 13:25+0000\n" +"PO-Revision-Date: 2024-02-12 08:12+0000\n" "Last-Translator: Ryo Nakano \n" "Language-Team: Japanese \n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.14.2\n" +"X-Generator: Weblate 5.0.2\n" "X-Launchpad-Export-Date: 2017-03-09 05:44+0000\n" #: compositor/WindowManager.vala:324 @@ -28,7 +28,7 @@ msgstr[0] "変更は%i秒後に自動的に元に戻ります。" #: compositor/WindowManager.vala:331 msgid "Keep new display settings?" -msgstr "新しいディスプレイの設定を維持しますか?" +msgstr "新しいディスプレイの設定を維持しますか?" #: compositor/WindowManager.vala:335 msgid "Keep Settings" From 0b833eab4d781cded5c828d61debadbc939e7a24 Mon Sep 17 00:00:00 2001 From: Leo Date: Wed, 14 Feb 2024 03:00:41 +0900 Subject: [PATCH 2/3] Simpler fade-in animation (#703) --- compositor/WindowManager.vala | 19 ++++++++++++++++++- src/Application.vala | 4 ++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/compositor/WindowManager.vala b/compositor/WindowManager.vala index 65028ce0a..7995e03fa 100644 --- a/compositor/WindowManager.vala +++ b/compositor/WindowManager.vala @@ -46,7 +46,9 @@ namespace GreeterCompositor { public Greeter.SystemBackground system_background { get; private set; } - Meta.PluginInfo info; + private Clutter.Actor fade_in_screen; + + private Meta.PluginInfo info; // Used to toggle screenreader private GLib.Settings application_settings; @@ -76,6 +78,12 @@ namespace GreeterCompositor { public override void start () { show_stage (); + fade_in_screen.save_easing_state (); + fade_in_screen.set_easing_duration (1000); + fade_in_screen.set_easing_mode (Clutter.AnimationMode.EASE); + fade_in_screen.opacity = 0; + fade_in_screen.restore_easing_state (); + unowned Meta.Display display = get_display (); display.gl_video_memory_purged.connect (() => { refresh_background (); @@ -124,6 +132,15 @@ namespace GreeterCompositor { pointer_locator = new PointerLocator (this); ui_group.add_child (pointer_locator); + int width, height; + display.get_size (out width, out height); + fade_in_screen = new Clutter.Actor () { + width = width, + height = height, + background_color = Clutter.Color.from_rgba (0, 0, 0, 255), + }; + stage.add_child (fade_in_screen); + MaskCorners.init (this); /*keybindings*/ diff --git a/src/Application.vala b/src/Application.vala index 9695b4532..c107f55a0 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -32,8 +32,6 @@ public int main (string[] args) { var settings_daemon = new Greeter.SettingsDaemon (); settings_daemon.start (); - Gtk.init (ref args); - Greeter.SubprocessSupervisor compositor; Greeter.SubprocessSupervisor wingpanel; @@ -43,6 +41,8 @@ public int main (string[] args) { critical (e.message); } + Gtk.init (ref args); + var window = new Greeter.MainWindow (); window.show_all (); From 85bbb720a8eb71c996d5e1e0aebce4adff62a7e6 Mon Sep 17 00:00:00 2001 From: Leo Date: Wed, 14 Feb 2024 03:03:06 +0900 Subject: [PATCH 3/3] Cleanup (#696) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Danielle Foré --- src/Cards/UserCard.vala | 11 ---- src/MainWindow.vala | 133 ++++++++++++++++------------------------ 2 files changed, 53 insertions(+), 91 deletions(-) diff --git a/src/Cards/UserCard.vala b/src/Cards/UserCard.vala index e1c886d57..c88d42b33 100644 --- a/src/Cards/UserCard.vala +++ b/src/Cards/UserCard.vala @@ -12,7 +12,6 @@ public class Greeter.UserCard : Greeter.BaseCard { public LightDM.User lightdm_user { get; construct; } public bool show_input { get; set; default = false; } - public double reveal_ratio { get; private set; default = 0.0; } public bool is_24h { get; set; default = true; } public int prefers_accent_color { get; set; default = 6; } @@ -236,20 +235,10 @@ public class Greeter.UserCard : Greeter.BaseCard { } }); - // This makes all the animations synchonous - form_revealer.size_allocate.connect ((alloc) => { - var total_height = form_box.get_allocated_height () + form_box.margin_top + form_box.margin_bottom; - reveal_ratio = (double)alloc.height / (double)total_height; - }); - notify["show-input"].connect (() => { update_collapsed_class (); }); - notify["child-revealed"].connect (() => { - reveal_ratio = child_revealed ? 1.0 : 0.0; - }); - password_entry.activate.connect (on_login); login_button.clicked.connect (on_login); diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 53266c34d..344ad448e 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -24,16 +24,17 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { private GLib.Queue user_cards; private Gtk.SizeGroup card_size_group; - private int index_delta = 0; private Hdy.Carousel carousel; private LightDM.Greeter lightdm_greeter; private Greeter.Settings settings; private Gtk.Button guest_login_button; private Gtk.ToggleButton manual_login_button; private Greeter.DateTimeWidget datetime_widget; - private unowned Greeter.BaseCard current_card; private unowned LightDM.UserList lightdm_user_list; + private int current_user_card_index = 0; + private unowned Greeter.BaseCard? current_card = null; + private bool installer_mode = false; private const uint[] NAVIGATION_KEYS = { @@ -125,7 +126,8 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { } manual_login_stack.visible_child = carousel; - current_card = user_cards.peek_nth (index_delta); + current_card = user_cards.peek_nth (current_user_card_index); + try { lightdm_greeter.authenticate (((UserCard) current_card).lightdm_user.name); } catch (Error e) { @@ -142,23 +144,10 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { } }); - GLib.ActionEntry entries[] = { - GLib.ActionEntry () { - name = "previous", - activate = go_previous - }, - GLib.ActionEntry () { - name = "next", - activate = go_next - } - }; - card_size_group = new Gtk.SizeGroup (Gtk.SizeGroupMode.HORIZONTAL); card_size_group.add_widget (extra_login_grid); card_size_group.add_widget (manual_card); - add_action_entries (entries, this); - lightdm_greeter = new LightDM.Greeter (); lightdm_greeter.show_message.connect (show_message); lightdm_greeter.show_prompt.connect (show_prompt); @@ -194,47 +183,48 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { manual_card.do_connect.connect (do_connect); key_press_event.connect ((event) => { + if (!(event.keyval in NAVIGATION_KEYS)) { + // Don't focus if it is a modifier or if search_box is already focused + unowned var current_focus = get_focus (); + if ((event.is_modifier == 0) && (current_focus == null || !current_focus.is_ancestor (current_card))) { + current_card.grab_focus (); + } + + return Gdk.EVENT_PROPAGATE; + } + // arrow key is being used to navigate - if (event.keyval in NAVIGATION_KEYS) { - if (current_card is UserCard) { - weak Gtk.Widget? current_focus = get_focus (); - if (current_focus is Gtk.Entry && current_focus.is_ancestor (current_card)) { - if (((Gtk.Entry) current_focus).text == "") { - if (event.keyval == Gdk.Key.Left) { - if (get_style_context ().direction == Gtk.TextDirection.RTL) { - activate_action ("next", null); - } else { - activate_action ("previous", null); - } - return true; - } else if (event.keyval == Gdk.Key.Right) { - if (get_style_context ().direction == Gtk.TextDirection.RTL) { - activate_action ("previous", null); - } else { - activate_action ("next", null); - } - return true; + if (current_card is UserCard) { + unowned var focused_entry = (Gtk.Entry) get_focus (); + if (focused_entry != null && focused_entry.is_ancestor (current_card)) { + if (focused_entry.text == "") { + if (event.keyval == Gdk.Key.Left) { + if (get_style_context ().direction == LTR) { + go_previous (); + } else { + go_next (); + } + return Gdk.EVENT_STOP; + } else if (event.keyval == Gdk.Key.Right) { + if (get_style_context ().direction == LTR) { + go_next (); + } else { + go_previous (); } + return Gdk.EVENT_STOP; } } } - - return false; - } - - // Don't focus if it is a modifier or if search_box is already focused - weak Gtk.Widget? current_focus = get_focus (); - if ((event.is_modifier == 0) && (current_focus == null || !current_focus.is_ancestor (current_card))) { - current_card.grab_focus (); } - return false; + return Gdk.EVENT_PROPAGATE; }); carousel.page_changed.connect ((index) => { var children = carousel.get_children (); if (children.nth_data (index) is Greeter.UserCard) { + current_user_card_index = (int) index; switch_to_card ((Greeter.UserCard) children.nth_data (index)); } }); @@ -473,7 +463,7 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { } if (!user_selected) { - unowned Greeter.UserCard user_card = (Greeter.UserCard) user_cards.peek_head (); + unowned var user_card = user_cards.peek_head (); user_card.show_input = true; switch_to_card (user_card); } @@ -519,18 +509,18 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { }); user_card.go_left.connect (() => { - if (get_style_context ().direction == Gtk.TextDirection.RTL) { - activate_action ("next", null); + if (get_style_context ().direction == LTR) { + go_previous (); } else { - activate_action ("previous", null); + go_next (); } }); user_card.go_right.connect (() => { - if (get_style_context ().direction == Gtk.TextDirection.RTL) { - activate_action ("previous", null); + if (get_style_context ().direction == LTR) { + go_next (); } else { - activate_action ("next", null); + go_previous (); } }); @@ -540,37 +530,29 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { user_cards.push_tail (user_card); } - int next_delta = 0; - weak GLib.Binding? binding = null; + private unowned GLib.Binding? time_format_binding = null; private void switch_to_card (Greeter.UserCard user_card) { if (!carousel.interactive) { return; } - if (next_delta != index_delta) { - return; + if (current_card != null && current_card is UserCard) { + ((UserCard) current_card).show_input = false; } - current_card = user_card; - if (binding != null) { - binding.unbind (); + if (time_format_binding != null) { + time_format_binding.unbind (); } + time_format_binding = user_card.bind_property ("is-24h", datetime_widget, "is-24h", GLib.BindingFlags.SYNC_CREATE); - user_card.set_settings (); - - binding = user_card.bind_property ("is-24h", datetime_widget, "is-24h", GLib.BindingFlags.SYNC_CREATE); - next_delta = user_cards.index (user_card); + current_card = user_card; carousel.scroll_to (user_card); - user_card.notify["reveal-ratio"].connect (notify_cb); + user_card.set_settings (); user_card.show_input = true; user_card.grab_focus (); - if (index_delta != next_delta) { - ((Greeter.UserCard) user_cards.peek_nth (index_delta)).show_input = false; - } - if (user_card.lightdm_user.session != null) { get_action_group ("session").activate_action ("select", new GLib.Variant.string (user_card.lightdm_user.session)); } @@ -590,15 +572,6 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { } } - private void notify_cb (GLib.Object obj, GLib.ParamSpec spec) { - unowned var user_card = (Greeter.UserCard) obj; - if (user_card.reveal_ratio == 1.0) { - index_delta = next_delta; - user_card.notify["reveal-ratio"].disconnect (notify_cb); - return; - } - } - private void do_connect_username (string username) { if (lightdm_greeter.in_authentication) { try { @@ -628,23 +601,23 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { carousel.scroll_to (current_card); } - private void go_previous (GLib.SimpleAction action, GLib.Variant? parameter) { + private void go_previous () { if (!carousel.interactive) { return; } - unowned Greeter.UserCard? next_card = user_cards.peek_nth (index_delta - 1); + unowned Greeter.UserCard? next_card = user_cards.peek_nth (current_user_card_index - 1); if (next_card != null) { carousel.scroll_to (next_card); } } - private void go_next (GLib.SimpleAction action, GLib.Variant? parameter) { + private void go_next () { if (!carousel.interactive) { return; } - unowned Greeter.UserCard? next_card = user_cards.peek_nth (index_delta + 1); + unowned Greeter.UserCard? next_card = user_cards.peek_nth (current_user_card_index + 1); if (next_card != null) { carousel.scroll_to (next_card); }