Improve the layout of Prev/Next/Finish navigation buttons

This commit is contained in:
Tony George 2019-08-11 15:09:05 +05:30
parent c76a4cd88e
commit f973835635
4 changed files with 97 additions and 118 deletions

View File

@ -69,7 +69,7 @@ class BackupWindow : Gtk.Window{
// vbox_main
vbox_main = new Gtk.Box(Orientation.VERTICAL, 6);
vbox_main.margin = 12;
vbox_main.margin = 0;
add(vbox_main);
this.resize(def_width, def_height);
@ -81,22 +81,22 @@ class BackupWindow : Gtk.Window{
label = new Gtk.Label(_("Estimate"));
estimate_box = new EstimateBox(this);
estimate_box.margin = 0;
estimate_box.margin = 12;
notebook.append_page (estimate_box, label);
label = new Gtk.Label(_("Location"));
backup_dev_box = new BackupDeviceBox(this);
backup_dev_box.margin = 0;
backup_dev_box.margin = 12;
notebook.append_page (backup_dev_box, label);
label = new Gtk.Label(_("Backup"));
backup_box = new BackupBox(this);
backup_box.margin = 0;
backup_box.margin = 12;
notebook.append_page (backup_box, label);
label = new Gtk.Label(_("Finish"));
backup_finish_box = new BackupFinishBox(this);
backup_finish_box.margin = 0;
backup_finish_box.margin = 12;
notebook.append_page (backup_finish_box, label);
create_actions();
@ -134,23 +134,26 @@ class BackupWindow : Gtk.Window{
private void create_actions(){
var hbox = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL);
hbox.margin = 0;
hbox.margin_left = 24;
hbox.margin_right = 24;
hbox.margin_top = 6;
vbox_main.add(hbox);
bbox_action = hbox;
var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 6);
vbox_main.add(hbox);
var bbox = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL);
bbox.margin = 12;
bbox.spacing = 6;
bbox.hexpand = true;
hbox.add(bbox);
bbox_action = bbox;
#if GTK3_18
hbox.set_layout (Gtk.ButtonBoxStyle.EXPAND);
bbox.set_layout (Gtk.ButtonBoxStyle.CENTER);
#endif
var size_group = new Gtk.SizeGroup(SizeGroupMode.HORIZONTAL);
Gtk.SizeGroup size_group = null; //new Gtk.SizeGroup(SizeGroupMode.HORIZONTAL);
// previous
btn_prev = add_button(hbox, _("Previous"), "", size_group, null);
btn_prev = add_button(bbox, _("Previous"), "", size_group, null);
btn_prev.clicked.connect(()=>{
go_prev();
@ -158,7 +161,7 @@ class BackupWindow : Gtk.Window{
// next
btn_next = add_button(hbox, _("Next"), "", size_group, null);
btn_next = add_button(bbox, _("Next"), "", size_group, null);
btn_next.clicked.connect(()=>{
go_next();
@ -166,7 +169,7 @@ class BackupWindow : Gtk.Window{
// close
btn_close = add_button(hbox, _("Close"), "", size_group, null);
btn_close = add_button(bbox, _("Close"), "", size_group, null);
btn_close.clicked.connect(()=>{
save_changes();
@ -175,7 +178,7 @@ class BackupWindow : Gtk.Window{
// cancel
btn_cancel = add_button(hbox, _("Cancel"), "", size_group, null);
btn_cancel = add_button(bbox, _("Cancel"), "", size_group, null);
btn_cancel.clicked.connect(()=>{
if (App.task != null){
@ -276,9 +279,6 @@ class BackupWindow : Gtk.Window{
btn_next.hide();
btn_close.hide();
btn_cancel.show();
#if GTK3_18
bbox_action.set_layout (Gtk.ButtonBoxStyle.CENTER);
#endif
break;
case Tabs.BACKUP_DEVICE:
btn_prev.show();
@ -288,9 +288,6 @@ class BackupWindow : Gtk.Window{
btn_prev.sensitive = false;
btn_next.sensitive = true;
btn_close.sensitive = true;
#if GTK3_18
bbox_action.set_layout (Gtk.ButtonBoxStyle.EXPAND);
#endif
break;
case Tabs.BACKUP_FINISH:
btn_prev.hide();
@ -298,9 +295,6 @@ class BackupWindow : Gtk.Window{
btn_close.show();
btn_close.sensitive = true;
btn_cancel.hide();
#if GTK3_18
bbox_action.set_layout (Gtk.ButtonBoxStyle.CENTER);
#endif
break;
}

View File

@ -71,7 +71,7 @@ class DeleteWindow : Gtk.Window{
// vbox_main
vbox_main = new Gtk.Box(Orientation.VERTICAL, 6);
vbox_main.margin = 12;
vbox_main.margin = 0;
add(vbox_main);
// add notebook
@ -80,8 +80,8 @@ class DeleteWindow : Gtk.Window{
// create tab
var vbox_tab = new Gtk.Box(Orientation.VERTICAL, 6);
vbox_tab.margin = 0;
vbox_tab.margin = 12;
add_label_header(vbox_tab, _("Select Snapshots"), true);
add_label(vbox_tab, _("Select the snapshots to be deleted"));
@ -97,12 +97,12 @@ class DeleteWindow : Gtk.Window{
label = new Gtk.Label(_("Delete"));
delete_box = new DeleteBox(this);
delete_box.margin = 0;
delete_box.margin = 12;
notebook.append_page (delete_box, label);
label = new Gtk.Label(_("Finish"));
delete_finish_box = new DeleteFinishBox(this);
delete_finish_box.margin = 0;
delete_finish_box.margin = 12;
notebook.append_page (delete_finish_box, label);
create_actions();
@ -135,23 +135,26 @@ class DeleteWindow : Gtk.Window{
private void create_actions(){
var hbox = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL);
hbox.margin = 0;
hbox.margin_left = 24;
hbox.margin_right = 24;
hbox.margin_top = 6;
vbox_main.add(hbox);
bbox_action = hbox;
var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 6);
vbox_main.add(hbox);
var bbox = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL);
bbox.margin = 12;
bbox.spacing = 6;
bbox.hexpand = true;
hbox.add(bbox);
bbox_action = bbox;
#if GTK3_18
hbox.set_layout (Gtk.ButtonBoxStyle.EXPAND);
#if GTK3_18
bbox.set_layout (Gtk.ButtonBoxStyle.CENTER);
#endif
var size_group = new Gtk.SizeGroup(SizeGroupMode.HORIZONTAL);
Gtk.SizeGroup size_group = null; //new Gtk.SizeGroup(SizeGroupMode.HORIZONTAL);
// previous
btn_prev = add_button(hbox, _("Previous"), "", size_group, null);
btn_prev = add_button(bbox, _("Previous"), "", size_group, null);
btn_prev.clicked.connect(()=>{
go_prev();
@ -159,7 +162,7 @@ class DeleteWindow : Gtk.Window{
// next
btn_next = add_button(hbox, _("Next"), "", size_group, null);
btn_next = add_button(bbox, _("Next"), "", size_group, null);
btn_next.clicked.connect(()=>{
go_next();
@ -167,7 +170,7 @@ class DeleteWindow : Gtk.Window{
// close
btn_close = add_button(hbox, _("Close"), "", size_group, null);
btn_close = add_button(bbox, _("Close"), "", size_group, null);
btn_close.clicked.connect(()=>{
this.destroy();
@ -175,7 +178,7 @@ class DeleteWindow : Gtk.Window{
// hide
btn_hide = add_button(hbox, _("Hide"), "", size_group, null);
btn_hide = add_button(bbox, _("Hide"), "", size_group, null);
btn_hide.set_tooltip_text(_("Hide this window (files will be deleted in background)"));
btn_hide.clicked.connect(()=>{
@ -184,7 +187,7 @@ class DeleteWindow : Gtk.Window{
// cancel
btn_cancel = add_button(hbox, _("Cancel"), "", size_group, null);
btn_cancel = add_button(bbox, _("Cancel"), "", size_group, null);
btn_cancel.clicked.connect(()=>{
// clear queue
@ -283,9 +286,6 @@ class DeleteWindow : Gtk.Window{
btn_close.hide();
btn_hide.show();
btn_cancel.show();
#if GTK3_18
bbox_action.set_layout (Gtk.ButtonBoxStyle.EXPAND);
#endif
break;
case Tabs.SNAPSHOT_LIST:
@ -297,9 +297,6 @@ class DeleteWindow : Gtk.Window{
btn_prev.sensitive = false;
btn_next.sensitive = true;
btn_close.sensitive = true;
#if GTK3_18
bbox_action.set_layout (Gtk.ButtonBoxStyle.EXPAND);
#endif
break;
case Tabs.DELETE_FINISH:
@ -308,9 +305,6 @@ class DeleteWindow : Gtk.Window{
btn_close.show();
btn_hide.hide();
btn_cancel.hide();
#if GTK3_18
bbox_action.set_layout (Gtk.ButtonBoxStyle.CENTER);
#endif
break;
}

View File

@ -78,7 +78,7 @@ class RestoreWindow : Gtk.Window{
// vbox_main
vbox_main = new Gtk.Box(Orientation.VERTICAL, 6);
vbox_main.margin = 12;
vbox_main.margin = 0;
add(vbox_main);
// add notebook
@ -88,48 +88,48 @@ class RestoreWindow : Gtk.Window{
label = new Gtk.Label(_("Restore Device"));
restore_device_box = new RestoreDeviceBox(this);
restore_device_box.margin = 0;
restore_device_box.margin = 12;
notebook.append_page (restore_device_box, label);
label = new Gtk.Label(_("Restore Exclude"));
restore_exclude_box = new RestoreExcludeBox(this);
restore_exclude_box.margin = 0;
restore_exclude_box.margin = 12;
notebook.append_page (restore_exclude_box, label);
label = new Gtk.Label(_("Exclude Apps"));
exclude_apps_box = new ExcludeAppsBox(this);
exclude_apps_box.margin = 0;
exclude_apps_box.margin = 12;
notebook.append_page (exclude_apps_box, label);
label = new Gtk.Label(_("Checking Restore Actions (Dry Run)"));
check_box = new RestoreBox(this);
check_box.margin = 0;
check_box.margin = 12;
notebook.append_page (check_box, label);
label = new Gtk.Label(_("Confirm Actions"));
log_box = new RsyncLogBox(this);
log_box.margin = 0;
log_box.margin = 12;
notebook.append_page (log_box, label);
label = new Gtk.Label(_("Users Home"));
var exclude_box = new ExcludeBox(this); // dummy - not used
users_box = new UsersBox(this, exclude_box, true);
users_box.margin = 0;
users_box.margin = 12;
notebook.append_page (users_box, label);
label = new Gtk.Label(_("Summary"));
summary_box = new RestoreSummaryBox(this);
summary_box.margin = 0;
summary_box.margin = 12;
notebook.append_page (summary_box, label);
label = new Gtk.Label(_("Restore"));
restore_box = new RestoreBox(this);
restore_box.margin = 0;
restore_box.margin = 12;
notebook.append_page (restore_box, label);
label = new Gtk.Label(_("Finished"));
restore_finish_box = new RestoreFinishBox(this);
restore_finish_box.margin = 0;
restore_finish_box.margin = 12;
notebook.append_page (restore_finish_box, label);
create_actions();
@ -171,23 +171,26 @@ class RestoreWindow : Gtk.Window{
private void create_actions(){
var hbox = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL);
hbox.margin = 0;
hbox.margin_left = 24;
hbox.margin_right = 24;
hbox.margin_top = 6;
vbox_main.add(hbox);
bbox_action = hbox;
var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 6);
vbox_main.add(hbox);
var bbox = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL);
bbox.margin = 12;
bbox.spacing = 6;
bbox.hexpand = true;
hbox.add(bbox);
bbox_action = bbox;
#if GTK3_18
hbox.set_layout (Gtk.ButtonBoxStyle.EXPAND);
bbox.set_layout (Gtk.ButtonBoxStyle.CENTER);
#endif
Gtk.SizeGroup size_group = new Gtk.SizeGroup(SizeGroupMode.HORIZONTAL);
Gtk.SizeGroup size_group = null; //new Gtk.SizeGroup(SizeGroupMode.HORIZONTAL);
// previous
btn_prev = add_button(hbox, _("Previous"), "", size_group, null);
btn_prev = add_button(bbox, _("Previous"), "", size_group, null);
btn_prev.clicked.connect(()=>{
go_prev();
@ -195,7 +198,7 @@ class RestoreWindow : Gtk.Window{
// next
btn_next = add_button(hbox, _("Next"), "", size_group, null);
btn_next = add_button(bbox, _("Next"), "", size_group, null);
btn_next.clicked.connect(()=>{
go_next();
@ -203,7 +206,7 @@ class RestoreWindow : Gtk.Window{
// close
btn_close = add_button(hbox, _("Cancel"), "", size_group, null);
btn_close = add_button(bbox, _("Cancel"), "", size_group, null);
btn_close.clicked.connect(()=>{
save_changes();
@ -212,7 +215,7 @@ class RestoreWindow : Gtk.Window{
// cancel
btn_cancel = add_button(hbox, _("Cancel"), "", size_group, null);
btn_cancel = add_button(bbox, _("Cancel"), "", size_group, null);
btn_cancel.clicked.connect(()=>{
@ -381,10 +384,6 @@ class RestoreWindow : Gtk.Window{
btn_cancel.show();
#if GTK3_18
bbox_action.set_layout (Gtk.ButtonBoxStyle.CENTER);
#endif
break;
case Tabs.CHECK:
@ -396,9 +395,6 @@ class RestoreWindow : Gtk.Window{
btn_cancel.show();
btn_cancel.sensitive = true;
#if GTK3_18
bbox_action.set_layout (Gtk.ButtonBoxStyle.CENTER);
#endif
break;
case Tabs.TARGET_DEVICE:
@ -416,10 +412,7 @@ class RestoreWindow : Gtk.Window{
btn_prev.sensitive = false;
btn_next.sensitive = true;
btn_close.sensitive = true;
#if GTK3_18
bbox_action.set_layout (Gtk.ButtonBoxStyle.EXPAND);
#endif
break;
case Tabs.SHOW_LOG:
@ -433,9 +426,6 @@ class RestoreWindow : Gtk.Window{
btn_next.sensitive = true;
btn_close.sensitive = true;
#if GTK3_18
bbox_action.set_layout (Gtk.ButtonBoxStyle.EXPAND);
#endif
break;
case Tabs.FINISH:
@ -448,10 +438,7 @@ class RestoreWindow : Gtk.Window{
btn_prev.sensitive = false;
btn_next.sensitive = false;
btn_close.sensitive = true;
#if GTK3_18
bbox_action.set_layout (Gtk.ButtonBoxStyle.EXPAND);
#endif
break;
}

View File

@ -71,7 +71,7 @@ class SetupWizardWindow : Gtk.Window{
// vbox_main
vbox_main = new Gtk.Box(Orientation.VERTICAL, 6);
vbox_main.margin = 12;
vbox_main.margin = 0;
vbox_main.set_size_request(def_width, def_height);
add(vbox_main);
@ -93,33 +93,33 @@ class SetupWizardWindow : Gtk.Window{
label = new Gtk.Label(_("Backend"));
backend_box = new SnapshotBackendBox(this);
backend_box.margin = 0;
backend_box.margin = 12;
notebook.append_page (backend_box, label);
label = new Gtk.Label(_("Estimate"));
estimate_box = new EstimateBox(this);
estimate_box.margin = 0;
estimate_box.margin = 12;
notebook.append_page (estimate_box, label);
label = new Gtk.Label(_("Location"));
backup_dev_box = new BackupDeviceBox(this);
backup_dev_box.margin = 0;
backup_dev_box.margin = 12;
notebook.append_page (backup_dev_box, label);
label = new Gtk.Label(_("Schedule"));
schedule_box = new ScheduleBox(this);
schedule_box.margin = 0;
schedule_box.margin = 12;
notebook.append_page (schedule_box, label);
label = new Gtk.Label(_("User"));
var exclude_box = new ExcludeBox(this);
users_box = new UsersBox(this, exclude_box, false);
users_box.margin = 0;
users_box.margin = 12;
notebook.append_page (users_box, label);
label = new Gtk.Label(_("Finished"));
finish_box = new FinishBox(this, false);
finish_box.margin = 0;
finish_box.margin = 12;
notebook.append_page (finish_box, label);
// TODO: Add a tab for excluding browser cache and other items
@ -174,29 +174,33 @@ class SetupWizardWindow : Gtk.Window{
}
private void create_actions(){
var hbox = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL);
hbox.margin = 0;
hbox.margin_top = 6;
vbox_main.add(hbox);
var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 6);
vbox_main.add(hbox);
var bbox = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL);
bbox.margin = 12;
bbox.spacing = 6;
bbox.hexpand = true;
hbox.add(bbox);
#if GTK3_18
hbox.set_layout (Gtk.ButtonBoxStyle.EXPAND);
bbox.set_layout (Gtk.ButtonBoxStyle.CENTER);
#endif
var size_group = new Gtk.SizeGroup(SizeGroupMode.HORIZONTAL);
Gtk.SizeGroup size_group = null; //new Gtk.SizeGroup(SizeGroupMode.HORIZONTAL);
// previous
btn_prev = add_button(hbox, _("Previous"), "", size_group, null);
btn_prev = add_button(bbox, _("Previous"), "", size_group, null);
btn_prev.clicked.connect(()=>{
go_prev();
});
// next
btn_next = add_button(hbox, _("Next"), "", size_group, null);
btn_next = add_button(bbox, _("Next"), "", size_group, null);
btn_next.clicked.connect(()=>{
go_next();
@ -204,7 +208,7 @@ class SetupWizardWindow : Gtk.Window{
// close
btn_close = add_button(hbox, _("Finish"), "", size_group, null);
btn_close = add_button(bbox, _("Finish"), "", size_group, null);
btn_close.clicked.connect(()=>{
save_changes();
@ -213,7 +217,7 @@ class SetupWizardWindow : Gtk.Window{
// cancel
btn_cancel = add_button(hbox, _("Cancel"), "", size_group, null);
btn_cancel = add_button(bbox, _("Cancel"), "", size_group, null);
btn_cancel.clicked.connect(()=>{
if (App.task != null){