ekiga r5900 - in trunk: . lib/engine/framework src src/endpoints src/gui
- From: dsandras svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r5900 - in trunk: . lib/engine/framework src src/endpoints src/gui
- Date: Sat, 12 Jan 2008 21:05:38 +0000 (GMT)
Author: dsandras
Date: Sat Jan 12 21:05:38 2008
New Revision: 5900
URL: http://svn.gnome.org/viewvc/ekiga?rev=5900&view=rev
Log:
Added first shot at a GmConf bridge to asbtract the configuration
(properties) from the Ekiga::Service objects.
Added:
trunk/lib/engine/framework/gmconf-bridge.cpp
trunk/lib/engine/framework/gmconf-bridge.h
trunk/src/endpoints/opal-gmconf-bridge.cpp
trunk/src/endpoints/opal-gmconf-bridge.h
Modified:
trunk/ChangeLog
trunk/lib/engine/framework/Makefile.am
trunk/src/Makefile.am
trunk/src/endpoints/manager.cpp
trunk/src/endpoints/manager.h
trunk/src/gui/conf.cpp
Modified: trunk/lib/engine/framework/Makefile.am
==============================================================================
--- trunk/lib/engine/framework/Makefile.am (original)
+++ trunk/lib/engine/framework/Makefile.am Sat Jan 12 21:05:38 2008
@@ -5,7 +5,8 @@
AM_CXXFLAGS = $(SIGC_CFLAGS) $(GLIB_CFLAGS) $(XML_CFLAGS)
INCLUDES = \
- -I$(top_srcdir)/lib/engine/include \
+ -I$(top_srcdir)/lib/gmconf \
+ -I$(top_srcdir)/lib/engine/include \
-I$(top_srcdir)/lib/engine/framework
libgmframework_la_SOURCES = \
@@ -17,6 +18,8 @@
$(framework_dir)/form-request.h \
$(framework_dir)/form-request-simple.h \
$(framework_dir)/form-visitor.h \
+ $(framework_dir)/gmconf-bridge.h \
+ $(framework_dir)/gmconf-bridge.cpp \
$(framework_dir)/map-key-reference-iterator.h \
$(framework_dir)/map-key-const-reference-iterator.h \
$(framework_dir)/menu-builder.h \
Added: trunk/lib/engine/framework/gmconf-bridge.cpp
==============================================================================
--- (empty file)
+++ trunk/lib/engine/framework/gmconf-bridge.cpp Sat Jan 12 21:05:38 2008
@@ -0,0 +1,73 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2007 Damien Sandras
+
+ * 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.
+ */
+
+
+/*
+ * gmconf-bridge.h - description
+ * ------------------------------------------
+ * begin : written in 2008 by Damien Sandras
+ * copyright : (c) 2008 by Damien Sandras
+ * description : declaration of an object able to do the bridging
+ * between gmconf and any object
+ *
+ */
+
+#include <iostream>
+
+#include "gmconf-bridge.h"
+
+#include "gmconf.h"
+
+
+using namespace Ekiga;
+
+
+static void entry_changed_nt (gpointer /*id*/,
+ GmConfEntry *entry,
+ gpointer data);
+
+static void
+entry_changed_nt (gpointer /*id*/,
+ GmConfEntry *entry,
+ gpointer data)
+{
+ Ekiga::ConfBridge *bridge = (Ekiga::ConfBridge *) data;
+ std::string key = gm_conf_entry_get_key (entry);
+
+ bridge->property_changed.emit (key, entry);
+}
+
+
+void ConfBridge::load (ConfKeys & keys)
+{
+ for (ConfKeys::iterator it = keys.begin ();
+ it != keys.end ();
+ it++) {
+
+ gm_conf_notifier_add ((*it).c_str (), entry_changed_nt, this);
+ gm_conf_notifier_trigger ((*it).c_str ());
+ }
+}
+
Added: trunk/lib/engine/framework/gmconf-bridge.h
==============================================================================
--- (empty file)
+++ trunk/lib/engine/framework/gmconf-bridge.h Sat Jan 12 21:05:38 2008
@@ -0,0 +1,102 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2007 Damien Sandras
+
+ * 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.
+ */
+
+
+/*
+ * gmconf-bridge.h - description
+ * ------------------------------------------
+ * begin : written in 2008 by Damien Sandras
+ * copyright : (c) 2008 by Damien Sandras
+ * description : declaration of an object able to do the bridging
+ * between gmconf and any object
+ *
+ */
+
+#ifndef __GMCONF_BRIDGE_H__
+#define __GMCONF_BRIDGE_H__
+
+#include <vector>
+#include <sigc++/sigc++.h>
+
+#include "gmconf.h"
+#include "services.h"
+
+namespace Ekiga
+{
+ /**
+ * This is a vector of string corresponding to the GMConf keys
+ */
+ typedef std::vector<std::string> ConfKeys;
+
+
+ /**
+ * This class implements a bridge between an Ekiga::Service and its
+ * configuration stored in GMConf.
+ *
+ * This class has several purposes :
+ * - abstract the configuration stuff from the engine classes
+ * - keep the GMConf idea of notifiers triggered when the value associated
+ * with a key changes, but instead of reacting to it in the object,
+ * directly, update it using its public API
+ *
+ * This could be replaced at some point by a C++ implementation of GMConf,
+ * but for now it is a good abstraction layer : The service exposes its API
+ * but does not care about storing the configuration. GMConf stores the
+ * configuration (the model), and the bridge updates the Ekiga::Service (the
+ * view), when a controller updates the configuration (the prefs window or
+ * an external program).
+ *
+ * It should only monitor keys representing properties of the Ekiga::Service.
+ */
+
+ class ConfBridge
+ {
+ public:
+
+ /** The constructor
+ * @param _service is the Ekiga::Service the bridge will update
+ */
+ ConfBridge (Ekiga::Service & _service) : service (_service) {};
+
+
+ /** Load notifiers for the vector of keys given as argument
+ * @param keys is a vector of keys for which the ConfBridge will trigger
+ * GmConf notifers. They are triggered when the value associated with the
+ * key changes, or when this method is called.
+ */
+ void load (ConfKeys & keys);
+
+
+ /** This signal is emitted when a notifier is triggered for a key
+ * @param key is the GmConf key whose value changed
+ * @param entry is the new GmConf entry
+ */
+ sigc::signal<void, std::string /*key*/, GmConfEntry * /*entry*/> property_changed;
+
+ protected :
+ Ekiga::Service & service;
+ };
+};
+#endif
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Sat Jan 12 21:05:38 2008
@@ -100,6 +100,8 @@
endpoints/opal-call.cpp \
endpoints/opal-codec-description.h \
endpoints/opal-codec-description.cpp \
+ endpoints/opal-gmconf-bridge.h \
+ endpoints/opal-gmconf-bridge.cpp\
endpoints/opal-main.h \
endpoints/opal-main.cpp \
endpoints/urlhandler.h \
Modified: trunk/src/endpoints/manager.cpp
==============================================================================
--- trunk/src/endpoints/manager.cpp (original)
+++ trunk/src/endpoints/manager.cpp Sat Jan 12 21:05:38 2008
@@ -52,6 +52,7 @@
#include "gmconf.h"
#include "call-core.h"
+#include "opal-gmconf-bridge.h"
#include "opal-call.h"
#include "opal-codec-description.h"
@@ -70,17 +71,6 @@
-/* DESCRIPTION : This notifier is called when the firstname or last name
- * keys changes.
- * BEHAVIOR : Updates the ZeroConf registrations and the internal i
- * configuration.
- * PRE : data is a pointer to the GMManager.
- */
-static void fullname_changed_nt (gpointer id,
- GmConfEntry *entry,
- gpointer data);
-
-
/* DESCRIPTION : This notifier is called when the config database data
* associated with the enable_video key changes.
* BEHAVIOR : It updates the endpoint.
@@ -91,26 +81,6 @@
gpointer data);
-/* DESCRIPTION : This callback is called when a silence detection key of
- * the config database associated with a toggle changes.
- * BEHAVIOR : Update silence detection.
- * PRE : data is a pointer to the GMManager.
- */
-static void silence_detection_changed_nt (G_GNUC_UNUSED gpointer id,
- GmConfEntry *entry,
- gpointer data);
-
-
-/* DESCRIPTION : This callback is called when the echo cancelation key of
- * the config database associated with a toggle changes.
- * BEHAVIOR : Update echo cancelation.
- * PRE : data is a pointer to the GMManager.
- */
-static void echo_cancelation_changed_nt (G_GNUC_UNUSED gpointer id,
- GmConfEntry *entry,
- gpointer data);
-
-
/* DESCRIPTION : This notifier is called when the config database data
* associated with the listening interface changes.
* BEHAVIOR : Updates the interface.
@@ -254,34 +224,6 @@
static void
-silence_detection_changed_nt (G_GNUC_UNUSED gpointer id,
- GmConfEntry *entry,
- gpointer data)
-{
- GMManager *ep = (GMManager *) data;
-
- if (gm_conf_entry_get_type (entry) == GM_CONF_BOOL) {
-
- ep->set_silence_detection (gm_conf_entry_get_bool (entry));
- }
-}
-
-
-static void
-echo_cancelation_changed_nt (G_GNUC_UNUSED gpointer id,
- GmConfEntry *entry,
- gpointer data)
-{
- GMManager *ep = (GMManager *) data;
-
- if (gm_conf_entry_get_type (entry) == GM_CONF_BOOL) {
-
- ep->set_echo_cancelation (gm_conf_entry_get_bool (entry));
- }
-}
-
-
-static void
network_interface_changed_nt (G_GNUC_UNUSED gpointer id,
GmConfEntry *entry,
gpointer data)
@@ -510,6 +452,9 @@
get_port_ranges (a, b, c, d, e, f);
set_port_ranges (a, b, c, d, e, f);
+ // Test
+ bridge = new Opal::ConfBridge (*this);
+
// Video options
gm_conf_notifier_add (VIDEO_CODECS_KEY "maximum_video_tx_bitrate",
video_option_changed_nt, this);
@@ -539,21 +484,14 @@
gm_conf_notifier_add (AUDIO_CODECS_KEY "maximum_jitter_buffer",
jitter_buffer_changed_nt, this);
gm_conf_notifier_trigger (AUDIO_CODECS_KEY "maximum_jitter_buffer");
-
- // Audio codecs settings
- gm_conf_notifier_add (AUDIO_CODECS_KEY "enable_silence_detection",
- silence_detection_changed_nt, this);
- gm_conf_notifier_trigger (AUDIO_CODECS_KEY "enable_silence_detection");
-
- gm_conf_notifier_add (AUDIO_CODECS_KEY "enable_echo_cancelation",
- echo_cancelation_changed_nt, this);
- gm_conf_notifier_trigger (AUDIO_CODECS_KEY "enable_silence_detection");
}
GMManager::~GMManager ()
{
Exit ();
+
+ delete bridge;
}
@@ -730,7 +668,11 @@
bool GMManager::get_silence_detection ()
{
- return gm_conf_get_bool (AUDIO_CODECS_KEY "enable_echo_cancelation");
+ OpalSilenceDetector::Params sd;
+
+ sd = GetSilenceDetectParams ();
+
+ return (sd.m_mode != OpalSilenceDetector::NoSilenceDetection);
}
Modified: trunk/src/endpoints/manager.h
==============================================================================
--- trunk/src/endpoints/manager.h (original)
+++ trunk/src/endpoints/manager.h Sat Jan 12 21:05:38 2008
@@ -55,6 +55,7 @@
#include "accountshandler.h"
+#include "gmconf-bridge.h"
#include "runtime.h"
#include "contact-core.h"
#include "presence-core.h"
@@ -681,6 +682,7 @@
Ekiga::ServiceCore & core;
Ekiga::Runtime & runtime;
+ Ekiga::ConfBridge *bridge;
};
#endif
Added: trunk/src/endpoints/opal-gmconf-bridge.cpp
==============================================================================
--- (empty file)
+++ trunk/src/endpoints/opal-gmconf-bridge.cpp Sat Jan 12 21:05:38 2008
@@ -0,0 +1,71 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2007 Damien Sandras
+
+ * 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.
+ */
+
+
+/*
+ * opal-gmconf-bridge.cpp - description
+ * ------------------------------------------
+ * begin : written in 2008 by Damien Sandras
+ * copyright : (c) 2008 by Damien Sandras
+ * description : declaration of an object able to do the bridging
+ * between gmconf and opal
+ *
+ */
+
+#include <iostream>
+#include <sigc++/sigc++.h>
+
+#include "gmconf.h"
+#include "opal-gmconf-bridge.h"
+
+#include "manager.h"
+
+
+using namespace Opal;
+
+
+ConfBridge::ConfBridge (Ekiga::Service & service)
+ : Ekiga::ConfBridge (service)
+{
+ Ekiga::ConfKeys keys;
+ keys.push_back (AUDIO_CODECS_KEY "enable_silence_detection");
+ keys.push_back (AUDIO_CODECS_KEY "enable_echo_cancelation");
+
+ load (keys);
+
+ property_changed.connect (sigc::mem_fun (this, &ConfBridge::on_property_changed));
+}
+
+
+void ConfBridge::on_property_changed (std::string key, GmConfEntry *entry)
+{
+ GMManager & manager = (GMManager &) service;
+
+ if (key == AUDIO_CODECS_KEY "enable_silence_detection")
+ manager.set_silence_detection (gm_conf_entry_get_bool (entry));
+ else if (key == AUDIO_CODECS_KEY "enable_echo_cancelation")
+ manager.set_echo_cancelation (gm_conf_entry_get_bool (entry));
+}
+
Added: trunk/src/endpoints/opal-gmconf-bridge.h
==============================================================================
--- (empty file)
+++ trunk/src/endpoints/opal-gmconf-bridge.h Sat Jan 12 21:05:38 2008
@@ -0,0 +1,56 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2007 Damien Sandras
+
+ * 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.
+ */
+
+
+/*
+ * opal-gmconf-bridge.h - description
+ * ------------------------------------------
+ * begin : written in 2008 by Damien Sandras
+ * copyright : (c) 2008 by Damien Sandras
+ * description : declaration of an object able to do the bridging
+ * between gmconf and opal
+ *
+ */
+
+#ifndef __OPAL_GMCONF_BRIDGE_H__
+#define __OPAL_GMCONF_BRIDGE_H__
+
+#include "gmconf-bridge.h"
+
+class GMManager;
+
+namespace Opal
+{
+ class ConfBridge
+ : public Ekiga::ConfBridge
+ {
+ public:
+
+ ConfBridge (Ekiga::Service & service);
+
+ void on_property_changed (std::string key, GmConfEntry *value);
+ };
+};
+#endif
Modified: trunk/src/gui/conf.cpp
==============================================================================
--- trunk/src/gui/conf.cpp (original)
+++ trunk/src/gui/conf.cpp Sat Jan 12 21:05:38 2008
@@ -281,7 +281,6 @@
gnomemeeting_conf_init ()
{
GtkWidget *main_window = NULL;
- GtkWidget *prefs_window = NULL;
main_window = GnomeMeeting::Process ()->GetMainWindow ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]