[geary/wip/720794-modal] Make AccountDialog transitory dialog box
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/720794-modal] Make AccountDialog transitory dialog box
- Date: Sat, 21 Dec 2013 00:34:22 +0000 (UTC)
commit 6fbe6cea3aecdb953af49288c2ac80958a1afea9
Author: Jim Nelson <jim yorba org>
Date: Fri Dec 20 16:33:55 2013 -0800
Make AccountDialog transitory dialog box
src/client/accounts/account-dialog.vala | 27 +++----------------------
src/client/application/geary-controller.vala | 5 +++-
2 files changed, 8 insertions(+), 24 deletions(-)
---
diff --git a/src/client/accounts/account-dialog.vala b/src/client/accounts/account-dialog.vala
index eb78ee6..1102bf5 100644
--- a/src/client/accounts/account-dialog.vala
+++ b/src/client/accounts/account-dialog.vala
@@ -7,8 +7,6 @@
public class AccountDialog : Gtk.Dialog {
private const int MARGIN = 12;
- private static AccountDialog? account_dialog = null;
-
private Gtk.Notebook notebook = new Gtk.Notebook();
private AccountDialogAccountListPane account_list_pane;
private AccountDialogAddEditPane add_edit_pane;
@@ -16,9 +14,11 @@ public class AccountDialog : Gtk.Dialog {
private AccountDialogRemoveConfirmPane remove_confirm_pane;
private AccountDialogRemoveFailPane remove_fail_pane;
- private AccountDialog() {
+ public AccountDialog(Gtk.Window parent) {
set_size_request(450, -1); // Sets min size.
title = _("Accounts");
+ set_transient_for(parent);
+ set_modal(true);
get_content_area().margin_top = MARGIN;
get_content_area().margin_left = MARGIN;
get_content_area().margin_right = MARGIN;
@@ -42,8 +42,6 @@ public class AccountDialog : Gtk.Dialog {
remove_confirm_pane.ok.connect(on_delete_account_confirmed);
remove_confirm_pane.cancel.connect(on_cancel_back_to_list);
remove_fail_pane.ok.connect(on_cancel_back_to_list);
- delete_event.connect(on_delete);
- response.connect(on_close);
// Set default page.
account_list_pane.present();
@@ -57,16 +55,6 @@ public class AccountDialog : Gtk.Dialog {
notebook.show_all(); // Required due to longstanding Gtk.Notebook bug
}
- public static void show_instance(Gtk.Window parent) {
- if (account_dialog == null) {
- account_dialog = new AccountDialog();
- }
- account_dialog.set_transient_for(parent);
- account_dialog.set_modal(true);
- account_dialog.show_all();
- account_dialog.present();
- }
-
// 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.
@@ -80,15 +68,8 @@ public class AccountDialog : Gtk.Dialog {
account_list_pane.present();
}
- private bool on_delete() {
- return hide_on_delete();
- }
-
private void on_close() {
- hide();
-
- // Go back to default page.
- account_list_pane.present();
+ response(Gtk.ResponseType.CLOSE);
}
private void on_add_account() {
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 566b519..da59363 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -1298,7 +1298,10 @@ public class GearyController : Geary.BaseObject {
}
private void on_accounts() {
- AccountDialog.show_instance(main_window);
+ AccountDialog dialog = new AccountDialog(main_window);
+ dialog.show_all();
+ dialog.run();
+ dialog.destroy();
}
private void on_preferences() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]