Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VariantWidget: Gtk4 prep #769

Merged
merged 1 commit into from
May 15, 2024
Merged
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
44 changes: 19 additions & 25 deletions src/Widgets/VariantWidget.vala
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
/*-
* Copyright 2017-2020 elementary, Inc. (https://elementary.io)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* SPDX-FileCopyrightText: 2017-2023 elementary, Inc. (https://elementary.io)
*/

public class VariantWidget : Gtk.Frame {
public Gtk.ListBox main_listbox { public get; private set; }
public Gtk.ListBox variant_listbox { public get; private set; }
public Gtk.ListBox main_listbox { get; private set; }
public Gtk.ListBox variant_listbox { get; private set; }

public signal void going_to_main ();

Expand Down Expand Up @@ -52,13 +40,18 @@ public class VariantWidget : Gtk.Frame {
};
back_button.get_style_context ().add_class (Granite.STYLE_CLASS_BACK_BUTTON);

variant_title = new Gtk.Label (null);
variant_title.ellipsize = Pango.EllipsizeMode.END;
variant_title.max_width_chars = 20;
variant_title.use_markup = true;
variant_title = new Gtk.Label ("") {
hexpand = true,
justify = CENTER,
margin_end = 6,
margin_start = 6,
use_markup = true,
wrap = true
};

var header_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
header_box.hexpand = true;
var header_box = new Gtk.Box (HORIZONTAL, 0) {
hexpand = true
};
header_box.add (back_button);
header_box.set_center_widget (variant_title);

Expand All @@ -74,11 +67,12 @@ public class VariantWidget : Gtk.Frame {
deck.add (main_scrolled);
deck.add (variant_box);

add (deck);
child = deck;
vexpand = true;

back_button.clicked.connect (() => {
going_to_main ();
deck.navigate (Hdy.NavigationDirection.BACK);
deck.navigate (BACK);
});
}

Expand Down
Loading