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

ComboEntry: Use Gtk.Box instead of Gtk.Grid if possible #131

Merged
merged 2 commits into from
Apr 22, 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
22 changes: 12 additions & 10 deletions src/Widgets/ComboEntry.vala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-FileCopyrightText: 2020-2024 Ryo Nakano <[email protected]>
*/

public class Widgets.ComboEntry : Gtk.Grid {
public class Widgets.ComboEntry : Gtk.Box {
public signal void text_copied ();

public string id { get; construct; }
Expand Down Expand Up @@ -48,6 +48,9 @@ public class Widgets.ComboEntry : Gtk.Grid {
}

construct {
orientation = Gtk.Orientation.VERTICAL;
spacing = 0;

var case_label = new Gtk.Label (description);

var case_dropdown = new Gtk.DropDown.from_strings ({
Expand All @@ -69,18 +72,17 @@ public class Widgets.ComboEntry : Gtk.Grid {
tooltip_text = _("Copy to Clipboard")
};

var toolbar_grid = new Gtk.Grid () {
var toolbar = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 12) {
valign = Gtk.Align.CENTER,
margin_top = 6,
margin_bottom = 6,
margin_start = 6,
margin_end = 6,
column_spacing = 12
margin_end = 6
};
toolbar_grid.attach (case_label, 0, 0);
toolbar_grid.attach (case_dropdown, 1, 0);
toolbar_grid.attach (case_info_button_icon, 2, 0);
toolbar_grid.attach (copy_clipboard_button, 3, 0);
toolbar.append (case_label);
toolbar.append (case_dropdown);
toolbar.append (case_info_button_icon);
toolbar.append (copy_clipboard_button);

source_buffer = new GtkSource.Buffer (null);
source_view = new GtkSource.View.with_buffer (source_buffer) {
Expand All @@ -94,8 +96,8 @@ public class Widgets.ComboEntry : Gtk.Grid {
child = source_view
};

attach (toolbar_grid, 0, 0);
attach (scrolled, 0, 1);
append (toolbar);
append (scrolled);

update_buttons ();

Expand Down