[ekiga] Use smart pointers to build the accounts window



commit 8d14385d95d8c640eab88b1d5e579200eb8760b5
Author: Julien Puydt <jpuydt free fr>
Date:   Thu Jun 20 20:43:20 2013 +0200

    Use smart pointers to build the accounts window
    
    Additionally, the gtk+ frontend now also checks for the account core.

 lib/engine/gui/gtk-frontend/accounts-window.cpp |    8 ++++----
 lib/engine/gui/gtk-frontend/accounts-window.h   |    6 ++++--
 lib/engine/gui/gtk-frontend/gtk-frontend.cpp    |    8 ++++++--
 3 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/lib/engine/gui/gtk-frontend/accounts-window.cpp b/lib/engine/gui/gtk-frontend/accounts-window.cpp
index 8dbbc63..afc636d 100644
--- a/lib/engine/gui/gtk-frontend/accounts-window.cpp
+++ b/lib/engine/gui/gtk-frontend/accounts-window.cpp
@@ -40,7 +40,6 @@
 #include "account.h"
 #include "bank.h"
 #include "opal-bank.h"
-#include "account-core.h"
 
 #include "gmcallbacks.h"
 
@@ -523,7 +522,8 @@ accounts_window_class_init (AccountsWindowClass *klass)
 
 /* Public API */
 GtkWidget *
-accounts_window_new (Ekiga::ServiceCore &core)
+accounts_window_new (boost::shared_ptr<Ekiga::AccountCore> account_core,
+                    boost::shared_ptr<Ekiga::PersonalDetails> details)
 {
   AccountsWindow *self = NULL;
 
@@ -564,8 +564,8 @@ accounts_window_new (Ekiga::ServiceCore &core)
   self = (AccountsWindow *) g_object_new (ACCOUNTS_WINDOW_TYPE, NULL);
 
   self->priv = new AccountsWindowPrivate;
-  self->priv->details = core.get<Ekiga::PersonalDetails> ("personal-details");
-  self->priv->account_core = core.get<Ekiga::AccountCore> ("account-core");
+  self->priv->details = details;
+  self->priv->account_core = account_core;
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
   gtk_window_set_title (GTK_WINDOW (self), _("Accounts"));
diff --git a/lib/engine/gui/gtk-frontend/accounts-window.h b/lib/engine/gui/gtk-frontend/accounts-window.h
index d294d2c..aeda4f7 100644
--- a/lib/engine/gui/gtk-frontend/accounts-window.h
+++ b/lib/engine/gui/gtk-frontend/accounts-window.h
@@ -46,7 +46,8 @@
 #include "services.h"
 
 #include "gmwindow.h"
-
+#include "account-core.h"
+#include "personal-details.h"
 
 typedef struct _AccountsWindow AccountsWindow;
 typedef struct _AccountsWindowPrivate AccountsWindowPrivate;
@@ -87,6 +88,7 @@ GType accounts_window_get_type ();
  * BEHAVIOR     : Builds the GMAccounts window GObject.
  * PRE          : /
  */
-GtkWidget *accounts_window_new (Ekiga::ServiceCore &core);
+GtkWidget* accounts_window_new (boost::shared_ptr<Ekiga::AccountCore> account_core,
+                               boost::shared_ptr<Ekiga::PersonalDetails> details);
 
 #endif
diff --git a/lib/engine/gui/gtk-frontend/gtk-frontend.cpp b/lib/engine/gui/gtk-frontend/gtk-frontend.cpp
index e570cea..407e1a9 100644
--- a/lib/engine/gui/gtk-frontend/gtk-frontend.cpp
+++ b/lib/engine/gui/gtk-frontend/gtk-frontend.cpp
@@ -44,6 +44,7 @@
 
 #include "gtk-frontend.h"
 #include "gmstockicons.h"
+#include "account-core.h"
 #include "chat-core.h"
 #include "contact-core.h"
 #include "presence-core.h"
@@ -100,8 +101,9 @@ gtk_frontend_init (Ekiga::ServiceCore &core,
   boost::shared_ptr<History::Source> history_source = core.get<History::Source> ("call-history-store");
   boost::shared_ptr<Ekiga::PersonalDetails> details = core.get<Ekiga::PersonalDetails> ("personal-details");
   boost::shared_ptr<Ekiga::NotificationCore> notification_core = core.get<Ekiga::NotificationCore> 
("notification-core");
+  boost::shared_ptr<Ekiga::AccountCore> account_core = core.get<Ekiga::AccountCore> ("account-core");
 
-  if (presence_core && contact_core && chat_core && history_source && notification_core) {
+  if (presence_core && contact_core && chat_core && history_source && notification_core && account_core) {
 
     // BEWARE: the GtkFrontend ctor could do everything, but the status
     // icon ctor and the main window ctor use GtkFrontend, so we must
@@ -128,7 +130,9 @@ void
 GtkFrontend::build ()
 {
   boost::shared_ptr<Ekiga::ContactCore> contact_core = core.get<Ekiga::ContactCore> ("contact-core");
+  boost::shared_ptr<Ekiga::PersonalDetails> details = core.get<Ekiga::PersonalDetails> ("personal-details");
   boost::shared_ptr<Ekiga::ChatCore> chat_core = core.get<Ekiga::ChatCore> ("chat-core");
+  boost::shared_ptr<Ekiga::AccountCore> account_core = core.get<Ekiga::AccountCore> ("account-core");
 
   /* Init the stock icons */
   gnomemeeting_stock_icons_init ();
@@ -140,7 +144,7 @@ GtkFrontend::build ()
                     "/apps/" PACKAGE_NAME "/general/user_interface/addressbook_window");
 
   accounts_window =
-    boost::shared_ptr<GtkWidget> (accounts_window_new (core), gtk_widget_destroy);
+    boost::shared_ptr<GtkWidget> (accounts_window_new (account_core, details), gtk_widget_destroy);
   gm_window_set_key(GM_WINDOW (accounts_window.get ()),
                    "/apps/" PACKAGE_NAME "/general/user_interface/accounts_window");
 


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