[ekiga/ds-gtk-application] Actors: Added ContactActor. Added the notion of disabled Actions.



commit 45073660f3db898f7c10d1ac387006056ae9e23a
Author: Damien Sandras <dsandras beip be>
Date:   Sun Mar 23 16:19:02 2014 +0100

    Actors: Added ContactActor. Added the notion of disabled Actions.
    
    This largely simplifies the ActorMenu code.
    
    The ContactActor class handles ContactActions. The set_data method is
    used to set data on all ContactActions of the ContactActor.
    
    The Actor object now can enable/disable Actions by name. This will allow
    disabling Actions on the fly after they have been added. Disabled
    actions will not appear in menus.
    
    When data is set on a ContactAction, the ContactAction is automatically
    disabled when it can not be run with the given data.
    
    This allows having an oversimplistic ActorMenu/ContactActorMenu
    implementation. The ContactActorMenu methods have mostly been removed as
    everything can be handled in the ActorMenu parent class thanks to the
    notion if "enabled" Actions.

 lib/Makefile.am                                    |    2 +
 lib/engine/addressbook/contact-action.cpp          |    7 +-
 lib/engine/addressbook/contact-action.h            |    3 +
 lib/engine/addressbook/contact-actor.cpp           |   69 ++++++++
 lib/engine/addressbook/contact-actor.h             |   97 +++++++++++
 lib/engine/addressbook/contact-core.cpp            |    6 +-
 lib/engine/addressbook/contact-core.h              |    4 +-
 lib/engine/framework/action.cpp                    |   23 +++
 lib/engine/framework/action.h                      |   22 +++
 lib/engine/framework/actor.cpp                     |   28 +++-
 lib/engine/framework/actor.h                       |   25 ++-
 lib/engine/gui/gtk-core/actor-menu.cpp             |  167 ++++----------------
 lib/engine/gui/gtk-core/actor-menu.h               |   24 +---
 .../gui/gtk-frontend/call-history-view-gtk.cpp     |    4 +-
 14 files changed, 299 insertions(+), 182 deletions(-)
---
diff --git a/lib/Makefile.am b/lib/Makefile.am
index d0813e5..9711c39 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -237,6 +237,8 @@ libekiga_la_SOURCES += \
        engine/addressbook/source-impl.h \
        engine/addressbook/contact-action.h \
        engine/addressbook/contact-action.cpp \
+       engine/addressbook/contact-actor.h \
+       engine/addressbook/contact-actor.cpp \
        engine/addressbook/contact-core.h \
        engine/addressbook/contact-core.cpp
 
diff --git a/lib/engine/addressbook/contact-action.cpp b/lib/engine/addressbook/contact-action.cpp
index 3e36702..cc05069 100644
--- a/lib/engine/addressbook/contact-action.cpp
+++ b/lib/engine/addressbook/contact-action.cpp
@@ -57,13 +57,18 @@ ContactAction::set_data (ContactPtr _contact,
 {
   contact = _contact;
   uri = _uri;
+
+  if (can_run_with_data (contact, uri))
+    enable ();
+  else
+    disable ();
 }
 
 
 void
 ContactAction::on_activated ()
 {
-  if (can_run_with_data (contact, uri))
+  if (is_enabled ())
     callback (contact, uri);
 }
 
diff --git a/lib/engine/addressbook/contact-action.h b/lib/engine/addressbook/contact-action.h
index a83f739..f79aa3e 100644
--- a/lib/engine/addressbook/contact-action.h
+++ b/lib/engine/addressbook/contact-action.h
@@ -77,6 +77,7 @@ namespace Ekiga {
 
     /** Set the (Contact, uri) tuple on which the ContactAction should be run.
      * They must stay valid until the ContactAction is activated.
+     * The Action is enabled/disabled following the parameters validity.
      * @param the contact part of the tuple.
      * @param the uri part of the tuple.
      */
@@ -104,6 +105,8 @@ namespace Ekiga {
     std::string uri;
   };
 
+  typedef boost::shared_ptr<ContactAction> ContactActionPtr;
+
   /**
    * @}
    */
diff --git a/lib/engine/addressbook/contact-actor.cpp b/lib/engine/addressbook/contact-actor.cpp
new file mode 100644
index 0000000..31d6a2e
--- /dev/null
+++ b/lib/engine/addressbook/contact-actor.cpp
@@ -0,0 +1,69 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2014 Damien Sandras <dsandras seconix com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         contact-actor.cpp  -  description
+ *                         ---------------------------------
+ *   begin                : written in March 2014 by Damien Sandras
+ *   copyright            : (c) 2014 by Damien Sandras
+ *   description          : An engine contact actor.
+ *
+ */
+
+#include "contact-actor.h"
+
+using namespace Ekiga;
+
+
+void
+ContactActor::add_action (ActionPtr action)
+{
+  actions.insert (std::make_pair (action->get_name (), action));
+
+  ContactActionPtr a = boost::dynamic_pointer_cast<ContactAction> (action);
+  if (a != NULL)
+    a->set_data (contact, uri);
+}
+
+
+void
+ContactActor::set_data (ContactPtr _contact,
+                        const std::string & _uri)
+{
+  ActionMap::iterator it;
+
+  contact = _contact;
+  uri = _uri;
+
+  for (it = actions.begin(); it != actions.end(); ++it) {
+
+    ContactActionPtr a = boost::dynamic_pointer_cast<ContactAction> (it->second);
+    if (a != NULL)
+      a->set_data (contact, uri);
+  }
+}
diff --git a/lib/engine/addressbook/contact-actor.h b/lib/engine/addressbook/contact-actor.h
new file mode 100644
index 0000000..f06b272
--- /dev/null
+++ b/lib/engine/addressbook/contact-actor.h
@@ -0,0 +1,97 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2014 Damien Sandras <dsandras seconix com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         contact-actor.h  -  description
+ *                         -------------------------------
+ *   begin                : written in March 2014 by Damien Sandras
+ *   copyright            : (c) 2014 by Damien Sandras
+ *   description          : An engine contact actor.
+ *
+ */
+
+#ifndef __CONTACT_ACTOR_H__
+#define __CONTACT_ACTOR_H__
+
+#include <string>
+
+#include "contact-action.h"
+#include "actor.h"
+
+namespace Ekiga {
+
+  /**
+   * @defgroup actions ContactActor
+   * @{
+   */
+
+
+  /* An actor is an object able to execute Actions.
+   *
+   * Actor can register actions through the add_action method.
+   * acting.
+   */
+  class ContactActor : public Actor
+  {
+    friend class ContactActorMenu;
+
+  public:
+
+    /** Register an action on the given ContactActor.
+     *
+     * Actions that are not "added" using this method will not be usable
+     * from menus.
+     *
+     * @param A ContactAction.
+     */
+    void add_action (ActionPtr action);
+
+
+    /** Set the (Contact, uri) tuple on which the ContactActions should be run.
+     * They must stay valid until the ContactAction is activated.
+     * Actions are enabled/disabled following the parameters validity.
+     * @param the contact part of the tuple.
+     * @param the uri part of the tuple.
+     */
+    void set_data (ContactPtr _contact = ContactPtr (),
+                   const std::string & _uri = "");
+
+
+  private:
+
+    ContactPtr contact;
+    std::string uri;
+  };
+
+  /**
+   * @}
+   */
+}
+
+#endif
+
diff --git a/lib/engine/addressbook/contact-core.cpp b/lib/engine/addressbook/contact-core.cpp
index e62a872..a131191 100644
--- a/lib/engine/addressbook/contact-core.cpp
+++ b/lib/engine/addressbook/contact-core.cpp
@@ -101,8 +101,8 @@ Ekiga::ContactCore::add_contact_decorator (boost::shared_ptr<ContactDecorator> d
 
 
 bool
-Ekiga::ContactCore::populate_contact_menu (ContactPtr contact,
-                                          const std::string uri,
+Ekiga::ContactCore::populate_contact_menu (ContactPtr _contact,
+                                          const std::string _uri,
                                           MenuBuilder &builder)
 {
   bool populated = false;
@@ -112,7 +112,7 @@ Ekiga::ContactCore::populate_contact_menu (ContactPtr contact,
        iter != contact_decorators.end ();
        ++iter) {
 
-    populated = (*iter)->populate_menu (contact, uri, builder) || populated;
+    populated = (*iter)->populate_menu (_contact, _uri, builder) || populated;
   }
 
   return populated;
diff --git a/lib/engine/addressbook/contact-core.h b/lib/engine/addressbook/contact-core.h
index 02f84ba..581b964 100644
--- a/lib/engine/addressbook/contact-core.h
+++ b/lib/engine/addressbook/contact-core.h
@@ -37,7 +37,7 @@
 #define __CONTACT_CORE_H__
 
 #include "services.h"
-#include "actor.h"
+#include "contact-actor.h"
 #include "source.h"
 #include "scoped-connections.h"
 
@@ -69,7 +69,7 @@ namespace Ekiga
    */
   class ContactCore:
     public virtual LiveObject,
-    public Actor,
+    public ContactActor,
     public Service
   {
   public:
diff --git a/lib/engine/framework/action.cpp b/lib/engine/framework/action.cpp
index ba4d083..5af12af 100644
--- a/lib/engine/framework/action.cpp
+++ b/lib/engine/framework/action.cpp
@@ -45,6 +45,7 @@ Action::Action (const std::string & _name,
 {
   name = _name;
   description = _description;
+  enabled = true;
 
   activated.connect (boost::bind (&Action::on_activated, this));
 }
@@ -57,6 +58,7 @@ Action::Action (const std::string & _name,
   name = _name;
   description = _description;
   callback = _callback;
+  enabled = true;
 
   activated.connect (boost::bind (&Action::on_activated, this));
 }
@@ -86,6 +88,27 @@ Action::activate ()
 
 
 void
+Action::enable ()
+{
+  enabled = true;
+}
+
+
+void
+Action::disable ()
+{
+  enabled = false;
+}
+
+
+bool
+Action::is_enabled ()
+{
+  return enabled;
+}
+
+
+void
 Action::on_activated ()
 {
   callback ();
diff --git a/lib/engine/framework/action.h b/lib/engine/framework/action.h
index 1a476d6..3e189df 100644
--- a/lib/engine/framework/action.h
+++ b/lib/engine/framework/action.h
@@ -122,6 +122,26 @@ namespace Ekiga {
     void activate ();
 
 
+    /** Enable the Action.
+     * This will enable the action. Only enabled actions are usable
+     * and appear in menus.
+     */
+    void enable ();
+
+
+    /** Disable the Action.
+     * This will disable the action. Only enabled actions are usable
+     * and appear in menus.
+     */
+    void disable ();
+
+
+    /** Return the Action state.
+     * @return true if the Action is enabled, false otherwise.
+     */
+    bool is_enabled ();
+
+
   protected:
 
     std::string name;
@@ -141,6 +161,8 @@ namespace Ekiga {
      * the signal execution.
      */
     boost::signals2::signal<void(void)> activated;
+
+    bool enabled;
   };
 
   typedef boost::shared_ptr<Action> ActionPtr;
diff --git a/lib/engine/framework/actor.cpp b/lib/engine/framework/actor.cpp
index 6e8d9fd..3988c04 100644
--- a/lib/engine/framework/actor.cpp
+++ b/lib/engine/framework/actor.cpp
@@ -44,16 +44,30 @@ void
 Actor::add_action (ActionPtr action)
 {
   actions.insert (std::make_pair (action->get_name (), action));
-  action_added (action->get_name ());
 }
 
 
-bool
-Actor::remove_action (const std::string & name)
+void
+Actor::enable_action (const std::string & name)
+{
+  ActionMap::iterator it;
+  it = actions.find (name);
+
+  if (it != actions.end ()) {
+    it->second->enable ();
+    action_enabled (name);
+  }
+}
+
+
+void
+Actor::disable_action (const std::string & name)
 {
-  bool success = (actions.erase (name) > 0);
-  if (success)
-    action_removed (name);
+  ActionMap::iterator it;
+  it = actions.find (name);
 
-  return success;
+  if (it != actions.end ()) {
+    it->second->disable ();
+    action_disabled (name);
+  }
 }
diff --git a/lib/engine/framework/actor.h b/lib/engine/framework/actor.h
index 8009710..9ee0ebd 100644
--- a/lib/engine/framework/actor.h
+++ b/lib/engine/framework/actor.h
@@ -58,7 +58,6 @@ namespace Ekiga {
   class Actor
   {
     friend class ActorMenu;
-    friend class ContactActorMenu;
 
   public:
 
@@ -69,15 +68,21 @@ namespace Ekiga {
      *
      * @param An Action.
      */
-    void add_action (ActionPtr action);
+    virtual void add_action (ActionPtr action);
 
 
-    /** Remove an action on the given Actor.
+    /** Enable a specific action on the given Actor.
      *
-     * @param An Action name.
-     * @return True if the action has been removed, false otherwise.
+     * @param The Action name.
      */
-    bool remove_action (const std::string & name);
+    void enable_action (const std::string & name);
+
+
+    /** Disable a specific action on the given Actor.
+     *
+     * @param The Action name.
+     */
+    void disable_action (const std::string & name);
 
 
   protected:
@@ -86,10 +91,12 @@ namespace Ekiga {
      */
     virtual void register_actions () = 0;
 
-    /** Those signals are emitted when the ActionMap is updated.
+
+    /** Those signals are emitted when an Action is enabled/disabled
+     *  in the ActionMap.
      */
-    boost::signals2::signal<void(const std::string &)> action_added;
-    boost::signals2::signal<void(const std::string &)> action_removed;
+    boost::signals2::signal<void(const std::string &)> action_enabled;
+    boost::signals2::signal<void(const std::string &)> action_disabled;
 
     ActionMap actions;
   };
diff --git a/lib/engine/gui/gtk-core/actor-menu.cpp b/lib/engine/gui/gtk-core/actor-menu.cpp
index c4ef5c6..b8b47dd 100644
--- a/lib/engine/gui/gtk-core/actor-menu.cpp
+++ b/lib/engine/gui/gtk-core/actor-menu.cpp
@@ -40,6 +40,7 @@
 
 #include "action.h"
 #include "contact-core.h"
+#include "contact-actor.h"
 #include "actor-menu.h"
 
 
@@ -59,8 +60,10 @@ action_activated (GSimpleAction *a,
 
 Ekiga::ActorMenu::ActorMenu (Ekiga::Actor & _obj) : obj (_obj)
 {
-  obj.action_added.connect (boost::bind (&Ekiga::ActorMenu::add_gio_action, this, _1));
-  obj.action_removed.connect (boost::bind (&Ekiga::ActorMenu::remove_gio_action, this, _1));
+  obj.action_enabled.connect (boost::bind (static_cast<void (Ekiga::ActorMenu::*)(const 
std::string&)>(&Ekiga::ActorMenu::add_gio_action), this, _1));
+  obj.action_disabled.connect (boost::bind (&Ekiga::ActorMenu::remove_gio_action, this, _1));
+
+  sync_gio_actions ();
 }
 
 
@@ -75,19 +78,12 @@ Ekiga::ActorMenu::~ActorMenu ()
 
 
 void
-Ekiga::ActorMenu::add_gio_actions ()
+Ekiga::ActorMenu::sync_gio_actions ()
 {
   ActionMap::const_iterator it;
 
-  for (it = obj.actions.begin(); it != obj.actions.end(); ++it) {
-
-    if (!g_action_map_lookup_action (G_ACTION_MAP (g_application_get_default ()),
-                                     it->first.c_str ())) {
-
-      Ekiga::Action *a = dynamic_cast<Ekiga::Action *> (it->second.get ());
-      add_action (a);
-    }
-  }
+  for (it = obj.actions.begin(); it != obj.actions.end(); ++it)
+    add_gio_action (boost::dynamic_pointer_cast<Action> (it->second));
 }
 
 
@@ -97,24 +93,24 @@ Ekiga::ActorMenu::add_gio_action (const std::string & name)
   ActionMap::const_iterator it;
 
   it = obj.actions.find (name);
-
-  if (it != obj.actions.end ()
-      && !g_action_map_lookup_action (G_ACTION_MAP (g_application_get_default ()),
-                                      it->first.c_str ())) {
-
-    Ekiga::Action *a = dynamic_cast<Ekiga::Action *> (it->second.get ());
-    add_action (a);
-  }
+  if (it != obj.actions.end ())
+    add_gio_action (boost::dynamic_pointer_cast<Action> (it->second));
 }
 
 
 void
-Ekiga::ActorMenu::add_action (Ekiga::Action *a)
+Ekiga::ActorMenu::add_gio_action (Ekiga::ActionPtr a)
 {
   GSimpleAction *action = NULL;
 
+  /* Action is disabled or already present */
+  if (!a->is_enabled ()
+      || g_action_map_lookup_action (G_ACTION_MAP (g_application_get_default ()),
+                                     a->get_name ().c_str ()))
+    return;
+
   action = g_simple_action_new (a->get_name ().c_str (), NULL);
-  g_object_set_data (G_OBJECT (action), "action", a);
+  g_object_set_data (G_OBJECT (action), "action", a.get ());
   g_action_map_add_action (G_ACTION_MAP (g_application_get_default ()),
                            G_ACTION (action));
   g_signal_connect (action, "activate",
@@ -146,16 +142,6 @@ Ekiga::ActorMenu::get_xml_menu (const std::string & id,
 }
 
 
-Ekiga::ActorMenu *
-Ekiga::ActorMenu::create (Ekiga::Actor & obj)
-{
-  Ekiga::ActorMenu *m = new Ekiga::ActorMenu (obj);
-  m->add_gio_actions ();
-
-  return m;
-}
-
-
 void
 Ekiga::ActorMenu::activate (Ekiga::Action *action)
 {
@@ -176,11 +162,12 @@ Ekiga::ActorMenu::as_xml (const std::string & id)
 
   for (it = obj.actions.begin(); it != obj.actions.end(); ++it) {
 
-    xml_content +=
-      "      <item>"
-      "        <attribute name=\"label\" translatable=\"yes\">"+it->second->get_description ()+"</attribute>"
-      "        <attribute name=\"action\">win."+it->second->get_name ()+"</attribute>"
-      "      </item>";
+    if (it->second->is_enabled ())
+      xml_content +=
+        "      <item>"
+        "        <attribute name=\"label\" translatable=\"yes\">"+it->second->get_description 
()+"</attribute>"
+        "        <attribute name=\"action\">win."+it->second->get_name ()+"</attribute>"
+        "      </item>";
   }
 
   xml_content +=
@@ -196,110 +183,12 @@ Ekiga::ContactActorMenu::ContactActorMenu (Ekiga::Actor & _obj) : ActorMenu (_ob
 
 
 void
-Ekiga::ContactActorMenu::add_gio_actions ()
-{
-  ActionMap::const_iterator it;
-
-  for (it = obj.actions.begin(); it != obj.actions.end(); ++it) {
-
-    Ekiga::ContactAction *a = dynamic_cast<Ekiga::ContactAction *> (it->second.get ());
-    add_action (a);
-  }
-}
-
-
-void
-Ekiga::ContactActorMenu::add_gio_action (const std::string & name)
-{
-  ActionMap::const_iterator it;
-
-  it = obj.actions.find (name);
-
-  if (it != obj.actions.end ()
-      && !g_action_map_lookup_action (G_ACTION_MAP (g_application_get_default ()),
-                                                 it->first.c_str ())) {
-
-    Ekiga::ContactAction *a = dynamic_cast<Ekiga::ContactAction *> (it->second.get ());
-    add_action (a);
-  }
-}
-
-
-void
-Ekiga::ContactActorMenu::add_action (Ekiga::Action *_action)
-{
-  GSimpleAction *action = NULL;
-  Ekiga::ContactAction *a = dynamic_cast<Ekiga::ContactAction *> (_action);
-
-  if (!a || !a->can_run_with_data (contact, uri)) {
-    a->set_data (); // Make sure action data is reset
-
-    g_action_map_remove_action (G_ACTION_MAP (g_application_get_default ()),
-                                a->get_name ().c_str ());
-  }
-  else if (a && a->can_run_with_data (contact, uri)) {
-    a->set_data (contact, uri); // Make sure action data is set
-
-    action = g_simple_action_new (a->get_name ().c_str (), NULL);
-    g_object_set_data (G_OBJECT (action), "action", a);
-    g_action_map_add_action (G_ACTION_MAP (g_application_get_default ()),
-                             G_ACTION (action));
-    g_signal_connect (action, "activate",
-                      G_CALLBACK (action_activated),
-                      (gpointer) this);
-    g_object_unref (action);
-  }
-}
-
-
-void
 Ekiga::ContactActorMenu::set_data (Ekiga::ContactPtr _contact,
                                    const std::string & _uri)
 {
-  contact = _contact;
-  uri = _uri;
-
-  add_gio_actions ();
-}
-
-
-const std::string
-Ekiga::ContactActorMenu::as_xml (const std::string & id)
-{
-  ActionMap::const_iterator it;
-  std::string xml_content;
-
-  if (!id.empty ())
-   xml_content += "    <section id=\"" + id + "\">";
-  else
-   xml_content += "    <section>";
-
-  for (it = obj.actions.begin(); it != obj.actions.end(); ++it) {
-
-    Ekiga::ContactAction *action = dynamic_cast<Ekiga::ContactAction *> (it->second.get ());
-
-    if (action && action->can_run_with_data (contact, uri)) {
-      action->set_data (contact, uri);
-      xml_content +=
-        "      <item>"
-        "        <attribute name=\"label\" translatable=\"yes\">"+it->second->get_description 
()+"</attribute>"
-        "        <attribute name=\"action\">win."+it->second->get_name ()+"</attribute>"
-        "      </item>";
-    }
-  }
-
-  xml_content +=
-    "    </section>";
-
-  return xml_content;
-}
-
-
-Ekiga::ContactActorMenu *
-Ekiga::ContactActorMenu::create (Ekiga::Actor & obj)
-{
-  Ekiga::ContactActorMenu *m = new Ekiga::ContactActorMenu (obj);
-  m->add_gio_actions ();
+  Ekiga::ContactActor *actor = dynamic_cast <Ekiga::ContactActor *> (&obj);
+  if (actor)
+    actor->set_data (_contact, _uri);
 
-  return m;
+  sync_gio_actions ();
 }
diff --git a/lib/engine/gui/gtk-core/actor-menu.h b/lib/engine/gui/gtk-core/actor-menu.h
index 04b4686..bf70603 100644
--- a/lib/engine/gui/gtk-core/actor-menu.h
+++ b/lib/engine/gui/gtk-core/actor-menu.h
@@ -60,9 +60,8 @@ namespace Ekiga {
   {
   public:
 
-    static ActorMenu* create (Actor & obj);
-
-    ~ActorMenu ();
+    ActorMenu (Actor & obj);
+    virtual ~ActorMenu ();
 
     virtual void activate (Ekiga::Action *action);
     virtual const std::string as_xml (const std::string & id = "");
@@ -72,10 +71,9 @@ namespace Ekiga {
                                            bool full);
 
   protected:
-    ActorMenu (Actor & obj);
-    virtual void add_gio_actions ();
+    virtual void sync_gio_actions ();
     virtual void add_gio_action (const std::string & name);
-    virtual void add_action (Action *a);
+    virtual void add_gio_action (ActionPtr a);
     virtual void remove_gio_action (const std::string & name);
 
     Actor & obj;
@@ -84,22 +82,10 @@ namespace Ekiga {
   class ContactActorMenu : public ActorMenu
   {
   public:
-
-    static ContactActorMenu* create (Actor & obj);
+    ContactActorMenu (Actor & obj);
 
     void set_data (ContactPtr _contact = ContactPtr (),
                    const std::string & _uri = "");
-
-    const std::string as_xml (const std::string & id = "");
-
-  protected:
-    ContactActorMenu (Actor & obj);
-    void add_gio_actions ();
-    void add_gio_action (const std::string & name);
-    void add_action (Action *a);
-
-    ContactPtr contact;
-    std::string uri;
   };
 
   typedef boost::shared_ptr<ActorMenu> ActorMenuPtr;
diff --git a/lib/engine/gui/gtk-frontend/call-history-view-gtk.cpp 
b/lib/engine/gui/gtk-frontend/call-history-view-gtk.cpp
index 0398f40..66b6317 100644
--- a/lib/engine/gui/gtk-frontend/call-history-view-gtk.cpp
+++ b/lib/engine/gui/gtk-frontend/call-history-view-gtk.cpp
@@ -367,8 +367,8 @@ call_history_view_gtk_new (boost::shared_ptr<History::Book> book,
   on_book_updated(self);
 
   /* register book actions */
-  self->priv->menu = Ekiga::ActorMenuPtr (Ekiga::ActorMenu::create (*book));
-  self->priv->contact_menu = Ekiga::ContactActorMenuPtr (Ekiga::ContactActorMenu::create (*ccore));
+  self->priv->menu = Ekiga::ActorMenuPtr (new Ekiga::ActorMenu (*book));
+  self->priv->contact_menu = Ekiga::ContactActorMenuPtr (new Ekiga::ContactActorMenu (*ccore));
 
   return GTK_WIDGET (self);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]