widgets: redesign backlight and volume with unified submenu style

parent 16e371f2
.widget-backlight {
padding: 0;
margin: 5px 0px;
border-radius: var(--window-radius);
&.expanded {
background: var(--dialog-bg-color);
box-shadow: 0px 0px 10px var(--headerbar-shade-color);
border: 1px solid var(--border-color);
}
.image-button {
background: transparent;
}
revealer > box > box {
padding: 4px 14px;
}
}
......@@ -59,7 +59,7 @@
}
}
.quick-settings-submenu {
.submenu {
border-radius: var(--window-radius);
margin: 5px 0;
padding: 4px 0;
......@@ -67,23 +67,6 @@
border: 1px solid var(--border-color);
box-shadow: 0px 0px 10px var(--headerbar-shade-color);
.submenu-header {
padding: 5px 8px;
.submenu-header-icon {
background: var(--accent-bg-color);
color: var(--accent-fg-color);
border-radius: 100%;
padding: 8px;
-gtk-icon-size: 24px;
}
.submenu-header-label {
font-weight: bold;
font-size: 1.4rem;
}
}
button {
margin: 2px 4px;
}
......@@ -93,3 +76,20 @@
margin-bottom: 4px;
}
}
.submenu-header {
padding: 5px 8px;
}
.submenu-header-icon {
background: var(--accent-bg-color);
color: var(--accent-fg-color);
border-radius: 100%;
padding: 8px;
-gtk-icon-size: 24px;
}
.submenu-header-label {
font-weight: bold;
font-size: 1.4rem;
}
.widget-volume {
padding: 0;
margin: 5px 0px;
border-radius: var(--window-radius);
&.expanded {
background: var(--dialog-bg-color);
box-shadow: 0px 0px 10px var(--headerbar-shade-color);
border: 1px solid var(--border-color);
}
& > box {
padding: 0 10px;
margin: 0 0 0 3px;
}
.image-button {
background: transparent;
......@@ -21,12 +9,13 @@
.per-app-volume {
background: transparent;
padding: 0 10px;
padding: 0;
margin: 0;
border-radius: var(--window-radius);
row {
background: transparent;
padding: 4px 14px;
}
}
......
......@@ -7,17 +7,45 @@ template $XimperShellNotificationCenterWidgetsBacklight:
Box topbar {
orientation: horizontal;
spacing: 6;
margin-start: 10;
margin-end: 10;
styles ["submenu-header"]
Image topbar_icon {
icon-name: "display-brightness-symbolic";
valign: center;
}
Label topbar_label {
label: _("Brightness");
Stack middle_stack {
hexpand: true;
halign: start;
transition-type: crossfade;
transition-duration: 150;
StackPage {
name: "slider";
child: Scale compact_scale {
orientation: horizontal;
hexpand: true;
draw-value: false;
round-digits: 0;
adjustment: Adjustment {
lower: 0;
upper: 100;
step-increment: 1;
};
};
}
StackPage {
name: "header";
child: Label topbar_label {
label: _("Brightness");
hexpand: true;
halign: start;
styles ["submenu-header-label"]
};
}
}
ToggleButton reveal_btn {
......@@ -32,30 +60,11 @@ template $XimperShellNotificationCenterWidgetsBacklight:
child: Box content {
orientation: vertical;
Box displays_box {
orientation: vertical;
margin-start: 10;
margin-end: 10;
}
Separator separator {
margin-top: 8;
margin-bottom: 8;
}
Box kbd_box {
orientation: vertical;
margin-start: 10;
margin-end: 10;
}
};
}
Box single_source_box {
orientation: vertical;
visible: false;
margin-start: 10;
margin-end: 10;
}
}
......@@ -6,23 +6,47 @@ template $XimperShellNotificationCenterWidgetsVolume:
Box main_volume_slider_container {
orientation: horizontal;
spacing: 6;
styles ["submenu-header"]
Image icon_widget {
icon-name: "audio-volume-high-symbolic";
valign: center;
}
Scale slider {
orientation: horizontal;
Stack middle_stack {
hexpand: true;
draw-value: false;
transition-type: crossfade;
transition-duration: 150;
StackPage {
name: "slider";
child: Scale slider {
orientation: horizontal;
hexpand: true;
draw-value: false;
adjustment: Adjustment {
lower: 0;
upper: 100;
step-increment: 1;
};
value-changed => $on_slider_changed();
};
}
adjustment: Adjustment {
lower: 0;
upper: 100;
step-increment: 1;
};
StackPage {
name: "header";
child: Label header_label {
label: _("Volume");
hexpand: true;
halign: start;
value-changed => $on_slider_changed();
styles ["submenu-header-label"]
};
}
}
ToggleButton reveal_button {
......@@ -38,6 +62,44 @@ template $XimperShellNotificationCenterWidgetsVolume:
child: Box revealer_content {
orientation: vertical;
Box main_sink_row {
orientation: vertical;
margin-top: 4;
margin-bottom: 4;
margin-start: 14;
margin-end: 14;
Box {
orientation: horizontal;
spacing: 6;
Image main_sink_icon {
icon-name: "audio-speakers-symbolic";
}
Label main_sink_label {
halign: start;
ellipsize: end;
styles ["dim-label", "caption"]
}
}
Scale main_sink_scale {
orientation: horizontal;
hexpand: true;
draw-value: false;
adjustment: Adjustment {
lower: 0;
upper: 100;
step-increment: 1;
};
value-changed => $on_main_sink_scale_changed();
}
}
ListBox levels_listbox {
activate-on-single-click: true;
selection-mode: none;
......@@ -54,10 +116,6 @@ template $XimperShellNotificationCenterWidgetsVolume:
Box sink_list_box {
orientation: vertical;
visible: false;
margin-start: 4;
margin-end: 4;
margin-top: 4;
margin-bottom: 4;
styles ["sink-selector"]
}
......
......@@ -16,3 +16,4 @@ src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala
data/ui/widgets/notifications.blp
data/ui/widgets/inhibitors.blp
data/ui/widgets/backlight.blp
data/ui/widgets/volume.blp
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ximper-shell-notification-center 0.1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-31 19:15+0300\n"
"POT-Creation-Date: 2026-04-19 00:04+0300\n"
"PO-Revision-Date: 2026-03-24 00:00+0300\n"
"Last-Translator: \n"
"Language-Team: Russian\n"
......@@ -18,24 +18,24 @@ msgstr ""
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: src/notification/notification.vala:536
#: src/notification/notification.vala:550
msgid "Enter Text"
msgstr "Введите текст"
#: src/notification/notification.vala:548
#: src/notification/notification.vala:562
msgid "Reply"
msgstr "Ответить"
#: src/notification/notification.vala:576
#: src/notification/notification.vala:590
#, c-format
msgid "COPY \"%s\""
msgstr "КОПИРОВАТЬ \"%s\""
#: src/notification/notification.vala:618
#: src/notification/notification.vala:632
msgid "Now"
msgstr "Сейчас"
#: src/notification/notification.vala:622
#: src/notification/notification.vala:636
#, c-format
msgid "%d min ago"
msgid_plural "%d mins ago"
......@@ -43,7 +43,7 @@ msgstr[0] "%d мин. назад"
msgstr[1] "%d мин. назад"
msgstr[2] "%d мин. назад"
#: src/notification/notification.vala:626
#: src/notification/notification.vala:640
#, c-format
msgid "%d hour ago"
msgid_plural "%d hours ago"
......@@ -51,7 +51,7 @@ msgstr[0] "%d ч. назад"
msgstr[1] "%d ч. назад"
msgstr[2] "%d ч. назад"
#: src/notification/notification.vala:630
#: src/notification/notification.vala:644
#, c-format
msgid "%d day ago"
msgid_plural "%d days ago"
......@@ -63,6 +63,10 @@ msgstr[2] "%d д. назад"
msgid "Inhibitors"
msgstr "Блокировки"
#: src/controlCenter/widgets/backlight/backlight.vala:164
msgid "Built-in Display"
msgstr "Встроенный дисплей"
#: src/controlCenter/widgets/quickSettings/tiles/dndTile.vala:5
msgid "Do Not Disturb"
msgstr "Не беспокоить"
......@@ -75,15 +79,15 @@ msgstr "Тёмный стиль"
msgid "Power Mode"
msgstr "Режим питания"
#: src/controlCenter/widgets/quickSettings/tiles/powerProfilesTile.vala:95
#: src/controlCenter/widgets/quickSettings/tiles/powerProfilesTile.vala:96
msgid "Performance"
msgstr "Производительность"
#: src/controlCenter/widgets/quickSettings/tiles/powerProfilesTile.vala:97
#: src/controlCenter/widgets/quickSettings/tiles/powerProfilesTile.vala:98
msgid "Balanced"
msgstr "Баланс"
#: src/controlCenter/widgets/quickSettings/tiles/powerProfilesTile.vala:99
#: src/controlCenter/widgets/quickSettings/tiles/powerProfilesTile.vala:100
msgid "Power Saver"
msgstr "Энергосбережение"
......@@ -95,74 +99,74 @@ msgstr "Кофеин"
msgid "Caffeine mode"
msgstr "Режим кофеина"
#: src/controlCenter/widgets/quickSettings/tiles/nightLightTile.vala:8
#: src/controlCenter/widgets/quickSettings/tiles/nightLightTile.vala:9
msgid "Night Light"
msgstr "Ночной свет"
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:27
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:38
msgid "Wi-Fi"
msgstr "Wi-Fi"
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:94
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:58
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:105
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:64
msgid "Disabled"
msgstr "Отключён"
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:135
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:70
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:146
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:76
msgid "Not Connected"
msgstr "Не подключён"
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:349
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:373
msgid "No networks found"
msgstr "Сети не найдены"
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:440
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:450
msgid "Password"
msgstr "Пароль"
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:444
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:130
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:454
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:121
msgid "Connect"
msgstr "Подключить"
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:504
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:520
msgid "Connecting…"
msgstr "Подключение…"
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:520
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:532
msgid "Network Settings"
msgstr "Настройки сети"
#: src/controlCenter/widgets/quickSettings/tiles/vpnTile.vala:20
#: src/controlCenter/widgets/quickSettings/tiles/vpnTile.vala:30
msgid "VPN"
msgstr "VPN"
#: src/controlCenter/widgets/quickSettings/tiles/vpnTile.vala:88
#: src/controlCenter/widgets/quickSettings/tiles/vpnTile.vala:94
msgid "Disconnected"
msgstr "Отключён"
#: src/controlCenter/widgets/quickSettings/tiles/vpnTile.vala:274
#: src/controlCenter/widgets/quickSettings/tiles/vpnTile.vala:291
msgid "No VPN connections"
msgstr "Нет VPN-подключений"
#: src/controlCenter/widgets/quickSettings/tiles/vpnTile.vala:348
#: src/controlCenter/widgets/quickSettings/tiles/vpnTile.vala:346
msgid "VPN Settings"
msgstr "Настройки VPN"
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:10
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:16
msgid "Bluetooth"
msgstr "Bluetooth"
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:91
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:97
msgid "Searching for devices…"
msgstr "Поиск устройств…"
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:129
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:120
msgid "Disconnect"
msgstr "Отключить"
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:172
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:161
msgid "Bluetooth Settings"
msgstr "Настройки Bluetooth"
......@@ -178,9 +182,13 @@ msgstr "Очистить"
msgid "No Notifications"
msgstr "Нет уведомлений"
#: data/ui/widgets/backlight.blp:18
#: data/ui/widgets/backlight.blp:44
msgid "Brightness"
msgstr "Яркость"
#: data/ui/widgets/volume.blp:43
msgid "Volume"
msgstr "Громкость"
#~ msgid "No active sink input"
#~ msgstr "Нет активного источника"
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ximper-shell-notification-center\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-31 19:15+0300\n"
"POT-Creation-Date: 2026-04-19 00:04+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -18,38 +18,38 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
#: src/notification/notification.vala:536
#: src/notification/notification.vala:550
msgid "Enter Text"
msgstr ""
#: src/notification/notification.vala:548
#: src/notification/notification.vala:562
msgid "Reply"
msgstr ""
#: src/notification/notification.vala:576
#: src/notification/notification.vala:590
#, c-format
msgid "COPY \"%s\""
msgstr ""
#: src/notification/notification.vala:618
#: src/notification/notification.vala:632
msgid "Now"
msgstr ""
#: src/notification/notification.vala:622
#: src/notification/notification.vala:636
#, c-format
msgid "%d min ago"
msgid_plural "%d mins ago"
msgstr[0] ""
msgstr[1] ""
#: src/notification/notification.vala:626
#: src/notification/notification.vala:640
#, c-format
msgid "%d hour ago"
msgid_plural "%d hours ago"
msgstr[0] ""
msgstr[1] ""
#: src/notification/notification.vala:630
#: src/notification/notification.vala:644
#, c-format
msgid "%d day ago"
msgid_plural "%d days ago"
......@@ -60,6 +60,10 @@ msgstr[1] ""
msgid "Inhibitors"
msgstr ""
#: src/controlCenter/widgets/backlight/backlight.vala:164
msgid "Built-in Display"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/dndTile.vala:5
msgid "Do Not Disturb"
msgstr ""
......@@ -72,15 +76,15 @@ msgstr ""
msgid "Power Mode"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/powerProfilesTile.vala:95
#: src/controlCenter/widgets/quickSettings/tiles/powerProfilesTile.vala:96
msgid "Performance"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/powerProfilesTile.vala:97
#: src/controlCenter/widgets/quickSettings/tiles/powerProfilesTile.vala:98
msgid "Balanced"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/powerProfilesTile.vala:99
#: src/controlCenter/widgets/quickSettings/tiles/powerProfilesTile.vala:100
msgid "Power Saver"
msgstr ""
......@@ -92,74 +96,74 @@ msgstr ""
msgid "Caffeine mode"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/nightLightTile.vala:8
#: src/controlCenter/widgets/quickSettings/tiles/nightLightTile.vala:9
msgid "Night Light"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:27
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:38
msgid "Wi-Fi"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:94
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:58
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:105
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:64
msgid "Disabled"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:135
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:70
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:146
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:76
msgid "Not Connected"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:349
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:373
msgid "No networks found"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:440
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:450
msgid "Password"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:444
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:130
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:454
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:121
msgid "Connect"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:504
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:520
msgid "Connecting…"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:520
#: src/controlCenter/widgets/quickSettings/tiles/wifiTile.vala:532
msgid "Network Settings"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/vpnTile.vala:20
#: src/controlCenter/widgets/quickSettings/tiles/vpnTile.vala:30
msgid "VPN"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/vpnTile.vala:88
#: src/controlCenter/widgets/quickSettings/tiles/vpnTile.vala:94
msgid "Disconnected"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/vpnTile.vala:274
#: src/controlCenter/widgets/quickSettings/tiles/vpnTile.vala:291
msgid "No VPN connections"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/vpnTile.vala:348
#: src/controlCenter/widgets/quickSettings/tiles/vpnTile.vala:346
msgid "VPN Settings"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:10
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:16
msgid "Bluetooth"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:91
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:97
msgid "Searching for devices…"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:129
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:120
msgid "Disconnect"
msgstr ""
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:172
#: src/controlCenter/widgets/quickSettings/tiles/bluetoothTile.vala:161
msgid "Bluetooth Settings"
msgstr ""
......@@ -175,6 +179,10 @@ msgstr ""
msgid "No Notifications"
msgstr ""
#: data/ui/widgets/backlight.blp:18
#: data/ui/widgets/backlight.blp:44
msgid "Brightness"
msgstr ""
#: data/ui/widgets/volume.blp:43
msgid "Volume"
msgstr ""
......@@ -82,7 +82,7 @@ namespace XimperShellNotificationCenter.Widgets {
public override Gtk.Widget ?create_submenu () {
var box = new Gtk.Box (
Gtk.Orientation.VERTICAL, 0);
box.add_css_class ("quick-settings-submenu");
box.add_css_class ("submenu");
build_submenu_header (box);
bt_proxy.start_discovery ();
......
......@@ -141,7 +141,7 @@ namespace XimperShellNotificationCenter.Widgets {
var box = new Gtk.Box (
Gtk.Orientation.VERTICAL, 0);
box.add_css_class ("quick-settings-submenu");
box.add_css_class ("submenu");
build_submenu_header (box);
......
......@@ -262,7 +262,7 @@ namespace XimperShellNotificationCenter.Widgets {
public override Gtk.Widget ?create_submenu () {
var box = new Gtk.Box (
Gtk.Orientation.VERTICAL, 0);
box.add_css_class ("quick-settings-submenu");
box.add_css_class ("submenu");
current_submenu = box;
build_submenu_header (box);
......
......@@ -335,7 +335,7 @@ namespace XimperShellNotificationCenter.Widgets {
var box = new Gtk.Box (
Gtk.Orientation.VERTICAL, 0);
box.add_css_class ("quick-settings-submenu");
box.add_css_class ("submenu");
current_submenu = box;
scan_button =
......
namespace XimperShellNotificationCenter.Widgets {
public class SinkInputRow : Gtk.ListBoxRow {
Gtk.Box container;
Gtk.Image icon = new Gtk.Image ();
Gtk.Label label = new Gtk.Label (null);
Gtk.Scale scale = new Gtk.Scale.with_range (
Gtk.Orientation.HORIZONTAL, 0, 100, 1);
......@@ -20,9 +20,19 @@ namespace XimperShellNotificationCenter.Widgets {
scale.draw_value = false;
scale.set_hexpand (true);
container = new Gtk.Box (
Gtk.Orientation.HORIZONTAL, 0);
container.append (icon);
label.set_halign (Gtk.Align.START);
label.set_ellipsize (Pango.EllipsizeMode.END);
label.add_css_class ("dim-label");
label.add_css_class ("caption");
var header = new Gtk.Box (
Gtk.Orientation.HORIZONTAL, 6);
header.append (icon);
header.append (label);
var container = new Gtk.Box (
Gtk.Orientation.VERTICAL, 0);
container.append (header);
container.append (scale);
set_child (container);
......@@ -50,7 +60,11 @@ namespace XimperShellNotificationCenter.Widgets {
}
}
icon.set_from_icon_name (icon_name);
icon.set_tooltip_text (sink_input.name);
string app_name =
sink_input.application_binary
?? sink_input.name ?? "";
label.set_text (app_name);
scale.set_value (sink_input.volume);
scale.tooltip_text =
......
......@@ -10,6 +10,8 @@ namespace XimperShellNotificationCenter.Widgets {
[GtkChild]
unowned Gtk.Image icon_widget;
[GtkChild]
unowned Gtk.Stack middle_stack;
[GtkChild]
unowned Gtk.Scale slider;
[GtkChild]
unowned Gtk.ToggleButton reveal_button;
......@@ -21,9 +23,16 @@ namespace XimperShellNotificationCenter.Widgets {
unowned Gtk.Separator sink_separator;
[GtkChild]
unowned Gtk.Box sink_list_box;
[GtkChild]
unowned Gtk.Image main_sink_icon;
[GtkChild]
unowned Gtk.Label main_sink_label;
[GtkChild]
unowned Gtk.Scale main_sink_scale;
IterListBoxController list_box_controller;
uint sink_rebuild_timeout = 0;
private bool syncing_slider = false;
private PulseDevice ?default_sink = null;
private PulseDaemon client = new PulseDaemon ();
......@@ -70,6 +79,7 @@ namespace XimperShellNotificationCenter.Widgets {
[GtkCallback]
private void on_slider_changed () {
if (syncing_slider) return;
if (default_sink != null) {
this.client.set_device_volume (
default_sink,
......@@ -78,16 +88,41 @@ namespace XimperShellNotificationCenter.Widgets {
((int) slider.get_value ()).to_string ();
}
update_volume_icon ((int) slider.get_value ());
syncing_slider = true;
main_sink_scale.set_value (slider.get_value ());
syncing_slider = false;
}
[GtkCallback]
private void on_main_sink_scale_changed () {
if (syncing_slider) return;
if (default_sink != null) {
this.client.set_device_volume (
default_sink,
(float) main_sink_scale.get_value ());
}
update_volume_icon (
(int) main_sink_scale.get_value ());
syncing_slider = true;
slider.set_value (main_sink_scale.get_value ());
syncing_slider = false;
}
[GtkCallback]
private void on_reveal_toggled () {
set_button_icon ();
revealer.set_reveal_child (reveal_button.active);
if (reveal_button.active) {
add_css_class ("expanded");
bool expanded = reveal_button.active;
middle_stack.set_visible_child_name (
expanded ? "header" : "slider");
if (expanded) {
add_css_class ("submenu");
icon_widget.add_css_class (
"submenu-header-icon");
} else {
remove_css_class ("expanded");
remove_css_class ("submenu");
icon_widget.remove_css_class (
"submenu-header-icon");
}
}
......@@ -155,6 +190,14 @@ namespace XimperShellNotificationCenter.Widgets {
== PulseAudio.Direction.OUTPUT) {
this.default_sink = device;
slider.set_value (device.volume);
string ?name = device.get_display_name ();
if (name == null || name == "") {
name = device.device_description
?? "";
}
main_sink_label.set_text (name);
main_sink_icon.set_from_icon_name (
get_sink_icon (device.icon_name));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment