1919* Authored by: Felipe Escoto <[email protected] > 2020*/
2121
22- public class Wallpaperize.Window : Gtk .ApplicationWindow {
22+ public class Wallpaperize.Window : Gtk .Window {
2323 const int MIN_WIDTH = 450 ;
2424 const int MIN_HEIGHT = 600 ;
2525 const int IMAGE_HEIGHT = 200 ;
@@ -31,10 +31,13 @@ public class Wallpaperize.Window : Gtk.ApplicationWindow {
3131 background-color: @bg_color;
3232 background-image: none;
3333 border: none;
34+ box-shadow: none;
35+ padding: 16px;
3436 }
3537 " " " ;
3638
3739 public Gtk . Image image;
40+ public Gtk . Button cancel_button;
3841 public Gtk . Button run_button;
3942 public Gtk . Label drag_label;
4043
@@ -56,7 +59,7 @@ public class Wallpaperize.Window : Gtk.ApplicationWindow {
5659 pixbuf = pixbuf. scale_simple (image. get_allocated_width (), image. get_allocated_height (), Gdk . InterpType . BILINEAR );
5760
5861 image. set_from_pixbuf (pixbuf);
59- run_button. label = " Wallpaperize!" ;
62+ run_button. label = _( " Wallpaperize!" ) ;
6063 drag_label. visible = false ;
6164 drag_label. no_show_all = true ;
6265
@@ -80,13 +83,15 @@ public class Wallpaperize.Window : Gtk.ApplicationWindow {
8083 drag_data_received. connect (on_drag_data_received);
8184
8285 resizable = false ;
86+ deletable = false ;
8387 set_keep_above (true );
8488
8589 var grid = new Gtk .Grid ();
8690 grid. orientation = Gtk . Orientation . VERTICAL ;
87- grid. margin = 6 ;
8891 grid. column_spacing = 12 ;
8992 grid. row_spacing = 12 ;
93+ grid. expand = true ;
94+ grid. margin = 6 ;
9095
9196 image = new Gtk .Image ();
9297 image. get_style_context (). add_class (" card" );
@@ -111,8 +116,8 @@ public class Wallpaperize.Window : Gtk.ApplicationWindow {
111116 width. input_purpose = Gtk . InputPurpose . DIGITS ;
112117 height. input_purpose = Gtk . InputPurpose . DIGITS ;
113118
114- width. set_tooltip_text (" Width" );
115- height. set_tooltip_text (" Height" );
119+ width. set_tooltip_text (_( " Width" ) );
120+ height. set_tooltip_text (_( " Height" ) );
116121
117122 width. changed. connect (() = > {
118123 Wallpaperize . Wallpaperiser . W = int . parse (width. text);
@@ -126,37 +131,45 @@ public class Wallpaperize.Window : Gtk.ApplicationWindow {
126131
127132 var reset_button = new Gtk .Button .from_icon_name (" video-display-symbolic" );
128133 reset_button. clicked. connect (get_screen_size);
129- reset_button. set_tooltip_text (" Get resolution" );
134+ reset_button. set_tooltip_text (_( " Get resolution" ) );
130135
131136 var resolution_box = new Gtk .Grid ();
132137 resolution_box. column_spacing = 6 ;
133138 resolution_box. margin = 6 ;
134139 resolution_box. add (width);
135- resolution_box. add (new Gtk .Label (" x " ));
140+ resolution_box. add (new Gtk .Label (" \u 00D7 " ));
136141 resolution_box. add (height);
137142 resolution_box. add (reset_button);
138143
139- run_button = new Gtk .Button .with_label (" Wallpaperize!" );
144+ cancel_button = new Gtk .Button .with_label (_(" Cancel" ));
145+ run_button = new Gtk .Button .with_label (_(" Wallpaperize!" ));
140146 run_button. get_style_context (). add_class (" suggested-action" );
141- run_button. expand = true ;
142- run_button. halign = Gtk . Align . END ;
143- run_button. valign = Gtk . Align . END ;
144- run_button. margin = 6 ;
145147
146- run_button. sensitive = false ;
148+ var actions_box = new Gtk .Box (Gtk . Orientation . HORIZONTAL , 6 );
149+ actions_box. pack_start (cancel_button);
150+ actions_box. pack_end (run_button);
151+ actions_box. expand = true ;
152+ actions_box. halign = Gtk . Align . END ;
153+ actions_box. valign = Gtk . Align . END ;
154+ actions_box. margin = 6 ;
155+
156+ cancel_button. clicked. connect (() = > {
157+ this . close ();
158+ });
147159
160+ run_button. sensitive = false ;
148161 run_button. clicked. connect (() = > {
149- run_button. sensitive = false ;
150- Wallpaperize . Wallpaperiser . from_file (file);
162+ run_button. sensitive = false ;
163+ Wallpaperize . Wallpaperiser . from_file (file);
151164 run_button. label = _(" Done" );
152165 });
153166
154- grid. add (overlay);
155- grid. add (resolution_box);
156- grid. add (run_button);
157- add (grid);
158- show_all ();
167+ grid. attach (overlay, 0 , 0 , 1 , 1 );
168+ grid. attach (resolution_box, 0 , 1 , 1 , 1 );
169+ grid. attach (actions_box, 0 , 2 , 1 , 1 );
170+ this . add (grid);
159171
172+ show_all ();
160173 get_screen_size ();
161174 }
162175
0 commit comments