Skip to content

Commit

Permalink
VariantWidget: Gtk4 prep (#769)
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit authored May 15, 2024
1 parent 46ccd9c commit a903b46
Showing 1 changed file with 19 additions and 25 deletions.
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

0 comments on commit a903b46

Please sign in to comment.