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



Author: dsandras
Date: Mon Apr 14 20:26:40 2008
New Revision: 6196
URL: http://svn.gnome.org/viewvc/ekiga?rev=6196&view=rev

Log:
Added various guards against insane values. Fixed XML reading and
writing. Possibly fixed #527936 too.


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/gui/gtk-frontend/call-history-view-gtk.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	Mon Apr 14 20:26:40 2008
@@ -116,7 +116,7 @@
 void
 History::Book::add (const std::string & name,
 		    const std::string & uri,
-                    const time_t call_start,
+                    const time_t & call_start,
                     const std::string & call_duration,
 		    const call_type c_t)
 {
@@ -146,6 +146,7 @@
 bool
 History::Book::populate_menu (Ekiga::MenuBuilder &builder)
 {
+  std::cout << "populate_menu" << std::endl << std::flush;
   builder.add_action ("clear",
 		      "Clear", sigc::mem_fun (this,
 					      &History::Book::clear));

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	Mon Apr 14 20:26:40 2008
@@ -77,7 +77,7 @@
 
     void add (const std::string & name,
               const std::string & uri,
-              const time_t call_start,
+              const time_t & call_start,
               const std::string & call_duration,
               const call_type c_t);
 

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	Mon Apr 14 20:26:40 2008
@@ -85,7 +85,7 @@
 
         xml_str = xmlNodeGetContent (child);
 	if (xml_str != NULL)
-	  call_duration = (unsigned) atoi ((const char *) xml_str);
+	  call_duration = (const char *) xml_str;
         xmlFree (xml_str);
       }
     }
@@ -101,6 +101,7 @@
 			   call_type c_t):
   core(_core), name(_name), uri(_uri), call_start(_call_start), call_duration(_call_duration), m_type(c_t)
 {
+  gchar *tmp = NULL;
   std::string callp;
   contact_core
     = dynamic_cast<Ekiga::ContactCore*>(core.get ("contact-core"));
@@ -111,15 +112,15 @@
   xmlNewChild (node, NULL,
 	       BAD_CAST "name", BAD_CAST name.c_str ());
 
-  callp = call_start;
+  tmp = g_strdup_printf ("%lu", call_start);
   xmlNewChild (node, NULL,
-	       BAD_CAST "call_start", BAD_CAST callp.c_str ());
-  callp = call_duration;
+	       BAD_CAST "call_start", BAD_CAST tmp);
+  g_free (tmp);
+
   xmlNewChild (node, NULL,
-	       BAD_CAST "call_duration", BAD_CAST callp.c_str ());
+	       BAD_CAST "call_duration", BAD_CAST call_duration.c_str ());
 
   /* FIXME: I don't like the way it's done */
-  gchar *tmp = NULL;
   tmp = g_strdup_printf ("%d", m_type);
   xmlSetProp (node, BAD_CAST "type", BAD_CAST tmp);
   g_free (tmp);

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	Mon Apr 14 20:26:40 2008
@@ -49,7 +49,7 @@
   COLUMN_CONTACT,
   COLUMN_PIXBUF,
   COLUMN_NAME,
-  COLUMN_STATUS,
+  COLUMN_INFO,
   COLUMN_NUMBER
 };
 
@@ -107,16 +107,19 @@
 
   t = hcontact->get_call_start ();
   timeinfo = localtime (&t);
-  strftime (buffer, 80, "%x %X", timeinfo);
-
-  info << buffer << " (" << hcontact->get_call_duration () << ")";
+  if (timeinfo != NULL) {
+    strftime (buffer, 80, "%x %X", timeinfo);
+    info << buffer << " (" << hcontact->get_call_duration () << ")";
+  }
+  else
+    info << hcontact->get_call_duration ();
 
   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, info.str ().c_str (),
+		      COLUMN_INFO, info.str ().c_str (),
 		      -1);
 }
 
@@ -221,7 +224,7 @@
   gtk_tree_view_column_add_attribute (column, renderer,
 				      "primary-text", COLUMN_NAME);
   gtk_tree_view_column_add_attribute (column, renderer,
-				      "secondary-text", COLUMN_STATUS);
+				      "secondary-text", COLUMN_INFO);
   gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
 
   /* react to user clicks */



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