diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4ed9add..e3bf6ec 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,7 +24,7 @@ jobs: - name: Install Dependencies run: | apt update - apt install -y libglib2.0-dev libgtk-3-dev libpackagekit-glib2-dev libportal-dev libwingpanel-dev libaccountsservice-dev meson valac + apt install -y libadwaita-1-dev libglib2.0-dev libgtk-4-dev libpackagekit-glib2-dev libportal-dev libwingpanel-8-dev libaccountsservice-dev meson valac - name: Build env: DESTDIR: out diff --git a/README.md b/README.md index b035ef0..a667e5e 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@ You'll need the following dependencies: -* libgranite-dev -* libhandy-1-dev -* libwingpanel-dev +* libgranite-7-dev +* libadwaita-1-dev +* libwingpanel-8-dev * meson * valac diff --git a/meson.build b/meson.build index 5b33394..e613e68 100644 --- a/meson.build +++ b/meson.build @@ -12,16 +12,15 @@ datadir = prefix / get_option('datadir') add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()), language:'c') add_project_arguments('-DG_LOG_DOMAIN="@0@"'.format(meson.project_name()), language:'c') -add_project_arguments('--vapidir=' + join_paths(meson.project_source_root(), 'vapi'), language: 'vala') -gdk_wl_dep = dependency('gdk-wayland-3.0') glib_dep = dependency('glib-2.0') gobject_dep = dependency('gobject-2.0') -granite_dep = dependency('granite', version: '>=6.0.0') -gtk_dep = dependency('gtk+-3.0') -handy_dep = dependency('libhandy-1', version: '>=1.0') +granite_dep = dependency('granite-7', version: '>=7.0.0') +gtk_dep = dependency('gtk4') +gtk_wayland_dep = dependency('gtk4-wayland') +handy_dep = dependency('libadwaita-1', version: '>=1.0') packagekit_dep = dependency('packagekit-glib2') -wingpanel_dep = dependency('wingpanel') +wingpanel_dep = dependency('wingpanel-8') wingpanel_indicatorsdir = wingpanel_dep.get_pkgconfig_variable('indicatorsdir', define_variable: ['libdir', libdir]) wl_client_dep = dependency('wayland-client') portal_dep = dependency('libportal') diff --git a/src/Indicator.vala b/src/Indicator.vala index 04642b1..c941c6c 100644 --- a/src/Indicator.vala +++ b/src/Indicator.vala @@ -22,7 +22,7 @@ public class QuickSettings.Indicator : Wingpanel.Indicator { // Prevent a race that skips automatic resource loading // https://github.com/elementary/wingpanel-indicator-bluetooth/issues/203 - Gtk.IconTheme.get_default ().add_resource_path ("/org/elementary/wingpanel/icons"); + Gtk.IconTheme.get_for_display (Gdk.Display.get_default ()).add_resource_path ("/org/elementary/wingpanel/icons"); } public override Gtk.Widget get_display_widget () { @@ -39,8 +39,8 @@ public class QuickSettings.Indicator : Wingpanel.Indicator { var provider = new Gtk.CssProvider (); provider.load_from_resource ("io/elementary/quick-settings/Indicator.css"); - Gtk.StyleContext.add_provider_for_screen ( - Gdk.Screen.get_default (), + Gtk.StyleContext.add_provider_for_display ( + Gdk.Display.get_default (), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION ); diff --git a/src/PopoverWidget.vala b/src/PopoverWidget.vala index 88bb9c2..33d5bcf 100644 --- a/src/PopoverWidget.vala +++ b/src/PopoverWidget.vala @@ -47,8 +47,8 @@ public class QuickSettings.PopoverWidget : Gtk.Box { row_spacing = 12, selection_mode = NONE }; - toggle_box.get_style_context ().add_class ("togglebox"); - toggle_box.add (prevent_sleep_toggle); + toggle_box.add_css_class ("togglebox"); + toggle_box.append (prevent_sleep_toggle); var text_scale = new TextScale (); @@ -59,9 +59,9 @@ public class QuickSettings.PopoverWidget : Gtk.Box { current_user_button = new Gtk.Button () { child = current_user }; - current_user_button.get_style_context ().add_class ("circular"); - current_user_button.get_style_context ().add_class ("flat"); - current_user_button.get_style_context ().add_class ("no-padding"); + current_user_button.add_css_class ("circular"); + current_user_button.add_css_class ("flat"); + current_user_button.add_css_class ("no-padding"); var session_box = new SessionBox (server_type) { halign = END, @@ -70,15 +70,15 @@ public class QuickSettings.PopoverWidget : Gtk.Box { }; var bottom_box = new Gtk.Box (HORIZONTAL, 0); - bottom_box.add (current_user_button); - bottom_box.add (session_box); - bottom_box.get_style_context ().add_class ("togglebox"); + bottom_box.append (current_user_button); + bottom_box.append (session_box); + bottom_box.add_css_class ("togglebox"); main_box = new Gtk.Box (VERTICAL, 0); - main_box.add (toggle_box); - main_box.add (scale_box); - main_box.add (new Gtk.Separator (HORIZONTAL)); - main_box.add (bottom_box); + main_box.append (toggle_box); + main_box.append (scale_box); + main_box.append (new Gtk.Separator (HORIZONTAL)); + main_box.append (bottom_box); accounts_view = new UserList (); @@ -88,10 +88,10 @@ public class QuickSettings.PopoverWidget : Gtk.Box { transition_type = SLIDE_LEFT_RIGHT }; - stack.add (main_box); - stack.add (accounts_view); + stack.add_child (main_box); + stack.add_child (accounts_view); - add (stack); + append (stack); if (server_type == GREETER) { bottom_box.remove (current_user_button); @@ -99,16 +99,14 @@ public class QuickSettings.PopoverWidget : Gtk.Box { if (server_type != GREETER) { var darkmode_button = new DarkModeToggle (); - toggle_box.add (darkmode_button); - show_all (); + toggle_box.append (darkmode_button); } setup_sensor_proxy.begin ((obj, res) => { var sensor_proxy = setup_sensor_proxy.end (res); if (sensor_proxy.has_accelerometer) { var rotation_toggle = new RotationToggle (); - toggle_box.add (rotation_toggle); - show_all (); + toggle_box.append (rotation_toggle); }; }); @@ -122,18 +120,18 @@ public class QuickSettings.PopoverWidget : Gtk.Box { var glib_settings = new Settings ("io.elementary.desktop.quick-settings"); if (server_type == GREETER || glib_settings.get_boolean ("show-a11y")) { - toggle_box.add (screen_reader); - toggle_box.add (onscreen_keyboard); + toggle_box.append (screen_reader); + toggle_box.append (onscreen_keyboard); - scale_box.add (text_scale); + scale_box.append (text_scale); } glib_settings.changed["show-a11y"].connect (() => { if (glib_settings.get_boolean ("show-a11y") && screen_reader.parent == null) { - toggle_box.add (screen_reader); - toggle_box.add (onscreen_keyboard); + toggle_box.append (screen_reader); + toggle_box.append (onscreen_keyboard); - scale_box.add (text_scale); + scale_box.append (text_scale); } else { toggle_box.remove (screen_reader); toggle_box.remove (onscreen_keyboard); @@ -162,7 +160,7 @@ public class QuickSettings.PopoverWidget : Gtk.Box { new ThemedIcon ("onboard") ) { badge_icon = new ThemedIcon ("system-log-out"), - transient_for = (Gtk.Window) get_toplevel () + transient_for = (Gtk.Window) get_root () }; message_dialog.response.connect (message_dialog.destroy); message_dialog.present (); diff --git a/src/Widgets/CurrentUser.vala b/src/Widgets/CurrentUser.vala index eb84e5b..06f219d 100644 --- a/src/Widgets/CurrentUser.vala +++ b/src/Widgets/CurrentUser.vala @@ -7,7 +7,7 @@ public bool minimal { get; construct; } public Act.User? user { get; set; default = null; } - private Hdy.Avatar avatar; + private Adw.Avatar avatar; private Gtk.Label fullname_label; private Gtk.Label status_label; private Gtk.Button logout_button; @@ -29,7 +29,7 @@ } construct { - avatar = new Hdy.Avatar (minimal ? 32 : 48, null, true); + avatar = new Adw.Avatar (minimal ? 32 : 48, null, true); // We want to use the user's accent, not a random color unowned Gtk.StyleContext avatar_context = avatar.get_style_context (); @@ -52,14 +52,14 @@ valign = Gtk.Align.END, halign = Gtk.Align.START }; - fullname_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL); + fullname_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); status_label = new Gtk.Label (null) { valign = Gtk.Align.START, halign = Gtk.Align.START }; - status_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); - status_label.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL); + status_label.add_css_class (Granite.STYLE_CLASS_DIM_LABEL); + status_label.add_css_class (Granite.STYLE_CLASS_SMALL_LABEL); logout_button = new Gtk.Button.from_icon_name ("system-log-out-symbolic") { tooltip_text = _("Log Out…"), @@ -67,10 +67,10 @@ halign = END, valign = CENTER }; - logout_button.get_style_context ().add_class ("circular"); + logout_button.add_css_class ("circular"); if (minimal) { - add (avatar); + append (avatar); } else { var grid = new Gtk.Grid () { column_spacing = 12 @@ -79,11 +79,10 @@ grid.attach (fullname_label, 1, 0, 1, 1); grid.attach (status_label, 1, 1, 1, 1); grid.attach (logout_button, 2, 0, 2, 2); - grid.show_all (); - get_style_context ().add_class ("menuitem"); + add_css_class ("menuitem"); - add (grid); + append (grid); } if (UserManager.get_usermanager ().is_loaded) { @@ -132,13 +131,12 @@ } } - private GLib.LoadableIcon? get_avatar_icon () { - var file = File.new_for_path (user.get_icon_file ()); - if (file.query_exists ()) { - return new FileIcon (file); + private Gdk.Texture? get_avatar_icon () { + try { + return Gdk.Texture.from_filename (user.get_icon_file ()); + } catch { + return null; } - - return null; } public async void update_state () { @@ -166,6 +164,6 @@ fullname_label.label = user.real_name; avatar.text = user.real_name; - avatar.set_loadable_icon (get_avatar_icon ()); + avatar.custom_image = get_avatar_icon (); } } diff --git a/src/Widgets/DarkModeToggle.vala b/src/Widgets/DarkModeToggle.vala index d58a548..3626aab 100644 --- a/src/Widgets/DarkModeToggle.vala +++ b/src/Widgets/DarkModeToggle.vala @@ -13,7 +13,7 @@ public class QuickSettings.DarkModeToggle: SettingsToggle { construct { icon_name = "dark-mode-symbolic"; settings_uri = "settings://desktop/appearance"; - get_style_context ().add_class ("color-scheme"); + add_css_class ("color-scheme"); var settings = new GLib.Settings ("io.elementary.settings-daemon.prefers-color-scheme"); diff --git a/src/Widgets/EndSessionDialog.vala b/src/Widgets/EndSessionDialog.vala index 204d04c..8149ee1 100644 --- a/src/Widgets/EndSessionDialog.vala +++ b/src/Widgets/EndSessionDialog.vala @@ -23,7 +23,6 @@ public class QuickSettings.EndSessionDialog : Granite.MessageDialog { public EndSessionDialogType dialog_type { get; construct; } private Gtk.CheckButton? updates_check_button; - private Gtk.EventControllerKey key_controller; public EndSessionDialog (QuickSettings.EndSessionDialogType type) { Object (dialog_type: type); @@ -50,10 +49,6 @@ public class QuickSettings.EndSessionDialog : Granite.MessageDialog { break; } - var image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.DIALOG) { - valign = Gtk.Align.START - }; - /* * the indicator does not have a separate item for restart, that's * why we show both shutdown and restart for the restart action @@ -71,7 +66,7 @@ public class QuickSettings.EndSessionDialog : Granite.MessageDialog { var cancel = (Gtk.Button) add_button (_("Cancel"), Gtk.ResponseType.CANCEL); var confirm = (Gtk.Button) add_button (button_text, Gtk.ResponseType.ACCEPT); - confirm.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); + confirm.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); if (dialog_type != LOGOUT) { bool has_prepared_updates = false; @@ -86,9 +81,8 @@ public class QuickSettings.EndSessionDialog : Granite.MessageDialog { active = true, label = _("Install pending system updates"), }; - updates_check_button.show (); - custom_bin.add (updates_check_button); + custom_bin.append (updates_check_button); } } @@ -104,13 +98,15 @@ public class QuickSettings.EndSessionDialog : Granite.MessageDialog { cancel_action.activate (null); }); - key_controller = new Gtk.EventControllerKey (this); + var key_controller = new Gtk.EventControllerKey (); key_controller.key_released.connect ((keyval, keycode, state) => { if (keyval == Gdk.Key.Escape) { cancel_action.activate (null); } }); + ((Gtk.Widget) this).add_controller (key_controller); + confirm.clicked.connect (() => { if (dialog_type == EndSessionDialogType.RESTART || dialog_type == EndSessionDialogType.SHUTDOWN) { if (set_offline_trigger (POWER_OFF)) { @@ -125,7 +121,7 @@ public class QuickSettings.EndSessionDialog : Granite.MessageDialog { destroy (); }); - realize.connect (() => Idle.add_once (() => init_wl ())); + ((Gtk.Widget) this).realize.connect (() => Idle.add_once (() => init_wl ())); } private bool set_offline_trigger (Pk.OfflineAction action) { @@ -156,9 +152,10 @@ public class QuickSettings.EndSessionDialog : Granite.MessageDialog { public void registry_handle_global (Wl.Registry wl_registry, uint32 name, string @interface, uint32 version) { if (@interface == "io_elementary_pantheon_shell_v1") { var desktop_shell = wl_registry.bind (name, ref Pantheon.Desktop.Shell.iface, uint32.min (version, 1)); - unowned var window = get_window (); - if (window is Gdk.Wayland.Window) { - unowned var wl_surface = ((Gdk.Wayland.Window) window).get_wl_surface (); + unowned var surface = get_surface (); + if (surface is Gdk.Wayland.Surface) { + unowned var wl_surface = ((Gdk.Wayland.Surface) surface).get_wl_surface (); + var extended_behavior = desktop_shell.get_extended_behavior (wl_surface); extended_behavior.set_keep_above (); extended_behavior.make_centered (); diff --git a/src/Widgets/PreventSleepToggle.vala b/src/Widgets/PreventSleepToggle.vala index 2298e5e..9981530 100644 --- a/src/Widgets/PreventSleepToggle.vala +++ b/src/Widgets/PreventSleepToggle.vala @@ -23,12 +23,12 @@ public class QuickSettings.PreventSleepToggle: SettingsToggle { if (_prevent_sleep_toggle.active && suspend_cookie == 0 && idle_cookie == 0) { suspend_cookie = application.inhibit ( - (Gtk.Window) get_toplevel (), + (Gtk.Window) get_root (), Gtk.ApplicationInhibitFlags.SUSPEND, "Prevent session from suspending" ); idle_cookie = application.inhibit ( - (Gtk.Window) get_toplevel (), + (Gtk.Window) get_root (), Gtk.ApplicationInhibitFlags.IDLE, "Prevent session from idle" ); diff --git a/src/Widgets/RotationToggle.vala b/src/Widgets/RotationToggle.vala index c2fab22..e557615 100644 --- a/src/Widgets/RotationToggle.vala +++ b/src/Widgets/RotationToggle.vala @@ -12,21 +12,20 @@ public class QuickSettings.RotationToggle: SettingsToggle { construct { var lock_image = new Gtk.Image (); - lock_image.get_style_context ().add_class ("lock"); + lock_image.add_css_class ("lock"); - var arrow_image = new Gtk.Image.from_icon_name ("quick-settings-rotation-arrow-symbolic", BUTTON); - arrow_image.get_style_context ().add_class ("arrow"); + var arrow_image = new Gtk.Image.from_icon_name ("quick-settings-rotation-arrow-symbolic"); + arrow_image.add_css_class ("arrow"); var overlay = new Gtk.Overlay () { + can_target = false, child = lock_image }; overlay.add_overlay (arrow_image); - overlay.set_overlay_pass_through (arrow_image, true); - overlay.set_overlay_pass_through (lock_image, true); button_child = overlay; - get_style_context ().add_class ("rotation"); + add_css_class ("rotation"); settings_uri = "settings://display"; var touchscreen_settings = new Settings ("org.gnome.settings-daemon.peripherals.touchscreen"); diff --git a/src/Widgets/SessionBox.vala b/src/Widgets/SessionBox.vala index adba17a..6696166 100644 --- a/src/Widgets/SessionBox.vala +++ b/src/Widgets/SessionBox.vala @@ -18,28 +18,28 @@ public class QuickSettings.SessionBox : Gtk.Box { var settings_button = new Gtk.Button.from_icon_name ("preferences-system-symbolic") { tooltip_text = _("System Settings…") }; - settings_button.get_style_context ().add_class ("circular"); + settings_button.add_css_class ("circular"); var suspend_button = new Gtk.Button.from_icon_name ("system-suspend-symbolic") { tooltip_text = _("Suspend") }; - suspend_button.get_style_context ().add_class ("circular"); + suspend_button.add_css_class ("circular"); var lock_button = new Gtk.Button.from_icon_name ("system-lock-screen-symbolic") { tooltip_text = _("Lock") }; - lock_button.get_style_context ().add_class ("circular"); + lock_button.add_css_class ("circular"); var shutdown_button = new Gtk.Button.from_icon_name ("system-shutdown-symbolic") { tooltip_text = _("Shut Down…") }; - shutdown_button.get_style_context ().add_class ("circular"); + shutdown_button.add_css_class ("circular"); spacing = 6; - add (settings_button); - add (suspend_button); - add (lock_button); - add (shutdown_button); + append (settings_button); + append (suspend_button); + append (lock_button); + append (shutdown_button); realize.connect (() => { popover = (Gtk.Popover) get_ancestor (typeof (Gtk.Popover)); @@ -134,7 +134,7 @@ public class QuickSettings.SessionBox : Gtk.Box { if (current_dialog != null) { if (current_dialog.dialog_type != type) { - current_dialog.destroy (); + current_dialog.close (); } else { return; } @@ -143,11 +143,12 @@ public class QuickSettings.SessionBox : Gtk.Box { unowned var server = EndSessionDialogServer.get_default (); current_dialog = new EndSessionDialog (type) { - transient_for = (Gtk.Window) get_toplevel () + transient_for = (Gtk.Window) get_root () }; - current_dialog.destroy.connect (() => { + current_dialog.close_request.connect (() => { server.closed (); current_dialog = null; + return Gdk.EVENT_PROPAGATE; }); current_dialog.cancelled.connect (() => { diff --git a/src/Widgets/SettingsToggle.vala b/src/Widgets/SettingsToggle.vala index ecd84a0..486714f 100644 --- a/src/Widgets/SettingsToggle.vala +++ b/src/Widgets/SettingsToggle.vala @@ -11,13 +11,13 @@ public class QuickSettings.SettingsToggle : Gtk.FlowBoxChild { public Gtk.Widget button_child { set { - button.remove (button.get_child ()); + button.get_child ().unparent (); button.child = value; + button.add_css_class ("image-button"); } } private Gtk.ToggleButton button; - private Gtk.GestureMultiPress middle_click_gesture; public SettingsToggle (string label) { Object ( @@ -26,11 +26,8 @@ public class QuickSettings.SettingsToggle : Gtk.FlowBoxChild { } construct { - var image = new Gtk.Image (); - button = new Gtk.ToggleButton () { - halign = CENTER, - image = image + halign = CENTER }; var label_widget = new Gtk.Label (label) { @@ -40,20 +37,20 @@ public class QuickSettings.SettingsToggle : Gtk.FlowBoxChild { max_width_chars = 13, mnemonic_widget = button }; - label_widget.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL); + label_widget.add_css_class (Granite.STYLE_CLASS_SMALL_LABEL); var box = new Gtk.Box (VERTICAL, 3); - box.add (button); - box.add (label_widget); + box.append (button); + box.append (label_widget); can_focus = false; child = box; button.bind_property ("active", this, "active", SYNC_CREATE | BIDIRECTIONAL); - bind_property ("icon-name", image, "icon-name"); + bind_property ("icon-name", button, "icon-name", SYNC_CREATE); - middle_click_gesture = new Gtk.GestureMultiPress (button) { + var middle_click_gesture = new Gtk.GestureClick () { button = Gdk.BUTTON_MIDDLE }; middle_click_gesture.pressed.connect (() => { @@ -66,5 +63,7 @@ public class QuickSettings.SettingsToggle : Gtk.FlowBoxChild { critical ("Failed to open system settings: %s", e.message); } }); + + button.add_controller (middle_click_gesture); } } diff --git a/src/Widgets/TextScale.vala b/src/Widgets/TextScale.vala index ce847a2..2a8395f 100644 --- a/src/Widgets/TextScale.vala +++ b/src/Widgets/TextScale.vala @@ -14,9 +14,10 @@ public class QuickSettings.TextScale : Gtk.Box { construct { zoom_out_button = new Gtk.Button.from_icon_name ("format-text-smaller-symbolic") { - tooltip_text = _("Decrease text size") + tooltip_text = _("Decrease text size"), + valign = CENTER }; - zoom_out_button.get_style_context ().add_class ("circular"); + zoom_out_button.add_css_class ("circular"); var zoom_adjustment = new Gtk.Adjustment (-1, 0.75, 1.75, 0.05, 0, 0); @@ -28,14 +29,15 @@ public class QuickSettings.TextScale : Gtk.Box { zoom_scale.add_mark (1.5, BOTTOM, null); zoom_in_button = new Gtk.Button.from_icon_name ("format-text-larger-symbolic") { - tooltip_text = _("Increase text size") + tooltip_text = _("Increase text size"), + valign = CENTER }; - zoom_in_button.get_style_context ().add_class ("circular"); + zoom_in_button.add_css_class ("circular"); - get_style_context ().add_class ("font-size"); - add (zoom_out_button); - add (zoom_scale); - add (zoom_in_button); + add_css_class ("font-size"); + append (zoom_out_button); + append (zoom_scale); + append (zoom_in_button); interface_settings = new Settings ("org.gnome.desktop.interface"); interface_settings.bind ("text-scaling-factor", zoom_adjustment, "value", GET); diff --git a/src/Widgets/UserList.vala b/src/Widgets/UserList.vala index 8384f38..18ebdd5 100644 --- a/src/Widgets/UserList.vala +++ b/src/Widgets/UserList.vala @@ -31,20 +31,20 @@ }; listbox.set_sort_func (sort_func); - var listbox_scrolled = new Gtk.ScrolledWindow (null, null) { + var listbox_scrolled = new Gtk.ScrolledWindow () { hscrollbar_policy = NEVER, max_content_height = 200, propagate_natural_height = true, child = listbox }; - var settings_button = new Gtk.ModelButton () { + var settings_button = new Wingpanel.PopoverMenuItem () { text = _("User Accounts Settings…") }; var user_list_vbox = new Gtk.Box (VERTICAL, 0); - user_list_vbox.add (new Gtk.Separator (HORIZONTAL)); - user_list_vbox.add (listbox_scrolled); + user_list_vbox.append (new Gtk.Separator (HORIZONTAL)); + user_list_vbox.append (listbox_scrolled); user_list_revealer = new Gtk.Revealer () { child = user_list_vbox, @@ -52,10 +52,10 @@ }; orientation = VERTICAL; - add (current_user); - add (user_list_revealer); - add (new Gtk.Separator (HORIZONTAL)); - add (settings_button); + append (current_user); + append (user_list_revealer); + append (new Gtk.Separator (HORIZONTAL)); + append (settings_button); if (UserManager.get_usermanager ().is_loaded) { init_users (); @@ -171,7 +171,7 @@ user_map[uid] = new UserRow (user); user_map[uid].show (); - listbox.add (user_map[uid]); + listbox.append (user_map[uid]); user_list_revealer.reveal_child = listbox.get_row_at_index (0) != null; } @@ -188,7 +188,7 @@ user_map[GUEST_USER_UID] = new UserRow.guest (); user_map[GUEST_USER_UID].show (); - listbox.add (user_map[GUEST_USER_UID]); + listbox.append (user_map[GUEST_USER_UID]); user_list_revealer.reveal_child = listbox.get_row_at_index (0) != null; } diff --git a/src/Widgets/UserRow.vala b/src/Widgets/UserRow.vala index 87fdd40..96208ae 100644 --- a/src/Widgets/UserRow.vala +++ b/src/Widgets/UserRow.vala @@ -16,7 +16,7 @@ public class QuickSettings.UserRow : Gtk.ListBoxRow { } } - private Hdy.Avatar avatar; + private Adw.Avatar avatar; private Gtk.Label fullname_label; private Gtk.Label status_label; @@ -37,17 +37,17 @@ public class QuickSettings.UserRow : Gtk.ListBoxRow { valign = Gtk.Align.END, halign = Gtk.Align.START }; - fullname_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL); + fullname_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); status_label = new Gtk.Label (null) { valign = Gtk.Align.START, halign = Gtk.Align.START }; - status_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); - status_label.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL); + status_label.add_css_class (Granite.STYLE_CLASS_DIM_LABEL); + status_label.add_css_class (Granite.STYLE_CLASS_SMALL_LABEL); if (user == null) { - avatar = new Hdy.Avatar (ICON_SIZE, null, false); + avatar = new Adw.Avatar (ICON_SIZE, null, false); // We want to use the user's accent, not a random color unowned Gtk.StyleContext avatar_context = avatar.get_style_context (); @@ -66,8 +66,9 @@ public class QuickSettings.UserRow : Gtk.ListBoxRow { avatar_context.remove_class ("color13"); avatar_context.remove_class ("color14"); } else { - avatar = new Hdy.Avatar (ICON_SIZE, fullname, true); - avatar.set_loadable_icon (get_avatar_icon ()); + avatar = new Adw.Avatar (ICON_SIZE, fullname, true) { + custom_image = get_avatar_icon () + }; user.changed.connect (() => { update_state.begin (); @@ -80,21 +81,19 @@ public class QuickSettings.UserRow : Gtk.ListBoxRow { grid.attach (avatar, 0, 0, 1, 2); grid.attach (fullname_label, 1, 0, 1, 1); grid.attach (status_label, 1, 1, 1, 1); - grid.show_all (); - get_style_context ().add_class ("menuitem"); + add_css_class ("menuitem"); child = grid; update_state.begin (); } - private GLib.LoadableIcon? get_avatar_icon () { - var file = File.new_for_path (user.get_icon_file ()); - if (file.query_exists ()) { - return new FileIcon (file); + private Gdk.Texture? get_avatar_icon () { + try { + return Gdk.Texture.from_filename (user.get_icon_file ()); + } catch { + return null; } - - return null; } public async UserState get_user_state () { @@ -120,7 +119,7 @@ public class QuickSettings.UserRow : Gtk.ListBoxRow { if (user != null) { fullname_label.label = user.real_name; avatar.text = user.real_name; - avatar.set_loadable_icon (get_avatar_icon ()); + avatar.custom_image = get_avatar_icon (); sensitive = !user.locked; if (user.locked) { @@ -129,7 +128,5 @@ public class QuickSettings.UserRow : Gtk.ListBoxRow { } ((Gtk.ListBox) parent).invalidate_sort (); - - show_all (); } } diff --git a/src/meson.build b/src/meson.build index f4becd8..da31cb4 100644 --- a/src/meson.build +++ b/src/meson.build @@ -36,11 +36,11 @@ shared_module( gresource, sources, dependencies: [ - gdk_wl_dep, glib_dep, gobject_dep, granite_dep, gtk_dep, + gtk_wayland_dep, handy_dep, wingpanel_dep, packagekit_dep, diff --git a/vapi/gdk-wayland-3.0.vapi b/vapi/gdk-wayland-3.0.vapi deleted file mode 100644 index f38aab4..0000000 --- a/vapi/gdk-wayland-3.0.vapi +++ /dev/null @@ -1,16 +0,0 @@ -[CCode (cheader_filename = "gdk/gdkwayland.h")] -namespace Gdk.Wayland { - [CCode (type_id = "GDK_TYPE_WAYLAND_WINDOW", type_check_function = "GDK_IS_WAYLAND_WINDOW")] - public class Window : Gdk.Window { - protected Window (); - - public unowned Wl.Surface get_wl_surface (); - } - - [CCode (type_id = "GDK_TYPE_WAYLAND_DISPLAY", type_check_function = "GDK_IS_WAYLAND_DISPLAY")] - public class Display : Gdk.Display { - protected Display (); - - public unowned Wl.Display get_wl_display (); - } -}