Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions data/bluetooth.metainfo.xml.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2019-2023 elementary, Inc. <contact@elementary.io> -->
<component type="addon">
<id>io.elementary.wingpanel.bluetooth</id>
<translation type="gettext">bluetooth-indicator</translation>
<id>io.elementary.panel.bluetooth</id>
<translation type="gettext">io.elementary.panel.bluetooth</translation>
<extends>io.elementary.wingpanel</extends>
<metadata_license>CC0-1.0</metadata_license>
<project_license>LGPL-2.1</project_license>
Expand Down
10 changes: 5 additions & 5 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -15,15 +15,15 @@ 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',
'data' / 'gresource.xml',
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()
Expand Down Expand Up @@ -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,
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions src/Widgets/Device.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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 () {
Expand Down
25 changes: 13 additions & 12 deletions src/Widgets/DisplayWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 ();
Expand All @@ -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 (() => {
Expand All @@ -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 () {
Expand All @@ -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");
}
Expand Down
25 changes: 12 additions & 13 deletions src/Widgets/PopoverWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 ();
Expand Down Expand Up @@ -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 ();

Expand Down
Loading