control-center: remove dual layout

parent 2ad20060
......@@ -39,13 +39,6 @@ scrollbar {
padding: 0;
}
/* Dual layout */
.dual-layout {
& > separator {
margin: 0 15px;
}
}
.notifications-placeholder {
opacity: 0.5;
}
......
......@@ -165,13 +165,6 @@ config file to be able to detect config errors
to its content, up to 'control-center-height' as ++
maximum. If false, height is fixed.
*control-center-layout* ++
type: string ++
default: single ++
values: single, dual ++
description: Panel layout. "single" is a vertical column. ++
"dual" places widgets and notifications side by side.
*control-center-width* ++
type: integer ++
default: 500 ++
......
......@@ -7,7 +7,6 @@
"control-center-width": 400,
"control-center-height": 740,
"control-center-dynamic-height": true,
"control-center-layout": "single",
"control-center-margin-top": 8,
"control-center-margin-bottom": 8,
"control-center-margin-right": 8,
......
......@@ -659,14 +659,6 @@ namespace XimperShellNotificationCenter {
public string control_center_preferred_output { get; set; default = ""; }
/**
* Panel layout: "single" (vertical) or "dual" (two columns).
*/
public string control_center_layout {
get; set; default = "single";
}
/**
* Notification body image height, in pixels.
*/
private const int NOTIFICATION_BODY_IMAGE_MINIMUM_HEIGHT = 100;
......@@ -853,7 +845,7 @@ namespace XimperShellNotificationCenter {
var tmp_table = new OrderedHashTable<T> ();
if (node.get_node_type () != Json.NodeType.OBJECT) {
stderr.printf ("Node %s is not a json object!...\n",
stderr.printf ("Node %s is not a json object!\n",
property_name);
return tmp_table;
}
......@@ -1013,7 +1005,7 @@ namespace XimperShellNotificationCenter {
GenericArray<T> tmp_array = new GenericArray<T> ();
if (node.get_node_type () != Json.NodeType.ARRAY) {
stderr.printf ("Node %s is not a json array!...\n",
stderr.printf ("Node %s is not a json array!\n",
property_name);
return tmp_array;
}
......
......@@ -298,9 +298,11 @@
},
"control-center-layout": {
"type": "string",
"description": "Panel layout: single (vertical column) or dual (widgets and notifications side by side)",
"description": "Deprecated. Ignored.",
"default": "single",
"enum": ["single", "dual"]
"enum": ["single", "dual"],
"deprecated": true,
"x-ximper-hidden": true
},
"transition-time": {
"type": "integer",
......
......@@ -16,10 +16,6 @@ namespace XimperShellNotificationCenter {
private List<unowned Widgets.BaseWidget> widgets;
private const string[] DEFAULT_WIDGETS = { "notifications" };
private Gtk.Box ?dual_container = null;
private Gtk.Box ?left_column = null;
private Gtk.SizeGroup ?dual_size_group = null;
private string ?monitor_name = null;
public ControlCenter () {
......@@ -199,14 +195,6 @@ namespace XimperShellNotificationCenter {
remove_from_parent (notifications_widget);
}
// Remove dual layout container
if (dual_container != null) {
box.remove (dual_container);
dual_container = null;
left_column = null;
dual_size_group = null;
}
// Reset widgets list, keep notifications
widgets = new List<unowned Widgets.BaseWidget> ();
if (notifications_widget != null) {
......@@ -218,20 +206,6 @@ namespace XimperShellNotificationCenter {
w = DEFAULT_WIDGETS;
}
bool is_dual =
ConfigModel.instance.control_center_layout
== "dual"
&& notifications_widget != null;
// Prepare target containers
Gtk.Box widgets_target;
if (is_dual) {
setup_dual_container ();
widgets_target = left_column;
} else {
widgets_target = box;
}
bool has_notifications = false;
foreach (string key in w) {
......@@ -253,51 +227,14 @@ namespace XimperShellNotificationCenter {
}
widgets.append (widget);
widgets_target.append (widget);
box.append (widget);
}
// Add notifications
if (has_notifications) {
if (is_dual) {
var right = new Gtk.Box (
Gtk.Orientation.VERTICAL, 0);
right.add_css_class (
"notifications-column");
right.set_hexpand (true);
dual_size_group.add_widget (right);
right.append (notifications_widget);
dual_container.append (right);
} else {
box.append (notifications_widget);
}
box.append (notifications_widget);
notifications_widget.reload_config ();
}
if (is_dual) {
box.append (dual_container);
}
}
private void setup_dual_container () {
dual_container = new Gtk.Box (
Gtk.Orientation.HORIZONTAL, 0);
dual_container.add_css_class ("dual-layout");
dual_container.set_vexpand (true);
dual_size_group = new Gtk.SizeGroup (
Gtk.SizeGroupMode.HORIZONTAL);
left_column = new Gtk.Box (
Gtk.Orientation.VERTICAL, 0);
left_column.add_css_class ("widgets-column");
left_column.set_hexpand (true);
dual_size_group.add_widget (left_column);
var separator = new Gtk.Separator (
Gtk.Orientation.VERTICAL);
dual_container.append (left_column);
dual_container.append (separator);
}
/** Resets the UI positions */
......
......@@ -101,26 +101,17 @@ namespace XimperShellNotificationCenter.Widgets {
bool dynamic =
ConfigModel.instance
.control_center_dynamic_height;
bool is_dual =
ConfigModel.instance.control_center_layout
== "dual";
set_vexpand (is_dual || !dynamic);
set_vexpand (!dynamic);
scrolled_window.set_propagate_natural_height (
dynamic && !is_dual);
dynamic);
update_header_visibility ();
}
private void update_header_visibility () {
bool has_notis = !is_empty ();
bool is_dual =
ConfigModel.instance.control_center_layout
== "dual";
// Placeholder only in dual mode when empty
bool show_placeholder = is_dual && !has_notis;
placeholder_box.set_visible (show_placeholder);
scrolled_window.set_visible (!show_placeholder
&& (is_dual || has_notis));
placeholder_box.set_visible (false);
scrolled_window.set_visible (has_notis);
switch (show_title) {
case "true":
......@@ -134,8 +125,7 @@ namespace XimperShellNotificationCenter.Widgets {
title_label.set_visible (false);
break;
default: // auto
header_box.set_visible (
is_dual || has_notis);
header_box.set_visible (has_notis);
title_label.set_visible (true);
clear_all_button.set_sensitive (
has_notis);
......
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