ekiga r6115 - in trunk: . lib/engine/addressbook/call-history lib/engine/gui/gtk-frontend src/gui



Author: jpuydt
Date: Thu Apr  3 13:30:31 2008
New Revision: 6115
URL: http://svn.gnome.org/viewvc/ekiga?rev=6115&view=rev

Log:
Squashed commit of the following:

commit 5ade0185e039a05a509e7e0ea598b1469473774f
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Thu Apr 3 14:18:11 2008 +0200

    Used get_status to make a better call history view

commit eec388743b91ad8813deb5bbe9bf771647142ccc
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Thu Apr 3 14:17:53 2008 +0200

    Added the get_status method to History::Contact

commit e4b8acfaa6fb30a64d8d57844547ff0b806ca125
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Thu Apr 3 14:00:59 2008 +0200

    Guard the call history against empty calls (!)

commit 948a19f7060450fdb42cfbb2b3cdf1f653eb1609
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Thu Apr 3 10:36:51 2008 +0200

    Added an emblem for the type of call in the call history view

commit 0cd327b409c1f662a25ea4b1e53294a1192d7b28
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Thu Apr 3 10:36:09 2008 +0200

    Modified the way things are stored.

commit e4fb4328fce1cc2dc8de4bd1e876792ce4c96c58
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Wed Apr 2 22:37:37 2008 +0200

    Fixed call history saving

commit f0db79bb4ba915d2434d21876e4fe86e922477db
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Wed Apr 2 21:50:34 2008 +0200

    Added a context menu to the call history view

commit 6edb5005c8124d9c5c2615b9c47d305e3f174c05
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Wed Apr 2 21:25:44 2008 +0200

    Made the widget less ugly by using a scrolled window

commit a0a534a56eeb545451fc7886539230674f2c21de
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Wed Apr 2 21:16:48 2008 +0200

    Adding the column to the treeview gives better-looking results

commit 143a1cdb693820a68ddb43af4021648e897136d7
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Wed Apr 2 21:11:02 2008 +0200

    Make the main window use the new call history widget

commit dc0cbcd2c063a41a9fa210bc55dd27eb236077e3
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Wed Apr 2 21:04:38 2008 +0200

    Turns out just copy-pasting the book-view-gtk api wasn't that smart ;-)

commit ba381342bcc08fcee090960a645dd3e51c717b53
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Wed Apr 2 21:01:29 2008 +0200

    Made the view actually show something ; it compiles!

commit 45b1afc54e76058c7906a7f93276cdfe3d8aabc1
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Wed Apr 2 21:00:37 2008 +0200

    Added forgotten dep

commit 5826f4410141bb740a98df8b373fd037464b3d17
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Wed Apr 2 20:49:07 2008 +0200

    Fix the filenames in Makefile.am... sigh!

commit 382dfaafbc54cd57419569557e4c3c5b1e364351
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Wed Apr 2 20:37:11 2008 +0200

    Added a 'cleared' signal to the call history

commit 5fc4186ea7ffce194d73d5053779221e216443c0
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Wed Apr 2 10:08:44 2008 +0200

    Added skeletton of call history view code

commit 54e08f4aa4cad829d3b76b569e9a3b3a76238264
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Tue Apr 1 17:50:12 2008 +0200

    Put a call history view in the main window


Added:
   trunk/lib/engine/gui/gtk-frontend/call-history-view-gtk.cpp
   trunk/lib/engine/gui/gtk-frontend/call-history-view-gtk.h
      - copied, changed from r6114, /trunk/lib/engine/gui/gtk-frontend/gtk-frontend.h
Modified:
   trunk/ChangeLog
   trunk/lib/engine/addressbook/call-history/history-book.cpp
   trunk/lib/engine/addressbook/call-history/history-book.h
   trunk/lib/engine/addressbook/call-history/history-contact.cpp
   trunk/lib/engine/addressbook/call-history/history-contact.h
   trunk/lib/engine/addressbook/call-history/history-source.cpp
   trunk/lib/engine/addressbook/call-history/history-source.h
   trunk/lib/engine/gui/gtk-frontend/Makefile.am
   trunk/lib/engine/gui/gtk-frontend/gtk-frontend.cpp
   trunk/lib/engine/gui/gtk-frontend/gtk-frontend.h
   trunk/src/gui/main.cpp

Modified: trunk/lib/engine/addressbook/call-history/history-book.cpp
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-book.cpp	(original)
+++ trunk/lib/engine/addressbook/call-history/history-book.cpp	Thu Apr  3 13:30:31 2008
@@ -47,7 +47,7 @@
 History::Book::Book (Ekiga::ServiceCore &_core) :
   core(_core), doc(NULL)
 {
-  xmlNodePtr root;
+  xmlNodePtr root = NULL;
 
   const gchar *c_raw = gm_conf_get_string (KEY);
 
@@ -56,9 +56,11 @@
     const std::string raw = c_raw;
 
     doc = xmlRecoverMemory (raw.c_str (), raw.length ());
+    if (doc == NULL)
+      doc = xmlNewDoc (BAD_CAST "1.0");
 
     root = xmlDocGetRootElement (doc);
-    
+
     if (root == NULL) {
 
       root = xmlNewNode (NULL, BAD_CAST "list");
@@ -119,12 +121,18 @@
   Contact *contact = NULL;
   xmlNodePtr root = NULL;
 
-  root = xmlDocGetRootElement (doc);
-  contact = new Contact (core, name, uri, contact_status, c_t);
+  if ( !uri.empty ()) {
 
-  xmlAddChild (root, contact->get_node ());
+    root = xmlDocGetRootElement (doc);
 
-  common_add (*contact);
+    contact = new Contact (core, name, uri, contact_status, c_t);
+
+    xmlAddChild (root, contact->get_node ());
+
+    save ();
+
+    common_add (*contact);
+  }
 }
 
 void
@@ -176,10 +184,19 @@
 void
 History::Book::clear ()
 {
+  xmlNodePtr root = NULL;
 
   while (begin () != end ())
     remove_contact (*begin ());
+
+  if (doc != NULL)
+    xmlFreeDoc (doc);
+  doc = xmlNewDoc (BAD_CAST "1.0");
+  root = xmlNewDocNode (doc, NULL, BAD_CAST "list", NULL);
+  xmlDocSetRootElement (doc, root);
+
   save ();
+  cleared.emit ();
 }
 
 void

Modified: trunk/lib/engine/addressbook/call-history/history-book.h
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-book.h	(original)
+++ trunk/lib/engine/addressbook/call-history/history-book.h	Thu Apr  3 13:30:31 2008
@@ -82,6 +82,8 @@
 
     void clear ();
 
+    sigc::signal<void> cleared;
+
   private:
 
     void parse_entry (xmlNodePtr entry);

Modified: trunk/lib/engine/addressbook/call-history/history-contact.cpp
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-contact.cpp	(original)
+++ trunk/lib/engine/addressbook/call-history/history-contact.cpp	Thu Apr  3 13:30:31 2008
@@ -34,6 +34,7 @@
  */
 
 #include <iostream>
+#include <glib.h>
 
 #include "history-contact.h"
 
@@ -48,7 +49,7 @@
 
   xml_str = xmlGetProp (node, (const xmlChar *)"type");
   if (xml_str != NULL)
-    groups.insert ((const char *)xml_str);
+    m_type = (call_type)(xml_str[0] - '0'); // FIXME: I don't like it!
   xmlFree (xml_str);
 
   xml_str = xmlGetProp (node, (const xmlChar *)"uri");
@@ -87,7 +88,7 @@
 			   const std::string _uri,
 			   const std::string _status,
 			   call_type c_t):
-  core(_core), name(_name), uri(_uri), status(_status)
+  core(_core), name(_name), uri(_uri), status(_status), m_type(c_t)
 {
   contact_core
     = dynamic_cast<Ekiga::ContactCore*>(core.get ("contact-core"));
@@ -100,26 +101,11 @@
   xmlNewChild (node, NULL,
 	       BAD_CAST "status", BAD_CAST status.c_str ());
 
-  switch (c_t) {
-
-  case RECEIVED:
-
-    xmlSetProp (node, BAD_CAST "type", BAD_CAST "Received");
-    groups.insert ("Received");
-    break;
-  case PLACED:
-
-    groups.insert ("Placed");
-    break;
-  case MISSED:
-
-    groups.insert ("Missed");
-    break;
-
-  default:
-
-    break;
-  }
+  /* FIXME: I don't like the way it's done */
+  gchar *type_string = NULL;
+  type_string = g_strdup_printf ("%d", m_type);
+  xmlSetProp (node, BAD_CAST "type", BAD_CAST type_string);
+  g_free (type_string);
 }
 
 History::Contact::~Contact ()
@@ -138,6 +124,23 @@
 const std::set<std::string>
 History::Contact::get_groups () const
 {
+  std::set<std::string> groups;
+
+  switch (m_type) {
+  case RECEIVED:
+    groups.insert ("Received"); // FIXME: translate
+    break;
+  case PLACED:
+    groups.insert ("Placed"); // FIXME: translate
+    break;
+  case MISSED:
+    groups.insert ("Missed"); // FIXME: translate
+    break;
+
+  default:
+    groups.insert ("AIE!!");
+  }
+
   return groups;
 }
 
@@ -153,6 +156,18 @@
   return node;
 }
 
+History::call_type
+History::Contact::get_type () const
+{
+  return m_type;
+}
+
+const std::string
+History::Contact::get_status () const
+{
+  return status;
+}
+
 const std::map<std::string,std::string>
 History::Contact::get_uris () const
 {

Modified: trunk/lib/engine/addressbook/call-history/history-contact.h
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-contact.h	(original)
+++ trunk/lib/engine/addressbook/call-history/history-contact.h	Thu Apr  3 13:30:31 2008
@@ -80,13 +80,17 @@
 
     bool populate_menu (Ekiga::MenuBuilder &builder);
 
+    const std::map<std::string,std::string> get_uris () const;
+
+    bool is_found (std::string test) const;
+
     /* more specific api */
 
     xmlNodePtr get_node ();
 
-    const std::map<std::string,std::string> get_uris () const;
+    call_type get_type () const;
 
-    bool is_found (std::string test) const;
+    const std::string get_status () const;
 
   private:
 
@@ -97,7 +101,7 @@
     std::string name;
     std::string uri;
     std::string status;
-    std::set<std::string> groups;
+    call_type m_type;
   };
 
 /**

Modified: trunk/lib/engine/addressbook/call-history/history-source.cpp
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-source.cpp	(original)
+++ trunk/lib/engine/addressbook/call-history/history-source.cpp	Thu Apr  3 13:30:31 2008
@@ -65,3 +65,9 @@
    */
   return false;
 }
+
+History::Book*
+History::Source::get_book () const
+{
+  return book;
+}

Modified: trunk/lib/engine/addressbook/call-history/history-source.h
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-source.h	(original)
+++ trunk/lib/engine/addressbook/call-history/history-source.h	Thu Apr  3 13:30:31 2008
@@ -70,6 +70,8 @@
 
     const std::set<std::string> existing_groups () const;
 
+    Book *get_book () const;
+
   private:
 
     Ekiga::ServiceCore &core;

Modified: trunk/lib/engine/gui/gtk-frontend/Makefile.am
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/Makefile.am	(original)
+++ trunk/lib/engine/gui/gtk-frontend/Makefile.am	Thu Apr  3 13:30:31 2008
@@ -2,7 +2,7 @@
 
 gtk_frontend_dir = $(top_srcdir)/lib/engine/gui/gtk-frontend
 
-AM_CPPFLAGS = $(SIGC_CFLAGS) $(GTK_CFLAGS)
+AM_CPPFLAGS = $(XML_CFLAGS) $(SIGC_CFLAGS) $(GTK_CFLAGS)
 
 INCLUDES = \
 	-I$(top_srcdir)/lib/gui \
@@ -11,6 +11,7 @@
 	-I$(top_srcdir)/lib/engine/presence/skel \
 	-I$(top_srcdir)/lib/engine/protocol/skel \
 	-I$(top_srcdir)/lib/engine/addressbook/skel \
+	-I$(top_srcdir)/lib/engine/addressbook/call-history \
 	-I$(top_srcdir)/lib/engine/gui/gtk-core 
 
 libgmgtk_frontend_la_SOURCES = \
@@ -20,6 +21,8 @@
 	$(gtk_frontend_dir)/book-view-gtk.cpp \
 	$(gtk_frontend_dir)/roster-view-gtk.h \
 	$(gtk_frontend_dir)/roster-view-gtk.cpp \
+	$(gtk_frontend_dir)/call-history-view-gtk.h \
+	$(gtk_frontend_dir)/call-history-view-gtk.cpp \
 	$(gtk_frontend_dir)/chat-window.h \
 	$(gtk_frontend_dir)/chat-window.cpp \
 	$(gtk_frontend_dir)/chat-window-page.h \

Added: trunk/lib/engine/gui/gtk-frontend/call-history-view-gtk.cpp
==============================================================================
--- (empty file)
+++ trunk/lib/engine/gui/gtk-frontend/call-history-view-gtk.cpp	Thu Apr  3 13:30:31 2008
@@ -0,0 +1,229 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 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.
+ */
+
+
+/*
+ *                         call-history-view-gtk.h  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2008 by Julien Puydt
+ *   copyright            : (c) 2008 by Julien Puydt
+ *   description          : implementation of a call history view widget
+ *
+ */
+
+#include "call-history-view-gtk.h"
+
+#include "menu-builder-gtk.h"
+#include "gm-cell-renderer-bitext.h"
+#include "gmstockicons.h"
+
+enum {
+  COLUMN_CONTACT,
+  COLUMN_PIXBUF,
+  COLUMN_NAME,
+  COLUMN_STATUS,
+  COLUMN_NUMBER
+};
+
+
+/* make sure we stop watching signals when the widget gets destroyed */
+static void
+destroy_connections (gpointer data,
+		     GObject */*unused*/)
+{
+  std::list<sigc::connection> *conns
+    = (std::list<sigc::connection> *)data;
+
+  delete conns;
+}
+
+/* react to a new call being inserted in history */
+static void
+on_contact_added (Ekiga::Contact &contact,
+		  GtkListStore *store)
+{
+  History::Contact *hcontact = NULL;
+  GtkTreeIter iter;
+  const gchar *id = NULL;
+
+  hcontact = dynamic_cast<History::Contact*>(&contact);
+
+  if (hcontact != NULL) {
+
+    switch (hcontact->get_type ()) {
+
+    case History::RECEIVED:
+
+      id = GM_STOCK_CALL_RECEIVED;
+      break;
+
+    case History::PLACED:
+
+      id = GM_STOCK_CALL_PLACED;
+      break;
+
+    case History::MISSED:
+
+      id = GM_STOCK_CALL_MISSED;
+      break;
+
+    default:
+      id = GTK_STOCK_MISSING_IMAGE;
+    }
+
+  }
+
+  gtk_list_store_prepend (store, &iter);
+  gtk_list_store_set (store, &iter,
+		      COLUMN_CONTACT, &contact,
+		      COLUMN_PIXBUF, id,
+		      COLUMN_NAME, contact.get_name ().c_str (),
+		      COLUMN_STATUS, hcontact->get_status ().c_str (),
+		      -1);
+}
+
+/* react to user clicks */
+static gint
+on_clicked (GtkWidget *tree,
+	    GdkEventButton *event,
+	    gpointer data)
+{
+  History::Book *book = NULL;
+  GtkTreeModel *model = NULL;
+  GtkTreePath *path = NULL;
+  GtkTreeIter iter;
+  Ekiga::Contact *contact = NULL;
+
+  book = (History::Book*)data;
+  model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree));
+
+  if (event->type == GDK_BUTTON_PRESS || event->type == GDK_KEY_PRESS) {
+
+    if (event->button == 3) {
+
+      MenuBuilderGtk builder;
+      if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tree),
+					 (gint) event->x, (gint) event->y,
+					 &path, NULL, NULL, NULL)) {
+
+	if (gtk_tree_model_get_iter (model, &iter, path)) {
+
+	  gtk_tree_model_get (model, &iter,
+			      COLUMN_CONTACT, &contact,
+			      -1);
+
+	  if (contact != NULL)
+	    contact->populate_menu (builder);
+	}
+      }
+      if (!builder.empty())
+	builder.add_separator ();
+      builder.add_action ("FIXME", "clear history", // FIXME: translate
+			  sigc::mem_fun (book, &History::Book::clear));
+      gtk_widget_show_all (builder.menu);
+      gtk_menu_popup (GTK_MENU (builder.menu), NULL, NULL,
+		      NULL, NULL, event->button, event->time);
+      g_signal_connect (G_OBJECT (builder.menu), "hide",
+			GTK_SIGNAL_FUNC (g_object_unref),
+			(gpointer) builder.menu);
+      g_object_ref_sink (G_OBJECT (builder.menu));
+
+    }
+  }
+  return TRUE;
+}
+
+/* public api */
+
+GtkWidget *
+call_history_view_gtk_new (History::Book &book)
+{
+  GtkWidget *result = NULL;
+  std::list<sigc::connection> *conns = NULL;
+  GtkListStore *store = NULL;
+  GtkWidget *tree = NULL;
+  GtkTreeViewColumn *column = NULL;
+  GtkCellRenderer *renderer = NULL;
+  GtkTreeSelection *selection = NULL;
+  sigc::connection connection;
+
+  result = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (result),
+				  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+  /* we don't leak conns : it will be freed when we die... and it will
+   * prevent the signals to come to a now-dead GObject
+   */
+  conns = new std::list<sigc::connection>;
+  g_object_weak_ref (G_OBJECT (result), destroy_connections, (gpointer)conns);
+
+  /* build the store then the tree */
+  store = gtk_list_store_new (COLUMN_NUMBER,
+			      G_TYPE_POINTER,
+			      G_TYPE_STRING,
+			      G_TYPE_STRING,
+			      G_TYPE_STRING);
+
+  tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
+  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree), FALSE);
+  gtk_container_add (GTK_CONTAINER (result), tree);
+
+  /* one column should be enough for everyone */
+  column = gtk_tree_view_column_new ();
+
+  /* show icon */
+  renderer = gtk_cell_renderer_pixbuf_new ();
+  gtk_tree_view_column_pack_start (column, renderer, FALSE);
+  gtk_tree_view_column_add_attribute (column, renderer,
+				      "stock-id", COLUMN_PIXBUF);
+
+  /* show name and text */
+  renderer = gm_cell_renderer_bitext_new ();
+  gtk_tree_view_column_pack_start (column, renderer, FALSE);
+  gtk_tree_view_column_add_attribute (column, renderer,
+				      "primary-text", COLUMN_NAME);
+  gtk_tree_view_column_add_attribute (column, renderer,
+				      "secondary-text", COLUMN_STATUS);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
+
+  /* react to user clicks */
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
+  gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
+  g_signal_connect (G_OBJECT (tree), "event-after",
+		    G_CALLBACK (on_clicked), &book);
+
+  /* connect to the signals */
+  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));
+  conns->push_front (connection);
+
+  /* populate */
+  book.visit_contacts (sigc::bind_return(sigc::bind (sigc::ptr_fun (on_contact_added), store), true));
+
+  return result;
+}

Copied: trunk/lib/engine/gui/gtk-frontend/call-history-view-gtk.h (from r6114, /trunk/lib/engine/gui/gtk-frontend/gtk-frontend.h)
==============================================================================
--- /trunk/lib/engine/gui/gtk-frontend/gtk-frontend.h	(original)
+++ trunk/lib/engine/gui/gtk-frontend/call-history-view-gtk.h	Thu Apr  3 13:30:31 2008
@@ -1,6 +1,6 @@
 
 /* Ekiga -- A VoIP and Video-Conferencing application
- * Copyright (C) 2000-2007 Damien Sandras
+ * Copyright (C) 2000-2008 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
@@ -27,60 +27,20 @@
 
 
 /*
- *                         gtk-frontend.h  -  description
+ *                         call-history-view-gtk.h  -  description
  *                         ------------------------------------------
- *   begin                : written in 2007 by Julien Puydt
- *   copyright            : (c) 2007 by Julien Puydt
- *   description          : code to hook a gtk+ user interface to
- *                          the main program
+ *   begin                : written in 2008 by Julien Puydt
+ *   copyright            : (c) 2008 by Julien Puydt
+ *   description          : declaration of a call history view widget
  *
  */
 
-#ifndef __GTK_FRONTEND_H__
-#define __GTK_FRONTEND_H__
+#ifndef __CALL_HISTORY_VIEW_GTK_H__
+#define __CALL_HISTORY_VIEW_GTK_H__
 
 #include <gtk/gtk.h>
-#include <vector>
+#include "history-book.h"
 
-#include "services.h"
-#include "contact-core.h"
-#include "presence-core.h"
-#include "call-manager.h"
-
-
-class GtkFrontend: public Ekiga::Service
-{
-public:
-
-    GtkFrontend (Ekiga::ServiceCore & _core);
-
-    ~GtkFrontend ();
-
-    const std::string get_name () const;
-
-    const std::string get_description () const;
-
-    const GtkWidget *get_roster_view () const;
-
-    const GtkWidget *get_addressbook_window () const;
-
-    const GtkWidget *get_chat_window () const;
-
-private :
-    void on_new_chat (Ekiga::CallManager & manager,
-                      std::string name,
-                      std::string uri);
-
-    GtkWidget *addressbook_window;
-    GtkWidget *roster_view;
-    GtkWidget *chat_window;
-
-    std::vector<sigc::connection> connections;
-};
-
-
-bool gtk_frontend_init (Ekiga::ServiceCore &core,
-			int *argc,
-			char **argv[]);
+GtkWidget *call_history_view_gtk_new (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 Apr  3 13:30:31 2008
@@ -50,6 +50,9 @@
 #include "addressbook-window.h"
 #include "chat-window.h"
 #include "roster-view-gtk.h"
+#include "history-source.h"
+#include "book-view-gtk.h"
+#include "call-history-view-gtk.h"
 
 #include "gmwindow.h"
 
@@ -61,12 +64,17 @@
   Ekiga::PresenceCore *presence_core = NULL;
   Ekiga::ContactCore *contact_core = NULL;
   Ekiga::CallCore *call_core = NULL;
+  History::Source *history_source = NULL;
+  History::Book *history_book = NULL;
 
   contact_core = dynamic_cast<Ekiga::ContactCore *>(core.get ("contact-core"));
   presence_core = dynamic_cast<Ekiga::PresenceCore *>(core.get ("presence-core"));
   call_core = dynamic_cast<Ekiga::CallCore *>(core.get ("call-core"));
+  history_source = dynamic_cast<History::Source*>(core.get ("call-history-store"));
+  history_book = history_source->get_book ();
 
   roster_view = roster_view_gtk_new (*presence_core);
+  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 = 
@@ -116,6 +124,13 @@
 }
 
 
+const GtkWidget *
+GtkFrontend::get_call_history_view () const
+{ 
+  return call_history_view;
+}
+
+
 void GtkFrontend::on_new_chat (Ekiga::CallManager & /*manager*/,
                                std::string name,
                                std::string uri)

Modified: trunk/lib/engine/gui/gtk-frontend/gtk-frontend.h
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/gtk-frontend.h	(original)
+++ trunk/lib/engine/gui/gtk-frontend/gtk-frontend.h	Thu Apr  3 13:30:31 2008
@@ -62,6 +62,8 @@
 
     const GtkWidget *get_roster_view () const;
 
+  const GtkWidget *get_call_history_view () const;
+
     const GtkWidget *get_addressbook_window () const;
 
     const GtkWidget *get_chat_window () const;
@@ -73,6 +75,7 @@
 
     GtkWidget *addressbook_window;
     GtkWidget *roster_view;
+  GtkWidget *call_history_view;
     GtkWidget *chat_window;
 
     std::vector<sigc::connection> connections;

Modified: trunk/src/gui/main.cpp
==============================================================================
--- trunk/src/gui/main.cpp	(original)
+++ trunk/src/gui/main.cpp	Thu Apr  3 13:30:31 2008
@@ -275,6 +275,13 @@
 static void gm_mw_init_call (GtkWidget *);
 
 
+/* DESCRIPTION  : /
+ * BEHAVIOR     : Builds the call history part of the main window.
+ * PRE          : The given GtkWidget pointer must be the main window GMObject. 
+ */
+static void gm_mw_init_history (GtkWidget *);
+
+
 /* DESCRIPTION  :  /
  * BEHAVIOR     :  enables/disables the zoom related menuitems according
  *                 to zoom factor
@@ -2084,6 +2091,27 @@
   gtk_paned_pack2 (GTK_PANED (mw->hpaned), frame, true, true);
 }  
 
+static void
+gm_mw_init_history (GtkWidget *main_window)
+{
+  GmMainWindow *mw = NULL;
+  Ekiga::ServiceCore *services = NULL;
+  GtkWidget *label = NULL;
+  GtkFrontend *gtk_frontend = NULL;
+
+  g_return_if_fail (main_window != NULL);
+  mw = gm_mw_get_mw (main_window);
+
+  services = GnomeMeeting::Process ()->GetServiceCore ();
+  g_return_if_fail (services != NULL);
+
+  gtk_frontend = dynamic_cast<GtkFrontend *>(services->get ("gtk-frontend"));
+
+  label = gtk_label_new (_("Call history"));
+  gtk_notebook_append_page (GTK_NOTEBOOK (mw->main_notebook),
+			    GTK_WIDGET (gtk_frontend->get_call_history_view ()),
+			    label);
+}
 
 void
 gm_mw_zooms_menu_update_sensitivity (GtkWidget *main_window,
@@ -3700,6 +3728,7 @@
   gtk_widget_set_size_request (mw->main_notebook, 200, -1);
 
   gm_mw_init_call (window);
+  gm_mw_init_history (window);
 
   section = (PanelSection) 
     gm_conf_get_int (USER_INTERFACE_KEY "main_window/panel_section");



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