ekiga r6508 - in trunk: . lib/engine/addressbook/call-history lib/engine/addressbook/evolution lib/engine/addressbook/ldap lib/engine/addressbook/skel lib/engine/gui/gtk-frontend lib/engine/presence/local-roster lib/engine/presence/skel src/endpoints
- From: jpuydt svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r6508 - in trunk: . lib/engine/addressbook/call-history lib/engine/addressbook/evolution lib/engine/addressbook/ldap lib/engine/addressbook/skel lib/engine/gui/gtk-frontend lib/engine/presence/local-roster lib/engine/presence/skel src/endpoints
- Date: Fri, 25 Jul 2008 14:05:34 +0000 (UTC)
Author: jpuydt
Date: Fri Jul 25 14:05:34 2008
New Revision: 6508
URL: http://svn.gnome.org/viewvc/ekiga?rev=6508&view=rev
Log:
Made the ContactDecorator api more similar to this of PresentityDecorator, and removed the get_uris method from Ekiga::Contact
Modified:
trunk/ChangeLog
trunk/lib/engine/addressbook/call-history/history-contact.cpp
trunk/lib/engine/addressbook/call-history/history-contact.h
trunk/lib/engine/addressbook/evolution/evolution-contact.cpp
trunk/lib/engine/addressbook/evolution/evolution-contact.h
trunk/lib/engine/addressbook/ldap/ldap-contact.cpp
trunk/lib/engine/addressbook/ldap/ldap-contact.h
trunk/lib/engine/addressbook/skel/contact-core.cpp
trunk/lib/engine/addressbook/skel/contact-core.h
trunk/lib/engine/addressbook/skel/contact.h
trunk/lib/engine/gui/gtk-frontend/book-view-gtk.cpp
trunk/lib/engine/presence/local-roster/local-roster-bridge.cpp
trunk/lib/engine/presence/skel/presence-core.cpp
trunk/lib/engine/presence/skel/presence-core.h
trunk/src/endpoints/h323.cpp
trunk/src/endpoints/h323.h
trunk/src/endpoints/sip.cpp
trunk/src/endpoints/sip.h
Modified: trunk/lib/engine/addressbook/call-history/history-contact.cpp
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-contact.cpp (original)
+++ trunk/lib/engine/addressbook/call-history/history-contact.cpp Fri Jul 25 14:05:34 2008
@@ -33,6 +33,8 @@
*
*/
+#include "config.h"
+
#include <iostream>
#include <glib.h>
@@ -143,13 +145,13 @@
switch (m_type) {
case RECEIVED:
- groups.insert ("Received"); // FIXME: translate
+ groups.insert (_("Received"));
break;
case PLACED:
- groups.insert ("Placed"); // FIXME: translate
+ groups.insert (_("Placed"));
break;
case MISSED:
- groups.insert ("Missed"); // FIXME: translate
+ groups.insert (_("Missed"));
break;
default:
@@ -162,7 +164,7 @@
bool
History::Contact::populate_menu (Ekiga::MenuBuilder &builder)
{
- return contact_core->populate_contact_menu (*this, builder);
+ return contact_core->populate_contact_menu (*this, uri, builder);
}
xmlNodePtr
@@ -189,16 +191,6 @@
return call_duration;
}
-const std::map<std::string,std::string>
-History::Contact::get_uris () const
-{
- std::map<std::string,std::string> result;
-
- result[""] = uri;
-
- return result;
-}
-
bool
History::Contact::is_found (std::string /*test*/) const
{
Modified: trunk/lib/engine/addressbook/call-history/history-contact.h
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-contact.h (original)
+++ trunk/lib/engine/addressbook/call-history/history-contact.h Fri Jul 25 14:05:34 2008
@@ -81,8 +81,6 @@
bool populate_menu (Ekiga::MenuBuilder &builder);
- const std::map<std::string,std::string> get_uris () const;
-
bool is_found (std::string test) const;
/*** more specific api ***/
Modified: trunk/lib/engine/addressbook/evolution/evolution-contact.cpp
==============================================================================
--- trunk/lib/engine/addressbook/evolution/evolution-contact.cpp (original)
+++ trunk/lib/engine/addressbook/evolution/evolution-contact.cpp Fri Jul 25 14:05:34 2008
@@ -103,21 +103,6 @@
return groups;
}
-const std::map<std::string, std::string>
-Evolution::Contact::get_uris () const
-{
- std::map<std::string, std::string> uris;
-
- for (unsigned int attr_type = 0; attr_type < ATTR_NUMBER; attr_type++) {
-
- std::string attr_value = get_attribute_value (attr_type);
- if ( !attr_value.empty ())
- uris[get_attribute_name_from_type (attr_type)] = attr_value;
- }
-
- return uris;
-}
-
bool
Evolution::Contact::is_found (const std::string /*test*/) const
{
@@ -221,19 +206,34 @@
{
Ekiga::ContactCore *core = dynamic_cast<Ekiga::ContactCore *>(services.get ("contact-core"));
bool populated = false;
+ std::map<std::string, std::string> uris;
+
+ if (core != NULL) {
- if (core != NULL)
- populated = core->populate_contact_menu (*this, builder);
+ for (unsigned int attr_type = 0; attr_type < ATTR_NUMBER; attr_type++) {
- if (populated)
- builder.add_separator ();
+ std::string attr_value = get_attribute_value (attr_type);
+ if ( !attr_value.empty ()) {
- builder.add_action ("remove", _("_Remove"),
- sigc::mem_fun (this, &Evolution::Contact::remove));
- builder.add_action ("edit", _("_Edit"),
- sigc::mem_fun (this, &Evolution::Contact::edit_action));
+ // get_attribute_name_from_type (attr_type) will tell the name of
+ // this attribute
+ populated = populated || core->populate_contact_menu (*this,
+ attr_value,
+ builder);
+ }
+ }
+
+ if (populated)
+ builder.add_separator ();
+
+ builder.add_action ("remove", _("_Remove"),
+ sigc::mem_fun (this, &Evolution::Contact::remove));
+ builder.add_action ("edit", _("_Edit"),
+ sigc::mem_fun (this, &Evolution::Contact::edit_action));
+ populated = true;
+ }
- return true;
+ return populated;
}
Modified: trunk/lib/engine/addressbook/evolution/evolution-contact.h
==============================================================================
--- trunk/lib/engine/addressbook/evolution/evolution-contact.h (original)
+++ trunk/lib/engine/addressbook/evolution/evolution-contact.h Fri Jul 25 14:05:34 2008
@@ -69,8 +69,6 @@
const std::set<std::string> get_groups () const;
- const std::map<std::string, std::string> get_uris () const;
-
bool populate_menu (Ekiga::MenuBuilder &builder);
bool is_found (const std::string) const;
Modified: trunk/lib/engine/addressbook/ldap/ldap-contact.cpp
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-contact.cpp (original)
+++ trunk/lib/engine/addressbook/ldap/ldap-contact.cpp Fri Jul 25 14:05:34 2008
@@ -43,9 +43,8 @@
OPENLDAP::Contact::Contact (Ekiga::ServiceCore &_core,
const std::string _name,
const std::string _uri)
- : core(_core), name(_name)
+ : core(_core), name(_name), uri(_uri)
{
- uris[""] = _uri;
}
@@ -65,12 +64,6 @@
return std::set<std::string>();
}
-const std::map<std::string, std::string>
-OPENLDAP::Contact::get_uris () const
-{
- return uris;
-}
-
bool
OPENLDAP::Contact::populate_menu (Ekiga::MenuBuilder &builder)
{
@@ -80,7 +73,7 @@
* (before or after the uri-specific actions)
*/
- return contact_core->populate_contact_menu (*this, builder);
+ return contact_core->populate_contact_menu (*this, uri, builder);
}
bool
Modified: trunk/lib/engine/addressbook/ldap/ldap-contact.h
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-contact.h (original)
+++ trunk/lib/engine/addressbook/ldap/ldap-contact.h Fri Jul 25 14:05:34 2008
@@ -63,8 +63,6 @@
const std::set<std::string> get_groups () const;
- const std::map<std::string, std::string> get_uris () const;
-
bool populate_menu (Ekiga::MenuBuilder &builder);
bool is_found (const std::string) const;
@@ -75,7 +73,7 @@
std::string name;
- std::map<std::string, std::string> uris;
+ std::string uri;
};
/**
Modified: trunk/lib/engine/addressbook/skel/contact-core.cpp
==============================================================================
--- trunk/lib/engine/addressbook/skel/contact-core.cpp (original)
+++ trunk/lib/engine/addressbook/skel/contact-core.cpp Fri Jul 25 14:05:34 2008
@@ -149,24 +149,23 @@
void
Ekiga::ContactCore::add_contact_decorator (ContactDecorator &decorator)
{
- contact_decorators.insert (&decorator);
+ contact_decorators.push_back (&decorator);
}
bool
Ekiga::ContactCore::populate_contact_menu (Contact &contact,
+ const std::string uri,
MenuBuilder &builder)
{
bool populated = false;
- for (std::set<ContactDecorator *>::const_iterator iter
+ for (std::list<ContactDecorator *>::const_iterator iter
= contact_decorators.begin ();
iter != contact_decorators.end ();
iter++) {
- if (populated)
- builder.add_separator ();
- populated = (*iter)->populate_menu (contact, builder);
+ populated = (*iter)->populate_menu (contact, uri, builder);
}
return populated;
Modified: trunk/lib/engine/addressbook/skel/contact-core.h
==============================================================================
--- trunk/lib/engine/addressbook/skel/contact-core.h (original)
+++ trunk/lib/engine/addressbook/skel/contact-core.h Fri Jul 25 14:05:34 2008
@@ -56,6 +56,7 @@
{}
virtual bool populate_menu (Contact &/*contact*/,
+ const std::string /*uri*/,
MenuBuilder &/*builder*/) = 0;
};
@@ -163,16 +164,18 @@
void add_contact_decorator (ContactDecorator &decorator);
-
/** Create the menu for a given Contact and its actions.
- * @param The Ekiga::Contact and a MenuBuilder object to populate.
+ * @param The Ekiga::Contact for which the actions could be made available.
+ * @param The uri for which actions could be made available.
+ * @param A MenuBuilder object to populate.
*/
bool populate_contact_menu (Contact &contact,
+ const std::string uri,
MenuBuilder &builder);
private:
- std::set<ContactDecorator *> contact_decorators;
+ std::list<ContactDecorator *> contact_decorators;
/*** Misc ***/
Modified: trunk/lib/engine/addressbook/skel/contact.h
==============================================================================
--- trunk/lib/engine/addressbook/skel/contact.h (original)
+++ trunk/lib/engine/addressbook/skel/contact.h Fri Jul 25 14:05:34 2008
@@ -78,13 +78,6 @@
virtual const std::set<std::string> get_groups () const = 0;
- /** Returns a list of uris.
- * @return Returns a map of (precision -> uri) association pairs,
- * like ("home" -> "sip:home ekiga net")
- */
- virtual const std::map<std::string,std::string> get_uris () const = 0;
-
-
/** Returns if a contact is found or not.
* @return True if the contact has been found.
*/
Modified: trunk/lib/engine/gui/gtk-frontend/book-view-gtk.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/book-view-gtk.cpp (original)
+++ trunk/lib/engine/gui/gtk-frontend/book-view-gtk.cpp Fri Jul 25 14:05:34 2008
@@ -410,38 +410,42 @@
GtkTreeIter *iter)
{
GtkListStore *store = NULL;
- GdkPixbuf *icon = NULL;
- std::string phone;
store = GTK_LIST_STORE (gtk_tree_view_get_model (self->priv->tree_view));
- gtk_list_store_set (store, iter, COLUMN_NAME, contact.get_name ().c_str (), -1);
-
- std::map<std::string, std::string> uris = contact.get_uris ();
-
- for (std::map<std::string, std::string>::const_iterator uri = uris.begin () ;
- uri != uris.end () ;
- uri++) {
-
- std::string::size_type loc = uri->second.find ("sip:", 0);
- if (loc != std::string::npos) {
- gtk_list_store_set (store, iter, COLUMN_VIDEO_URL, uri->second.c_str (), -1);
- }
- else if (!uri->second.empty ()) {
- if (!phone.empty ())
- phone += ", ";
- phone += uri->second;
- }
- }
-
- icon = gtk_widget_render_icon (GTK_WIDGET (self),
- GM_STOCK_PHONE_PICK_UP_16,
- GTK_ICON_SIZE_MENU, NULL);
gtk_list_store_set (store, iter,
- COLUMN_PHONE, phone.c_str (),
- COLUMN_PIXBUF, icon, -1);
+ COLUMN_NAME, contact.get_name ().c_str (),
+ -1);
+
+// FIXME: that doesn't look good at all!
+// std::map<std::string, std::string> uris = contact.get_uris ();
+// GdkPixbuf *icon = NULL;
+// std::string phone;
+
+// for (std::map<std::string, std::string>::const_iterator uri = uris.begin () ;
+// uri != uris.end () ;
+// uri++) {
+
+// std::string::size_type loc = uri->second.find ("sip:", 0);
+// if (loc != std::string::npos) {
+// gtk_list_store_set (store, iter, COLUMN_VIDEO_URL, uri->second.c_str (), -1);
+// }
+// else if (!uri->second.empty ()) {
+// if (!phone.empty ())
+// phone += ", ";
+// phone += uri->second;
+// }
+// }
+
+// icon = gtk_widget_render_icon (GTK_WIDGET (self),
+// GM_STOCK_PHONE_PICK_UP_16,
+// GTK_ICON_SIZE_MENU, NULL);
+
+// gtk_list_store_set (store, iter,
+// COLUMN_PHONE, phone.c_str (),
+// COLUMN_PIXBUF, icon, -1);
- g_object_unref (icon);
+// g_object_unref (icon);
if (GDK_IS_WINDOW (GTK_WIDGET (self)->window))
gdk_window_set_cursor (GTK_WIDGET (self)->window, NULL);
Modified: trunk/lib/engine/presence/local-roster/local-roster-bridge.cpp
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-roster-bridge.cpp (original)
+++ trunk/lib/engine/presence/local-roster/local-roster-bridge.cpp Fri Jul 25 14:05:34 2008
@@ -68,6 +68,7 @@
{ return "\tComponent to push contacts into the local roster"; }
bool populate_menu (Ekiga::Contact &contact,
+ const std::string uri,
Ekiga::MenuBuilder &builder);
private:
@@ -79,26 +80,21 @@
bool
Local::ContactDecorator::populate_menu (Ekiga::Contact &contact,
+ const std::string uri,
Ekiga::MenuBuilder &builder)
{
- std::map<std::string, std::string> uris = contact.get_uris ();
bool populated = false;
- for (std::map<std::string, std::string>::const_iterator iter = uris.begin ();
- iter != uris.end ();
- iter++) {
+ if (cluster.is_supported_uri (uri)) {
- if (cluster.is_supported_uri (iter->second)) {
+ Heap &heap = cluster.get_heap ();
- Heap &heap = cluster.get_heap ();
+ if (!heap.has_presentity_with_uri (uri)) {
- if (!heap.has_presentity_with_uri (iter->second)) {
-
- builder.add_action ("add", _("Add to local roster"),
- sigc::bind (sigc::mem_fun (heap, &Local::Heap::new_presentity),
- contact.get_name (), iter->second));
- populated = true;
- }
+ builder.add_action ("add", _("Add to local roster"),
+ sigc::bind (sigc::mem_fun (heap, &Local::Heap::new_presentity),
+ contact.get_name (), uri));
+ populated = true;
}
}
Modified: trunk/lib/engine/presence/skel/presence-core.cpp
==============================================================================
--- trunk/lib/engine/presence/skel/presence-core.cpp (original)
+++ trunk/lib/engine/presence/skel/presence-core.cpp Fri Jul 25 14:05:34 2008
@@ -162,7 +162,7 @@
void
Ekiga::PresenceCore::add_presentity_decorator (PresentityDecorator &decorator)
{
- presentity_decorators.insert (&decorator);
+ presentity_decorators.push_back (&decorator);
}
bool
@@ -172,7 +172,7 @@
{
bool populated = false;
- for (std::set<PresentityDecorator *>::const_iterator iter
+ for (std::list<PresentityDecorator *>::const_iterator iter
= presentity_decorators.begin ();
iter != presentity_decorators.end ();
iter++) {
Modified: trunk/lib/engine/presence/skel/presence-core.h
==============================================================================
--- trunk/lib/engine/presence/skel/presence-core.h (original)
+++ trunk/lib/engine/presence/skel/presence-core.h Fri Jul 25 14:05:34 2008
@@ -238,7 +238,7 @@
private:
- std::set<PresentityDecorator *> presentity_decorators;
+ std::list<PresentityDecorator *> presentity_decorators;
/*** API to help presentities get presence ***/
public:
Modified: trunk/src/endpoints/h323.cpp
==============================================================================
--- trunk/src/endpoints/h323.cpp (original)
+++ trunk/src/endpoints/h323.cpp Fri Jul 25 14:05:34 2008
@@ -128,12 +128,10 @@
bool CallProtocolManager::populate_menu (Ekiga::Contact &contact,
+ std::string uri,
Ekiga::MenuBuilder &builder)
{
- std::string name = contact.get_name ();
- std::map<std::string, std::string> uris = contact.get_uris ();
-
- return menu_builder_add_actions (name, uris, builder);
+ return menu_builder_add_actions (contact.get_name (), uri, builder);
}
@@ -141,33 +139,20 @@
const std::string uri,
Ekiga::MenuBuilder & builder)
{
- std::map<std::string, std::string> uris;
- uris [""] = uri;
-
- return menu_builder_add_actions (presentity.get_name (), uris, builder);
+ return menu_builder_add_actions (presentity.get_name (), uri, builder);
}
bool CallProtocolManager::menu_builder_add_actions (const std::string & /*fullname*/,
- std::map<std::string,std::string> & uris,
+ const std::string& uri,
Ekiga::MenuBuilder & builder)
{
bool populated = false;
+ std::string action = _("Call");
- /* Add actions of type "call" for all uris */
- for (std::map<std::string, std::string>::const_iterator iter = uris.begin ();
- iter != uris.end ();
- iter++) {
-
- std::string action = _("Call");
+ builder.add_action ("call", action, sigc::bind (sigc::mem_fun (this, &CallProtocolManager::on_dial), uri));
- if (!iter->first.empty ())
- action = action + " [" + iter->first + "]";
-
- builder.add_action ("call", action, sigc::bind (sigc::mem_fun (this, &CallProtocolManager::on_dial), iter->second));
-
- populated = true;
- }
+ populated = true;
return populated;
}
Modified: trunk/src/endpoints/h323.h
==============================================================================
--- trunk/src/endpoints/h323.h (original)
+++ trunk/src/endpoints/h323.h Fri Jul 25 14:05:34 2008
@@ -66,6 +66,7 @@
/* ContactDecorator and PresentityDecorator */
bool populate_menu (Ekiga::Contact &contact,
+ const std::string uri,
Ekiga::MenuBuilder &builder);
bool populate_menu (Ekiga::Presentity& presentity,
@@ -73,7 +74,7 @@
Ekiga::MenuBuilder & builder);
bool menu_builder_add_actions (const std::string & fullname,
- std::map<std::string, std::string> & uris,
+ const std::string& uri,
Ekiga::MenuBuilder & builder);
Modified: trunk/src/endpoints/sip.cpp
==============================================================================
--- trunk/src/endpoints/sip.cpp (original)
+++ trunk/src/endpoints/sip.cpp Fri Jul 25 14:05:34 2008
@@ -166,12 +166,10 @@
bool CallProtocolManager::populate_menu (Ekiga::Contact &contact,
+ const std::string uri,
Ekiga::MenuBuilder &builder)
{
- std::string name = contact.get_name ();
- std::map<std::string, std::string> uris = contact.get_uris ();
-
- return menu_builder_add_actions (name, uris, builder);
+ return menu_builder_add_actions (contact.get_name (), uri, builder);
}
@@ -179,50 +177,33 @@
const std::string uri,
Ekiga::MenuBuilder & builder)
{
- std::map<std::string, std::string> uris;
- uris [""] = uri;
-
- return menu_builder_add_actions (presentity.get_name (), uris, builder);
+ return menu_builder_add_actions (presentity.get_name (), uri, builder);
}
bool CallProtocolManager::menu_builder_add_actions (const std::string& fullname,
- std::map<std::string,std::string> & uris,
+ const std::string& uri,
Ekiga::MenuBuilder & builder)
{
bool populated = false;
+ std::string call_action = _("Call");
+ std::string forward_action = _("Forward");
+ std::string msg_action = _("Message");
- /* Add actions of type "call" for all uris */
- for (std::map<std::string, std::string>::const_iterator iter = uris.begin ();
- iter != uris.end ();
- iter++) {
-
- std::string call_action = _("Call");
- std::string forward_action = _("Forward");
- std::string msg_action = _("Message");
-
- if (!iter->first.empty ()) {
-
- call_action = call_action + " [" + iter->first + "]";
- forward_action = forward_action + " [" + iter->first + "]";
- msg_action = msg_action + " [" + iter->first + "]";
- }
-
- if (0 == GetConnectionCount ()) {
+ if (0 == GetConnectionCount ()) {
- builder.add_action ("call", call_action,
- sigc::bind (sigc::mem_fun (this, &CallProtocolManager::on_dial), iter->second));
- } else {
+ builder.add_action ("call", call_action,
+ sigc::bind (sigc::mem_fun (this, &CallProtocolManager::on_dial), uri));
+ } else {
- builder.add_action ("forward", forward_action,
- sigc::bind (sigc::mem_fun (this, &CallProtocolManager::on_forward), iter->second));
- }
+ builder.add_action ("forward", forward_action,
+ sigc::bind (sigc::mem_fun (this, &CallProtocolManager::on_forward), uri));
+ }
- builder.add_action ("message", msg_action,
- sigc::bind (sigc::mem_fun (this, &CallProtocolManager::on_message), iter->second, fullname));
+ builder.add_action ("message", msg_action,
+ sigc::bind (sigc::mem_fun (this, &CallProtocolManager::on_message), uri, fullname));
- populated = true;
- }
+ populated = true;
return populated;
}
Modified: trunk/src/endpoints/sip.h
==============================================================================
--- trunk/src/endpoints/sip.h (original)
+++ trunk/src/endpoints/sip.h Fri Jul 25 14:05:34 2008
@@ -78,6 +78,7 @@
/* ContactDecorator and PresentityDecorator */
bool populate_menu (Ekiga::Contact &contact,
+ const std::string uri,
Ekiga::MenuBuilder &builder);
bool populate_menu (Ekiga::Presentity& presentity,
@@ -85,7 +86,7 @@
Ekiga::MenuBuilder & builder);
bool menu_builder_add_actions (const std::string & fullname,
- std::map<std::string, std::string> & uris,
+ const std::string& uri,
Ekiga::MenuBuilder & builder);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]