[ekiga/ds-gtk-application] Forms: Fixed flickering effect on error.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga/ds-gtk-application] Forms: Fixed flickering effect on error.
- Date: Sun, 5 Oct 2014 17:16:08 +0000 (UTC)
commit f36451da909191d458bb62bc401dd75bb6c2c455
Author: Damien Sandras <dsandras seconix com>
Date: Sun Oct 5 19:13:14 2014 +0200
Forms: Fixed flickering effect on error.
The new Forms implementation allows callbacks to fail by returning
false, and to place an error message in the arguments.
This permits our GTK+ implementation to display the error in the current
form and to accept Form validation only in case there is no error.
The former implementation was creating a new form instance displaying
the various fields, their values and the error message. That new popup
replacing the validation form was triggering an annoying virtual
artifact.
lib/engine/components/opal/opal-account.cpp | 52 ++++++++++++-----------
lib/engine/components/opal/opal-account.h | 13 ++++--
lib/engine/components/opal/opal-bank.cpp | 28 +++++--------
lib/engine/components/opal/opal-bank.h | 7 ++-
lib/engine/components/opal/opal-presentity.cpp | 20 +++++++--
lib/engine/components/opal/opal-presentity.h | 5 +-
lib/engine/framework/form-request-simple.cpp | 13 ++++--
lib/engine/framework/form-request-simple.h | 7 +--
lib/engine/framework/form-request.h | 2 +-
lib/engine/gui/gtk-core/form-dialog-gtk.cpp | 33 ++++++++++-----
lib/engine/gui/gtk-core/form-dialog-gtk.h | 3 +-
plugins/evolution/evolution-book.cpp | 13 ++++--
plugins/evolution/evolution-book.h | 6 +-
plugins/evolution/evolution-contact.cpp | 24 +++++++----
plugins/evolution/evolution-contact.h | 10 +++--
plugins/ldap/ldap-book.cpp | 33 +++++++--------
plugins/ldap/ldap-book.h | 7 ++-
plugins/ldap/ldap-source.cpp | 23 ++++------
plugins/ldap/ldap-source.h | 5 +-
plugins/resource-list/rl-cluster.cpp | 11 +++--
plugins/resource-list/rl-cluster.h | 5 +-
plugins/resource-list/rl-heap.cpp | 22 ++++++----
plugins/resource-list/rl-heap.h | 10 +++--
plugins/resource-list/rl-presentity.cpp | 11 +++--
plugins/resource-list/rl-presentity.h | 5 +-
25 files changed, 208 insertions(+), 160 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index a92ad38..1407786 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -622,7 +622,7 @@ Opal::Account::populate_menu (Ekiga::MenuBuilder &builder)
void
Opal::Account::edit ()
{
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&Opal::Account::on_edit_form_submitted, this, _1, _2)));
+ boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&Opal::Account::on_edit_form_submitted, this, _1, _2, _3)));
std::stringstream str;
str << get_timeout ();
@@ -661,12 +661,13 @@ Opal::Account::edit ()
}
-void
+bool
Opal::Account::on_edit_form_submitted (bool submitted,
- Ekiga::Form &result)
+ Ekiga::Form &result,
+ std::string &error)
{
if (!submitted)
- return;
+ return false;
std::string new_name = result.text ("name");
std::string new_host = result.text ("host");
@@ -681,7 +682,6 @@ Opal::Account::on_edit_form_submitted (bool submitted,
bool should_enable = false;
bool should_disable = false;
unsigned new_timeout = atoi (result.text ("timeout").c_str ());
- std::string error;
if (new_name.empty ())
error = _("You did not supply a name for that account.");
@@ -694,11 +694,7 @@ Opal::Account::on_edit_form_submitted (bool submitted,
if (!error.empty ()) {
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&Opal::Account::on_edit_form_submitted, this, _1, _2)));
- result.visit (*request);
- request->error (error);
-
- Ekiga::Account::questions (request);
+ return false;
}
else {
@@ -761,6 +757,8 @@ Opal::Account::on_edit_form_submitted (bool submitted,
updated ();
trigger_saving ();
}
+
+ return true;
}
void
@@ -771,7 +769,7 @@ Opal::Account::add_contact ()
return;
boost::shared_ptr<Ekiga::FormRequestSimple> request =
- boost::shared_ptr<Ekiga::FormRequestSimple> (new Ekiga::FormRequestSimple (boost::bind
(&Opal::Account::on_add_contact_form_submitted, this, _1, _2)));
+ boost::shared_ptr<Ekiga::FormRequestSimple> (new Ekiga::FormRequestSimple (boost::bind
(&Opal::Account::on_add_contact_form_submitted, this, _1, _2, _3)));
std::list<std::string> groups = existing_groups ();
request->title (_("Add to account roster"));
@@ -788,16 +786,17 @@ Opal::Account::add_contact ()
Ekiga::Heap::questions (request);
}
-void
+bool
Opal::Account::on_add_contact_form_submitted (bool submitted,
- Ekiga::Form& result)
+ Ekiga::Form& result,
+ std::string& error)
{
if (!submitted)
- return;
+ return false;
boost::shared_ptr<Ekiga::PresenceCore> pcore = presence_core.lock ();
if (!pcore)
- return;
+ return false;
const std::string name = result.text ("name");
std::string uri;
@@ -820,18 +819,18 @@ Opal::Account::on_add_contact_form_submitted (bool submitted,
presentity_added (pres);
fetch (pres->get_uri ());
- } else {
+ return true;
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple>(new
Ekiga::FormRequestSimple (boost::bind (&Opal::Account::on_add_contact_form_submitted, this, _1, _2)));
+ }
+ else {
- result.visit (*request);
if (!pcore->is_supported_uri (uri))
- request->error (_("You supplied an unsupported address"));
+ error = _("You supplied an unsupported address");
else
- request->error (_("You already have a contact with this address!"));
-
- Ekiga::Heap::questions (request);
+ error = _("You already have a contact with this address!");
}
+
+ return false;
}
void
@@ -1298,7 +1297,7 @@ Opal::Account::on_rename_group (Opal::PresentityPtr pres)
{
boost::shared_ptr<Ekiga::FormRequestSimple> request =
boost::shared_ptr<Ekiga::FormRequestSimple> (new Ekiga::FormRequestSimple (boost::bind
(&Opal::Account::on_rename_group_form_submitted,
- this, _1, _2,
pres->get_groups ())));
+ this, _1, _2,
_3, pres->get_groups ())));
request->title (_("Renaming Groups"));
request->editable_list ("groups", "",
@@ -1330,13 +1329,14 @@ struct rename_group_form_submitted_helper
};
-void
+bool
Opal::Account::on_rename_group_form_submitted (bool submitted,
Ekiga::Form& result,
+ std::string& error,
const std::list<std::string> & groups)
{
if (!submitted)
- return;
+ return false;
std::list <std::string> new_groups = result.editable_list ("groups");
@@ -1353,6 +1353,8 @@ Opal::Account::on_rename_group_form_submitted (bool submitted,
visit_presentities (boost::ref (helper));
}
}
+
+ return true;
}
void
diff --git a/lib/engine/components/opal/opal-account.h b/lib/engine/components/opal/opal-account.h
index 46211ce..fb630f6 100644
--- a/lib/engine/components/opal/opal-account.h
+++ b/lib/engine/components/opal/opal-account.h
@@ -205,16 +205,19 @@ private:
void decide_type ();
void add_contact ();
- void on_add_contact_form_submitted (bool submitted,
- Ekiga::Form& result);
+ bool on_add_contact_form_submitted (bool submitted,
+ Ekiga::Form& result,
+ std::string& error);
- void on_edit_form_submitted (bool submitted,
- Ekiga::Form &result);
+ bool on_edit_form_submitted (bool submitted,
+ Ekiga::Form &result,
+ std::string& error);
void on_consult (const std::string url);
bool is_myself (const std::string uri) const;
- void on_rename_group_form_submitted (bool submitted,
+ bool on_rename_group_form_submitted (bool submitted,
Ekiga::Form& result,
+ std::string& error,
const std::list<std::string> & groups);
Type type;
diff --git a/lib/engine/components/opal/opal-bank.cpp b/lib/engine/components/opal/opal-bank.cpp
index c470d33..3cbb174 100644
--- a/lib/engine/components/opal/opal-bank.cpp
+++ b/lib/engine/components/opal/opal-bank.cpp
@@ -167,7 +167,7 @@ Opal::Bank::new_account (Account::Type acc_type,
std::string username,
std::string password)
{
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&Opal::Bank::on_new_account_form_submitted, this, _1, _2, acc_type)));
+ boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&Opal::Bank::on_new_account_form_submitted, this, _1, _2, _3,
acc_type)));
request->title (_("Edit account"));
request->instructions (_("Please update the following fields:"));
@@ -216,24 +216,21 @@ Opal::Bank::new_account (Account::Type acc_type,
}
request->boolean ("enabled", _("Enable account"), true);
- if (!username.empty () && !password.empty ())
- request->submit (*request);
- else
- questions (request);
+ questions (request);
}
-void
+bool
Opal::Bank::on_new_account_form_submitted (bool submitted,
Ekiga::Form& result,
+ std::string& error,
Account::Type acc_type)
{
if (!submitted)
- return;
+ return false;
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&Opal::Bank::on_new_account_form_submitted, this, _1, _2, acc_type)));
+ boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&Opal::Bank::on_new_account_form_submitted, this, _1, _2, _3,
acc_type)));
- std::string error;
std::string new_name = (acc_type == Opal::Account::SIP
|| acc_type == Opal::Account::H323) ? result.text ("name") : result.hidden ("name");
std::string new_host = (acc_type == Opal::Account::SIP
@@ -257,16 +254,13 @@ Opal::Bank::on_new_account_form_submitted (bool submitted,
else if (new_timeout < 10)
error = _("The timeout should be at least 10 seconds.");
- if (!error.empty ()) {
- request->error (error);
-
- questions (request);
- }
- else {
-
+ if (!error.empty ())
+ return false;
+ else
add (acc_type, new_name, new_host, new_user, new_authentication_user,
new_password, new_enabled, new_timeout);
- }
+
+ return true;
}
diff --git a/lib/engine/components/opal/opal-bank.h b/lib/engine/components/opal/opal-bank.h
index 544b614..120854b 100644
--- a/lib/engine/components/opal/opal-bank.h
+++ b/lib/engine/components/opal/opal-bank.h
@@ -135,9 +135,10 @@ private:
const std::string& uri,
Ekiga::MenuBuilder& builder);
- void on_new_account_form_submitted (bool submitted,
- Ekiga::Form& form,
- Account::Type acc_type);
+ bool on_new_account_form_submitted (bool submitted,
+ Ekiga::Form& form,
+ std::string& error,
+ Account::Type acc_type);
void add (Account::Type acc_type,
std::string name,
diff --git a/lib/engine/components/opal/opal-presentity.cpp b/lib/engine/components/opal/opal-presentity.cpp
index 345dc0c..6bafae2 100644
--- a/lib/engine/components/opal/opal-presentity.cpp
+++ b/lib/engine/components/opal/opal-presentity.cpp
@@ -253,7 +253,7 @@ void
Opal::Presentity::edit_presentity ()
{
boost::shared_ptr<Ekiga::FormRequestSimple> request =
- boost::shared_ptr<Ekiga::FormRequestSimple> (new Ekiga::FormRequestSimple (boost::bind
(&Opal::Presentity::edit_presentity_form_submitted, this, _1, _2)));
+ boost::shared_ptr<Ekiga::FormRequestSimple> (new Ekiga::FormRequestSimple (boost::bind
(&Opal::Presentity::edit_presentity_form_submitted, this, _1, _2, _3)));
/* Translators: This is Edit name of the contact
* e.g. Editing Contact Claire Fleury.
@@ -275,12 +275,13 @@ Opal::Presentity::edit_presentity ()
}
-void
+bool
Opal::Presentity::edit_presentity_form_submitted (bool submitted,
- Ekiga::Form &result)
+ Ekiga::Form &result,
+ std::string &error)
{
if (!submitted)
- return;
+ return false;
const std::string new_name = result.text ("name");
const std::list<std::string> groups = get_groups ();
@@ -289,6 +290,15 @@ Opal::Presentity::edit_presentity_form_submitted (bool submitted,
const std::string uri = get_uri ();
std::set<xmlNodePtr> nodes_to_remove;
+ if (new_name.empty ()) {
+ error = _("You did not provide a valid name");
+ return false;
+ }
+ else if (new_uri.empty ()) {
+ error = _("You did not provide a valid address");
+ return false;
+ }
+
new_uri = canonize_uri (new_uri);
for (xmlNodePtr child = node->children ;
@@ -358,6 +368,8 @@ Opal::Presentity::edit_presentity_form_submitted (bool submitted,
updated ();
trigger_saving ();
+
+ return true;
}
diff --git a/lib/engine/components/opal/opal-presentity.h b/lib/engine/components/opal/opal-presentity.h
index abfce41..bdac762 100644
--- a/lib/engine/components/opal/opal-presentity.h
+++ b/lib/engine/components/opal/opal-presentity.h
@@ -126,8 +126,9 @@ namespace Opal
* a nice form
*/
void edit_presentity ();
- void edit_presentity_form_submitted (bool submitted,
- Ekiga::Form& result);
+ bool edit_presentity_form_submitted (bool submitted,
+ Ekiga::Form& result,
+ std::string& error);
const Account & account;
boost::weak_ptr<Ekiga::PresenceCore> presence_core;
diff --git a/lib/engine/framework/form-request-simple.cpp b/lib/engine/framework/form-request-simple.cpp
index 22b7cdc..f4e1912 100644
--- a/lib/engine/framework/form-request-simple.cpp
+++ b/lib/engine/framework/form-request-simple.cpp
@@ -35,11 +35,12 @@
#include "form-request-simple.h"
-Ekiga::FormRequestSimple::FormRequestSimple (boost::function2<void, bool, Form&> callback_):
callback(callback_)
+Ekiga::FormRequestSimple::FormRequestSimple (boost::function3<bool, bool, Form&, std::string&> callback_):
callback(callback_)
{
// nothing
}
+
Ekiga::FormRequestSimple::~FormRequestSimple ()
{
if (!answered)
@@ -49,14 +50,16 @@ Ekiga::FormRequestSimple::~FormRequestSimple ()
void
Ekiga::FormRequestSimple::cancel ()
{
+ std::string error_string;
Ekiga::EmptyForm empty;
answered = true;
- callback (false, empty);
+ callback (false, empty, error_string);
}
-void
-Ekiga::FormRequestSimple::submit (Ekiga::Form &form)
+bool
+Ekiga::FormRequestSimple::submit (Ekiga::Form &form,
+ std::string &error_string)
{
answered = true;
- callback (true, form);
+ return callback (true, form, error_string);
}
diff --git a/lib/engine/framework/form-request-simple.h b/lib/engine/framework/form-request-simple.h
index 74b84ae..75a5ec6 100644
--- a/lib/engine/framework/form-request-simple.h
+++ b/lib/engine/framework/form-request-simple.h
@@ -60,19 +60,18 @@ namespace Ekiga
* the request was cancelled ;
* - a form, which contains the submitted answer (or is empty otherwise)
*/
- FormRequestSimple (boost::function2<void, bool, Form&> callback_);
+ FormRequestSimple (boost::function3<bool, bool, Form &, std::string &> callback_);
~FormRequestSimple ();
void cancel ();
- void submit (Form &);
+ bool submit (Form &, std::string &);
private:
bool answered;
- boost::function2<void,bool,Form&> callback;
-
+ boost::function3<bool,bool,Form&,std::string&> callback;
};
/**
diff --git a/lib/engine/framework/form-request.h b/lib/engine/framework/form-request.h
index 10f4fc3..a490486 100644
--- a/lib/engine/framework/form-request.h
+++ b/lib/engine/framework/form-request.h
@@ -55,7 +55,7 @@ namespace Ekiga
virtual void cancel () = 0;
- virtual void submit (Form &) = 0;
+ virtual bool submit (Form &, std::string &) = 0;
};
diff --git a/lib/engine/gui/gtk-core/form-dialog-gtk.cpp b/lib/engine/gui/gtk-core/form-dialog-gtk.cpp
index 8ce6b0f..f8edd32 100644
--- a/lib/engine/gui/gtk-core/form-dialog-gtk.cpp
+++ b/lib/engine/gui/gtk-core/form-dialog-gtk.cpp
@@ -759,6 +759,8 @@ FormDialog::~FormDialog ()
void
FormDialog::run ()
{
+ bool ok = false;
+
if (has_preamble)
gtk_widget_show_all (preamble);
gtk_widget_show_all (fields);
@@ -766,17 +768,20 @@ FormDialog::run ()
gtk_widget_show_all (expander);
gtk_widget_show (window);
- switch (gtk_dialog_run (GTK_DIALOG (window))) {
+ while (!ok) {
+ switch (gtk_dialog_run (GTK_DIALOG (window))) {
- case GTK_RESPONSE_ACCEPT:
- submit();
- break;
+ case GTK_RESPONSE_ACCEPT:
+ ok = submit();
+ break;
- case GTK_RESPONSE_CANCEL:
- case GTK_RESPONSE_DELETE_EVENT:
- default:
- cancel();
- break;
+ case GTK_RESPONSE_CANCEL:
+ case GTK_RESPONSE_DELETE_EVENT:
+ default:
+ cancel();
+ ok = true;
+ break;
+ }
}
}
@@ -871,6 +876,7 @@ FormDialog::error (const std::string _error)
("<span foreground=\"red\">" + _error + "</span>").c_str ());
gtk_container_add (GTK_CONTAINER (preamble), widget);
has_preamble = true;
+ gtk_widget_show_all (preamble);
}
}
@@ -1410,9 +1416,11 @@ FormDialog::editable_list (const std::string name,
}
-void
+bool
FormDialog::submit ()
{
+ bool ok = false;
+ std::string error_msg;
Ekiga::FormBuilder builder;
for (std::list<Submitter *>::iterator iter = submitters.begin ();
@@ -1420,7 +1428,10 @@ FormDialog::submit ()
iter++)
(*iter)->submit (builder);
- request->submit (builder);
+ ok = request->submit (builder, error_msg);
+ if (!ok)
+ error (error_msg);
+ return ok;
}
diff --git a/lib/engine/gui/gtk-core/form-dialog-gtk.h b/lib/engine/gui/gtk-core/form-dialog-gtk.h
index 85eb6c8..483547d 100644
--- a/lib/engine/gui/gtk-core/form-dialog-gtk.h
+++ b/lib/engine/gui/gtk-core/form-dialog-gtk.h
@@ -120,10 +120,9 @@ public:
bool rename_only);
/* those are public only to be called from C code */
-
void cancel ();
- void submit ();
+ bool submit ();
private:
diff --git a/plugins/evolution/evolution-book.cpp b/plugins/evolution/evolution-book.cpp
index 9056496..35031c4 100644
--- a/plugins/evolution/evolution-book.cpp
+++ b/plugins/evolution/evolution-book.cpp
@@ -338,7 +338,7 @@ Evolution::Book::refresh ()
void
Evolution::Book::new_contact_action ()
{
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&Evolution::Book::on_new_contact_form_submitted, this, _1, _2)));
+ boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&Evolution::Book::on_new_contact_form_submitted, this, _1, _2, _3)));
request->title (_("Add Contact"));
@@ -370,12 +370,13 @@ Evolution::Book::set_econtact_attribute_value (EContact *econtact,
e_vcard_add_attribute (E_VCARD (econtact), attribute);
}
-void
+bool
Evolution::Book::on_new_contact_form_submitted (bool submitted,
- Ekiga::Form &result)
+ Ekiga::Form &result,
+ std::string& /*error*/)
{
- if ( !submitted)
- return;
+ if (!submitted)
+ return false;
EContact *econtact = NULL;
@@ -403,4 +404,6 @@ Evolution::Book::on_new_contact_form_submitted (bool submitted,
e_book_add_contact (book, econtact, NULL);
g_object_unref (econtact);
+
+ return true;
}
diff --git a/plugins/evolution/evolution-book.h b/plugins/evolution/evolution-book.h
index 8256eb0..d8d7f07 100644
--- a/plugins/evolution/evolution-book.h
+++ b/plugins/evolution/evolution-book.h
@@ -1,4 +1,3 @@
-
/* Ekiga -- A VoIP and Video-Conferencing application
* Copyright (C) 2000-2009 Damien Sandras <dsandras seconix com>
*
@@ -102,8 +101,9 @@ namespace Evolution
void set_econtact_attribute_value (EContact *contact,
const std::string subtype,
const std::string value) const;
- void on_new_contact_form_submitted (bool submitted,
- Ekiga::Form &result);
+ bool on_new_contact_form_submitted (bool submitted,
+ Ekiga::Form &result,
+ std::string& error);
Ekiga::ServiceCore &services;
EBook *book;
diff --git a/plugins/evolution/evolution-contact.cpp b/plugins/evolution/evolution-contact.cpp
index a7f482c..5b2eeb3 100644
--- a/plugins/evolution/evolution-contact.cpp
+++ b/plugins/evolution/evolution-contact.cpp
@@ -315,7 +315,7 @@ Evolution::Contact::set_attribute_value (unsigned int attr_type,
void
Evolution::Contact::edit_action ()
{
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&Evolution::Contact::on_edit_form_submitted, this, _1, _2)));;
+ boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&Evolution::Contact::on_edit_form_submitted, this, _1, _2, _3)));;
request->title (_("Edit contact"));
@@ -340,12 +340,13 @@ Evolution::Contact::edit_action ()
questions (request);
}
-void
+bool
Evolution::Contact::on_edit_form_submitted (bool submitted,
- Ekiga::Form &result)
+ Ekiga::Form &result,
+ std::string &/*error*/)
{
if (!submitted)
- return;
+ return false;
std::string name = result.text ("name");
std::string home = result.text ("home");
@@ -363,12 +364,14 @@ Evolution::Contact::on_edit_form_submitted (bool submitted,
e_contact_set (econtact, E_CONTACT_FULL_NAME, (gpointer)name.c_str ());
e_book_commit_contact (book, econtact, NULL);
+
+ return true;
}
void
Evolution::Contact::remove_action ()
{
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple>(new
Ekiga::FormRequestSimple (boost::bind (&Evolution::Contact::on_remove_form_submitted, this, _1, _2)));
+ boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple>(new
Ekiga::FormRequestSimple (boost::bind (&Evolution::Contact::on_remove_form_submitted, this, _1, _2, _3)));
gchar* instructions = NULL;
request->title (_("Remove contact"));
@@ -380,10 +383,13 @@ Evolution::Contact::remove_action ()
questions (request);
}
-void
+bool
Evolution::Contact::on_remove_form_submitted (bool submitted,
- Ekiga::Form& /*result*/)
+ Ekiga::Form& /*result*/,
+ std::string& /*error*/)
{
- if (submitted)
- remove ();
+ if (!submitted)
+ return false;
+
+ return true;
}
diff --git a/plugins/evolution/evolution-contact.h b/plugins/evolution/evolution-contact.h
index fd18834..3657af6 100644
--- a/plugins/evolution/evolution-contact.h
+++ b/plugins/evolution/evolution-contact.h
@@ -107,13 +107,15 @@ namespace Evolution
void edit_action ();
- void on_edit_form_submitted (bool submitted,
- Ekiga::Form &result);
+ bool on_edit_form_submitted (bool submitted,
+ Ekiga::Form &result,
+ std::string &error);
void remove_action ();
- void on_remove_form_submitted (bool submitted,
- Ekiga::Form &result);
+ bool on_remove_form_submitted (bool submitted,
+ Ekiga::Form &result,
+ std::string &error);
};
typedef boost::shared_ptr<Contact> ContactPtr;
diff --git a/plugins/ldap/ldap-book.cpp b/plugins/ldap/ldap-book.cpp
index 3761530..2601345 100644
--- a/plugins/ldap/ldap-book.cpp
+++ b/plugins/ldap/ldap-book.cpp
@@ -481,14 +481,17 @@ OPENLDAP::Book::get_node ()
return node;
}
-void
+bool
OPENLDAP::Book::on_sasl_form_submitted (bool submitted,
- Ekiga::Form &result)
+ Ekiga::Form &result,
+ std::string &/*error*/)
{
if (!submitted)
- return;
+ return false;
result.visit (*saslform);
+
+ return true;
}
extern "C" {
@@ -554,7 +557,7 @@ extern "C" {
/* If there are missing items, try to get them all in one dialog */
if (nprompts) {
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&OPENLDAP::Book::on_sasl_form_submitted, ctx->book, _1, _2)));
+ boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&OPENLDAP::Book::on_sasl_form_submitted, ctx->book, _1, _2, _3)));
Ekiga::FormBuilder result;
std::string prompt;
std::string ctxt = "";
@@ -1007,7 +1010,7 @@ OPENLDAP::BookForm (boost::shared_ptr<Ekiga::FormRequestSimple> request,
void
OPENLDAP::Book::edit ()
{
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&OPENLDAP::Book::on_edit_form_submitted, this, _1, _2)));
+ boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&OPENLDAP::Book::on_edit_form_submitted, this, _1, _2, _3)));
OPENLDAP::BookForm (request, bookinfo, std::string(_("Edit LDAP directory")));
@@ -1113,22 +1116,16 @@ OPENLDAP::BookFormInfo (Ekiga::Form &result,
return 0;
}
-void
+bool
OPENLDAP::Book::on_edit_form_submitted (bool submitted,
- Ekiga::Form &result)
+ Ekiga::Form &result,
+ std::string &error)
{
if (!submitted)
- return;
-
- std::string errmsg;
- if (OPENLDAP::BookFormInfo (result, bookinfo, errmsg)) {
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&OPENLDAP::Book::on_edit_form_submitted, this, _1, _2)));
-
- result.visit (*request);
- request->error (errmsg);
+ return false;
- questions (request);
- return;
+ if (OPENLDAP::BookFormInfo (result, bookinfo, error)) {
+ return false;
}
robust_xmlNodeSetContent (node, &name_node, "name", bookinfo.name);
@@ -1146,4 +1143,6 @@ OPENLDAP::Book::on_edit_form_submitted (bool submitted,
updated ();
trigger_saving ();
+
+ return true;
}
diff --git a/plugins/ldap/ldap-book.h b/plugins/ldap/ldap-book.h
index bcf0519..3a2d7f3 100644
--- a/plugins/ldap/ldap-book.h
+++ b/plugins/ldap/ldap-book.h
@@ -129,7 +129,7 @@ namespace OPENLDAP
bool is_ekiga_net_book () const;
/* public for access from C */
- void on_sasl_form_submitted (bool, Ekiga::Form &);
+ bool on_sasl_form_submitted (bool, Ekiga::Form &, std::string &);
Ekiga::FormBuilder *saslform;
private:
@@ -143,8 +143,9 @@ namespace OPENLDAP
void parse_uri();
void edit ();
- void on_edit_form_submitted (bool submitted,
- Ekiga::Form &form);
+ bool on_edit_form_submitted (bool submitted,
+ Ekiga::Form &form,
+ std::string &error);
Ekiga::ServiceCore &core;
boost::shared_ptr<xmlDoc> doc;
diff --git a/plugins/ldap/ldap-source.cpp b/plugins/ldap/ldap-source.cpp
index bb58986..bf93ef7 100644
--- a/plugins/ldap/ldap-source.cpp
+++ b/plugins/ldap/ldap-source.cpp
@@ -137,7 +137,7 @@ OPENLDAP::Source::populate_menu (Ekiga::MenuBuilder &builder)
void
OPENLDAP::Source::new_book ()
{
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&OPENLDAP::Source::on_new_book_form_submitted, this, _1, _2)));
+ boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&OPENLDAP::Source::on_new_book_form_submitted, this, _1, _2, _3)));
struct BookInfo bookinfo;
bookinfo.name = "";
@@ -170,27 +170,22 @@ OPENLDAP::Source::new_ekiga_net_book ()
add (bookinfo);
}
-void
+bool
OPENLDAP::Source::on_new_book_form_submitted (bool submitted,
- Ekiga::Form &result)
+ Ekiga::Form &result,
+ std::string &error)
{
if (!submitted)
- return;
+ return false;
- std::string errmsg;
struct BookInfo bookinfo;
- if (OPENLDAP::BookFormInfo (result, bookinfo, errmsg)) {
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&OPENLDAP::Source::on_new_book_form_submitted, this, _1, _2)));
-
- result.visit (*request);
- request->error (errmsg);
-
- questions (request);
- return;
- }
+ if (OPENLDAP::BookFormInfo (result, bookinfo, error))
+ return false;
add (bookinfo);
+
+ return true;
}
void
diff --git a/plugins/ldap/ldap-source.h b/plugins/ldap/ldap-source.h
index 9cf7511..e59d883 100644
--- a/plugins/ldap/ldap-source.h
+++ b/plugins/ldap/ldap-source.h
@@ -92,8 +92,9 @@ namespace OPENLDAP
void new_ekiga_net_book ();
- void on_new_book_form_submitted (bool submitted,
- Ekiga::Form &result);
+ bool on_new_book_form_submitted (bool submitted,
+ Ekiga::Form &result,
+ std::string &error);
bool has_ekiga_net_book () const;
diff --git a/plugins/resource-list/rl-cluster.cpp b/plugins/resource-list/rl-cluster.cpp
index 18ca4bc..cb9a15d 100644
--- a/plugins/resource-list/rl-cluster.cpp
+++ b/plugins/resource-list/rl-cluster.cpp
@@ -156,7 +156,7 @@ RL::Cluster::new_heap (const std::string name,
const std::string user,
bool writable)
{
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&RL::Cluster::on_new_heap_form_submitted, this, _1, _2)));
+ boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&RL::Cluster::on_new_heap_form_submitted, this, _1, _2, _3)));
request->title (_("Add new resource-list"));
request->instructions (_("Please fill in this form to add a new "
@@ -171,12 +171,13 @@ RL::Cluster::new_heap (const std::string name,
questions (request);
}
-void
+bool
RL::Cluster::on_new_heap_form_submitted (bool submitted,
- Ekiga::Form& result)
+ Ekiga::Form &result,
+ std::string &/*error*/)
{
if (!submitted)
- return;
+ return false;
const std::string name = result.text ("name");
const std::string uri = result.text ("uri");
@@ -186,6 +187,8 @@ RL::Cluster::on_new_heap_form_submitted (bool submitted,
bool writable = result.boolean ("writable");
add (name, uri, username, password, user, writable);
+
+ return true;
}
diff --git a/plugins/resource-list/rl-cluster.h b/plugins/resource-list/rl-cluster.h
index bdee83d..5b58049 100644
--- a/plugins/resource-list/rl-cluster.h
+++ b/plugins/resource-list/rl-cluster.h
@@ -85,8 +85,9 @@ namespace RL {
const std::string user,
bool writable);
- void on_new_heap_form_submitted (bool submitted,
- Ekiga::Form& result);
+ bool on_new_heap_form_submitted (bool submitted,
+ Ekiga::Form& result,
+ std::string &error);
void on_presence_received (std::string uri,
std::string presence);
diff --git a/plugins/resource-list/rl-heap.cpp b/plugins/resource-list/rl-heap.cpp
index 1d38776..f5cf582 100644
--- a/plugins/resource-list/rl-heap.cpp
+++ b/plugins/resource-list/rl-heap.cpp
@@ -408,7 +408,7 @@ RL::Heap::push_status (const std::string uri_,
void
RL::Heap::edit ()
{
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&RL::Heap::on_edit_form_submitted, this, _1, _2)));
+ boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&RL::Heap::on_edit_form_submitted, this, _1, _2, _3)));
std::string name_str;
std::string root_str;
@@ -475,12 +475,13 @@ RL::Heap::edit ()
questions (request);
}
-void
+bool
RL::Heap::on_edit_form_submitted (bool submitted,
- Ekiga::Form& result)
+ Ekiga::Form& result,
+ std::string &/*error*/)
{
if (!submitted)
- return;
+ return false;
std::string name_str = result.text ("name");
std::string root_str = result.text ("root");
@@ -502,12 +503,14 @@ RL::Heap::on_edit_form_submitted (bool submitted,
trigger_saving ();
updated ();
refresh ();
+
+ return true;
}
void
RL::Heap::new_entry ()
{
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&RL::Heap::on_new_entry_form_submitted, this, _1, _2)));
+ boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&RL::Heap::on_new_entry_form_submitted, this, _1, _2, _3)));
request->title (_("Add a remote contact"));
request->instructions (_("Please fill in this form to create a new "
@@ -531,12 +534,13 @@ RL::Heap::new_entry ()
questions (request);
}
-void
+bool
RL::Heap::on_new_entry_form_submitted (bool submitted,
- Ekiga::Form& result)
+ Ekiga::Form& result,
+ std::string &/*error*/)
{
if (!submitted)
- return;
+ return false;
std::string entry_name = result.text ("name");
std::string entry_uri = result.text ("uri");
@@ -605,6 +609,8 @@ RL::Heap::on_new_entry_form_submitted (bool submitted,
boost::bind (&RL::Heap::new_entry_result, this, _1));
}
xmlBufferFree (buffer);
+
+ return true;
}
void
diff --git a/plugins/resource-list/rl-heap.h b/plugins/resource-list/rl-heap.h
index de3b41d..04682b2 100644
--- a/plugins/resource-list/rl-heap.h
+++ b/plugins/resource-list/rl-heap.h
@@ -117,12 +117,14 @@ namespace RL {
void parse_list (xmlNodePtr node);
void edit ();
- void on_edit_form_submitted (bool submitted,
- Ekiga::Form& result);
+ bool on_edit_form_submitted (bool submitted,
+ Ekiga::Form& result,
+ std::string &error);
void new_entry ();
- void on_new_entry_form_submitted (bool submitted,
- Ekiga::Form& result);
+ bool on_new_entry_form_submitted (bool submitted,
+ Ekiga::Form& result,
+ std::string &error);
void new_entry_result (std::string error);
};
diff --git a/plugins/resource-list/rl-presentity.cpp b/plugins/resource-list/rl-presentity.cpp
index 214ab92..57515c5 100644
--- a/plugins/resource-list/rl-presentity.cpp
+++ b/plugins/resource-list/rl-presentity.cpp
@@ -222,7 +222,7 @@ RL::Presentity::populate_menu (Ekiga::MenuBuilder &builder)
void
RL::Presentity::edit_presentity ()
{
- boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&RL::Presentity::edit_presentity_form_submitted, this, _1, _2)));
+ boost::shared_ptr<Ekiga::FormRequestSimple> request = boost::shared_ptr<Ekiga::FormRequestSimple> (new
Ekiga::FormRequestSimple (boost::bind (&RL::Presentity::edit_presentity_form_submitted, this, _1, _2, _3)));
// FIXME: we should be able to know all groups in the heap
std::set<std::string> all_groups = groups;
@@ -240,12 +240,13 @@ RL::Presentity::edit_presentity ()
}
-void
+bool
RL::Presentity::edit_presentity_form_submitted (bool submitted,
- Ekiga::Form &result)
+ Ekiga::Form &result,
+ std::string &/*error*/)
{
if (!submitted)
- return;
+ return false;
const std::string new_name = result.text ("name");
const std::string new_uri = result.text ("uri");
@@ -294,6 +295,8 @@ RL::Presentity::edit_presentity_form_submitted (bool submitted,
groups = new_groups;
save (reload);
+
+ return true;
}
void
diff --git a/plugins/resource-list/rl-presentity.h b/plugins/resource-list/rl-presentity.h
index 53bfd10..12c64f4 100644
--- a/plugins/resource-list/rl-presentity.h
+++ b/plugins/resource-list/rl-presentity.h
@@ -85,8 +85,9 @@ namespace RL
void edit_presentity ();
- void edit_presentity_form_submitted (bool submitted,
- Ekiga::Form &result);
+ bool edit_presentity_form_submitted (bool submitted,
+ Ekiga::Form &result,
+ std::string &error);
void save (bool reload);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]