Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to GTK 4 #711

Draft
wants to merge 27 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
43d2ad2
Start build for GTK 4
danirabbit Mar 7, 2024
acef097
SessionButton: build menu from model
danirabbit Mar 7, 2024
7d71741
self destruct
danirabbit Mar 7, 2024
0ce4926
equality
danirabbit Mar 7, 2024
035c36c
Merge branch 'danirabbit/sessionbutton-glibmenu' into danirabbit/gtk4
danirabbit Mar 7, 2024
5643020
Maybe fix capslock and numlock?
danirabbit Mar 7, 2024
1d9b300
Merge branch 'master' into danirabbit/gtk4
danirabbit Mar 10, 2024
6d2b0c3
Merge branch 'master' into danirabbit/gtk4
danirabbit Mar 10, 2024
d32dd16
minor API stuff
danirabbit Mar 10, 2024
ecc82af
Merge master
danirabbit Oct 7, 2024
88cfe93
Merge main, backgroundimage picture
danirabbit Oct 7, 2024
0483988
Replace style classes
danirabbit Oct 7, 2024
33ad884
Solve a lot of errors
danirabbit Oct 7, 2024
7d6e957
rm backgroundimage class
danirabbit Oct 8, 2024
54519b5
some usercard fixes
danirabbit Oct 8, 2024
2416b17
Fix carousel stuff
danirabbit Oct 8, 2024
3ca2727
Merge main
danirabbit Oct 18, 2024
f25f577
Use has_frame
danirabbit Oct 18, 2024
5927810
Fix icon_press connect
danirabbit Oct 18, 2024
6584e52
SessionButton: try no hierarchy connect
danirabbit Oct 18, 2024
b7f2726
Redundant app quit on window destroy
danirabbit Oct 18, 2024
1b8d6c3
Fix add controller
danirabbit Oct 18, 2024
5c4b1b3
Fix some focus stuff
danirabbit Oct 18, 2024
e2310c4
Can't subclass menubutton
danirabbit Oct 18, 2024
716fc23
Last compilation problem
danirabbit Oct 18, 2024
c5f1d8a
Fix some stuff
danirabbit Oct 18, 2024
5b982c6
Fix card overflow
danirabbit Oct 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Install Dependencies
run: |
apt update
apt install -y desktop-file-utils libaccountsservice-dev libgdk-pixbuf2.0-dev libgnome-desktop-3-dev libgranite-dev libgtk-3-dev libhandy-1-dev liblightdm-gobject-1-dev ${{ matrix.mutter_pkg }} libx11-dev meson valac
apt install -y desktop-file-utils libaccountsservice-dev libgdk-pixbuf2.0-dev libgnome-desktop-3-dev libgranite-7-dev libgtk-4-dev libadwaita-1-dev liblightdm-gobject-1-dev ${{ matrix.mutter_pkg }} libx11-dev meson valac
- name: Build
env:
DESTDIR: out
Expand Down
3 changes: 3 additions & 0 deletions data/Application.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/

.background {
background: transparent;
box-shadow: none;
opacity: 0;
transition: opacity 1s ease;
}
Expand All @@ -12,6 +14,7 @@
opacity: 1;
}


.date,
.time {
color: #fff;
Expand Down
1 change: 0 additions & 1 deletion po/POTFILES
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ src/Settings.vala
src/Cards/BaseCard.vala
src/Cards/ManualCard.vala
src/Cards/UserCard.vala
src/Widgets/BackgroundImage.vala
src/Widgets/CapsLockRevealer.vala
src/Widgets/DateTimeWidget.vala
src/Widgets/PasswordEntry.vala
Expand Down
7 changes: 2 additions & 5 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,12 @@ public class Greeter.Application : Gtk.Application {
protected override void startup () {
base.startup ();

var css_provider = new Gtk.CssProvider ();
css_provider.load_from_resource ("/io/elementary/greeter/Application.css");

Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
Granite.init ();
}

public override void activate () {
add_window (new Greeter.MainWindow ());
active_window.show_all ();
active_window.present ();
}

public static int main (string[] args) {
Expand Down
10 changes: 1 addition & 9 deletions src/Cards/BaseCard.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
public abstract class Greeter.BaseCard : Gtk.Box {
public signal void do_connect (string? credential = null);

protected static Gtk.CssProvider css_provider;

public bool connecting { get; set; default = false; }
public bool need_password { get; set; default = false; }
public bool use_fingerprint { get; set; default = false; }
Expand All @@ -38,11 +36,6 @@ public abstract class Greeter.BaseCard : Gtk.Box {

protected Gtk.Revealer revealer;

static construct {
css_provider = new Gtk.CssProvider ();
css_provider.load_from_resource ("/io/elementary/greeter/Card.css");
}

construct {
revealer = new Gtk.Revealer () {
halign = CENTER,
Expand All @@ -52,8 +45,7 @@ public abstract class Greeter.BaseCard : Gtk.Box {
width_request = 350
};

add (revealer);
events |= Gdk.EventMask.BUTTON_RELEASE_MASK;
append (revealer);

revealer.notify["child-revealed"].connect (() => {
if (!revealer.child_revealed) {
Expand Down
58 changes: 27 additions & 31 deletions src/Cards/ManualCard.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Greeter.ManualCard : Greeter.BaseCard {
hexpand = true,
margin_bottom = 16
};
label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL);
label.add_css_class (Granite.STYLE_CLASS_H2_LABEL);

username_entry = new Gtk.Entry () {
hexpand = true,
Expand All @@ -41,8 +41,8 @@ public class Greeter.ManualCard : Greeter.BaseCard {
var caps_lock_revealer = new Greeter.CapsLockRevealer ();

var password_box = new Gtk.Box (VERTICAL, 6);
password_box.add (password_entry);
password_box.add (caps_lock_revealer);
password_box.append (password_entry);
password_box.append (caps_lock_revealer);

var session_button = new Greeter.SessionButton ();

Expand All @@ -66,11 +66,9 @@ public class Greeter.ManualCard : Greeter.BaseCard {
margin_start = 12,
margin_end = 12
};
main_box.add (form_grid);

unowned var main_grid_style_context = main_box.get_style_context ();
main_grid_style_context.add_class (Granite.STYLE_CLASS_CARD);
main_grid_style_context.add_class (Granite.STYLE_CLASS_ROUNDED);
main_box.append (form_grid);
main_box.add_css_class (Granite.STYLE_CLASS_CARD);
main_box.add_css_class (Granite.STYLE_CLASS_ROUNDED);

child = main_box;

Expand All @@ -79,13 +77,19 @@ public class Greeter.ManualCard : Greeter.BaseCard {

username_entry.activate.connect (() => do_connect_username (username_entry.text));
password_entry.activate.connect (on_login);
grab_focus.connect (() => {
if (username_entry.sensitive) {
username_entry.grab_focus_without_selecting ();
} else {
password_entry.grab_focus_without_selecting ();

var focus_controller = new Gtk.EventControllerFocus ();
focus_controller.enter.connect (() => {
if (focus_controller.is_focus) {
if (username_entry.sensitive) {
username_entry.grab_focus_without_selecting ();
} else {
password_entry.grab_focus_without_selecting ();
}
}
});

add_controller (focus_controller);
}

private void on_login () {
Expand Down Expand Up @@ -119,19 +123,14 @@ public class Greeter.ManualCard : Greeter.BaseCard {
public override void wrong_credentials () {
password_entry.text = "";

unowned var username_entry_style_context = username_entry.get_style_context ();
username_entry_style_context.add_class (Gtk.STYLE_CLASS_ERROR);

unowned var password_entry_style_context = password_entry.get_style_context ();
password_entry_style_context.add_class (Gtk.STYLE_CLASS_ERROR);

unowned var grid_style_context = main_box.get_style_context ();
grid_style_context.add_class ("shake");
username_entry.add_css_class (Granite.STYLE_CLASS_ERROR);
password_entry.add_css_class (Granite.STYLE_CLASS_ERROR);
main_box.add_css_class ("shake");

Timeout.add (ERROR_SHAKE_DURATION, () => {
grid_style_context.remove_class ("shake");
username_entry_style_context.remove_class (Gtk.STYLE_CLASS_ERROR);
password_entry_style_context.remove_class (Gtk.STYLE_CLASS_ERROR);
main_box.remove_css_class ("shake");
username_entry.remove_css_class (Granite.STYLE_CLASS_ERROR);
password_entry.remove_css_class (Granite.STYLE_CLASS_ERROR);

connecting = false;
focus_username_entry ();
Expand All @@ -148,15 +147,12 @@ public class Greeter.ManualCard : Greeter.BaseCard {
username_entry.secondary_icon_name = "";
username_entry.text = "";

unowned var entry_style_context = username_entry.get_style_context ();
entry_style_context.add_class (Gtk.STYLE_CLASS_ERROR);

unowned var grid_style_context = main_box.get_style_context ();
grid_style_context.add_class ("shake");
username_entry.add_css_class (Granite.STYLE_CLASS_ERROR);
main_box.add_css_class ("shake");

Timeout.add (ERROR_SHAKE_DURATION, () => {
grid_style_context.remove_class ("shake");
entry_style_context.remove_class (Gtk.STYLE_CLASS_ERROR);
main_box.remove_css_class ("shake");
username_entry.remove_css_class (Granite.STYLE_CLASS_ERROR);

return Source.REMOVE;
});
Expand Down
Loading