[ekiga] Engine: Do not use a shared_ptr to the core.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Engine: Do not use a shared_ptr to the core.
- Date: Sun, 15 Mar 2015 15:46:21 +0000 (UTC)
commit a9d9a98a49a9173029fc1ac34c731740990cf6bd
Author: Damien Sandras <dsandras seconix com>
Date: Sun Mar 1 12:54:09 2015 +0100
Engine: Do not use a shared_ptr to the core.
We have more control over memory and objects destructions if we use a
reference to the core instead of a shared_ptr. The core is the basis of
everything and will exist during the whole life of the process.
lib/engine/engine.cpp | 56 ++++++++--------
lib/engine/engine.h | 6 +-
lib/engine/gui/gtk-core/codecsbox.cpp | 4 +-
lib/engine/gui/gtk-frontend/addressbook-window.cpp | 4 +-
lib/engine/gui/gtk-frontend/assistant-window.cpp | 4 +-
lib/engine/gui/gtk-frontend/call-window.cpp | 18 +++---
lib/engine/gui/gtk-frontend/chat-window.cpp | 8 +-
lib/engine/gui/gtk-frontend/ekiga-app.cpp | 71 +++++++++-----------
lib/engine/gui/gtk-frontend/ekiga-app.h | 5 +-
lib/engine/gui/gtk-frontend/main_window.cpp | 52 ++++++++-------
lib/engine/gui/gtk-frontend/preferences-window.cpp | 8 +-
lib/engine/gui/gtk-frontend/statusicon.cpp | 8 +-
src/dbus-helper/dbus.cpp | 4 +-
13 files changed, 120 insertions(+), 128 deletions(-)
---
diff --git a/lib/engine/engine.cpp b/lib/engine/engine.cpp
index 7e3f9e2..2c509ed 100644
--- a/lib/engine/engine.cpp
+++ b/lib/engine/engine.cpp
@@ -77,6 +77,7 @@
#include "hal-main-dbus.h"
#endif
+#include "opal-process.h"
#include "opal-main.h"
#define DEBUG_STARTUP 0
@@ -86,18 +87,19 @@
#endif
void
-engine_init (Ekiga::ServiceCorePtr service_core,
- int argc,
+engine_init (Ekiga::ServiceCore& core,
+ int argc,
char *argv [])
{
// AT THE VERY FIRST, create the PProcess
- opal_init_pprocess (*service_core, argc, argv);
+ GnomeMeeting & instance = opal_init_pprocess (argc, argv);
+ instance.Start (core);
// FIRST we add a few things by hand
// (for speed and because that's less code)
Ekiga::ServicePtr notification_core(new Ekiga::NotificationCore);
- service_core->add (notification_core);
+ core.add (notification_core);
boost::shared_ptr<Ekiga::FriendOrFoe> friend_or_foe (new Ekiga::FriendOrFoe);
boost::shared_ptr<Ekiga::FoeList> foe_list (new Ekiga::FoeList (friend_or_foe));
@@ -106,32 +108,32 @@ engine_init (Ekiga::ServiceCorePtr service_core,
boost::shared_ptr<Ekiga::CallCore> call_core (new Ekiga::CallCore (friend_or_foe));
boost::shared_ptr<Ekiga::ChatCore> chat_core (new Ekiga::ChatCore);
boost::shared_ptr<Ekiga::VideoOutputCore> videooutput_core (new Ekiga::VideoOutputCore);
- boost::shared_ptr<Ekiga::VideoInputCore> videoinput_core (new Ekiga::VideoInputCore (*service_core,
videooutput_core));
- boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core (new Ekiga::AudioOutputCore (*service_core));
- boost::shared_ptr<Ekiga::AudioInputCore> audioinput_core (new Ekiga::AudioInputCore(*service_core));
+ boost::shared_ptr<Ekiga::VideoInputCore> videoinput_core (new Ekiga::VideoInputCore (core,
videooutput_core));
+ boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core (new Ekiga::AudioOutputCore (core));
+ boost::shared_ptr<Ekiga::AudioInputCore> audioinput_core (new Ekiga::AudioInputCore(core));
boost::shared_ptr<Ekiga::HalCore> hal_core (new Ekiga::HalCore);
boost::shared_ptr<Gmconf::PersonalDetails> details(new Gmconf::PersonalDetails);
boost::shared_ptr<Ekiga::PresenceCore> presence_core(new Ekiga::PresenceCore (details));
- service_core->add (contact_core);
- service_core->add (chat_core);
- service_core->add (friend_or_foe);
- service_core->add (foe_list);
- service_core->add (videoinput_core);
- service_core->add (videooutput_core);
- service_core->add (audioinput_core);
- service_core->add (audiooutput_core);
- service_core->add (hal_core);
- service_core->add (call_core);
- service_core->add (account_core);
- service_core->add (details);
- service_core->add (presence_core);
-
- if (!videoinput_mlogo_init (*service_core, &argc, &argv)) {
+ core.add (contact_core);
+ core.add (chat_core);
+ core.add (friend_or_foe);
+ core.add (foe_list);
+ core.add (videoinput_core);
+ core.add (videooutput_core);
+ core.add (audioinput_core);
+ core.add (audiooutput_core);
+ core.add (hal_core);
+ core.add (call_core);
+ core.add (account_core);
+ core.add (details);
+ core.add (presence_core);
+
+ if (!videoinput_mlogo_init (core, &argc, &argv)) {
return;
}
- if (!videooutput_clutter_gst_init (*service_core, &argc, &argv)) {
+ if (!videooutput_clutter_gst_init (core, &argc, &argv)) {
return;
}
@@ -169,11 +171,11 @@ engine_init (Ekiga::ServiceCorePtr service_core,
// push the parts needed by the gui in the hand-crafted part of
// this initialization, or put the gui in the kickstart too.
- kickstart.kick (*service_core, &argc, &argv);
+ kickstart.kick (core, &argc, &argv);
- gtk_core_init (*service_core, &argc, &argv);
+ gtk_core_init (core, &argc, &argv);
- kickstart.kick (*service_core, &argc, &argv);
+ kickstart.kick (core, &argc, &argv);
/* FIXME: everything that follows except the debug output shouldn't
be there, as that means we're doing the work of initializing
@@ -198,6 +200,6 @@ engine_init (Ekiga::ServiceCorePtr service_core,
#if DEBUG_STARTUP
std::cout << "Here is what ekiga is made of for this run :" << std::endl;
- service_core->dump (std::cout);
+ core.dump (std::cout);
#endif
}
diff --git a/lib/engine/engine.h b/lib/engine/engine.h
index 169f4d1..e50afe2 100644
--- a/lib/engine/engine.h
+++ b/lib/engine/engine.h
@@ -44,9 +44,9 @@
* @{
*/
-void engine_init (Ekiga::ServiceCorePtr service_core,
- int argc,
- char *argv[]);
+void engine_init (Ekiga::ServiceCore& core,
+ int argc,
+ char *argv[]);
/**
* @}
diff --git a/lib/engine/gui/gtk-core/codecsbox.cpp b/lib/engine/gui/gtk-core/codecsbox.cpp
index 3d29a08..62f1951 100644
--- a/lib/engine/gui/gtk-core/codecsbox.cpp
+++ b/lib/engine/gui/gtk-core/codecsbox.cpp
@@ -474,11 +474,11 @@ codecs_box_new_with_type (GmApplication *app,
{
CodecsBox *self = CODECS_BOX (g_object_new (CODECS_BOX_TYPE, NULL));
- Ekiga::ServiceCorePtr core = gm_application_get_core (app);
+ Ekiga::ServiceCore& core = gm_application_get_core (app);
self->priv = new _CodecsBoxPrivate ();
self->priv->app = app;
- self->priv->call_core = core->get<Ekiga::CallCore> ("call-core");
+ self->priv->call_core = core.get<Ekiga::CallCore> ("call-core");
self->priv->type = type;
self->priv->audio_settings = boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings
(AUDIO_CODECS_SCHEMA));
self->priv->video_settings = boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings
(VIDEO_CODECS_SCHEMA));
diff --git a/lib/engine/gui/gtk-frontend/addressbook-window.cpp
b/lib/engine/gui/gtk-frontend/addressbook-window.cpp
index 936b303..e762605 100644
--- a/lib/engine/gui/gtk-frontend/addressbook-window.cpp
+++ b/lib/engine/gui/gtk-frontend/addressbook-window.cpp
@@ -736,7 +736,7 @@ addressbook_window_new (GmApplication *app)
GtkWidget *headerbar = NULL;
GtkWidget *hpaned = NULL;
- Ekiga::ServiceCorePtr core = gm_application_get_core (app);
+ Ekiga::ServiceCore& core = gm_application_get_core (app);
self = (AddressBookWindow *) g_object_new (ADDRESSBOOK_WINDOW_TYPE,
"application", GTK_APPLICATION (app),
@@ -745,7 +745,7 @@ addressbook_window_new (GmApplication *app)
"hide_on_esc", FALSE,
NULL);
boost::shared_ptr<Ekiga::ContactCore> contact_core =
- core->get<Ekiga::ContactCore> ("contact-core");
+ core.get<Ekiga::ContactCore> ("contact-core");
self->priv = new AddressBookWindowPrivate (contact_core);
self->priv->builder = gtk_builder_new ();
diff --git a/lib/engine/gui/gtk-frontend/assistant-window.cpp
b/lib/engine/gui/gtk-frontend/assistant-window.cpp
index b7b3a60..7a21cef 100644
--- a/lib/engine/gui/gtk-frontend/assistant-window.cpp
+++ b/lib/engine/gui/gtk-frontend/assistant-window.cpp
@@ -751,14 +751,14 @@ assistant_window_new (GmApplication *app)
AssistantWindow *assistant;
assistant = ASSISTANT_WINDOW (g_object_new (ASSISTANT_WINDOW_TYPE, NULL));
- Ekiga::ServiceCorePtr core = gm_application_get_core (app);
+ Ekiga::ServiceCore& core = gm_application_get_core (app);
/* FIXME: move this into the caller */
g_signal_connect (assistant, "key-press-event",
G_CALLBACK (assistant_window_key_press_cb), NULL);
boost::signals2::connection conn;
- assistant->priv->bank = core->get<Opal::Bank> ("opal-account-store");
+ assistant->priv->bank = core.get<Opal::Bank> ("opal-account-store");
return GTK_WIDGET (assistant);
}
diff --git a/lib/engine/gui/gtk-frontend/call-window.cpp b/lib/engine/gui/gtk-frontend/call-window.cpp
index e407406..6043cbb 100644
--- a/lib/engine/gui/gtk-frontend/call-window.cpp
+++ b/lib/engine/gui/gtk-frontend/call-window.cpp
@@ -1712,15 +1712,15 @@ call_window_new (GmApplication *app)
"key", USER_INTERFACE ".call-window",
"hide_on_delete", false,
"hide_on_esc", false, NULL));
- Ekiga::ServiceCorePtr core = gm_application_get_core (app);
-
- self->priv->videoinput_core = core->get<Ekiga::VideoInputCore> ("videoinput-core");
- self->priv->videooutput_core = core->get<Ekiga::VideoOutputCore> ("videooutput-core");
- self->priv->audioinput_core = core->get<Ekiga::AudioInputCore> ("audioinput-core");
- self->priv->audiooutput_core = core->get<Ekiga::AudioOutputCore> ("audiooutput-core");
- self->priv->call_core = core->get<Ekiga::CallCore> ("call-core");
- self->priv->friend_or_foe = core->get<Ekiga::FriendOrFoe> ("friend-or-foe");
- self->priv->foe_list = core->get<Ekiga::FoeList> ("foe-list");
+ Ekiga::ServiceCore& core = gm_application_get_core (app);
+
+ self->priv->videoinput_core = core.get<Ekiga::VideoInputCore> ("videoinput-core");
+ self->priv->videooutput_core = core.get<Ekiga::VideoOutputCore> ("videooutput-core");
+ self->priv->audioinput_core = core.get<Ekiga::AudioInputCore> ("audioinput-core");
+ self->priv->audiooutput_core = core.get<Ekiga::AudioOutputCore> ("audiooutput-core");
+ self->priv->call_core = core.get<Ekiga::CallCore> ("call-core");
+ self->priv->friend_or_foe = core.get<Ekiga::FriendOrFoe> ("friend-or-foe");
+ self->priv->foe_list = core.get<Ekiga::FoeList> ("foe-list");
ekiga_call_window_init_gui (self);
diff --git a/lib/engine/gui/gtk-frontend/chat-window.cpp b/lib/engine/gui/gtk-frontend/chat-window.cpp
index 100bf97..bf914a5 100644
--- a/lib/engine/gui/gtk-frontend/chat-window.cpp
+++ b/lib/engine/gui/gtk-frontend/chat-window.cpp
@@ -277,16 +277,16 @@ chat_window_new (GmApplication *app)
g_return_val_if_fail (GM_IS_APPLICATION (app), NULL);
- Ekiga::ServiceCorePtr core = gm_application_get_core (app);
+ Ekiga::ServiceCore& core = gm_application_get_core (app);
self = (ChatWindow*)g_object_new (CHAT_WINDOW_TYPE,
"application", GTK_APPLICATION (app),
"key", USER_INTERFACE ".chat-window",
NULL);
self->priv->notification_core =
- core->get<Ekiga::NotificationCore>("notification-core");
+ core.get<Ekiga::NotificationCore>("notification-core");
self->priv->audiooutput_core =
- core->get<Ekiga::AudioOutputCore>("audiooutput-core");
+ core.get<Ekiga::AudioOutputCore>("audiooutput-core");
GtkWidget* vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
gtk_container_add (GTK_CONTAINER (self), vbox);
@@ -315,7 +315,7 @@ chat_window_new (GmApplication *app)
G_CALLBACK (on_visible_conversation_changed), self);
boost::shared_ptr<Ekiga::ChatCore> chat_core =
- core->get<Ekiga::ChatCore> ("chat-core");
+ core.get<Ekiga::ChatCore> ("chat-core");
self->priv->connections.add (chat_core->dialect_added.connect (boost::bind (&on_dialect_added, self, _1)));
self->priv->connections.add (chat_core->questions.connect (boost::bind (&on_handle_questions, self, _1)));
chat_core->visit_dialects (boost::bind (&on_dialect_added, self, _1));
diff --git a/lib/engine/gui/gtk-frontend/ekiga-app.cpp b/lib/engine/gui/gtk-frontend/ekiga-app.cpp
index c7ff2af..de1247c 100644
--- a/lib/engine/gui/gtk-frontend/ekiga-app.cpp
+++ b/lib/engine/gui/gtk-frontend/ekiga-app.cpp
@@ -63,7 +63,6 @@
#include "audioinput-core.h"
#include "audiooutput-core.h"
#include "videoinput-core.h"
-#include "videooutput-core.h"
#include "call-core.h"
#include "engine.h"
#include "runtime.h"
@@ -100,7 +99,7 @@
*/
struct _GmApplicationPrivate
{
- Ekiga::ServiceCorePtr core;
+ Ekiga::ServiceCore core;
GtkBuilder *builder;
GtkWidget *main_window;
@@ -183,7 +182,7 @@ gm_application_populate_application_menu (GmApplication *app)
GMenuModel *app_menu = G_MENU_MODEL (gtk_builder_get_object (app->priv->builder, "appmenu"));
boost::shared_ptr<Ekiga::AccountCore> account_core
- = app->priv->core->get<Ekiga::AccountCore> ("account-core");
+ = app->priv->core.get<Ekiga::AccountCore> ("account-core");
g_return_if_fail (account_core);
for (int i = app->priv->banks_menu.size () ;
@@ -364,7 +363,7 @@ video_preview_changed (GSettings *settings,
GmApplication *self = GM_APPLICATION (data);
boost::shared_ptr<Ekiga::VideoInputCore> video_input_core =
- self->priv->core->get<Ekiga::VideoInputCore> ("videoinput-core");
+ self->priv->core.get<Ekiga::VideoInputCore> ("videoinput-core");
if (g_settings_get_boolean (settings, key)) {
gm_application_show_call_window (self);
@@ -384,6 +383,7 @@ ekiga_main (int argc,
char **argv)
{
GmApplication *app = gm_application_new ();
+
g_application_set_inactivity_timeout (G_APPLICATION (app), 10000);
if (g_application_get_is_remote (G_APPLICATION (app))) {
@@ -391,11 +391,19 @@ ekiga_main (int argc,
return;
}
- Ekiga::ServiceCorePtr core(new Ekiga::ServiceCore);
- gm_application_set_core (app, core);
-
Ekiga::Runtime::init ();
- engine_init (core, argc, argv);
+ engine_init (app->priv->core, argc, argv);
+
+ // Connect signals
+ {
+ boost::shared_ptr<Ekiga::CallCore> call_core = app->priv->core.get<Ekiga::CallCore> ("call-core");
+ call_core->created_call.connect (boost::bind (&on_created_call_cb, _1, (gpointer) app));
+
+ boost::shared_ptr<Ekiga::AccountCore> account_core = app->priv->core.get<Ekiga::AccountCore>
("account-core");
+ app->priv->conns.add (account_core->questions.connect (boost::bind (&on_handle_questions_cb, _1, app)));
+ app->priv->conns.add (account_core->account_added.connect (boost::bind (&on_account_modified_cb, _1, _2,
app)));
+ app->priv->conns.add (account_core->account_removed.connect (boost::bind (&on_account_modified_cb, _1,
_2, app)));
+ }
/* Create the main application window */
app->priv->main_window = gm_main_window_new (app);
@@ -414,24 +422,8 @@ ekiga_main (int argc,
general_settings->set_int ("version", schema_version);
}
- boost::shared_ptr<Ekiga::CallCore> call_core = app->priv->core->get<Ekiga::CallCore> ("call-core");
- g_return_if_fail (call_core);
- Ekiga::CodecList all_codecs = call_core->get_codecs ();
- g_return_if_fail (all_codecs.find ("VP8"));
- g_return_if_fail (all_codecs.find ("H.264"));
- g_return_if_fail (all_codecs.find ("Opus"));
- call_core->created_call.connect (boost::bind (&on_created_call_cb, _1, (gpointer) app));
-
- boost::shared_ptr<Ekiga::AccountCore> account_core = app->priv->core->get<Ekiga::AccountCore>
("account-core");
- g_return_if_fail (account_core);
- app->priv->conns.add (account_core->questions.connect (boost::bind (&on_handle_questions_cb, _1, app)));
- app->priv->conns.add (account_core->account_added.connect (boost::bind (&on_account_modified_cb, _1, _2,
app)));
- app->priv->conns.add (account_core->account_removed.connect (boost::bind (&on_account_modified_cb, _1, _2,
app)));
-
gm_application_populate_application_menu (app);
- core->close ();
-
g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
@@ -560,7 +552,6 @@ gm_application_shutdown (GApplication *app)
g_return_if_fail (self);
self->priv->banks_menu.clear ();
- self->priv->core.reset ();
Ekiga::Runtime::quit ();
gm_platform_shutdown ();
@@ -570,6 +561,16 @@ gm_application_shutdown (GApplication *app)
#endif
g_object_unref (self->priv->builder);
+ /* Destroy all windows to make sure the UI is gone
+ * and we do not block the ServiceCore from
+ * destruction.
+ */
+ while (GList *windows = gtk_application_get_windows (GTK_APPLICATION (self))) {
+ GList *windows_it = g_list_first (windows);
+ if (windows_it->data && GTK_IS_WIDGET (windows_it->data))
+ gtk_widget_destroy (GTK_WIDGET (windows_it->data));
+ }
+
delete self->priv;
self->priv = NULL;
@@ -587,7 +588,7 @@ gm_application_command_line (GApplication *app,
GmApplication *self = GM_APPLICATION (app);
- g_return_val_if_fail (self && self->priv->core, -1);
+ g_return_val_if_fail (self, -1);
static gchar *url = NULL;
static int debug_level = 0;
@@ -651,12 +652,12 @@ gm_application_command_line (GApplication *app,
}
else if (url) {
boost::shared_ptr<Ekiga::CallCore> call_core =
- self->priv->core->get<Ekiga::CallCore> ("call-core");
+ self->priv->core.get<Ekiga::CallCore> ("call-core");
call_core->dial (url);
}
else if (hangup) {
boost::shared_ptr<Ekiga::CallCore> call_core =
- self->priv->core->get<Ekiga::CallCore> ("call-core");
+ self->priv->core.get<Ekiga::CallCore> ("call-core");
call_core->hang_up ();
}
else if (version) {
@@ -713,26 +714,16 @@ gm_application_new ()
"application-id", "org.gnome.Ekiga",
"flags", G_APPLICATION_HANDLES_COMMAND_LINE,
NULL));
+
g_application_register (G_APPLICATION (self), NULL, NULL);
return self;
}
-void
-gm_application_set_core (GmApplication *self,
- Ekiga::ServiceCorePtr core)
-{
- g_return_if_fail (GM_IS_APPLICATION (self));
- self->priv->core = core;
-}
-
-
-Ekiga::ServiceCorePtr
+Ekiga::ServiceCore&
gm_application_get_core (GmApplication *self)
{
- g_return_val_if_fail (GM_IS_APPLICATION (self), boost::shared_ptr<Ekiga::ServiceCore> ());
-
return self->priv->core;
}
diff --git a/lib/engine/gui/gtk-frontend/ekiga-app.h b/lib/engine/gui/gtk-frontend/ekiga-app.h
index a16a2c6..4be0626 100644
--- a/lib/engine/gui/gtk-frontend/ekiga-app.h
+++ b/lib/engine/gui/gtk-frontend/ekiga-app.h
@@ -68,10 +68,7 @@ void ekiga_main (int argc,
GmApplication *gm_application_new ();
-void gm_application_set_core (GmApplication *app,
- Ekiga::ServiceCorePtr core);
-
-Ekiga::ServiceCorePtr gm_application_get_core (GmApplication *app);
+Ekiga::ServiceCore& gm_application_get_core (GmApplication *app);
void gm_application_show_main_window (GmApplication *app);
diff --git a/lib/engine/gui/gtk-frontend/main_window.cpp b/lib/engine/gui/gtk-frontend/main_window.cpp
index b9e7991..2bbffa4 100644
--- a/lib/engine/gui/gtk-frontend/main_window.cpp
+++ b/lib/engine/gui/gtk-frontend/main_window.cpp
@@ -96,7 +96,6 @@ G_DEFINE_TYPE (EkigaMainWindow, ekiga_main_window, GM_TYPE_WINDOW);
struct _EkigaMainWindowPrivate
{
GmApplication *app;
- Ekiga::ServiceCorePtr core;
boost::shared_ptr<Ekiga::AccountCore> account_core;
boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core;
@@ -104,7 +103,7 @@ struct _EkigaMainWindowPrivate
boost::shared_ptr<Ekiga::ContactCore> contact_core;
boost::shared_ptr<Ekiga::PresenceCore> presence_core;
boost::weak_ptr<Opal::Bank> bank;
- boost::shared_ptr<History::Source> history_source;
+ boost::weak_ptr<History::Source> history_source;
GtkWidget *call_window;
@@ -674,7 +673,7 @@ ekiga_main_window_init_status_toolbar (EkigaMainWindow *mw)
/* The main horizontal toolbar */
mw->priv->status_toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- mw->priv->status_option_menu = status_menu_new (*mw->priv->core);
+ mw->priv->status_option_menu = status_menu_new (gm_application_get_core (mw->priv->app));
status_menu_set_parent_window (STATUS_MENU (mw->priv->status_option_menu),
GTK_WINDOW (mw));
gtk_box_pack_start (GTK_BOX (mw->priv->status_toolbar),
@@ -742,19 +741,21 @@ ekiga_main_window_init_dialpad (EkigaMainWindow *mw)
static void
ekiga_main_window_init_history (EkigaMainWindow *mw)
{
- boost::shared_ptr<History::Book> history_book
- = mw->priv->history_source->get_book ();
+ boost::shared_ptr<History::Source> history_source = mw->priv->history_source.lock ();
+ if (history_source) {
+ boost::shared_ptr<History::Book> history_book = history_source->get_book ();
- mw->priv->call_history_view = call_history_view_gtk_new (history_book,
- mw->priv->call_core,
- mw->priv->contact_core);
- gtk_stack_add_named (GTK_STACK (mw->priv->main_stack), mw->priv->call_history_view, "call-history");
- gtk_container_child_set (GTK_CONTAINER (mw->priv->main_stack),
- mw->priv->call_history_view,
- "icon-name", "document-open-recent-symbolic", NULL);
+ mw->priv->call_history_view = call_history_view_gtk_new (history_book,
+ mw->priv->call_core,
+ mw->priv->contact_core);
+ gtk_stack_add_named (GTK_STACK (mw->priv->main_stack), mw->priv->call_history_view, "call-history");
+ gtk_container_child_set (GTK_CONTAINER (mw->priv->main_stack),
+ mw->priv->call_history_view,
+ "icon-name", "document-open-recent-symbolic", NULL);
- g_signal_connect (mw->priv->call_history_view, "actions-changed",
- G_CALLBACK (actions_changed_cb), mw);
+ g_signal_connect (mw->priv->call_history_view, "actions-changed",
+ G_CALLBACK (actions_changed_cb), mw);
+ }
}
@@ -857,8 +858,10 @@ ekiga_main_window_dispose (GObject* gobject)
g_object_unref (mw->priv->roster_view);
mw->priv->roster_view = NULL;
}
- g_object_unref (mw->priv->builder);
- mw->priv->builder = NULL;
+ if (mw->priv->builder) {
+ g_object_unref (mw->priv->builder);
+ mw->priv->builder = NULL;
+ }
G_OBJECT_CLASS (ekiga_main_window_parent_class)->dispose (gobject);
}
@@ -940,25 +943,24 @@ gm_main_window_new (GmApplication *app)
"application", GTK_APPLICATION (app),
"key", USER_INTERFACE ".main-window",
NULL));
- Ekiga::ServiceCorePtr core = gm_application_get_core (app);
+ Ekiga::ServiceCore& core = gm_application_get_core (app);
/* fetching needed engine objects */
- mw->priv->core = core;
mw->priv->app = app;
mw->priv->account_core
- = core->get<Ekiga::AccountCore> ("account-core");
+ = core.get<Ekiga::AccountCore> ("account-core");
mw->priv->audiooutput_core
- = core->get<Ekiga::AudioOutputCore>("audiooutput-core");
+ = core.get<Ekiga::AudioOutputCore>("audiooutput-core");
mw->priv->call_core
- = core->get<Ekiga::CallCore> ("call-core");
+ = core.get<Ekiga::CallCore> ("call-core");
mw->priv->contact_core
- = core->get<Ekiga::ContactCore> ("contact-core");
+ = core.get<Ekiga::ContactCore> ("contact-core");
mw->priv->presence_core
- = core->get<Ekiga::PresenceCore> ("presence-core");
- mw->priv->bank = boost::weak_ptr<Opal::Bank> (core->get<Opal::Bank> ("opal-account-store"));
+ = core.get<Ekiga::PresenceCore> ("presence-core");
+ mw->priv->bank = boost::weak_ptr<Opal::Bank> (core.get<Opal::Bank> ("opal-account-store"));
mw->priv->history_source
- = core->get<History::Source> ("call-history-store");
+ = core.get<History::Source> ("call-history-store");
ekiga_main_window_connect_engine_signals (mw);
diff --git a/lib/engine/gui/gtk-frontend/preferences-window.cpp
b/lib/engine/gui/gtk-frontend/preferences-window.cpp
index cb34853..d9b94ea 100644
--- a/lib/engine/gui/gtk-frontend/preferences-window.cpp
+++ b/lib/engine/gui/gtk-frontend/preferences-window.cpp
@@ -1802,7 +1802,7 @@ preferences_window_new (GmApplication *app)
boost::signals2::connection conn;
- Ekiga::ServiceCorePtr core = gm_application_get_core (app);
+ Ekiga::ServiceCore& core = gm_application_get_core (app);
/* The window */
self = (PreferencesWindow *) g_object_new (PREFERENCES_WINDOW_TYPE,
@@ -1812,9 +1812,9 @@ preferences_window_new (GmApplication *app)
"hide_on_esc", false, NULL);
self->priv = new PreferencesWindowPrivate ();
- self->priv->audioinput_core = core->get<Ekiga::AudioInputCore> ("audioinput-core");
- self->priv->audiooutput_core = core->get<Ekiga::AudioOutputCore> ("audiooutput-core");
- self->priv->videoinput_core = core->get<Ekiga::VideoInputCore> ("videoinput-core");
+ self->priv->audioinput_core = core.get<Ekiga::AudioInputCore> ("audioinput-core");
+ self->priv->audiooutput_core = core.get<Ekiga::AudioOutputCore> ("audiooutput-core");
+ self->priv->videoinput_core = core.get<Ekiga::VideoInputCore> ("videoinput-core");
self->priv->app = app;
headerbar = gtk_header_bar_new ();
diff --git a/lib/engine/gui/gtk-frontend/statusicon.cpp b/lib/engine/gui/gtk-frontend/statusicon.cpp
index 3ab1e13..eb6e2f6 100644
--- a/lib/engine/gui/gtk-frontend/statusicon.cpp
+++ b/lib/engine/gui/gtk-frontend/statusicon.cpp
@@ -533,7 +533,7 @@ status_icon_new (GmApplication *app)
if (!statusicon_should_run ())
return self;
- Ekiga::ServiceCorePtr core = gm_application_get_core (app);
+ Ekiga::ServiceCore& core = gm_application_get_core (app);
boost::signals2::connection conn;
@@ -548,11 +548,11 @@ status_icon_new (GmApplication *app)
self->priv->app = app;
boost::shared_ptr<Ekiga::PersonalDetails> details =
- core->get<Ekiga::PersonalDetails> ("personal-details");
+ core.get<Ekiga::PersonalDetails> ("personal-details");
boost::shared_ptr<Ekiga::CallCore> call_core =
- core->get<Ekiga::CallCore> ("call-core");
+ core.get<Ekiga::CallCore> ("call-core");
boost::shared_ptr<Ekiga::NotificationCore> notification_core =
- core->get<Ekiga::NotificationCore> ("notification-core");
+ core.get<Ekiga::NotificationCore> ("notification-core");
self->priv->chat_window = gm_application_get_chat_window (app);
diff --git a/src/dbus-helper/dbus.cpp b/src/dbus-helper/dbus.cpp
index 7173a5c..a364719 100644
--- a/src/dbus-helper/dbus.cpp
+++ b/src/dbus-helper/dbus.cpp
@@ -207,7 +207,7 @@ ekiga_dbus_component_new (GmApplication *app)
GError *error = NULL;
EkigaDBusComponent *obj;
- Ekiga::ServiceCorePtr core = gm_application_get_core (app);
+ Ekiga::ServiceCore& core = gm_application_get_core (app);
bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
if (!bus) {
@@ -217,7 +217,7 @@ ekiga_dbus_component_new (GmApplication *app)
}
obj = EKIGA_DBUS_COMPONENT (g_object_new (EKIGA_TYPE_DBUS_COMPONENT, NULL));
- obj->priv->call_core = core->get<Ekiga::CallCore> ("call-core");
+ obj->priv->call_core = core.get<Ekiga::CallCore> ("call-core");
obj->priv->personal_data_settings =
boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings (PERSONAL_DATA_SCHEMA));
obj->priv->app = app;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]