[ekiga/ds-gtk-application] Opal::Account: Moved Heap actions to the new Actor mechanism.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga/ds-gtk-application] Opal::Account: Moved Heap actions to the new Actor mechanism.
- Date: Tue, 16 Sep 2014 19:22:11 +0000 (UTC)
commit 6ac6e7e3c7275bb79b1d0f368fe495ac9ce99ac6
Author: Damien Sandras <dsandras seconix com>
Date: Tue Sep 16 21:20:43 2014 +0200
Opal::Account: Moved Heap actions to the new Actor mechanism.
lib/engine/components/opal/opal-account.cpp | 49 +++++++++++++++++------
lib/engine/components/opal/opal-account.h | 2 -
lib/engine/gui/gtk-frontend/roster-view-gtk.cpp | 28 ++++++++-----
3 files changed, 54 insertions(+), 25 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index 64ae0ed..668f00f 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -196,7 +196,36 @@ Opal::Account::Account (boost::shared_ptr<Opal::Sip::EndPoint> _sip_endpoint,
setup_presentity ();
/* Actor stuff */
- register_actions ();
+ add_action (Ekiga::ActionPtr (new Ekiga::Action ("add", _("A_dd Contact"),
+ boost::bind (&Opal::Account::add_contact, this))));
+ add_action (Ekiga::ActionPtr (new Ekiga::Action ("edit", _("_Edit"),
+ boost::bind (&Opal::Account::edit, this))));
+ add_action (Ekiga::ActionPtr (new Ekiga::Action ("remove", _("_Remove"),
+ boost::bind (&Opal::Account::remove, this))));
+ add_action (Ekiga::ActionPtr (new Ekiga::Action ("enable", _("_Enable"),
+ boost::bind (&Opal::Account::enable, this), !is_enabled
())));
+ add_action (Ekiga::ActionPtr (new Ekiga::Action ("disable", _("_Disable"),
+ boost::bind (&Opal::Account::disable, this), is_enabled
())));
+
+ 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";
+
+ url.str ("");
+ url << str.str () << "&act=rch";
+ add_action (Ekiga::ActionPtr (new Ekiga::Action ("recharge", _("Recharge the account"),
+ boost::bind (&Opal::Account::on_consult, this, url.str
()))));
+ url.str ("");
+ url << str.str () << "&act=bh";
+ add_action (Ekiga::ActionPtr (new Ekiga::Action ("balance", _("Consult the balance history"),
+ boost::bind (&Opal::Account::on_consult, this, url.str
()))));
+ url.str ("");
+ url << str.str () << "&act=ch";
+ add_action (Ekiga::ActionPtr (new Ekiga::Action ("history", _("Consult the call history"),
+ boost::bind (&Opal::Account::on_consult, this, url.str
()))));
+ }
}
@@ -438,6 +467,9 @@ Opal::Account::enable ()
updated ();
trigger_saving ();
+
+ disable_action ("enable");
+ enable_action ("disable");
}
@@ -471,6 +503,9 @@ Opal::Account::disable ()
updated ();
trigger_saving ();
+
+ enable_action ("enable");
+ disable_action ("disable");
}
@@ -544,7 +579,7 @@ Opal::Account::populate_menu (Ekiga::MenuBuilder &builder)
builder.add_action ("add", _("A_dd Contact"),
boost::bind (&Opal::Account::add_contact, this));
-
+
builder.add_separator ();
builder.add_action ("edit", _("_Edit"),
@@ -833,16 +868,6 @@ Opal::Account::publish (const Ekiga::PersonalDetails& details)
void
-Opal::Account::register_actions ()
-{
- /* Add Actor actions */
-// add_action (Ekiga::ActionPtr (new Ekiga::Action (id + "-new-contact", _("New Contact"),
- // boost::bind (&Opal::Account::add_contact, this)));
- std::cout << "FIXME" << std::endl << std::flush;
-}
-
-
-void
Opal::Account::fetch (const std::string uri) const
{
// Check if this is a presentity we watch
diff --git a/lib/engine/components/opal/opal-account.h b/lib/engine/components/opal/opal-account.h
index 583d800..b4c325a 100644
--- a/lib/engine/components/opal/opal-account.h
+++ b/lib/engine/components/opal/opal-account.h
@@ -193,8 +193,6 @@ public:
boost::signals2::signal<void(std::string, std::string)> status_received;
private:
- void register_actions ();
-
void fetch (const std::string uri) const;
void unfetch (const std::string uri) const;
diff --git a/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp b/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
index 95f17d2..085c478 100644
--- a/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
+++ b/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
@@ -63,7 +63,9 @@ struct _RosterViewGtkPrivate
gboolean show_offline_contacts;
Ekiga::Presentity *selected_presentity;
+ Ekiga::Heap *selected_heap;
Ekiga::GActorMenuPtr presentity_menu;
+ Ekiga::GActorMenuPtr heap_menu;
};
typedef struct _StatusIconInfo {
@@ -690,28 +692,32 @@ on_selection_changed (GtkTreeSelection* selection,
COLUMN_PRESENTITY, &presentity,
-1);
+ /* Reset old data. This also ensures GIO actions are
+ * properly removed before adding new ones.
+ */
+ self->priv->presentity_menu.reset ();
+ self->priv->heap_menu.reset ();
+ self->priv->selected_presentity = NULL;
+ self->priv->selected_heap = NULL;
+
switch (column_type) {
case TYPE_HEAP:
+ if (heap != NULL) {
+ self->priv->selected_heap = heap;
+ self->priv->heap_menu = Ekiga::GActorMenuPtr (new Ekiga::GActorMenu (*self->priv->selected_heap));
+ }
break;
case TYPE_GROUP:
break;
case TYPE_PRESENTITY:
- /* Reset old data. This also ensures GIO actions are
- * properly removed before adding new ones.
- */
- self->priv->presentity_menu.reset ();
- self->priv->selected_presentity = NULL;
-
if (presentity != NULL) {
self->priv->selected_presentity = presentity;
self->priv->presentity_menu = Ekiga::GActorMenuPtr (new Ekiga::GActorMenu
(*self->priv->selected_presentity));
}
-
- presentity->populate_menu (builder);
break;
default:
@@ -779,7 +785,8 @@ on_view_event_after (GtkWidget *tree_view,
if (event->type == GDK_BUTTON_PRESS && event->button == 1 && name)
on_clicked_fold (self, path, name);
if (event->type == GDK_BUTTON_PRESS && event->button == 3)
- on_clicked_show_heap_menu (heap, event);
+ gtk_menu_popup (GTK_MENU (self->priv->heap_menu->get_menu ()),
+ NULL, NULL, NULL, NULL, event->button, event->time);
break;
case TYPE_GROUP:
@@ -793,8 +800,6 @@ on_view_event_after (GtkWidget *tree_view,
if (event->type == GDK_BUTTON_PRESS && event->button == 3)
gtk_menu_popup (GTK_MENU (self->priv->presentity_menu->get_menu ()),
NULL, NULL, NULL, NULL, event->button, event->time);
- //on_clicked_show_presentity_menu (heap, presentity, event);
-
if (event->type == GDK_2BUTTON_PRESS || event->type == GDK_KEY_PRESS)
on_clicked_trigger_presentity (presentity);
break;
@@ -1456,6 +1461,7 @@ roster_view_gtk_init (RosterViewGtk* self)
self->priv = new RosterViewGtkPrivate;
self->priv->selected_presentity = NULL;
+ self->priv->selected_heap = NULL;
self->priv->settings = new Ekiga::Settings (CONTACTS_SCHEMA);
self->priv->folded_groups = self->priv->settings->get_slist ("roster-folded-groups");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]