Skip to content
Draft
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 libgranite-dev meson valac
apt install -y libgranite-7-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 @@ -7,8 +7,8 @@ Send and receive files via Bluetooth

You'll need the following dependencies:

libgranite-dev >= 6.0.0
libgtk3-dev
libgranite-7-dev
libgtk4-dev
meson
valac

Expand Down
4 changes: 2 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()), lan
gnome = import('gnome')
i18n = import('i18n')

granite_dep = dependency ('granite')
gtk_dep = dependency ('gtk+-3.0')
granite_dep = dependency ('granite-7')
gtk_dep = dependency ('gtk4')
posix_dep = meson.get_compiler('vala').find_library('posix')

subdir('data')
Expand Down
6 changes: 3 additions & 3 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class BluetoothApp : Gtk.Application {

if (bt_scan == null) {
bt_scan = new ScanDialog (this, object_manager);
bt_scan.destroy.connect (() => {
((Gtk.Widget) bt_scan).destroy.connect (() => {
bt_scan = null;
});

Expand All @@ -58,7 +58,7 @@ public class BluetoothApp : Gtk.Application {
bt_sender.add_files (files, device);
bt_senders.append (bt_sender);
bt_sender.present ();
bt_sender.destroy.connect (() => {
((Gtk.Widget) bt_sender).destroy.connect (() => {
bt_senders.foreach ((sender) => {
if (sender.device == bt_sender.device) {
bt_senders.remove_link (bt_senders.find (sender));
Expand Down Expand Up @@ -234,7 +234,7 @@ public class BluetoothApp : Gtk.Application {

bt_receiver = new ReceiverDialog (this);
bt_receivers.append (bt_receiver);
bt_receiver.destroy.connect (() => {
((Gtk.Widget) bt_receiver).destroy.connect (() => {
bt_receivers.foreach ((receiver) => {
if (receiver.transfer.session == bt_receiver.session) {
bt_receivers.remove_link (bt_receivers.find (receiver));
Expand Down
11 changes: 6 additions & 5 deletions src/Dialog/DeviceRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,19 @@ public class DeviceRow : Gtk.ListBoxRow {
}

construct {
var image = new Gtk.Image.from_icon_name (device.icon ?? "bluetooth", DND);
var image = new Gtk.Image.from_icon_name (device.icon ?? "bluetooth") {
icon_size = LARGE
};

state = new Gtk.Image.from_icon_name ("emblem-disabled", MENU) {
state = new Gtk.Image.from_icon_name ("emblem-disabled") {
halign = END,
valign = END
};

var state_label = new Gtk.Label (null) {
xalign = 0
};
state_label.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL);
state_label.add_css_class (Granite.CssClass.SMALL);

var overlay = new Gtk.Overlay () {
child = image,
Expand Down Expand Up @@ -81,7 +83,6 @@ public class DeviceRow : Gtk.ListBoxRow {
grid.attach (send_button, 4, 0, 1, 2);

child = grid;
show_all ();

set_sensitive (adapter.powered);
set_status (device.connected);
Expand Down Expand Up @@ -114,7 +115,7 @@ public class DeviceRow : Gtk.ListBoxRow {

send_button.clicked.connect (() => {
send_file (device);
get_toplevel ().destroy ();
get_root ().destroy ();
});
}

Expand Down
14 changes: 7 additions & 7 deletions src/Dialog/ReceiverDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public class ReceiverDialog : Granite.Dialog {
notification = new GLib.Notification ("bluetooth");
notification.set_priority (NotificationPriority.NORMAL);

var icon_image = new Gtk.Image.from_icon_name ("io.elementary.bluetooth", Gtk.IconSize.DIALOG) {
var icon_image = new Gtk.Image.from_icon_name ("io.elementary.bluetooth") {
pixel_size = 48,
valign = END,
halign = END
};
Expand All @@ -54,7 +55,7 @@ public class ReceiverDialog : Granite.Dialog {
wrap = true,
xalign = 0
};
device_label.get_style_context ().add_class ("primary");
device_label.add_css_class ("primary");

directory_label = new Gtk.Label (null) {
max_width_chars = 45,
Expand Down Expand Up @@ -101,14 +102,13 @@ public class ReceiverDialog : Granite.Dialog {
message_grid.attach (rate_label, 1, 3);
message_grid.attach (progressbar, 1, 4);
message_grid.attach (progress_label, 1, 5);
message_grid.show_all ();

get_content_area ().add (message_grid);
get_content_area ().append (message_grid);

add_button (_("Close"), Gtk.ResponseType.CLOSE);

var suggested_button = add_button (_("Reject"), Gtk.ResponseType.ACCEPT);
suggested_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION);
suggested_button.add_css_class (Granite.CssClass.DESTRUCTIVE);

response.connect ((response_id) => {
if (response_id == Gtk.ResponseType.ACCEPT) {
Expand All @@ -119,11 +119,11 @@ public class ReceiverDialog : Granite.Dialog {
}
destroy ();
} else {
hide_on_delete ();
hide ();
}
});

delete_event.connect (() => {
close_request.connect (() => {
if (transfer.status == "active") {
return hide_on_delete ();
} else {
Expand Down
28 changes: 13 additions & 15 deletions src/Dialog/ScanDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public class ScanDialog : Granite.Dialog {
}

construct {
var icon_image = new Gtk.Image.from_icon_name ("io.elementary.bluetooth", Gtk.IconSize.DIALOG) {
var icon_image = new Gtk.Image.from_icon_name ("io.elementary.bluetooth") {
pixel_size = 48,
valign = CENTER,
halign = CENTER
};
Expand All @@ -34,7 +35,7 @@ public class ScanDialog : Granite.Dialog {
wrap = true,
xalign = 0
};
title_label.get_style_context ().add_class ("primary");
title_label.add_css_class ("primary");

var info_label = new Gtk.Label (_("Select a Bluetooth Device Below to Send Files")) {
max_width_chars = 45,
Expand All @@ -43,12 +44,9 @@ public class ScanDialog : Granite.Dialog {
xalign = 0
};

var empty_alert = new Granite.Widgets.AlertView (
_("No Devices Found"),
_("Please ensure that your devices are visible and ready for pairing."),
""
);
empty_alert.show_all ();
var empty_alert = new Granite.Placeholder (_("No Devices Found")) {
description = _("Please ensure that your devices are visible and ready for pairing.")
};

list_box = new Gtk.ListBox () {
activate_on_single_click = true,
Expand All @@ -57,8 +55,9 @@ public class ScanDialog : Granite.Dialog {
list_box.set_sort_func ((Gtk.ListBoxSortFunc) compare_rows);
list_box.set_placeholder (empty_alert);

var scrolled = new Gtk.ScrolledWindow (null, null) {
var scrolled = new Gtk.ScrolledWindow () {
child = list_box,
has_frame = true,
hexpand = true,
vexpand = true,
hscrollbar_policy = NEVER,
Expand All @@ -67,13 +66,12 @@ public class ScanDialog : Granite.Dialog {
max_content_height = 350,
propagate_natural_height = true
};
scrolled.get_style_context ().add_class (Gtk.STYLE_CLASS_FRAME);

var overlay = new Gtk.Overlay () {
child = scrolled
};

var overlaybar = new Granite.Widgets.OverlayBar (overlay) {
var overlaybar = new Granite.OverlayBar (overlay) {
label = _("Discovering")
};

Expand All @@ -87,10 +85,10 @@ public class ScanDialog : Granite.Dialog {
var content_box = new Gtk.Box (VERTICAL, 0) {
valign = CENTER
};
content_box.add (image_grid);
content_box.add (overlay);
content_box.append (image_grid);
content_box.append (overlay);

get_content_area ().add (content_box);
get_content_area ().append (content_box);

manager.device_added.connect (add_device);
manager.device_removed.connect (device_removed);
Expand Down Expand Up @@ -124,7 +122,7 @@ public class ScanDialog : Granite.Dialog {
}

var row = new DeviceRow (device, manager.get_adapter_from_path (device.adapter));
list_box.add (row);
list_box.append (row);

if (list_box.get_selected_row () == null) {
list_box.select_row (row);
Expand Down
24 changes: 12 additions & 12 deletions src/Dialog/SenderDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public class SenderDialog : Granite.Dialog {
construct {
liststore = new Gtk.ListStore (1, typeof (File));

var icon_image = new Gtk.Image.from_icon_name ("io.elementary.bluetooth", Gtk.IconSize.DIALOG) {
var icon_image = new Gtk.Image.from_icon_name ("io.elementary.bluetooth") {
pixel_size = 48,
valign = END,
halign = END
};
Expand All @@ -59,7 +60,7 @@ public class SenderDialog : Granite.Dialog {
wrap = true,
xalign = 0
};
path_label.get_style_context ().add_class ("primary");
path_label.add_css_class ("primary");

device_label = new Gtk.Label (GLib.Markup.printf_escaped ("<b>%s</b>:", _("To"))) {
max_width_chars = 45,
Expand Down Expand Up @@ -106,14 +107,13 @@ public class SenderDialog : Granite.Dialog {
message_grid.attach (rate_label, 1, 3);
message_grid.attach (progressbar, 1, 4);
message_grid.attach (progress_label, 1, 5);
message_grid.show_all ();

get_content_area ().add (message_grid);
get_content_area ().append (message_grid);

add_button (_("Close"), Gtk.ResponseType.CLOSE);

var reject_transfer = add_button (_("Cancel"), Gtk.ResponseType.CANCEL);
reject_transfer.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION);
reject_transfer.add_css_class (Granite.CssClass.DESTRUCTIVE);

response.connect ((response_id) => {
if (response_id == Gtk.ResponseType.CANCEL) {
Expand All @@ -127,17 +127,17 @@ public class SenderDialog : Granite.Dialog {
remove_session.begin ();
}
}
destroy ();

} else {
if (transfer.status == "active") {
hide_on_delete ();
hide ();
} else {
destroy ();
}
}
});

delete_event.connect (() => {
close_request.connect (() => {
if (transfer.status == "active") {
return hide_on_delete ();
} else {
Expand Down Expand Up @@ -241,7 +241,7 @@ public class SenderDialog : Granite.Dialog {
);
send_file.begin ();
} catch (Error e) {
hide_on_delete ();
hide ();
var bt_retry = new Granite.MessageDialog (
_("Connecting to '%s' failed.").printf (device.alias),
"%s\n%s".printf (
Expand All @@ -257,7 +257,7 @@ public class SenderDialog : Granite.Dialog {
};
bt_retry.add_button (_("Cancel"), Gtk.ResponseType.CANCEL);
var suggested_button = bt_retry.add_button (_("Retry"), Gtk.ResponseType.ACCEPT);
suggested_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
suggested_button.add_css_class (Granite.CssClass.SUGGESTED);

bt_retry.response.connect ((response_id) => {
if (response_id == Gtk.ResponseType.ACCEPT) {
Expand Down Expand Up @@ -308,7 +308,7 @@ public class SenderDialog : Granite.Dialog {
private void tranfer_progress () {
switch (transfer.status) {
case "error":
hide_on_delete ();
hide ();
var bt_retry = new Granite.MessageDialog (
_("The transfer of '%s' failed.").printf (file_path.get_basename ()),
"%s\n%s".printf (
Expand All @@ -324,7 +324,7 @@ public class SenderDialog : Granite.Dialog {
};
bt_retry.add_button (_("Cancel"), Gtk.ResponseType.CANCEL);
var suggested_button = bt_retry.add_button (_("Retry"), Gtk.ResponseType.ACCEPT);
suggested_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
suggested_button.add_css_class (Granite.CssClass.SUGGESTED);

bt_retry.response.connect ((response_id) => {
if (response_id == Gtk.ResponseType.ACCEPT) {
Expand Down
Loading