Commit b13e3f1b authored by Clint Rogers's avatar Clint Rogers

3571 - Adds a close button for people using window managers or themes that...

3571 - Adds a close button for people using window managers or themes that don't expose 'close' in the titlebar.
parent a0880783
......@@ -386,9 +386,11 @@ private class BasicProperties : Properties {
}
}
private class ExtendedPropertiesWindow : Gtk.Window {
private class ExtendedPropertiesWindow : Gtk.Dialog {
private ExtendedProperties properties = null;
private const int FRAME_BORDER = 6;
private const int RESIZE_HANDLE_SPACER = 8;
private Gtk.Button close_button;
private class ExtendedProperties : Properties {
private const string NO_VALUE = "";
......@@ -518,19 +520,36 @@ private class ExtendedPropertiesWindow : Gtk.Window {
Gtk.Alignment alignment = new Gtk.Alignment(0.5f,0.5f,1,1);
alignment.add(properties);
alignment.set_padding(4, 4, 4, 4);
add(alignment);
vbox.add(alignment);
close_button = new Gtk.Button.from_stock(Gtk.Stock.CLOSE);
close_button.clicked.connect(on_close_clicked);
// Move the buttons away from where Unity window
// manager on Ubuntu 11.04 puts resize handles
Gtk.Alignment action_alignment = new Gtk.Alignment(1, 0.5f, 1, 1);
action_alignment.set_padding(0, 0, 0, RESIZE_HANDLE_SPACER);
action_alignment.add(close_button);
action_area.add(action_alignment);
}
~ExtendedPropertiesWindow() {
close_button.clicked.disconnect(on_close_clicked);
}
public override bool button_press_event(Gdk.EventButton event) {
// LMB only
if (event.button != 1)
return (base.button_press_event != null) ? base.button_press_event(event) : true;
begin_move_drag((int) event.button, (int) event.x_root, (int) event.y_root, event.time);
return true;
}
private void on_close_clicked() {
hide();
}
public override bool key_press_event(Gdk.EventKey event) {
// hide properties
if (Gdk.keyval_name(event.keyval) == "Escape") {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment