From f06f598eedc89bf5cfce3aa07dca4a604310998c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 16 Jun 2023 13:40:18 -0700 Subject: [PATCH 1/2] Plug: place contents in a Clamp --- src/InputPanel.vala | 4 +-- src/OutputPanel.vala | 2 -- src/Plug.vala | 63 ++++++++++++++++++-------------------------- src/meson.build | 1 + 4 files changed, 27 insertions(+), 43 deletions(-) diff --git a/src/InputPanel.vala b/src/InputPanel.vala index 7f3ce584..e08a6b1f 100644 --- a/src/InputPanel.vala +++ b/src/InputPanel.vala @@ -32,9 +32,7 @@ public class Sound.InputPanel : Gtk.Grid { private InputDeviceMonitor device_monitor; construct { - margin = 12; - margin_bottom = 24; - margin_top = 0; + margin_bottom = 12; column_spacing = 12; row_spacing = 6; diff --git a/src/OutputPanel.vala b/src/OutputPanel.vala index 4be6af39..df751999 100644 --- a/src/OutputPanel.vala +++ b/src/OutputPanel.vala @@ -36,8 +36,6 @@ public class Sound.OutputPanel : Gtk.Grid { public bool screen_reader_active { get; set; } construct { - margin = 12; - margin_top = 0; column_spacing = 12; row_spacing = 6; diff --git a/src/Plug.vala b/src/Plug.vala index aed83f09..b11c85e1 100644 --- a/src/Plug.vala +++ b/src/Plug.vala @@ -1,30 +1,14 @@ -// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- -/*- - * Copyright (c) 2016-2017 elementary LLC. (https://elementary.io) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. +/* + * SPDX-License-Identifier: LGPL-2.0-or-later + * SPDX-FileCopyrightText: 2016-2022 elementary, Inc. (https://elementary.io) * * Authored by: Corentin Noël */ public class Sound.Plug : Switchboard.Plug { - Gtk.Grid main_grid; - Gtk.Stack stack; - - InputPanel input_panel; + private Gtk.Box box; + private Gtk.Stack stack; + private InputPanel input_panel; public Plug () { GLib.Intl.bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); @@ -43,44 +27,47 @@ public class Sound.Plug : Switchboard.Plug { } public override Gtk.Widget get_widget () { - if (main_grid == null) { + if (box == null) { var output_panel = new OutputPanel (); input_panel = new InputPanel (); stack = new Gtk.Stack () { - expand = true + hexpand = true, + vexpand = true }; + stack.add_titled (output_panel, "output", _("Output")); + stack.add_titled (input_panel, "input", _("Input")); var stack_switcher = new Gtk.StackSwitcher () { halign = Gtk.Align.CENTER, homogeneous = true, - margin = 12, stack = stack }; - stack.add_titled (output_panel, "output", _("Output")); - stack.add_titled (input_panel, "input", _("Input")); - - stack.notify["visible-child"].connect (() => { - input_panel.set_visibility (stack.visible_child == input_panel); - }); + var clamp = new Hdy.Clamp () { + child = stack + }; - main_grid = new Gtk.Grid () { - orientation = Gtk.Orientation.VERTICAL + box = new Gtk.Box (VERTICAL, 12) { + margin = 12 }; - main_grid.add (stack_switcher); - main_grid.add (stack); - main_grid.show_all (); + box.add (stack_switcher); + box.add (clamp); + box.show_all (); var pam = PulseAudioManager.get_default (); pam.start (); + + stack.notify["visible-child"].connect (() => { + input_panel.set_visibility (stack.visible_child == input_panel); + }); } - return main_grid; + return box; } public override void shown () { - main_grid.show (); + box.show (); if (stack.visible_child == input_panel) { input_panel.set_visibility (true); } diff --git a/src/meson.build b/src/meson.build index 0e2e93cf..c3a161b0 100644 --- a/src/meson.build +++ b/src/meson.build @@ -27,6 +27,7 @@ shared_module( dependency('libpulse-mainloop-glib'), dependency('libcanberra'), dependency('libcanberra-gtk3'), + dependency('libhandy-1'), meson.get_compiler('vala').find_library('libpulse-ext', dirs: join_paths(meson.source_root(), 'vapi')), switchboard_dep ], From 1322f77aa8ee144025c0f14f7dba873c614ec84c Mon Sep 17 00:00:00 2001 From: Leo Date: Sat, 17 Jun 2023 06:06:50 +0000 Subject: [PATCH 2/2] Update copyright year --- src/Plug.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plug.vala b/src/Plug.vala index b11c85e1..96f544e0 100644 --- a/src/Plug.vala +++ b/src/Plug.vala @@ -1,6 +1,6 @@ /* * SPDX-License-Identifier: LGPL-2.0-or-later - * SPDX-FileCopyrightText: 2016-2022 elementary, Inc. (https://elementary.io) + * SPDX-FileCopyrightText: 2016-2023 elementary, Inc. (https://elementary.io) * * Authored by: Corentin Noël */