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

AppChooser: Fix listbox being unselectable #60

Closed
wants to merge 4 commits into from
Closed
Changes from 3 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
50 changes: 37 additions & 13 deletions src/AppChooser/Dialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public class AppChooser.Dialog : Hdy.Window {
placeholder.show_all ();

listbox = new Gtk.ListBox () {
expand = true
expand = true,
ryonakano marked this conversation as resolved.
Show resolved Hide resolved
activate_on_single_click = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about unsetting activate_on_single_click, i would prefer that we handle activating/selecting the row by ourselves in the ::row_activated signal.

};
listbox.set_placeholder (placeholder);

Expand All @@ -127,32 +128,55 @@ public class AppChooser.Dialog : Hdy.Window {
};
open_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);

var top_grid = new Gtk.Grid () {
orientation = Gtk.Orientation.VERTICAL,
column_spacing = 12,
row_spacing = 6,
margin_start = 12,
margin_end = 12,
margin_top = 12
Comment on lines +136 to +138
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
margin_start = 12,
margin_end = 12,
margin_top = 12
margin_top = 12,
margin_start = 12,
margin_end = 12,
margin_bottom = 6

};

top_grid.attach (overlay, 0, 0, 1, 2);
top_grid.attach (primary_label, 1, 0);
top_grid.attach (secondary_label, 1, 1);

var window_handle_top = new Hdy.WindowHandle ();
window_handle_top.add (top_grid);
Comment on lines +145 to +146
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var window_handle_top = new Hdy.WindowHandle ();
window_handle_top.add (top_grid);
var window_handle_top = new Hdy.WindowHandle () {
child = top_grid
};

the same for the window_handle_bottom.


var content_grid = new Gtk.Grid () {
orientation = Gtk.Orientation.VERTICAL,
column_spacing = 12,
row_spacing = 6,
margin_start = 12,
margin_end = 12
};

content_grid.attach (frame, 0, 0);
Comment on lines +148 to +156
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

frame should be added directly in the final box.


var button_box = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL) {
layout_style = Gtk.ButtonBoxStyle.END,
margin_top = 12,
margin = 12,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
margin = 12,
margin_top = 6,
margin_start = 12,
margin_end = 12,
margin_bottom = 12,

spacing = 6
};

button_box.add (cancel);
button_box.add (open_button);

var window_handle_bottom = new Hdy.WindowHandle ();
window_handle_bottom.add (button_box);

var grid = new Gtk.Grid () {
ryonakano marked this conversation as resolved.
Show resolved Hide resolved
orientation = Gtk.Orientation.VERTICAL,
column_spacing = 12,
row_spacing = 6,
margin = 12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove the margin here? the logic here is that this set the external margins, so that the header and button box only need to deal with the internal margins (margin_botton for the header and margin_top for the button box).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this 12px means the 4 edges of the dialog won't receive the key press events like the secondary click for the context menu and dragging for window movement. So I moved all margins into each grid. I'm not sure if these changes I made is correct though.

row_spacing = 6
};

grid.attach (overlay, 0, 0, 1, 2);
grid.attach (primary_label, 1, 0);
grid.attach (secondary_label, 1, 1);
grid.attach (frame, 0, 3, 2);
grid.attach (button_box, 1, 4);

var window_handle = new Hdy.WindowHandle ();
window_handle.add (grid);
grid.attach (window_handle_top, 0, 0);
grid.attach (content_grid, 0, 1);
grid.attach (window_handle_bottom, 0, 2);

add (window_handle);
add (grid);
type_hint = Gdk.WindowTypeHint.DIALOG;
default_height = 400;
default_width = 350;
Expand Down