diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 60011682..231894cf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: - name: Install Dependencies run: | apt update - apt install -y gobject-introspection libglib2.0-dev libgranite-dev libwingpanel-dev meson valac + apt install -y gobject-introspection libglib2.0-dev libgranite-7-dev libwingpanel-8-dev meson valac - name: Build env: DESTDIR: out diff --git a/README.md b/README.md index 65d7d894..d87b6304 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ You'll need the following dependencies: gobject-introspection libglib2.0-dev - libgranite-dev >= 6.0.0 - libwingpanel-dev + libgranite-7-dev >= 7.0.0 + libwingpanel-8-dev meson >= 0.58.0 valac diff --git a/data/bluetooth.metainfo.xml.in b/data/bluetooth.metainfo.xml.in index 4a964505..6ffa2ca3 100644 --- a/data/bluetooth.metainfo.xml.in +++ b/data/bluetooth.metainfo.xml.in @@ -1,8 +1,8 @@ - io.elementary.wingpanel.bluetooth - bluetooth-indicator + io.elementary.panel.bluetooth + io.elementary.panel.bluetooth io.elementary.wingpanel CC0-1.0 LGPL-2.1 diff --git a/meson.build b/meson.build index 534476b4..ff461079 100644 --- a/meson.build +++ b/meson.build @@ -5,7 +5,7 @@ project( meson_version : '>= 0.58' ) -gettext_name = meson.project_name() + '-indicator' +gettext_name = 'io.elementary.panel.' + meson.project_name() gnome = import('gnome') i18n = import('i18n') @@ -15,7 +15,7 @@ libdir = prefix / get_option('libdir') add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format(gettext_name), language:'c') -add_project_arguments('-DG_LOG_DOMAIN="io.elementary.wingpanel.bluetooth"', language:'c') +add_project_arguments('-DG_LOG_DOMAIN="io.elementary.panel.bluetooth"', language:'c') gresource = gnome.compile_resources( 'gresource', @@ -23,7 +23,7 @@ gresource = gnome.compile_resources( source_dir: 'data' ) -wingpanel_dep = dependency('wingpanel') +wingpanel_dep = dependency('wingpanel-8') wingpanel_indicatorsdir = wingpanel_dep.get_variable('indicatorsdir', pkgconfig_define: ['libdir', libdir]) config_data = configuration_data() @@ -52,8 +52,8 @@ shared_module( dependencies: [ dependency('glib-2.0'), dependency('gobject-2.0'), - dependency('granite', version: '>=6.0.0'), - dependency('gtk+-3.0'), + dependency('granite-7', version: '>=7.0.0'), + dependency('gtk4'), wingpanel_dep ], install: true, diff --git a/po/bluetooth-indicator.pot b/po/io.elementary.panel.bluetooth.pot similarity index 100% rename from po/bluetooth-indicator.pot rename to po/io.elementary.panel.bluetooth.pot diff --git a/src/Widgets/Device.vala b/src/Widgets/Device.vala index 0c1ea5d7..db488519 100644 --- a/src/Widgets/Device.vala +++ b/src/Widgets/Device.vala @@ -55,11 +55,11 @@ public class BluetoothIndicator.Widgets.Device : Gtk.ListBoxRow { size_group.add_widget (status_label); size_group.add_widget (spinner); - icon_image = new Gtk.Image.from_icon_name (device.icon == null ? DEFAULT_ICON : device.icon, Gtk.IconSize.DIALOG) { + icon_image = new Gtk.Image.from_icon_name (device.icon == null ? DEFAULT_ICON : device.icon) { pixel_size = 48 }; - status_image = new Gtk.Image.from_icon_name ("emblem-disabled", Gtk.IconSize.MENU) { + status_image = new Gtk.Image.from_icon_name ("emblem-disabled") { halign = END, valign = END }; @@ -118,7 +118,7 @@ public class BluetoothIndicator.Widgets.Device : Gtk.ListBoxRow { ((DBusProxy) device).g_properties_changed.connect (update_status); update_status (); - get_style_context ().add_class (Gtk.STYLE_CLASS_MENUITEM); + add_css_class (Granite.STYLE_CLASS_MENUITEM); selectable = false; obex_manager.active_transfers.foreach ((transfer, address)=> { on_obex_transfer_added (address, transfer); @@ -202,11 +202,11 @@ public class BluetoothIndicator.Widgets.Device : Gtk.ListBoxRow { } return; } - if (spinner.active) { + if (spinner.spinning) { return; } - spinner.active = true; + spinner.spinning = true; status_image.icon_name = "emblem-mixed"; try { if (!device.connected) { @@ -222,7 +222,7 @@ public class BluetoothIndicator.Widgets.Device : Gtk.ListBoxRow { status_image.icon_name = "emblem-error"; } - spinner.active = false; + spinner.spinning = false; } private void update_status () { diff --git a/src/Widgets/DisplayWidget.vala b/src/Widgets/DisplayWidget.vala index 545e7ae4..8144f6d5 100644 --- a/src/Widgets/DisplayWidget.vala +++ b/src/Widgets/DisplayWidget.vala @@ -3,10 +3,9 @@ * SPDX-FileCopyrightText: 2015-2025 elementary, Inc. (https://elementary.io) */ -public class BluetoothIndicator.Widgets.DisplayWidget : Gtk.Bin { +public class BluetoothIndicator.Widgets.DisplayWidget : Granite.Bin { public BluetoothIndicator.Services.ObjectManager object_manager { get; construct; } - private Gtk.GestureMultiPress gesture_click; private Gtk.Spinner spinner; public DisplayWidget (BluetoothIndicator.Services.ObjectManager object_manager) { @@ -20,15 +19,15 @@ public class BluetoothIndicator.Widgets.DisplayWidget : Gtk.Bin { // 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"); var provider = new Gtk.CssProvider (); provider.load_from_resource ("io/elementary/wingpanel/bluetooth/indicator.css"); - Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + Gtk.StyleContext.add_provider_for_display (Gdk.Display.get_default (), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); - spinner.get_style_context ().add_class ("bluetooth-icon"); - spinner.get_style_context ().add_class ("disabled"); + spinner.add_css_class ("bluetooth-icon"); + spinner.add_css_class ("disabled"); object_manager.global_state_changed.connect ((state, connected) => { set_icon (); @@ -40,7 +39,7 @@ public class BluetoothIndicator.Widgets.DisplayWidget : Gtk.Bin { object_manager.notify["retrieve-finished"].connect (set_icon); } - gesture_click = new Gtk.GestureMultiPress (this) { + var gesture_click = new Gtk.GestureClick () { button = Gdk.BUTTON_MIDDLE }; gesture_click.pressed.connect (() => { @@ -49,6 +48,8 @@ public class BluetoothIndicator.Widgets.DisplayWidget : Gtk.Bin { !object_manager.settings.get_boolean ("bluetooth-enabled") ); }); + + add_controller (gesture_click); } private void set_icon () { @@ -67,18 +68,18 @@ public class BluetoothIndicator.Widgets.DisplayWidget : Gtk.Bin { string context; if (state) { - spinner.get_style_context ().remove_class ("disabled"); + spinner.remove_css_class ("disabled"); context = _("Middle-click to turn Bluetooth off"); if (connected) { - spinner.get_style_context ().add_class ("paired"); + spinner.add_css_class ("paired"); description = _("Bluetooth connected"); } else { - spinner.get_style_context ().remove_class ("paired"); + spinner.remove_css_class ("paired"); description = _("Bluetooth is on"); } } else { - spinner.get_style_context ().remove_class ("paired"); - spinner.get_style_context ().add_class ("disabled"); + spinner.remove_css_class ("paired"); + spinner.add_css_class ("disabled"); description = _("Bluetooth is off"); context = _("Middle-click to turn Bluetooth on"); } diff --git a/src/Widgets/PopoverWidget.vala b/src/Widgets/PopoverWidget.vala index 9209cb5a..46080b80 100644 --- a/src/Widgets/PopoverWidget.vala +++ b/src/Widgets/PopoverWidget.vala @@ -32,12 +32,12 @@ public class BluetoothIndicator.Widgets.PopoverWidget : Gtk.Box { main_switch = new Granite.SwitchModelButton (_("Bluetooth")) { active = object_manager.get_global_state () }; - main_switch.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL); + main_switch.add_css_class (Granite.STYLE_CLASS_H4_LABEL); devices_list = new Gtk.ListBox (); devices_list.set_sort_func ((Gtk.ListBoxSortFunc) compare_rows); - var scroll_box = new Gtk.ScrolledWindow (null, null) { + var scroll_box = new Gtk.ScrolledWindow () { child = devices_list, hscrollbar_policy = NEVER, max_content_height = 512, @@ -50,32 +50,32 @@ public class BluetoothIndicator.Widgets.PopoverWidget : Gtk.Box { }; var revealer_content = new Gtk.Box (VERTICAL, 0); - revealer_content.add (revealer_content_separator); - revealer_content.add (scroll_box); + revealer_content.append (revealer_content_separator); + revealer_content.append (scroll_box); revealer = new Gtk.Revealer () { child = revealer_content }; - var show_settings_button = new Gtk.ModelButton (); - show_settings_button.text = _("Bluetooth Settings…"); + var show_settings_button = new Wingpanel.PopoverMenuItem () { + text = _("Bluetooth Settings…") + }; - add (main_switch); - add (revealer); + append (main_switch); + append (revealer); if (is_in_session) { var settings_button_separator = new Gtk.Separator (HORIZONTAL) { margin_top = 3, margin_bottom = 3 }; - add (settings_button_separator); - add (show_settings_button); + append (settings_button_separator); + append (show_settings_button); } main_switch.active = object_manager.get_global_state (); update_ui_state (object_manager.get_global_state ()); - show_all (); devices_list.row_activated.connect ((row) => { ((Widgets.Device) row).toggle_device.begin (); @@ -158,8 +158,7 @@ public class BluetoothIndicator.Widgets.PopoverWidget : Gtk.Box { private void add_device (BluetoothIndicator.Services.Device device) { var device_widget = new Widgets.Device (device, obex_manager); - devices_list.add (device_widget); - devices_list.show_all (); + devices_list.append (device_widget); update_devices_box_visible ();