From c7e99e03d1b841712582d49fd7ce651d473ec738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20T=2E=20Colombini=20G=C3=B3mez?= Date: Wed, 30 Jul 2014 16:15:08 +0200 Subject: [PATCH] Modificados los formularios para utilizar el SqlBatch. --- data/email.glade | 4 +- data/users.glade | 134 +++++++++++++++++++++++++++++++++++++++-------- debian/changelog | 2 +- src/email.vala | 2 +- src/users.vala | 28 +++++----- 5 files changed, 128 insertions(+), 42 deletions(-) diff --git a/data/email.glade b/data/email.glade index 2f5ea67..b263bf0 100644 --- a/data/email.glade +++ b/data/email.glade @@ -3,7 +3,7 @@ - + SELECT parent, child FROM mail_alias_child WHERE #link @@ -20,7 +20,7 @@ - + model-child diff --git a/data/users.glade b/data/users.glade index d813a58..e3b61fc 100644 --- a/data/users.glade +++ b/data/users.glade @@ -3,7 +3,7 @@ - + SELECT id, name FROM `group` @@ -61,7 +61,7 @@ FROM `user` u - + users-model @@ -120,6 +120,9 @@ FROM `user` u Identifier id + + + @@ -127,18 +130,27 @@ FROM `user` u User True name + + + MySQL User user + + + Enabled active + + + @@ -219,18 +231,6 @@ FROM `user` u 3 - - - True - False - users - active - - - 1 - 4 - - True @@ -264,6 +264,11 @@ FROM `user` u users id False + + + True + + 1 @@ -276,6 +281,11 @@ FROM `user` u False users name + + + False + + 1 @@ -309,6 +319,28 @@ FROM `user` u 2 + + + True + False + users + active + + + True + False + True + 0 + True + True + + + + + 1 + 4 + + False @@ -350,6 +382,11 @@ FROM `user` u account group_id account-combo-model + + + False + + 1 @@ -363,6 +400,11 @@ FROM `user` u False account uid + + + False + + 1 @@ -400,6 +442,12 @@ FROM `user` u False account last_change + + + False + False + + 1 @@ -412,6 +460,12 @@ FROM `user` u False account expire + + + False + False + + 1 @@ -504,9 +558,12 @@ FROM `user` u Alias - alias-combo-model mail_alias_id True + alias-combo-model + + + @@ -607,6 +664,11 @@ FROM `user` u False sip extension + + + False + + 1 @@ -619,6 +681,11 @@ FROM `user` u False sip secret + + + False + + 1 @@ -631,6 +698,11 @@ FROM `user` u False sip callerid + + + False + + 1 @@ -682,6 +754,12 @@ FROM `user` u + + + + + + False 5 @@ -779,11 +857,16 @@ FROM `user` u - + True - True - False - + False + + + False + False + + + 1 @@ -791,11 +874,16 @@ FROM `user` u - + True - True - False - + False + + + False + False + + + 1 diff --git a/debian/changelog b/debian/changelog index e13492a..2212626 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-account (1.0-6) UNRELEASED; urgency=low +hedera-account (1.0-7) UNRELEASED; urgency=low * Initial Release. diff --git a/src/email.vala b/src/email.vala index b5497a1..0045c42 100644 --- a/src/email.vala +++ b/src/email.vala @@ -19,7 +19,7 @@ using Gtk; public class Vn.EMail : Vn.Form { - public override void open (Gtk.Builder builder) + public override void open () { } } diff --git a/src/users.vala b/src/users.vala index 823d4c3..c8e572a 100644 --- a/src/users.vala +++ b/src/users.vala @@ -20,14 +20,14 @@ public class Vn.Users : Vn.Form { private unowned Gvn.Param user_id; private unowned Gtk.Dialog password_dialog; - private unowned Gtk.Entry password_entry; - private unowned Gtk.Entry repeat_password; + private unowned Vn.Entry password_entry; + private unowned Vn.Entry repeat_password; - public override void open (Gtk.Builder builder) + public override void open () { user_id = get ("user-id") as Gvn.Param; - password_entry = get ("password-entry") as Gtk.Entry; - repeat_password = get ("repeat-password") as Gtk.Entry; + password_entry = get ("password-entry") as Vn.Entry; + repeat_password = get ("repeat-password") as Vn.Entry; password_dialog = get ("password-dialog") as Gtk.Dialog; password_dialog.add_button (_("Cancel"), Gtk.ResponseType.CANCEL); password_dialog.add_button (_("Apply"), Gtk.ResponseType.ACCEPT); @@ -46,8 +46,8 @@ public class Vn.Users : Vn.Form else infobar.hide (); - repeat_password.text = ""; - password_entry.text = ""; + repeat_password.value = ""; + password_entry.value = ""; password_entry.grab_focus (); } @@ -64,19 +64,17 @@ public class Vn.Users : Vn.Form { if (response_id == Gtk.ResponseType.ACCEPT) { - string pass = password_entry.text; + var password = password_entry.value.get_string (), + repeat = repeat_password.value.get_string (); - if (pass == "") + if (password == "") reset_dialog (_("The password can't be empty.")); - else if (pass != repeat_password.text) + else if (password != repeat) reset_dialog (_("Passwords do not match.")); else { - var batch = new Sql.Batch (); - batch.add_from_param ("user", user_id); - batch.add_from_value ("pass", typeof (string), pass); - - string query = "SELECT user_set_password (#user, #pass)"; + var batch = get ("password-batch") as Sql.Batch; + var query = "SELECT user_set_password (#user, #pass)"; conn.query_async (query, batch, on_password_changed); } }