widgets: use symbolic icons for volume and backlight, add icon to clear button

parent ae8344b7
...@@ -396,11 +396,6 @@ config file to be able to detect config errors ...@@ -396,11 +396,6 @@ config file to be able to detect config errors
optional: true ++ optional: true ++
default: true ++ default: true ++
description: Whether to display a "Clear All" button ++ description: Whether to display a "Clear All" button ++
button-text: ++
type: string ++
optional: true ++
default: "Clear All" ++
description: "Clear All" button text ++
description: The notification visibility state. ++ description: The notification visibility state. ++
*dnd*++ *dnd*++
type: object ++ type: object ++
...@@ -659,11 +654,6 @@ config file to be able to detect config errors ...@@ -659,11 +654,6 @@ config file to be able to detect config errors
widget-volume ++ widget-volume ++
per-app-volume ++ per-app-volume ++
properties: ++ properties: ++
label: ++
type: string ++
optional: true ++
default: "Volume" ++
description: Text displayed in front of the volume slider ++
show-per-app: ++ show-per-app: ++
type: bool ++ type: bool ++
optional: true ++ optional: true ++
...@@ -716,11 +706,6 @@ config file to be able to detect config errors ...@@ -716,11 +706,6 @@ config file to be able to detect config errors
type: object ++ type: object ++
css class: widget-backlight ++ css class: widget-backlight ++
properties: ++ properties: ++
label: ++
type: string ++
optional: true ++
default: "Brightness" ++
description: Text displayed in front of the backlight slider ++
device: ++ device: ++
type: string ++ type: string ++
optional: true ++ optional: true ++
...@@ -752,11 +737,6 @@ config file to be able to detect config errors ...@@ -752,11 +737,6 @@ config file to be able to detect config errors
optional: true ++ optional: true ++
default: true ++ default: true ++
description: Whether to display a "Clear All" button ++ description: Whether to display a "Clear All" button ++
button-text: ++
type: string ++
optional: true ++
default: "Clear All" ++
description: "Clear All" button text ++
description: Displayed if notifications are inhibited. description: Displayed if notifications are inhibited.
example: example:
...@@ -765,8 +745,7 @@ config file to be able to detect config errors ...@@ -765,8 +745,7 @@ config file to be able to detect config errors
"widget-config": { "widget-config": {
"title": { "title": {
"text": "Notifications", "text": "Notifications",
"clear-all-button": true, "clear-all-button": true
"button-text": "Clear All"
}, },
"dnd": { "dnd": {
"text": "Do Not Disturb" "text": "Do Not Disturb"
......
src/main.vala src/main.vala
src/notification/notification.vala src/notification/notification.vala
src/configModel/configModel.vala
src/controlCenter/widgets/title/title.vala src/controlCenter/widgets/title/title.vala
src/controlCenter/widgets/dnd/dnd.vala src/controlCenter/widgets/dnd/dnd.vala
src/controlCenter/widgets/inhibitors/inhibitors.vala src/controlCenter/widgets/inhibitors/inhibitors.vala
src/controlCenter/widgets/volume/volume.vala src/controlCenter/widgets/volume/volume.vala
src/controlCenter/widgets/backlight/backlight.vala
src/controlCenter/widgets/slider/slider.vala src/controlCenter/widgets/slider/slider.vala
src/controlCenter/widgets/menubar/menubar.vala src/controlCenter/widgets/menubar/menubar.vala
src/controlCenter/widgets/powerProfiles/powerProfiles.vala src/controlCenter/widgets/powerProfiles/powerProfiles.vala
......
...@@ -79,14 +79,6 @@ msgstr "Блокировки" ...@@ -79,14 +79,6 @@ msgstr "Блокировки"
msgid "No active sink input" msgid "No active sink input"
msgstr "Нет активного источника" msgstr "Нет активного источника"
#: src/controlCenter/widgets/volume/volume.vala:58
msgid "Volume"
msgstr "Громкость"
#: src/controlCenter/widgets/backlight/backlight.vala:26
msgid "Brightness"
msgstr "Яркость"
#: src/controlCenter/widgets/slider/slider.vala:28 #: src/controlCenter/widgets/slider/slider.vala:28
msgid "Slider" msgid "Slider"
msgstr "Ползунок" msgstr "Ползунок"
......
...@@ -77,14 +77,6 @@ msgstr "" ...@@ -77,14 +77,6 @@ msgstr ""
msgid "No active sink input" msgid "No active sink input"
msgstr "" msgstr ""
#: src/controlCenter/widgets/volume/volume.vala:58
msgid "Volume"
msgstr ""
#: src/controlCenter/widgets/backlight/backlight.vala:26
msgid "Brightness"
msgstr ""
#: src/controlCenter/widgets/slider/slider.vala:28 #: src/controlCenter/widgets/slider/slider.vala:28
msgid "Slider" msgid "Slider"
msgstr "" msgstr ""
......
...@@ -50,13 +50,11 @@ ...@@ -50,13 +50,11 @@
}, },
"inhibitors": { "inhibitors": {
"text": "Inhibitors", "text": "Inhibitors",
"button-text": "Clear All",
"clear-all-button": true "clear-all-button": true
}, },
"title": { "title": {
"text": "Notifications", "text": "Notifications",
"clear-all-button": true, "clear-all-button": true
"button-text": "Clear All"
}, },
"dnd": { "dnd": {
"text": "Do Not Disturb" "text": "Do Not Disturb"
......
...@@ -389,11 +389,6 @@ ...@@ -389,11 +389,6 @@
"type": "boolean", "type": "boolean",
"description": "Whether to display a \"Clear All\" button", "description": "Whether to display a \"Clear All\" button",
"default": true "default": true
},
"button-text": {
"type": "string",
"description": "\"Clear All\" button text",
"default": "Clear All"
} }
} }
}, },
...@@ -652,11 +647,6 @@ ...@@ -652,11 +647,6 @@
"description": "Slider to control pulse volume", "description": "Slider to control pulse volume",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"label": {
"type": "string",
"description": "Text displayed in front of the volume slider",
"default": "Volume"
},
"show-per-app": { "show-per-app": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
...@@ -716,11 +706,6 @@ ...@@ -716,11 +706,6 @@
"description": "Slider to control monitor brightness", "description": "Slider to control monitor brightness",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"label": {
"type": "string",
"description": "Text displayed in front of the backlight slider",
"default": "Brightness"
},
"device": { "device": {
"type": "string", "type": "string",
"description": "Name of monitor (find possible devices using `ls /sys/class/backlight` or `ls /sys/class/leds`)", "description": "Name of monitor (find possible devices using `ls /sys/class/backlight` or `ls /sys/class/leds`)",
...@@ -758,11 +743,6 @@ ...@@ -758,11 +743,6 @@
"type": "boolean", "type": "boolean",
"description": "Whether to display a \"Clear All\" button", "description": "Whether to display a \"Clear All\" button",
"default": true "default": true
},
"button-text": {
"type": "string",
"description": "\"Clear All\" button text",
"default": "Clear All"
} }
} }
} }
......
...@@ -14,7 +14,8 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -14,7 +14,8 @@ namespace XimperShellNotificationCenter.Widgets {
bool use_ddc = false; bool use_ddc = false;
#endif #endif
Gtk.Label label_widget = new Gtk.Label (null); Gtk.Image icon_widget = new Gtk.Image.from_icon_name (
"display-brightness-symbolic");
Gtk.Scale slider = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 0, 100, 1); Gtk.Scale slider = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 0, 100, 1);
public Backlight (string suffix) { public Backlight (string suffix) {
...@@ -22,8 +23,6 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -22,8 +23,6 @@ namespace XimperShellNotificationCenter.Widgets {
Json.Object ?config = get_config (this); Json.Object ?config = get_config (this);
if (config != null) { if (config != null) {
string ?label = get_prop<string> (config, "label");
label_widget.set_label (label ?? _("Brightness"));
string device = (get_prop<string> (config, "device") ?? "intel_backlight"); string device = (get_prop<string> (config, "device") ?? "intel_backlight");
string subsystem = (get_prop<string> (config, "subsystem") ?? "backlight"); string subsystem = (get_prop<string> (config, "subsystem") ?? "backlight");
int min = int.max (0, get_prop<int> (config, "min")); int min = int.max (0, get_prop<int> (config, "min"));
...@@ -76,11 +75,9 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -76,11 +75,9 @@ namespace XimperShellNotificationCenter.Widgets {
#if HAVE_DDC #if HAVE_DDC
if (use_ddc) { if (use_ddc) {
if (ddc_clients.length == 1) { if (ddc_clients.length == 1) {
// Single DDC display — use the existing label + slider // Single DDC display — use the existing icon + slider
if (label_widget.get_label () == "Brightness") { icon_widget.set_tooltip_text (
label_widget.set_label ("󰍹"); ddc_clients[0].get_display_name ());
label_widget.set_tooltip_text (ddc_clients[0].get_display_name ());
}
ddc_clients[0].brightness_change.connect ((percent) => { ddc_clients[0].brightness_change.connect ((percent) => {
if (percent < 0) { if (percent < 0) {
hide (); hide ();
...@@ -95,15 +92,19 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -95,15 +92,19 @@ namespace XimperShellNotificationCenter.Widgets {
ddc_clients[0].set_brightness.begin ((float) slider.get_value ()); ddc_clients[0].set_brightness.begin ((float) slider.get_value ());
slider.tooltip_text = ((int) slider.get_value ()).to_string (); slider.tooltip_text = ((int) slider.get_value ()).to_string ();
}); });
append (label_widget); append (icon_widget);
append (slider); append (slider);
} else { } else {
// Multiple DDC displays — create a row per display // Multiple DDC displays — create a row per display
set_orientation (Gtk.Orientation.VERTICAL); set_orientation (Gtk.Orientation.VERTICAL);
for (int i = 0; i < ddc_clients.length; i++) { for (int i = 0; i < ddc_clients.length; i++) {
var row = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); var row = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
var lbl = new Gtk.Label ("󰍹 %d".printf (i + 1)); var icon = new Gtk.Image.from_icon_name (
lbl.set_tooltip_text (ddc_clients[i].get_display_name ()); "display-brightness-symbolic");
var num_label = new Gtk.Label (
(i + 1).to_string ());
icon.set_tooltip_text (
ddc_clients[i].get_display_name ());
var scl = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 0, 100, 1); var scl = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 0, 100, 1);
scl.set_draw_value (false); scl.set_draw_value (false);
scl.set_round_digits (0); scl.set_round_digits (0);
...@@ -122,7 +123,8 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -122,7 +123,8 @@ namespace XimperShellNotificationCenter.Widgets {
scl.tooltip_text = ((int) scl.get_value ()).to_string (); scl.tooltip_text = ((int) scl.get_value ()).to_string ();
}); });
row.append (lbl); row.append (icon);
row.append (num_label);
row.append (scl); row.append (scl);
append (row); append (row);
} }
...@@ -147,7 +149,7 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -147,7 +149,7 @@ namespace XimperShellNotificationCenter.Widgets {
slider.tooltip_text = ((int) slider.get_value ()).to_string (); slider.tooltip_text = ((int) slider.get_value ()).to_string ();
}); });
append (label_widget); append (icon_widget);
append (slider); append (slider);
} }
......
...@@ -12,12 +12,10 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -12,12 +12,10 @@ namespace XimperShellNotificationCenter.Widgets {
// Default config values // Default config values
string title; string title;
bool has_clear_all_button = true; bool has_clear_all_button = true;
string button_text;
public Inhibitors (string suffix) { public Inhibitors (string suffix) {
base (suffix); base (suffix);
title = _("Inhibitors"); title = _("Inhibitors");
button_text = _("Clear All");
ximper_shell_notification_center_daemon.inhibited_changed.connect ((length) => { ximper_shell_notification_center_daemon.inhibited_changed.connect ((length) => {
if (!ximper_shell_notification_center_daemon.inhibited) { if (!ximper_shell_notification_center_daemon.inhibited) {
...@@ -42,11 +40,6 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -42,11 +40,6 @@ namespace XimperShellNotificationCenter.Widgets {
if (found_clear_all) { if (found_clear_all) {
this.has_clear_all_button = has_clear_all_button; this.has_clear_all_button = has_clear_all_button;
} }
// Get button text
string ?button_text = get_prop<string> (config, "button-text");
if (button_text != null) {
this.button_text = button_text;
}
} }
title_widget = new Gtk.Label (title); title_widget = new Gtk.Label (title);
...@@ -56,7 +49,12 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -56,7 +49,12 @@ namespace XimperShellNotificationCenter.Widgets {
append (title_widget); append (title_widget);
if (has_clear_all_button) { if (has_clear_all_button) {
clear_all_button = new Gtk.Button.with_label (button_text); clear_all_button = new Gtk.Button ();
var btn_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 10);
btn_box.append (new Gtk.Image.from_icon_name (
"edit-clear-all-symbolic"));
btn_box.append (new Gtk.Label (_("Clear All")));
clear_all_button.set_child (btn_box);
clear_all_button.clicked.connect (() => { clear_all_button.clicked.connect (() => {
try { try {
ximper_shell_notification_center_daemon.clear_inhibitors (); ximper_shell_notification_center_daemon.clear_inhibitors ();
......
...@@ -12,12 +12,10 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -12,12 +12,10 @@ namespace XimperShellNotificationCenter.Widgets {
// Default config values // Default config values
string title; string title;
bool has_clear_all_button = true; bool has_clear_all_button = true;
string button_text;
public Title (string suffix) { public Title (string suffix) {
base (suffix); base (suffix);
title = _("Notifications"); title = _("Notifications");
button_text = _("Clear All");
Json.Object ?config = get_config (this); Json.Object ?config = get_config (this);
if (config != null) { if (config != null) {
...@@ -33,11 +31,6 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -33,11 +31,6 @@ namespace XimperShellNotificationCenter.Widgets {
if (found_clear_all) { if (found_clear_all) {
this.has_clear_all_button = has_clear_all_button; this.has_clear_all_button = has_clear_all_button;
} }
// Get button text
string ?button_text = get_prop<string> (config, "button-text");
if (button_text != null) {
this.button_text = button_text;
}
} }
title_widget = new Gtk.Label (title); title_widget = new Gtk.Label (title);
...@@ -46,7 +39,12 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -46,7 +39,12 @@ namespace XimperShellNotificationCenter.Widgets {
append (title_widget); append (title_widget);
if (has_clear_all_button) { if (has_clear_all_button) {
clear_all_button = new Gtk.Button.with_label (button_text); clear_all_button = new Gtk.Button ();
var btn_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 10);
btn_box.append (new Gtk.Image.from_icon_name (
"edit-clear-all-symbolic"));
btn_box.append (new Gtk.Label (_("Clear All")));
clear_all_button.set_child (btn_box);
clear_all_button.clicked.connect (() => { clear_all_button.clicked.connect (() => {
noti_daemon.request_dismiss_all_notifications (ClosedReasons.DISMISSED); noti_daemon.request_dismiss_all_notifications (ClosedReasons.DISMISSED);
}); });
......
...@@ -7,7 +7,7 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -7,7 +7,7 @@ namespace XimperShellNotificationCenter.Widgets {
} }
Gtk.Box main_volume_slider_container = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); Gtk.Box main_volume_slider_container = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
Gtk.Label label_widget = new Gtk.Label (null); Gtk.Image icon_widget = new Gtk.Image ();
Gtk.Scale slider = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 0, 100, 1); Gtk.Scale slider = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 0, 100, 1);
// Per app volume control // Per app volume control
...@@ -38,6 +38,8 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -38,6 +38,8 @@ namespace XimperShellNotificationCenter.Widgets {
construct { construct {
this.client.change_default_device.connect (default_device_changed); this.client.change_default_device.connect (default_device_changed);
icon_widget.set_from_icon_name ("audio-volume-high-symbolic");
slider.value_changed.connect (() => { slider.value_changed.connect (() => {
if (default_sink != null) { if (default_sink != null) {
this.client.set_device_volume ( this.client.set_device_volume (
...@@ -45,6 +47,7 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -45,6 +47,7 @@ namespace XimperShellNotificationCenter.Widgets {
(float) slider.get_value ()); (float) slider.get_value ());
slider.tooltip_text = ((int) slider.get_value ()).to_string (); slider.tooltip_text = ((int) slider.get_value ()).to_string ();
} }
update_volume_icon ((int) slider.get_value ());
}); });
} }
...@@ -54,9 +57,6 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -54,9 +57,6 @@ namespace XimperShellNotificationCenter.Widgets {
Json.Object ?config = get_config (this); Json.Object ?config = get_config (this);
if (config != null) { if (config != null) {
string ?label = get_prop<string> (config, "label");
label_widget.set_label (label ?? _("Volume"));
bool show_per_app_found; bool show_per_app_found;
bool ?show_per_app = get_prop<bool> (config, "show-per-app", bool ?show_per_app = get_prop<bool> (config, "show-per-app",
out show_per_app_found); out show_per_app_found);
...@@ -131,7 +131,7 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -131,7 +131,7 @@ namespace XimperShellNotificationCenter.Widgets {
slider.draw_value = false; slider.draw_value = false;
slider.set_hexpand (true); slider.set_hexpand (true);
main_volume_slider_container.append (label_widget); main_volume_slider_container.append (icon_widget);
main_volume_slider_container.append (slider); main_volume_slider_container.append (slider);
append (main_volume_slider_container); append (main_volume_slider_container);
...@@ -177,6 +177,20 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -177,6 +177,20 @@ namespace XimperShellNotificationCenter.Widgets {
} }
} }
private void update_volume_icon (int volume) {
string icon_name;
if (volume <= 0) {
icon_name = "audio-volume-muted-symbolic";
} else if (volume <= 33) {
icon_name = "audio-volume-low-symbolic";
} else if (volume <= 66) {
icon_name = "audio-volume-medium-symbolic";
} else {
icon_name = "audio-volume-high-symbolic";
}
icon_widget.set_from_icon_name (icon_name);
}
private void set_button_icon () { private void set_button_icon () {
if (!reveal_button.active) { if (!reveal_button.active) {
if (expand_label == null) { if (expand_label == null) {
......
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