[geary/gtk-3.10: 2/4] Remove Gtk.Notebook from Accounts dialog: Closes bgo#713955
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/gtk-3.10: 2/4] Remove Gtk.Notebook from Accounts dialog: Closes bgo#713955
- Date: Thu, 30 Jan 2014 01:27:24 +0000 (UTC)
commit 9bc8c5ff13b68205e748d1f8dfab3ae52e371a7f
Author: Wolfgang Steitz <wolfer7 web de>
Date: Wed Jan 29 16:19:47 2014 -0800
Remove Gtk.Notebook from Accounts dialog: Closes bgo#713955
Replaces Gtk.Notebook with Gtk.Stack, remove various Notebook hacks
we had to introduce.
.../accounts/account-dialog-account-list-pane.vala | 4 +-
.../accounts/account-dialog-add-edit-pane.vala | 4 +-
src/client/accounts/account-dialog-pane.vala | 13 +++----
.../account-dialog-remove-confirm-pane.vala | 4 +-
.../accounts/account-dialog-remove-fail-pane.vala | 4 +-
.../accounts/account-dialog-spinner-pane.vala | 4 +-
src/client/accounts/account-dialog.vala | 33 +++++---------------
7 files changed, 24 insertions(+), 42 deletions(-)
---
diff --git a/src/client/accounts/account-dialog-account-list-pane.vala
b/src/client/accounts/account-dialog-account-list-pane.vala
index bbc6b54..b991080 100644
--- a/src/client/accounts/account-dialog-account-list-pane.vala
+++ b/src/client/accounts/account-dialog-account-list-pane.vala
@@ -24,8 +24,8 @@ public class AccountDialogAccountListPane : AccountDialogPane {
public signal void close();
- public AccountDialogAccountListPane(Gtk.Notebook notebook) {
- base(notebook);
+ public AccountDialogAccountListPane(Gtk.Stack stack) {
+ base(stack);
Gtk.Builder builder = GearyApplication.instance.create_builder("account_list.glade");
pack_end((Gtk.Box) builder.get_object("container"));
Gtk.ActionGroup actions = (Gtk.ActionGroup) builder.get_object("account list actions");
diff --git a/src/client/accounts/account-dialog-add-edit-pane.vala
b/src/client/accounts/account-dialog-add-edit-pane.vala
index a5563e1..e9671d7 100644
--- a/src/client/accounts/account-dialog-add-edit-pane.vala
+++ b/src/client/accounts/account-dialog-add-edit-pane.vala
@@ -17,8 +17,8 @@ public class AccountDialogAddEditPane : AccountDialogPane {
public signal void size_changed();
- public AccountDialogAddEditPane(Gtk.Notebook notebook) {
- base(notebook);
+ public AccountDialogAddEditPane(Gtk.Stack stack) {
+ base(stack);
button_box.set_layout(Gtk.ButtonBoxStyle.END);
button_box.expand = false;
diff --git a/src/client/accounts/account-dialog-pane.vala b/src/client/accounts/account-dialog-pane.vala
index 27c4ce8..db58eb2 100644
--- a/src/client/accounts/account-dialog-pane.vala
+++ b/src/client/accounts/account-dialog-pane.vala
@@ -5,20 +5,19 @@
*/
// Base class for account dialog panes.
-// Could be factored into a generic "NotebookPage" class if needed.
+// Could be factored into a generic "StackPage" class if needed.
public class AccountDialogPane : Gtk.Box {
- private int page_number;
- private weak Gtk.Notebook parent_notebook;
+ private weak Gtk.Stack parent_stack;
- public class AccountDialogPane(Gtk.Notebook parent_notebook) {
+ public class AccountDialogPane(Gtk.Stack parent_stack) {
Object(orientation: Gtk.Orientation.VERTICAL, spacing: 4);
- this.parent_notebook = parent_notebook;
- page_number = parent_notebook.append_page(this, null);
+ this.parent_stack = parent_stack;
+ parent_stack.add(this);
}
public virtual void present() {
- parent_notebook.set_current_page(page_number);
+ parent_stack.set_visible_child(this);
}
}
diff --git a/src/client/accounts/account-dialog-remove-confirm-pane.vala
b/src/client/accounts/account-dialog-remove-confirm-pane.vala
index 594660c..8a3537e 100644
--- a/src/client/accounts/account-dialog-remove-confirm-pane.vala
+++ b/src/client/accounts/account-dialog-remove-confirm-pane.vala
@@ -14,8 +14,8 @@ public class AccountDialogRemoveConfirmPane : AccountDialogPane {
public signal void cancel();
- public AccountDialogRemoveConfirmPane(Gtk.Notebook notebook) {
- base(notebook);
+ public AccountDialogRemoveConfirmPane(Gtk.Stack stack) {
+ base(stack);
Gtk.Builder builder = GearyApplication.instance.create_builder("remove_confirm.glade");
pack_end((Gtk.Box) builder.get_object("container"));
diff --git a/src/client/accounts/account-dialog-remove-fail-pane.vala
b/src/client/accounts/account-dialog-remove-fail-pane.vala
index 10f0bc2..70a82fa 100644
--- a/src/client/accounts/account-dialog-remove-fail-pane.vala
+++ b/src/client/accounts/account-dialog-remove-fail-pane.vala
@@ -8,8 +8,8 @@
public class AccountDialogRemoveFailPane : AccountDialogPane {
public signal void ok();
- public AccountDialogRemoveFailPane(Gtk.Notebook notebook) {
- base(notebook);
+ public AccountDialogRemoveFailPane(Gtk.Stack stack) {
+ base(stack);
Gtk.Builder builder = GearyApplication.instance.create_builder("account_cannot_remove.glade");
pack_end((Gtk.Box) builder.get_object("container"));
diff --git a/src/client/accounts/account-dialog-spinner-pane.vala
b/src/client/accounts/account-dialog-spinner-pane.vala
index 9f90ea5..7d05bf9 100644
--- a/src/client/accounts/account-dialog-spinner-pane.vala
+++ b/src/client/accounts/account-dialog-spinner-pane.vala
@@ -6,8 +6,8 @@
// Lets user know that account removal cannot be completed..
public class AccountDialogSpinnerPane : AccountDialogPane {
- public AccountDialogSpinnerPane(Gtk.Notebook notebook) {
- base(notebook);
+ public AccountDialogSpinnerPane(Gtk.Stack stack) {
+ base(stack);
pack_end(new AccountSpinnerPage());
}
diff --git a/src/client/accounts/account-dialog.vala b/src/client/accounts/account-dialog.vala
index 1102bf5..36f607d 100644
--- a/src/client/accounts/account-dialog.vala
+++ b/src/client/accounts/account-dialog.vala
@@ -7,7 +7,7 @@
public class AccountDialog : Gtk.Dialog {
private const int MARGIN = 12;
- private Gtk.Notebook notebook = new Gtk.Notebook();
+ private Gtk.Stack stack = new Gtk.Stack();
private AccountDialogAccountListPane account_list_pane;
private AccountDialogAddEditPane add_edit_pane;
private AccountDialogSpinnerPane spinner_pane;
@@ -23,13 +23,12 @@ public class AccountDialog : Gtk.Dialog {
get_content_area().margin_left = MARGIN;
get_content_area().margin_right = MARGIN;
- // Add pages to notebook.
- // Important! Add the pane to show_all() below.
- account_list_pane = new AccountDialogAccountListPane(notebook);
- add_edit_pane = new AccountDialogAddEditPane(notebook);
- spinner_pane = new AccountDialogSpinnerPane(notebook);
- remove_confirm_pane = new AccountDialogRemoveConfirmPane(notebook);
- remove_fail_pane = new AccountDialogRemoveFailPane(notebook);
+ // Add pages to stack.
+ account_list_pane = new AccountDialogAccountListPane(stack);
+ add_edit_pane = new AccountDialogAddEditPane(stack);
+ spinner_pane = new AccountDialogSpinnerPane(stack);
+ remove_confirm_pane = new AccountDialogRemoveConfirmPane(stack);
+ remove_fail_pane = new AccountDialogRemoveFailPane(stack);
// Connect signals from pages.
account_list_pane.close.connect(on_close);
@@ -46,26 +45,10 @@ public class AccountDialog : Gtk.Dialog {
// Set default page.
account_list_pane.present();
- notebook.show_border = false;
- notebook.show_tabs = false;
- get_content_area().pack_start(notebook, true, true, 0);
+ get_content_area().pack_start(stack, true, true, 0);
set_default_response(Gtk.ResponseType.OK);
- notebook.show_all(); // Required due to longstanding Gtk.Notebook bug
- }
-
- // This is a hack to allow key events in this window. Gtk.Notebook will attempt to propagate
- // key events to Widgets which have not yet been realized; by forcing them to realize here,
- // we can avoid assertions and allow the Escape key to close the dialog.
- public override void show_all() {
- base.show_all();
-
- add_edit_pane.present();
- spinner_pane.present();
- remove_confirm_pane.present();
- remove_fail_pane.present();
- account_list_pane.present();
}
private void on_close() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]