ekiga r6546 - in trunk: . lib/engine/framework lib/engine/gui/gtk-core src src/endpoints
- From: dsandras svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r6546 - in trunk: . lib/engine/framework lib/engine/gui/gtk-core src src/endpoints
- Date: Mon, 4 Aug 2008 20:19:21 +0000 (UTC)
Author: dsandras
Date: Mon Aug 4 20:19:21 2008
New Revision: 6546
URL: http://svn.gnome.org/viewvc/ekiga?rev=6546&view=rev
Log:
Added the possibility to have links in Forms. Added "Get an Ekiga.net"
and "Get an Ekiga Call Out" links in the forms. Added
"Recharge/Balance/Call History" actions when editing a DiamondCard
account.
Modified:
trunk/ChangeLog
trunk/lib/engine/framework/form-builder.cpp
trunk/lib/engine/framework/form-builder.h
trunk/lib/engine/framework/form-visitor.h
trunk/lib/engine/gui/gtk-core/Makefile.am
trunk/lib/engine/gui/gtk-core/form-dialog-gtk.cpp
trunk/lib/engine/gui/gtk-core/form-dialog-gtk.h
trunk/src/Makefile.am
trunk/src/endpoints/opal-account.cpp
trunk/src/endpoints/opal-account.h
trunk/src/endpoints/opal-bank.cpp
Modified: trunk/lib/engine/framework/form-builder.cpp
==============================================================================
--- trunk/lib/engine/framework/form-builder.cpp (original)
+++ trunk/lib/engine/framework/form-builder.cpp Mon Aug 4 20:19:21 2008
@@ -54,6 +54,8 @@
visitor.title (my_title);
visitor.instructions (my_instructions);
+ if (!my_link.first.empty () && !my_link.second.empty ())
+ visitor.link (my_link.first, my_link.second);
visitor.error (my_error);
for (std::list<FieldType>::const_iterator iter = ordering.begin ();
@@ -240,6 +242,13 @@
}
void
+Ekiga::FormBuilder::link (const std::string _link,
+ const std::string _uri)
+{
+ my_link = make_pair (_link, _uri);
+}
+
+void
Ekiga::FormBuilder::error (const std::string _error)
{
my_error = _error;
Modified: trunk/lib/engine/framework/form-builder.h
==============================================================================
--- trunk/lib/engine/framework/form-builder.h (original)
+++ trunk/lib/engine/framework/form-builder.h Mon Aug 4 20:19:21 2008
@@ -80,6 +80,9 @@
void instructions (const std::string instructions);
+ void link (const std::string link,
+ const std::string uri);
+
void error (const std::string error);
void hidden (const std::string name,
@@ -231,6 +234,7 @@
std::string my_title;
std::string my_instructions;
+ std::pair<std::string, std::string> my_link;
std::string my_error;
std::list<FieldType> ordering;
std::list<struct HiddenField> hiddens;
Modified: trunk/lib/engine/framework/form-visitor.h
==============================================================================
--- trunk/lib/engine/framework/form-visitor.h (original)
+++ trunk/lib/engine/framework/form-visitor.h Mon Aug 4 20:19:21 2008
@@ -57,6 +57,9 @@
virtual void title (const std::string title) = 0;
virtual void instructions (const std::string instructions) = 0;
+
+ virtual void link (const std::string link,
+ const std::string uri) = 0;
virtual void error (const std::string error) = 0;
Modified: trunk/lib/engine/gui/gtk-core/Makefile.am
==============================================================================
--- trunk/lib/engine/gui/gtk-core/Makefile.am (original)
+++ trunk/lib/engine/gui/gtk-core/Makefile.am Mon Aug 4 20:19:21 2008
@@ -5,6 +5,7 @@
AM_CPPFLAGS = $(SIGC_CFLAGS) $(GTK_CFLAGS)
INCLUDES = \
+ -I$(top_srcdir)/lib/toolbox \
-I$(top_srcdir)/lib/gui \
-I$(top_srcdir)/lib/engine \
-I$(top_srcdir)/lib/engine/framework \
Modified: trunk/lib/engine/gui/gtk-core/form-dialog-gtk.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-core/form-dialog-gtk.cpp (original)
+++ trunk/lib/engine/gui/gtk-core/form-dialog-gtk.cpp Mon Aug 4 20:19:21 2008
@@ -37,6 +37,7 @@
#include <cstring>
#include <iostream>
+#include "toolbox.h"
#include "form-dialog-gtk.h"
/*
@@ -99,6 +100,16 @@
gpointer data);
+/** Called when a link in a Form is clicked.
+ * Open the URI.
+ *
+ * @param: The URI to open.
+ */
+static void
+link_clicked_cb (GtkWidget *widget,
+ gpointer data);
+
+
/*
* Declarations and implementation : the various submitters
* of a Form
@@ -575,6 +586,15 @@
gtk_tree_path_free (path);
}
+
+static void
+link_clicked_cb (GtkWidget * /*widget*/,
+ gpointer data)
+{
+ gm_open_uri ((gchar *) data);
+}
+
+
FormDialog::FormDialog (Ekiga::FormRequest &_request,
GtkWidget *parent): request(_request)
{
@@ -670,7 +690,7 @@
#if GTK_CHECK_VERSION(2,10,0)
gtk_label_set_line_wrap_mode (GTK_LABEL (widget), PANGO_WRAP_WORD);
#endif
- gtk_container_add (GTK_CONTAINER (preamble), widget);
+ gtk_box_pack_start (GTK_BOX (preamble), widget, FALSE, FALSE, 0);
submitter = new InstructionsSubmitter (_instructions);
submitters.push_back (submitter);
@@ -678,6 +698,32 @@
void
+FormDialog::link (const std::string _link,
+ const std::string _uri)
+{
+ GtkWidget *widget = NULL;
+ GtkWidget *label = NULL;
+ gchar *label_text = NULL;
+
+ widget = gtk_button_new ();
+ label = gtk_label_new (NULL);
+ label_text = g_strdup_printf ("<span foreground=\"blue\"><u>%s</u></span>",
+ _link.c_str ());
+ gtk_label_set_markup (GTK_LABEL (label), label_text);
+ g_free (label_text);
+
+ gtk_container_add (GTK_CONTAINER (widget), label);
+
+ gtk_button_set_relief (GTK_BUTTON (widget), GTK_RELIEF_NONE);
+ gtk_box_pack_start (GTK_BOX (preamble), widget, FALSE, FALSE, 0);
+
+ g_signal_connect_data (G_OBJECT (widget), "clicked",
+ G_CALLBACK (link_clicked_cb), (gpointer) g_strdup (_uri.c_str ()),
+ (GClosureNotify) g_free, (GConnectFlags) 0);
+}
+
+
+void
FormDialog::error (const std::string _error)
{
GtkWidget *widget = NULL;
Modified: trunk/lib/engine/gui/gtk-core/form-dialog-gtk.h
==============================================================================
--- trunk/lib/engine/gui/gtk-core/form-dialog-gtk.h (original)
+++ trunk/lib/engine/gui/gtk-core/form-dialog-gtk.h Mon Aug 4 20:19:21 2008
@@ -68,6 +68,9 @@
void instructions (const std::string instructions);
+ void link (const std::string link,
+ const std::string uri);
+
void error (const std::string error);
void hidden (const std::string name,
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Mon Aug 4 20:19:21 2008
@@ -1,6 +1,7 @@
INCLUDES = \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/toolbox \
-I$(top_srcdir)/lib/gui \
-I$(top_srcdir)/lib/engine/ \
-I$(top_srcdir)/lib/engine/gui/gtk-frontend \
Modified: trunk/src/endpoints/opal-account.cpp
==============================================================================
--- trunk/src/endpoints/opal-account.cpp (original)
+++ trunk/src/endpoints/opal-account.cpp Mon Aug 4 20:19:21 2008
@@ -47,6 +47,7 @@
#include "opal-account.h"
#include "form-request-simple.h"
+#include "toolbox.h"
Opal::Account::Account (Ekiga::ServiceCore & _core,
@@ -112,6 +113,15 @@
if (enabled)
enable ();
+
+ if (host == "ekiga.net")
+ type = Account::Ekiga;
+ else if (host == "sip.diamondcard.us")
+ type = Account::DiamondCard;
+ else if (protocol_name == "SIP")
+ type = Account::SIP;
+ else
+ type = Account::H323;
}
@@ -136,6 +146,7 @@
auth_username = _auth_username;
password = _password;
timeout = _timeout;
+ type = t;
if (enabled)
enable ();
@@ -285,6 +296,31 @@
builder.add_action ("remove", _("_Remove"),
sigc::mem_fun (this, &Opal::Account::remove));
+ if (type == DiamondCard) {
+
+ std::stringstream str;
+ std::stringstream url;
+ str << "https://www.diamondcard.us/exec/voip-login?accId=" << get_username () << "&pinCode=" << get_password () << "&spo=ekiga";
+
+ builder.add_separator ();
+
+ url.str ("");
+ url << str.str () << "&act=rch";
+ builder.add_action ("recharge",
+ _("Recharge the account"),
+ sigc::bind (sigc::mem_fun (this, &Opal::Account::on_consult), url.str ()));
+ url.str ("");
+ url << str.str () << "&act=bh";
+ builder.add_action ("balance",
+ _("Consult the balance history"),
+ sigc::bind (sigc::mem_fun (this, &Opal::Account::on_consult), url.str ()));
+ url.str ("");
+ url << str.str () << "&act=ch";
+ builder.add_action ("history",
+ _("Consult the calls history"),
+ sigc::bind (sigc::mem_fun (this, &Opal::Account::on_consult), url.str ()));
+ }
+
return true;
}
@@ -385,3 +421,9 @@
std::cerr << "Invalid result form" << std::endl; // FIXME: do better
}
}
+
+
+void Opal::Account::on_consult (const std::string url)
+{
+ gm_open_uri (url.c_str ());
+}
Modified: trunk/src/endpoints/opal-account.h
==============================================================================
--- trunk/src/endpoints/opal-account.h (original)
+++ trunk/src/endpoints/opal-account.h Mon Aug 4 20:19:21 2008
@@ -109,6 +109,7 @@
private:
void on_edit_form_submitted (Ekiga::Form &result);
+ void on_consult (const std::string url);
bool dead;
bool enabled;
@@ -120,6 +121,7 @@
std::string username;
std::string auth_username;
std::string password;
+ Type type;
Ekiga::ServiceCore & core;
};
Modified: trunk/src/endpoints/opal-bank.cpp
==============================================================================
--- trunk/src/endpoints/opal-bank.cpp (original)
+++ trunk/src/endpoints/opal-bank.cpp Mon Aug 4 20:19:21 2008
@@ -52,13 +52,13 @@
bool Opal::Bank::populate_menu (Ekiga::MenuBuilder & builder)
{
- builder.add_action ("add", _("_Add Ekiga.net Account"),
+ builder.add_action ("add", _("_Add an Ekiga.net Account"),
sigc::bind (sigc::mem_fun (this, &Opal::Bank::new_account), Opal::Account::Ekiga, "", ""));
- builder.add_action ("add", _("_Add Ekiga Call Out Account"),
+ builder.add_action ("add", _("_Add an Ekiga Call Out Account"),
sigc::bind (sigc::mem_fun (this, &Opal::Bank::new_account), Opal::Account::DiamondCard, "", ""));
- builder.add_action ("add", _("_Add SIP Account"),
+ builder.add_action ("add", _("_Add a SIP Account"),
sigc::bind (sigc::mem_fun (this, &Opal::Bank::new_account), Opal::Account::SIP, "", ""));
- builder.add_action ("add", _("_Add H.323 Account"),
+ builder.add_action ("add", _("_Add an H.323 Account"),
sigc::bind (sigc::mem_fun (this, &Opal::Bank::new_account), Opal::Account::H323, "", ""));
return true;
@@ -72,11 +72,12 @@
Ekiga::FormRequestSimple request;
request.title (_("Edit account"));
- request.instructions (_("Please update the following fields:"));
+ request.instructions (_("Please update the following fields."));
switch (t) {
case Opal::Account::Ekiga:
+ request.link (_("Get an ekiga.net SIP account"), "http://www.ekiga.net");
request.hidden ("name", "Ekiga.net");
request.hidden ("host", "ekiga.net");
request.text ("user", _("User:"), username);
@@ -86,6 +87,8 @@
break;
case Opal::Account::DiamondCard:
+ request.link (_("Get an Ekiga Call Out account"),
+ "https://www.diamondcard.us/exec/voip-login?act=sgn&spo=ekiga");
request.hidden ("name", "Ekiga Call Out");
request.hidden ("host", "sip.diamondcard.us");
request.text ("user", _("User:"), username);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]