[ekiga] Manage the main window using a smart pointer in the gtk+ frontend



commit 170f18e39f40527f58738f0dab3ef010eeacd975
Author: Julien Puydt <jpuydt free fr>
Date:   Wed Jun 19 17:51:03 2013 +0200

    Manage the main window using a smart pointer in the gtk+ frontend

 lib/engine/gui/gtk-frontend/gtk-frontend.cpp |    9 +++++----
 lib/engine/gui/gtk-frontend/gtk-frontend.h   |    2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/lib/engine/gui/gtk-frontend/gtk-frontend.cpp b/lib/engine/gui/gtk-frontend/gtk-frontend.cpp
index 003db75..f4eae7e 100644
--- a/lib/engine/gui/gtk-frontend/gtk-frontend.cpp
+++ b/lib/engine/gui/gtk-frontend/gtk-frontend.cpp
@@ -97,7 +97,6 @@ GtkFrontend::~GtkFrontend ()
 
   //if (status_icon)
   //  g_object_unref (status_icon);
-  //gtk_widget_destroy (main_window);
 }
 
 
@@ -129,8 +128,10 @@ void GtkFrontend::build ()
     boost::shared_ptr<GtkWidget> (preferences_window_new (core),
                                  gtk_widget_destroy);
   status_icon = status_icon_new (core);
-  main_window = gm_main_window_new (core);
-  gtk_window_set_transient_for (GTK_WINDOW (assistant_window.get ()), GTK_WINDOW (main_window));
+  main_window =
+    boost::shared_ptr<GtkWidget> (gm_main_window_new (core),
+                                gtk_widget_destroy);
+  gtk_window_set_transient_for (GTK_WINDOW (assistant_window.get ()), GTK_WINDOW (main_window.get ()));
 }
 
 
@@ -154,7 +155,7 @@ GtkFrontend::get_assistant_window () const
 const GtkWidget*
 GtkFrontend::get_main_window () const
 {
-  return main_window;
+  return main_window.get ();
 }
 
 
diff --git a/lib/engine/gui/gtk-frontend/gtk-frontend.h b/lib/engine/gui/gtk-frontend/gtk-frontend.h
index 1da79e4..018eff7 100644
--- a/lib/engine/gui/gtk-frontend/gtk-frontend.h
+++ b/lib/engine/gui/gtk-frontend/gtk-frontend.h
@@ -82,7 +82,7 @@ public:
 private :
 
   boost::shared_ptr<GtkWidget> assistant_window;
-  GtkWidget* main_window;
+  boost::shared_ptr<GtkWidget> main_window;
   boost::shared_ptr<GtkWidget> preferences_window;
   boost::shared_ptr<GtkWidget> addressbook_window;
   boost::shared_ptr<GtkWidget> accounts_window;


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