ekiga r7307 - trunk/lib/engine/gui/gtk-frontend



Author: jpuydt
Date: Thu Oct 30 15:18:33 2008
New Revision: 7307
URL: http://svn.gnome.org/viewvc/ekiga?rev=7307&view=rev

Log:
Made the GUI follow the new contact stack api

Modified:
   trunk/lib/engine/gui/gtk-frontend/addressbook-window.cpp
   trunk/lib/engine/gui/gtk-frontend/book-view-gtk.cpp
   trunk/lib/engine/gui/gtk-frontend/book-view-gtk.h
   trunk/lib/engine/gui/gtk-frontend/call-history-view-gtk.cpp
   trunk/lib/engine/gui/gtk-frontend/call-history-view-gtk.h
   trunk/lib/engine/gui/gtk-frontend/gtk-frontend.cpp

Modified: trunk/lib/engine/gui/gtk-frontend/addressbook-window.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/addressbook-window.cpp	(original)
+++ trunk/lib/engine/gui/gtk-frontend/addressbook-window.cpp	Thu Oct 30 15:18:33 2008
@@ -38,6 +38,7 @@
 
 #include "gmstockicons.h"
 
+#include "gm-refcounted-boxed.h"
 #include "addressbook-window.h"
 #include "book-view-gtk.h"
 #include "menu-builder-gtk.h"
@@ -95,7 +96,7 @@
  * BEHAVIOR     : 
  * PRE          : The given GtkWidget pointer must be an SearchBook GObject.
  */
-static void on_source_added (Ekiga::Source &source,
+static void on_source_added (gmref_ptr<Ekiga::Source> source,
 			     gpointer data);
 
 
@@ -103,8 +104,8 @@
  * BEHAVIOR     : 
  * PRE          : The given GtkWidget pointer must be an SearchBook GObject.
  */
-static bool visit_books (Ekiga::Book &book,
-			 Ekiga::Source *source,
+static bool visit_books (gmref_ptr<Ekiga::Book> book,
+			 gmref_ptr<Ekiga::Source> source,
 			 gpointer data);
 
 
@@ -113,8 +114,8 @@
  * BEHAVIOR     : Add a view of the Book in the AddressBookWindow.
  * PRE          : The given GtkWidget pointer must be an SearchBook GObject.
  */
-static void on_book_added (Ekiga::Source &source,
-			   Ekiga::Book &book,
+static void on_book_added (gmref_ptr<Ekiga::Source> source,
+			   gmref_ptr<Ekiga::Book> book,
                            gpointer data);
 
 
@@ -123,8 +124,8 @@
  * BEHAVIOR     : Remove the view of the Book from the AddressBookWindow.
  * PRE          : The given GtkWidget pointer must be an SearchBook GObject.
  */
-static void on_book_removed (Ekiga::Source &source,
-			     Ekiga::Book &book,
+static void on_book_removed (gmref_ptr<Ekiga::Source> source,
+			     gmref_ptr<Ekiga::Book> book,
                              gpointer data);
 
 
@@ -133,8 +134,8 @@
  * BEHAVIOR     : Update the Book in the AddressBookWindow.
  * PRE          : The given GtkWidget pointer must be an SearchBook GObject.
  */
-static void on_book_updated (Ekiga::Source &source,
-			     Ekiga::Book &book,
+static void on_book_updated (gmref_ptr<Ekiga::Source> source,
+			     gmref_ptr<Ekiga::Book> book,
                              gpointer data);
 
 /* DESCRIPTION  : Called when the ContactCore has a form request
@@ -186,7 +187,7 @@
  * PRE          : /
  */
 static void addressbook_window_add_book (AddressBookWindow * self,
-                                         Ekiga::Book &book);
+                                         gmref_ptr<Ekiga::Book> book);
 
 
 /* DESCRIPTION  : /
@@ -195,7 +196,7 @@
  * PRE          : /
  */
 static void addressbook_window_update_book (AddressBookWindow *self,
-                                            Ekiga::Book &book);
+                                            gmref_ptr<Ekiga::Book> book);
 
 
 /* DESCRIPTION  : /
@@ -203,7 +204,7 @@
  * PRE          : /
  */
 static void addressbook_window_remove_book (AddressBookWindow *self,
-                                            Ekiga::Book &book);
+                                            gmref_ptr<Ekiga::Book> book);
 
 
 /* DESCRIPTION  : /
@@ -214,7 +215,7 @@
  * PRE          : /
  */
 static gboolean find_iter_for_book (AddressBookWindow *addressbook_window,
-                                    Ekiga::Book &book,
+                                    gmref_ptr<Ekiga::Book> book,
                                     GtkTreeIter *iter);
 
 
@@ -250,27 +251,27 @@
 
 
 static void
-on_source_added (Ekiga::Source &source,
+on_source_added (gmref_ptr<Ekiga::Source> source,
 		 gpointer data)
 {
-  source.visit_books (sigc::bind (sigc::ptr_fun (visit_books),
-				  &source, data));
+  source->visit_books (sigc::bind (sigc::ptr_fun (visit_books),
+				   source, data));
 }
 
 
-static bool visit_books (Ekiga::Book &book,
-			 Ekiga::Source *source,
+static bool visit_books (gmref_ptr<Ekiga::Book> book,
+			 gmref_ptr<Ekiga::Source> source,
 			 gpointer data)
 {
-  on_book_added (*source, book, data);
+  on_book_added (source, book, data);
 
   return true;
 }
 
 
 static void
-on_book_added (Ekiga::Source &/*source*/,
-	       Ekiga::Book &book,
+on_book_added (gmref_ptr<Ekiga::Source> /*source*/,
+	       gmref_ptr<Ekiga::Book> book,
                gpointer data)
 {
   addressbook_window_add_book (ADDRESSBOOK_WINDOW (data), book);
@@ -278,8 +279,8 @@
 
 
 static void
-on_book_removed (Ekiga::Source &/*source*/,
-		 Ekiga::Book &book,
+on_book_removed (gmref_ptr<Ekiga::Source> /*source*/,
+		 gmref_ptr<Ekiga::Book> book,
                  gpointer data)
 {
   addressbook_window_remove_book (ADDRESSBOOK_WINDOW (data), book);
@@ -287,8 +288,8 @@
 
 
 static void
-on_book_updated (Ekiga::Source &/*source*/,
-		 Ekiga::Book &book,
+on_book_updated (gmref_ptr<Ekiga::Source> /*source*/,
+		 gmref_ptr<Ekiga::Book> book,
                  gpointer data)
 {
   addressbook_window_update_book (ADDRESSBOOK_WINDOW (data), book);
@@ -408,6 +409,7 @@
                               (gpointer) menu_builder.menu);
           }
           g_object_ref_sink (G_OBJECT (menu_builder.menu));
+	  gmref_dec (book_iter);
         }
         gtk_tree_path_free (path);
       }
@@ -421,7 +423,7 @@
 /* Implementation of the private functions */
 static void
 addressbook_window_add_book (AddressBookWindow *self,
-                             Ekiga::Book &book)
+                             gmref_ptr<Ekiga::Book> book)
 {
   GtkTreeIter iter;
   GtkTreeModel *store = NULL;
@@ -440,15 +442,15 @@
   g_signal_connect (view, "updated", G_CALLBACK (on_view_updated), self);
 
   icon = gtk_widget_render_icon (GTK_WIDGET (self->priv->tree_view),
-				 book.get_icon ().c_str (),
+				 book->get_icon ().c_str (),
 				 GTK_ICON_SIZE_MENU, NULL); 
 
   store = gtk_tree_view_get_model (GTK_TREE_VIEW (self->priv->tree_view));
   gtk_tree_store_append (GTK_TREE_STORE (store), &iter, NULL);
   gtk_tree_store_set (GTK_TREE_STORE (store), &iter,
                       COLUMN_PIXBUF, icon, 
-                      COLUMN_NAME, book.get_name ().c_str (),
-                      COLUMN_BOOK_POINTER, &book, 
+                      COLUMN_NAME, book->get_name ().c_str (),
+                      COLUMN_BOOK_POINTER, &*book, 
                       COLUMN_VIEW, view,
                       -1);
 
@@ -464,7 +466,7 @@
 
 static void
 addressbook_window_update_book (AddressBookWindow *self,
-                                Ekiga::Book &book)
+                                gmref_ptr<Ekiga::Book> book)
 {
   GtkTreeIter iter;
   GtkTreeModel *store = NULL;
@@ -472,14 +474,14 @@
   store = gtk_tree_view_get_model (GTK_TREE_VIEW (self->priv->tree_view));
   if (find_iter_for_book (self, book, &iter))
     gtk_tree_store_set (GTK_TREE_STORE (store), &iter,
-                        COLUMN_NAME, book.get_name ().c_str (),
+                        COLUMN_NAME, book->get_name ().c_str (),
                         -1);
 }
 
 
 static void
 addressbook_window_remove_book (AddressBookWindow *self,
-                                Ekiga::Book &book)
+                                gmref_ptr<Ekiga::Book> book)
 {
   GtkTreeIter iter;
   gint page = -1;
@@ -516,7 +518,7 @@
 
 static gboolean
 find_iter_for_book (AddressBookWindow *self,
-                    Ekiga::Book &book,
+                    gmref_ptr<Ekiga::Book> book,
                     GtkTreeIter *iter)
 {
   Ekiga::Book *book_iter = NULL;
@@ -532,8 +534,13 @@
                           COLUMN_BOOK_POINTER, &book_iter,
                           -1);
 
-      if (&book == book_iter)
+      if (&*book == book_iter) {
+
+	gmref_dec (book_iter);
         break;
+      }
+
+      gmref_dec (book_iter);
 
       if (!gtk_tree_model_iter_next (store, iter))
         return FALSE;
@@ -701,7 +708,7 @@
   store = gtk_tree_store_new (NUM_COLUMNS,
                               GDK_TYPE_PIXBUF,
                               G_TYPE_STRING,
-                              G_TYPE_POINTER,
+                              GM_TYPE_REFCOUNTED,
                               G_TYPE_OBJECT);
   self->priv->tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
   g_object_unref (store);

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	Thu Oct 30 15:18:33 2008
@@ -43,6 +43,7 @@
 #include "book-view-gtk.h"
 
 #include "gmstockicons.h"
+#include "gm-refcounted-boxed.h"
 #include "menu-builder-tools.h"
 #include "menu-builder-gtk.h"
 
@@ -57,53 +58,42 @@
   /* Watch the Book for changes,
    * connect the signals
    */
-  void watch_book (Ekiga::Book &book);
+  void watch_book (gmref_ptr<Ekiga::Book> book);
 
   /* Repopulate the book */
-  void repopulate (Ekiga::Book &book);
+  void repopulate (gmref_ptr<Ekiga::Book> book);
 
   /* signals emitted by this centralizer and of interest
    * for our GObject
    */
-  sigc::signal<void, Ekiga::Contact &> contact_added;
-  sigc::signal<void, Ekiga::Contact &> contact_updated;
-  sigc::signal<void, Ekiga::Contact &> contact_removed;
+  sigc::signal<void, gmref_ptr<Ekiga::Contact> > contact_added;
+  sigc::signal<void, gmref_ptr<Ekiga::Contact> > contact_updated;
+  sigc::signal<void, gmref_ptr<Ekiga::Contact> > contact_removed;
   sigc::signal<void> updated;
-
-private:
-
-  void on_contact_added (Ekiga::Contact &contact);
 };
 
 
-void SignalCentralizer::watch_book (Ekiga::Book &book)
+void SignalCentralizer::watch_book (gmref_ptr<Ekiga::Book> book)
 {
-  book.contact_added.connect (contact_added.make_slot ());
-  book.contact_updated.connect (contact_updated.make_slot ());
-  book.contact_removed.connect (contact_removed.make_slot ());
-  book.updated.connect (updated.make_slot ());
+  book->contact_added.connect (contact_added.make_slot ());
+  book->contact_updated.connect (contact_updated.make_slot ());
+  book->contact_removed.connect (contact_removed.make_slot ());
+  book->updated.connect (updated.make_slot ());
   repopulate (book);
 }
 
 
-void SignalCentralizer::repopulate (Ekiga::Book &book)
-{
-  book.visit_contacts (sigc::bind_return (sigc::mem_fun (this, &SignalCentralizer::on_contact_added), true));
-}
-
-
-void SignalCentralizer::on_contact_added (Ekiga::Contact &contact)
+void SignalCentralizer::repopulate (gmref_ptr<Ekiga::Book> book)
 {
-  contact_added.emit (contact);
+  book->visit_contacts (sigc::bind_return (contact_added.make_slot (), true));
 }
 
-
 /*
  * The Book View
  */
 struct _BookViewGtkPrivate
 {
-  _BookViewGtkPrivate (Ekiga::Book &_book) : book (_book) { }
+  _BookViewGtkPrivate (gmref_ptr<Ekiga::Book> book_) : book (book_) { }
 
   SignalCentralizer centralizer;
   GtkTreeView *tree_view;
@@ -112,17 +102,17 @@
   GtkWidget *statusbar;
   GtkWidget *scrolled_window;
 
-  Ekiga::Book &book;
+  gmref_ptr<Ekiga::Book> book;
 };
 
 
-enum
-  {
-    COLUMN_CONTACT_POINTER,
-    COLUMN_PIXBUF,
-    COLUMN_NAME,
-    COLUMN_NUMBER
-  };
+enum {
+
+  COLUMN_CONTACT_POINTER,
+  COLUMN_PIXBUF,
+  COLUMN_NAME,
+  COLUMN_NUMBER
+};
 
 static GObjectClass *parent_class = NULL;
 
@@ -136,7 +126,7 @@
  * BEHAVIOR     : Update the BookView.
  * PRE          : The gpointer must point to the BookViewGtk GObject.
  */
-static void on_contact_added (Ekiga::Contact &contact,
+static void on_contact_added (gmref_ptr<Ekiga::Contact> contact,
 			      gpointer data);
 
 
@@ -144,7 +134,7 @@
  * BEHAVIOR     : Update the BookView.
  * PRE          : The gpointer must point to the BookViewGtk GObject.
  */
-static void on_contact_updated (Ekiga::Contact &contact,
+static void on_contact_updated (gmref_ptr<Ekiga::Contact> contact,
 				gpointer data);
 
 
@@ -159,7 +149,7 @@
  * BEHAVIOR     : Update the BookView.
  * PRE          : The gpointer must point to the BookViewGtk GObject.
  */
-static void on_contact_removed (Ekiga::Contact &contact,
+static void on_contact_removed (gmref_ptr<Ekiga::Contact> contact,
 				gpointer data);
 
 
@@ -207,7 +197,7 @@
  */
 static void
 book_view_gtk_add_contact (BookViewGtk *self,
-                           Ekiga::Contact &contact);
+                           gmref_ptr<Ekiga::Contact> contact);
 
 
 /* DESCRIPTION  : /
@@ -216,7 +206,7 @@
  */
 static void
 book_view_gtk_update_contact (BookViewGtk *self,
-                              Ekiga::Contact &contact,
+                              gmref_ptr<Ekiga::Contact> contact,
                               GtkTreeIter *iter);
 
 
@@ -226,7 +216,7 @@
  */
 static void
 book_view_gtk_remove_contact (BookViewGtk *self,
-                              Ekiga::Contact &contact);
+                              gmref_ptr<Ekiga::Contact> contact);
 
 
 /* DESCRIPTION  : /
@@ -236,14 +226,14 @@
  */
 static gboolean
 book_view_gtk_find_iter_for_contact (BookViewGtk *view,
-                                     Ekiga::Contact &contact,
+                                     gmref_ptr<Ekiga::Contact> contact,
                                      GtkTreeIter *iter);
 
 
 
 /* Implementation of the callbacks */
 static void
-on_contact_added (Ekiga::Contact &contact,
+on_contact_added (gmref_ptr<Ekiga::Contact> contact,
 		  gpointer data)
 {
   book_view_gtk_add_contact (BOOK_VIEW_GTK (data), contact);
@@ -251,7 +241,7 @@
 
 
 static void
-on_contact_updated (Ekiga::Contact &contact,
+on_contact_updated (gmref_ptr<Ekiga::Contact> contact,
 		    gpointer data)
 {
   BookViewGtk *view = NULL;
@@ -272,7 +262,7 @@
 
   view = BOOK_VIEW_GTK (data);
 
-  std::string status = view->priv->book.get_status ();
+  std::string status = view->priv->book->get_status ();
 
   gtk_statusbar_pop (GTK_STATUSBAR (view->priv->statusbar), 0);
   gtk_statusbar_push (GTK_STATUSBAR (view->priv->statusbar), 0, status.c_str ());
@@ -284,7 +274,7 @@
 
 
 static void
-on_contact_removed (Ekiga::Contact &contact,
+on_contact_removed (gmref_ptr<Ekiga::Contact> contact,
 		    gpointer data)
 {
   BookViewGtk *view = NULL;
@@ -307,15 +297,13 @@
                        gpointer data)
 {
   GdkCursor *cursor = NULL;
-
-  Ekiga::Book &book = BOOK_VIEW_GTK (data)->priv->book;
   const char *entry_text = gtk_entry_get_text (GTK_ENTRY (entry));
 
   cursor = gdk_cursor_new (GDK_WATCH);
   gdk_window_set_cursor (GTK_WIDGET (data)->window, cursor);
   gdk_cursor_unref (cursor);
 
-  book.set_search_filter (entry_text);
+  BOOK_VIEW_GTK (data)->priv->book->set_search_filter (entry_text);
 }
 
 
@@ -337,7 +325,6 @@
   GtkTreePath *path = NULL;
   GtkTreeIter iter;
   GtkTreeModel *model = NULL;
-  Ekiga::Contact *contact = NULL;
 
   if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tree_view),
 				     (gint) event->x, (gint) event->y,
@@ -348,6 +335,7 @@
 
     if (gtk_tree_model_get_iter (model, &iter, path)) {
 
+      Ekiga::Contact *contact = NULL;
       gtk_tree_model_get (model, &iter,
 			  COLUMN_CONTACT_POINTER, &contact,
 			  -1);
@@ -359,7 +347,7 @@
 	  Ekiga::TemporaryMenuBuilder temp;
 	  MenuBuilderGtk builder;
 
-	  BOOK_VIEW_GTK (data)->priv->book.populate_menu (temp);
+	  BOOK_VIEW_GTK (data)->priv->book->populate_menu (temp);
 	  contact->populate_menu (builder);
 
 	  if (!temp.empty ()) {
@@ -384,6 +372,7 @@
 
 	  contact->populate_menu (builder);
 	}
+	gmref_dec (contact);
       }
     }
     gtk_tree_path_free (path);
@@ -396,7 +385,7 @@
 /* Implementation of the static functions */
 static void
 book_view_gtk_add_contact (BookViewGtk *self,
-                           Ekiga::Contact &contact)
+                           gmref_ptr<Ekiga::Contact> contact)
 {
   GtkTreeModel *model = NULL;
   GtkListStore *store = NULL;
@@ -406,14 +395,14 @@
   store = GTK_LIST_STORE (model);
 
   gtk_list_store_append (store, &iter);
-  gtk_list_store_set (store, &iter, COLUMN_CONTACT_POINTER, &contact, -1);
+  gtk_list_store_set (store, &iter, COLUMN_CONTACT_POINTER, &*contact, -1);
   book_view_gtk_update_contact (self, contact, &iter);
 }
 
 
 static void
 book_view_gtk_update_contact (BookViewGtk *self,
-			      Ekiga::Contact &contact,
+			      gmref_ptr<Ekiga::Contact> contact,
 			      GtkTreeIter *iter)
 {
   GdkPixbuf *icon = NULL;
@@ -425,7 +414,7 @@
 
   gtk_list_store_set (store, iter,
                       COLUMN_PIXBUF, icon,
-		      COLUMN_NAME, contact.get_name ().c_str (),
+		      COLUMN_NAME, contact->get_name ().c_str (),
 		      -1);
   g_object_unref (icon);
 
@@ -436,7 +425,7 @@
 
 static void
 book_view_gtk_remove_contact (BookViewGtk *self,
-                              Ekiga::Contact &contact)
+                              gmref_ptr<Ekiga::Contact> contact)
 {
   GtkTreeModel *model = NULL;
   GtkListStore *store = NULL;
@@ -455,11 +444,10 @@
 
 static gboolean
 book_view_gtk_find_iter_for_contact (BookViewGtk *view,
-                                     Ekiga::Contact &contact,
+                                     gmref_ptr<Ekiga::Contact> contact,
                                      GtkTreeIter *iter)
 {
   GtkTreeModel *model = NULL;
-  Ekiga::Contact *iter_contact = NULL;
   gboolean found = FALSE;
 
   model = gtk_tree_view_get_model (view->priv->tree_view);
@@ -468,12 +456,14 @@
 
     do {
 
+      Ekiga::Contact *iter_contact = NULL;
       gtk_tree_model_get (model, iter,
                           COLUMN_CONTACT_POINTER, &iter_contact,
                           -1);
-      if (iter_contact == &contact)
+      if (iter_contact == &*contact)
         found = TRUE;
-
+      
+      gmref_dec (iter_contact);
     } while (!found && gtk_tree_model_iter_next (model, iter));
   }
 
@@ -571,7 +561,7 @@
 
 /* public methods implementation */
 GtkWidget *
-book_view_gtk_new (Ekiga::Book &book)
+book_view_gtk_new (gmref_ptr<Ekiga::Book> book)
 {
   BookViewGtk *result = NULL;
 
@@ -613,7 +603,7 @@
 		    G_CALLBACK (on_contact_clicked), result);
 
   store = gtk_list_store_new (COLUMN_NUMBER,
-			      G_TYPE_POINTER,
+			      GM_TYPE_REFCOUNTED,
                               GDK_TYPE_PIXBUF,
                               G_TYPE_STRING);
 
@@ -688,7 +678,7 @@
   GtkWidget *item = NULL;
   MenuBuilderGtk builder (menu);
 
-  self->priv->book.populate_menu (builder);
+  self->priv->book->populate_menu (builder);
 
   selection = gtk_tree_view_get_selection (self->priv->tree_view);
 
@@ -701,6 +691,7 @@
       item = gtk_separator_menu_item_new ();
       gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
       contact->populate_menu (builder);
+      gmref_dec (contact);
     }
   }
 }

Modified: trunk/lib/engine/gui/gtk-frontend/book-view-gtk.h
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/book-view-gtk.h	(original)
+++ trunk/lib/engine/gui/gtk-frontend/book-view-gtk.h	Thu Oct 30 15:18:33 2008
@@ -47,7 +47,7 @@
 
 /* public api */
 
-GtkWidget *book_view_gtk_new (Ekiga::Book &book);
+GtkWidget *book_view_gtk_new (gmref_ptr<Ekiga::Book> book);
 
 void book_view_gtk_populate_menu (BookViewGtk *, GtkWidget *);
 

Modified: trunk/lib/engine/gui/gtk-frontend/call-history-view-gtk.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/call-history-view-gtk.cpp	(original)
+++ trunk/lib/engine/gui/gtk-frontend/call-history-view-gtk.cpp	Thu Oct 30 15:18:33 2008
@@ -68,7 +68,7 @@
 
 /* react to a new call being inserted in history */
 static void
-on_contact_added (Ekiga::Contact &contact,
+on_contact_added (gmref_ptr<Ekiga::Contact> contact,
 		  GtkListStore *store)
 {
   time_t t;
@@ -77,12 +77,10 @@
   std::stringstream info;
   const gchar *id = NULL;
 
-  History::Contact *hcontact = NULL;
+  gmref_ptr<History::Contact> hcontact = contact;
   GtkTreeIter iter;
 
-  hcontact = dynamic_cast<History::Contact*>(&contact);
-
-  if (hcontact != NULL) {
+  if (hcontact) {
 
     switch (hcontact->get_type ()) {
 
@@ -119,9 +117,9 @@
 
   gtk_list_store_prepend (store, &iter);
   gtk_list_store_set (store, &iter,
-		      COLUMN_CONTACT, &contact,
+		      COLUMN_CONTACT, &*contact,
 		      COLUMN_PIXBUF, id,
-		      COLUMN_NAME, contact.get_name ().c_str (),
+		      COLUMN_NAME, contact->get_name ().c_str (),
 		      COLUMN_INFO, info.str ().c_str (),
 		      -1);
 }
@@ -190,7 +188,7 @@
 /* public api */
 
 GtkWidget *
-call_history_view_gtk_new (History::Book &book)
+call_history_view_gtk_new (gmref_ptr<History::Book> book)
 {
   GtkWidget *result = NULL;
   std::list<sigc::connection> *conns = NULL;
@@ -248,13 +246,13 @@
 		    G_CALLBACK (on_clicked), &book);
 
   /* connect to the signals */
-  connection = book.cleared.connect (sigc::bind (sigc::ptr_fun (gtk_list_store_clear), store));
+  connection = book->cleared.connect (sigc::bind (sigc::ptr_fun (gtk_list_store_clear), store));
   conns->push_front (connection);
-  connection = book.contact_added.connect (sigc::bind (sigc::ptr_fun (on_contact_added), store));
+  connection = book->contact_added.connect (sigc::bind (sigc::ptr_fun (on_contact_added), store));
   conns->push_front (connection);
 
   /* populate */
-  book.visit_contacts (sigc::bind_return(sigc::bind (sigc::ptr_fun (on_contact_added), store), true));
+  book->visit_contacts (sigc::bind_return(sigc::bind (sigc::ptr_fun (on_contact_added), store), true));
 
   return result;
 }

Modified: trunk/lib/engine/gui/gtk-frontend/call-history-view-gtk.h
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/call-history-view-gtk.h	(original)
+++ trunk/lib/engine/gui/gtk-frontend/call-history-view-gtk.h	Thu Oct 30 15:18:33 2008
@@ -41,6 +41,6 @@
 #include <gtk/gtk.h>
 #include "history-book.h"
 
-GtkWidget *call_history_view_gtk_new (History::Book &book);
+GtkWidget *call_history_view_gtk_new (gmref_ptr<History::Book> book);
 
 #endif

Modified: trunk/lib/engine/gui/gtk-frontend/gtk-frontend.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/gtk-frontend.cpp	(original)
+++ trunk/lib/engine/gui/gtk-frontend/gtk-frontend.cpp	Thu Oct 30 15:18:33 2008
@@ -84,12 +84,10 @@
   gmref_ptr<Ekiga::ContactCore> contact_core = core.get ("contact-core");
   gmref_ptr<Ekiga::ChatCore> chat_core = core.get ("chat-core");
   gmref_ptr<History::Source> history_source = core.get ("call-history-store");
-  History::Book *history_book = NULL;
-
-  history_book = history_source->get_book ();
+  gmref_ptr<History::Book> history_book = history_source->get_book ();
 
   roster_view = roster_view_gtk_new (*presence_core);
-  call_history_view = call_history_view_gtk_new (*history_book);
+  call_history_view = call_history_view_gtk_new (history_book);
   addressbook_window =
     addressbook_window_new_with_key (*contact_core, "/apps/ekiga/general/user_interface/addressbook_window");
   chat_window =



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