From 9bb33db2e20f5a00793e55cedeb23fc6f58d156a Mon Sep 17 00:00:00 2001
From: Julien Bonjean <julien@bonjean.info>
Date: Tue, 3 Mar 2009 14:38:01 -0500
Subject: [PATCH] First development release

---
 .gitignore                                    |   2 +
 sflphone-gtk/.cproject                        | 229 +++++++++++++
 sflphone-gtk/.project                         |  77 +++++
 .../.settings/org.eclipse.cdt.core.prefs      | 148 +++++++++
 .../.settings/org.eclipse.cdt.ui.prefs        |   4 +
 .../org.eclipse.ltk.core.refactoring.prefs    |   3 +
 sflphone-gtk/configure.ac                     |   1 +
 sflphone-gtk/src/Makefile.am                  |  11 +-
 sflphone-gtk/src/actions.c                    | 171 +++++-----
 sflphone-gtk/src/calllist.c                   |  42 +--
 sflphone-gtk/src/calllist.h                   |  66 ++--
 sflphone-gtk/src/calltab.c                    |   9 +-
 sflphone-gtk/src/calltab.h                    |   8 +-
 sflphone-gtk/src/calltree.c                   | 310 +++++++++++++-----
 sflphone-gtk/src/calltree.h                   |  24 +-
 sflphone-gtk/src/contactlist/Makefile.am      |   8 +
 sflphone-gtk/src/contactlist/TODO             |   5 +
 sflphone-gtk/src/contactlist/eds.c            | 194 +++++++++++
 sflphone-gtk/src/contactlist/eds.h            |  48 +++
 sflphone-gtk/src/historyfilter.c              |  28 +-
 sflphone-gtk/src/mainwindow.c                 |  55 ++--
 sflphone-gtk/src/menus.c                      | 181 +++++-----
 22 files changed, 1260 insertions(+), 364 deletions(-)
 create mode 100644 sflphone-gtk/.cproject
 create mode 100644 sflphone-gtk/.project
 create mode 100644 sflphone-gtk/.settings/org.eclipse.cdt.core.prefs
 create mode 100644 sflphone-gtk/.settings/org.eclipse.cdt.ui.prefs
 create mode 100644 sflphone-gtk/.settings/org.eclipse.ltk.core.refactoring.prefs
 create mode 100644 sflphone-gtk/src/contactlist/Makefile.am
 create mode 100644 sflphone-gtk/src/contactlist/TODO
 create mode 100644 sflphone-gtk/src/contactlist/eds.c
 create mode 100644 sflphone-gtk/src/contactlist/eds.h

diff --git a/.gitignore b/.gitignore
index ef4892e797..1525a6ecc1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@
 *.Plo
 *.loT
 *.m4
+*.Tpo
 Makefile.in
 *.spec
 /config.*
@@ -82,6 +83,7 @@ libs/utilspp/functor/Makefile
 libs/utilspp/singleton/Makefile
 sflphone-gtk/Makefile
 sflphone-gtk/src/Makefile
+sflphone-gtk/src/contactlist/Makefile
 sflphone-gtk/pixmaps/Makefile
 
 
diff --git a/sflphone-gtk/.cproject b/sflphone-gtk/.cproject
new file mode 100644
index 0000000000..0164b0a62c
--- /dev/null
+++ b/sflphone-gtk/.cproject
@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="cdt.managedbuild.toolchain.gnu.base.666814495">
+<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.base.666814495" moduleId="org.eclipse.cdt.core.settings" name="Linux GCC">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+<configuration artifactName="sflphone-gtk" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.base.666814495" name="Linux GCC" parent="org.eclipse.cdt.build.core.emptycfg">
+<folderInfo id="cdt.managedbuild.toolchain.gnu.base.666814495.1839755914" name="/" resourcePath="">
+<toolChain id="cdt.managedbuild.toolchain.gnu.base.1195789621" name="cdt.managedbuild.toolchain.gnu.base" superClass="cdt.managedbuild.toolchain.gnu.base">
+<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.1493285969" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
+<builder id="cdt.managedbuild.target.gnu.builder.base.421214348" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.base"/>
+<tool id="cdt.managedbuild.tool.gnu.archiver.base.1558364998" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.731757910" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base"/>
+<tool id="cdt.managedbuild.tool.gnu.c.compiler.base.1299938473" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base">
+<option id="gnu.c.compiler.option.include.paths.1303328171" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+<listOptionValue builtIn="false" value="&quot;${workspace_loc:/sflphone-gtk}&quot;"/>
+<listOptionValue builtIn="false" value="&quot;${workspace_loc:/sflphone-gtk/src}&quot;"/>
+<listOptionValue builtIn="false" value="/usr/include/gtk-2.0"/>
+<listOptionValue builtIn="false" value="/usr/include/glib-2.0"/>
+<listOptionValue builtIn="false" value="/usr/include/dbus-1.0"/>
+</option>
+<option id="gnu.c.compiler.option.preprocessor.def.symbols.1676995808" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+<listOptionValue builtIn="false" value="&quot;ICONS_DIR=&quot;/usr/share/sflphone\&quot;"/>
+<listOptionValue builtIn="false" value="&quot;CODECS_DIR=&quot;/usr/lib/sflphone/codecs\&quot;"/>
+</option>
+<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1938301835" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+</tool>
+<tool id="cdt.managedbuild.tool.gnu.c.linker.base.981882139" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base">
+<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1274984809" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+<additionalInput kind="additionalinput" paths="$(LIBS)"/>
+</inputType>
+</tool>
+<tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.963771621" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"/>
+<tool id="cdt.managedbuild.tool.gnu.assembler.base.1924201184" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base">
+<option id="gnu.both.asm.option.include.paths.1513412733" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"/>
+<inputType id="cdt.managedbuild.tool.gnu.assembler.input.938125330" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+</tool>
+</toolChain>
+</folderInfo>
+</configuration>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
+<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
+
+<storageModule moduleId="scannerConfiguration">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.base.666814495;cdt.managedbuild.toolchain.gnu.base.666814495.1839755914;cdt.managedbuild.tool.gnu.c.compiler.base.1299938473;cdt.managedbuild.tool.gnu.c.compiler.input.1938301835">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+</scannerConfigBuildInfo>
+</storageModule>
+</cconfiguration>
+</storageModule>
+<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+<project id="sflphone-gtk.null.1710073778" name="sflphone-gtk"/>
+</storageModule>
+</cproject>
diff --git a/sflphone-gtk/.project b/sflphone-gtk/.project
new file mode 100644
index 0000000000..8c74f4d116
--- /dev/null
+++ b/sflphone-gtk/.project
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>sflphone-gtk</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+			<triggers>clean,full,incremental,</triggers>
+			<arguments>
+				<dictionary>
+					<key>?name?</key>
+					<value></value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.append_environment</key>
+					<value>true</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
+					<value>all</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.buildArguments</key>
+					<value></value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.buildCommand</key>
+					<value>make</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
+					<value>clean</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.contents</key>
+					<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
+					<value>false</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
+					<value>true</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.enableFullBuild</key>
+					<value>true</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
+					<value>all</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.stopOnError</key>
+					<value>true</value>
+				</dictionary>
+				<dictionary>
+					<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
+					<value>true</value>
+				</dictionary>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+		<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+		<nature>org.eclipse.cdt.core.cnature</nature>
+	</natures>
+</projectDescription>
diff --git a/sflphone-gtk/.settings/org.eclipse.cdt.core.prefs b/sflphone-gtk/.settings/org.eclipse.cdt.core.prefs
new file mode 100644
index 0000000000..55576b0f05
--- /dev/null
+++ b/sflphone-gtk/.settings/org.eclipse.cdt.core.prefs
@@ -0,0 +1,148 @@
+#Thu Feb 26 16:02:29 EST 2009
+eclipse.preferences.version=1
+org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
+org.eclipse.cdt.core.formatter.alignment_for_compact_if=0
+org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
+org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
+org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
+org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.cdt.core.formatter.compact_else_if=true
+org.eclipse.cdt.core.formatter.continuation_indentation=2
+org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
+org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
+org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false
+org.eclipse.cdt.core.formatter.indent_empty_lines=false
+org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.cdt.core.formatter.indentation.size=2
+org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert
+org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.cdt.core.formatter.lineSplit=80
+org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.cdt.core.formatter.tabulation.char=space
+org.eclipse.cdt.core.formatter.tabulation.size=2
+org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/sflphone-gtk/.settings/org.eclipse.cdt.ui.prefs b/sflphone-gtk/.settings/org.eclipse.cdt.ui.prefs
new file mode 100644
index 0000000000..6a9c16b18b
--- /dev/null
+++ b/sflphone-gtk/.settings/org.eclipse.cdt.ui.prefs
@@ -0,0 +1,4 @@
+#Thu Feb 26 16:02:29 EST 2009
+eclipse.preferences.version=1
+formatter_profile=_SFLPhone
+formatter_settings_version=1
diff --git a/sflphone-gtk/.settings/org.eclipse.ltk.core.refactoring.prefs b/sflphone-gtk/.settings/org.eclipse.ltk.core.refactoring.prefs
new file mode 100644
index 0000000000..15e25eb7b9
--- /dev/null
+++ b/sflphone-gtk/.settings/org.eclipse.ltk.core.refactoring.prefs
@@ -0,0 +1,3 @@
+#Thu Feb 26 15:43:10 EST 2009
+eclipse.preferences.version=1
+org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
diff --git a/sflphone-gtk/configure.ac b/sflphone-gtk/configure.ac
index e58ac42b26..1210e83265 100644
--- a/sflphone-gtk/configure.ac
+++ b/sflphone-gtk/configure.ac
@@ -42,6 +42,7 @@ AC_SUBST(DEPS_LIBS)
 AC_OUTPUT([
 Makefile 
 src/Makefile 
+src/contactlist/Makefile
 pixmaps/Makefile
 sflphone.desktop
 ])
diff --git a/sflphone-gtk/src/Makefile.am b/sflphone-gtk/src/Makefile.am
index e7b56542cc..ae05598de2 100644
--- a/sflphone-gtk/src/Makefile.am
+++ b/sflphone-gtk/src/Makefile.am
@@ -1,5 +1,9 @@
 bin_PROGRAMS = sflphone-gtk
 
+SUBDIRS=contactlist
+  
+# noinst_LTLIBRARIES = libsflphonegtk.la
+
 NOFIFY_LIBS=-lnotify
 SEXY_LIBS=-lsexy
 
@@ -35,13 +39,16 @@ sflphone_gtk_SOURCES = \
   codeclist.c \
   timestamp.c \
   reqaccount.c
-  
+
 noinst_HEADERS =  actions.h dbus.h sflnotify.h mainwindow.h calllist.h dialpad.h audioconf.h codeclist.h assistant.h \
                   callmanager-glue.h errors.h sflphone_const.h configurationmanager-glue.h instance-glue.h menus.h calltab.h calltree.h configwindow.h \
                   accountlist.h accountwindow.h marshaller.h sliders.h $(STATUSICON_HEADER) timestamp.h historyfilter.c reqaccount.h
 
 EXTRA_DIST   = marshaller.list  
-sflphone_gtk_LDADD = $(DEPS_LIBS) $(NOTIFY_LIBS) $(SEXY_LIBS)
+
+sflphone_gtk_LDADD = $(DEPS_LIBS) $(NOTIFY_LIBS) $(SEXY_LIBS) \
+			./contactlist/libcontact.la
+
 
 AM_CPPFLAGS = $(DEPS_CFLAGS) \
               -DICONS_DIR=\""$(prefix)/share/sflphone"\" \
diff --git a/sflphone-gtk/src/actions.c b/sflphone-gtk/src/actions.c
index 6d6bbe50b0..a08180c7a7 100644
--- a/sflphone-gtk/src/actions.c
+++ b/sflphone-gtk/src/actions.c
@@ -2,17 +2,17 @@
  *  Copyright (C) 2007 - 2008 Savoir-Faire Linux inc.
  *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
  *  Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
- *                                                                              
+ *
  *  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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -26,6 +26,7 @@
 #include <statusicon.h>
 #include <calltab.h>
 #include <historyfilter.h>
+#include <contactlist/eds.h>
 
 #include <gtk/gtk.h>
 #include <string.h>
@@ -41,7 +42,7 @@ sflphone_notify_voice_mail ( const gchar* accountID , guint count )
 {
     gchar *id;
     gchar *current;
-    
+
     // We want to notify only for the default current account; ie the first in the list
     id = g_strdup( accountID );
     current = account_list_get_current_id();
@@ -56,17 +57,17 @@ sflphone_notify_voice_mail ( const gchar* accountID , guint count )
         if( count > 1)
             g_sprintf(message, _("%d voice mails"), count);
         else
-            g_sprintf(message, _("%d voice mail"), count);	  
+            g_sprintf(message, _("%d voice mail"), count);
         statusbar_push_message(message,  __MSG_VOICE_MAILS);
         g_free(message);
     }
-	
+
     // TODO: add ifdef
     if( account_list_get_size() > 0 )
     {
         account_t* acc = account_list_get_by_id( id );
 	if( acc != NULL )
-            notify_voice_mails( count , acc );	
+            notify_voice_mails( count , acc );
     }
 }
 
@@ -77,14 +78,14 @@ status_bar_display_account( call_t* c)
     account_t* acc;
     if(c->accountID != NULL){
       acc = account_list_get_by_id(c->accountID);
-      msg = g_markup_printf_escaped(_("%s account- %s") , 
-				  (gchar*)g_hash_table_lookup( acc->properties , ACCOUNT_TYPE), 
+      msg = g_markup_printf_escaped(_("%s account- %s") ,
+				  (gchar*)g_hash_table_lookup( acc->properties , ACCOUNT_TYPE),
 				  (gchar*)g_hash_table_lookup( acc->properties , ACCOUNT_ALIAS));
       statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT);
       g_free(msg);
   }
 }
-  
+
 
 gboolean
 sflphone_quit ()
@@ -109,7 +110,7 @@ sflphone_quit ()
 	return quit;
 }
 
-void 
+void
 sflphone_hold(call_t * c )
 {
 	c->state = CALL_STATE_HOLD;
@@ -117,7 +118,7 @@ sflphone_hold(call_t * c )
 	update_menus();
 }
 
-void 
+void
 sflphone_ringing(call_t * c )
 {
 	c->state = CALL_STATE_RINGING;
@@ -206,7 +207,7 @@ sflphone_fill_account_list(gboolean toolbarInitialized)
 		else if(strcmp( status , "ERROR_EXIST_STUN") == 0 )
 		{
 		  a->state = ACCOUNT_STATE_ERROR_EXIST_STUN;
-		}	
+		}
 		else
 		{
 			a->state = ACCOUNT_STATE_INVALID;
@@ -222,18 +223,20 @@ sflphone_fill_account_list(gboolean toolbarInitialized)
 gboolean sflphone_init()
 {
 	if(!dbus_connect ()){
-	
+
 		main_window_error_message(_("Unable to connect to the SFLphone server.\nMake sure the daemon is running."));
 		return FALSE;
 	}
-	else 
+	else
 	{
 		dbus_register(getpid(), "Gtk+ Client");
-        current_calls = calltab_init();
-	    history = calltab_init();
-	    if(SHOW_SEARCHBAR)  histfilter = create_filter(GTK_TREE_MODEL(history->store));
-	    account_list_init ();
-        codec_list_init();
+    current_calls = calltab_init();
+	  history = calltab_init();
+	  contacts = calltab_init();
+	  if(SHOW_SEARCHBAR)  histfilter = create_filter(GTK_TREE_MODEL(history->store));
+	  init();
+	  account_list_init ();
+    codec_list_init();
 		sflphone_fill_account_list(FALSE);
 		sflphone_fill_codec_list();
 		sflphone_set_current_account();
@@ -241,7 +244,7 @@ gboolean sflphone_init()
 	}
 }
 
-void 
+void
 sflphone_hang_up()
 {
 	call_t * selectedCall = call_get_selected(current_calls);
@@ -270,13 +273,13 @@ sflphone_hang_up()
 				selectedCall->state = CALL_STATE_DIALING;
 				selectedCall->_stop = 0;
 				break;
-			case CALL_STATE_INCOMING:  
+			case CALL_STATE_INCOMING:
 				dbus_refuse (selectedCall);
 				selectedCall->state = CALL_STATE_DIALING;
 				selectedCall->_stop = 0;
 				g_print("from sflphone_hang_up : "); stop_notification();
 				break;
-			case CALL_STATE_TRANSFERT:  
+			case CALL_STATE_TRANSFERT:
 				dbus_hang_up (selectedCall);
 				(void) time(&selectedCall->_stop);
 				break;
@@ -289,7 +292,7 @@ sflphone_hang_up()
 }
 
 
-void 
+void
 sflphone_pick_up()
 {
 	call_t * selectedCall = call_get_selected(active_calltree);
@@ -327,7 +330,7 @@ sflphone_pick_up()
 	}
 }
 
-void 
+void
 sflphone_on_hold ()
 {
 	call_t * selectedCall = call_get_selected(current_calls);
@@ -341,7 +344,7 @@ sflphone_on_hold ()
                         case CALL_STATE_RECORD:
                                 dbus_hold (selectedCall);
                                 break;
-                                
+
 			default:
 				g_warning("Should not happen in sflphone_on_hold!");
 				break;
@@ -349,7 +352,7 @@ sflphone_on_hold ()
 	}
 }
 
-void 
+void
 sflphone_off_hold ()
 {
 	call_t * selectedCall = call_get_selected(current_calls);
@@ -368,7 +371,7 @@ sflphone_off_hold ()
 }
 
 
-void 
+void
 sflphone_fail( call_t * c )
 {
 	c->state = CALL_STATE_FAILURE;
@@ -376,7 +379,7 @@ sflphone_fail( call_t * c )
 	update_menus();
 }
 
-void 
+void
 sflphone_busy( call_t * c )
 {
 	c->state = CALL_STATE_BUSY;
@@ -384,7 +387,7 @@ sflphone_busy( call_t * c )
 	update_menus();
 }
 
-void 
+void
 sflphone_current( call_t * c )
 {
   if( c->state != CALL_STATE_HOLD )
@@ -404,7 +407,7 @@ sflphone_record( call_t * c )
   update_menus();
 }
 
-void 
+void
 sflphone_set_transfert()
 {
 	call_t * c = call_get_selected(current_calls);
@@ -418,7 +421,7 @@ sflphone_set_transfert()
 	toolbar_update_buttons();
 }
 
-void 
+void
 sflphone_unset_transfert()
 {
 	call_t * c = call_get_selected(current_calls);
@@ -433,14 +436,14 @@ sflphone_unset_transfert()
 }
 
 void
-sflphone_incoming_call (call_t * c) 
+sflphone_incoming_call (call_t * c)
 {
 	c->history_state = MISSED;
 	call_list_add ( current_calls, c );
 	call_list_add( history, c );
 	update_call_tree_add( current_calls , c );
 	update_menus();
-	if( active_calltree == history )  switch_tab();
+	switch_tab(current_calls);
 }
 
 void
@@ -468,7 +471,7 @@ process_dialing(call_t * c, guint keyval, gchar * key)
 			{  /* Brackets mandatory because of local vars */
 				gchar * before = c->to;
 				if(strlen(c->to) >= 1){
-                                        
+
 					c->to = g_strndup(c->to, strlen(c->to) -1);
 					g_free(before);
 					g_print("TO: backspace %s\n", c->to);
@@ -479,7 +482,7 @@ process_dialing(call_t * c, guint keyval, gchar * key)
 						c->from = g_strconcat("\"\" <", c->to, ">", NULL);
 					}
 					update_call_tree(current_calls,c);
-				} 
+				}
 				else if(strlen(c->to) == 0)
 				{
 				  if(c->state != CALL_STATE_TRANSFERT)
@@ -496,8 +499,8 @@ process_dialing(call_t * c, guint keyval, gchar * key)
 		default:
                   // if (keyval < 255 || (keyval >65453 && keyval < 65466))
                         if (keyval < 127)
-			{ 
-                               
+			{
+
                                 if(c->state != CALL_STATE_TRANSFERT)
 				  dbus_play_dtmf( key );
 				  gchar * before = c->to;
@@ -518,7 +521,7 @@ process_dialing(call_t * c, guint keyval, gchar * key)
 }
 
 
-call_t * 
+call_t *
 sflphone_new_call()
 {
 
@@ -533,7 +536,7 @@ sflphone_new_call()
 	c->from = g_strconcat("\"\" <>", NULL);
 
 	c->callID = g_new0(gchar, 30);
-	g_sprintf(c->callID, "%d", rand()); 
+	g_sprintf(c->callID, "%d", rand());
 
 	c->to = g_strdup("");
 
@@ -541,21 +544,38 @@ sflphone_new_call()
 	c->_stop = 0;
 
 	call_list_add(current_calls,c);
-	update_call_tree_add(current_calls,c);  
+	update_call_tree_add(current_calls,c);
 	update_menus();
 
 	return c;
 }
 
 
-void 
+void
 sflphone_keypad( guint keyval, gchar * key)
 {
-  
 	call_t * c = call_get_selected(current_calls);
-	if(c)
+
+	if((active_calltree != current_calls) || (active_calltree == current_calls && !c))
+  {
+    // Not in a call, not dialing, create a new call
+    //dbus_play_dtmf(key);
+    switch (keyval)
+    {
+      case 65293: /* ENTER */
+      case 65421: /* ENTER numpad */
+      case 65307: /* ESCAPE */
+        break;
+      default:
+        switch_tab(current_calls);
+        process_dialing(sflphone_new_call(), keyval, key);
+        break;
+    }
+  }
+  else if(c)
 	{
-		switch(c->state) 
+	  printf("call\n");
+		switch(c->state)
 		{
 			case CALL_STATE_DIALING: // Currently dialing => edit number
 				process_dialing(c, keyval, key);
@@ -569,11 +589,11 @@ sflphone_keypad( guint keyval, gchar * key)
 						(void) time(&c->_stop);
 						update_call_tree( history , c );
 						break;
-					default:  
+					default:
 						// To play the dtmf when calling mail box for instance
 						dbus_play_dtmf(key);
 						if (keyval < 255 || (keyval >65453 && keyval < 65466))
-						{ 
+						{
 							//gchar * temp = g_strconcat(call_get_number(c), key, NULL);
 							//gchar * before = c->from;
 							//c->from = g_strconcat("\"",call_get_name(c) ,"\" <", temp, ">", NULL);
@@ -609,7 +629,7 @@ sflphone_keypad( guint keyval, gchar * key)
 						(void) time(&c->_stop);
 						break;
 					case 65307: /* ESCAPE */
-						sflphone_unset_transfert(c); 
+						sflphone_unset_transfert(c);
 						break;
 					default: // When a call is on transfert, typing new numbers will add it to c->to
 						process_dialing(c, keyval, key);
@@ -646,35 +666,17 @@ sflphone_keypad( guint keyval, gchar * key)
 				break;
 			default:
 				break;
-		} 
-	}
-	else 
-	{ // Not in a call, not dialing, create a new call 
-		//dbus_play_dtmf(key);
-		switch (keyval)
-		{
-			case 65293: /* ENTER */
-			case 65421: /* ENTER numpad */
-			case 65307: /* ESCAPE */
-				break;
-			default:
-				if( active_calltree == history )
-				  switch_tab();
-				process_dialing(sflphone_new_call(), keyval, key);
-				break;
 		}
-
-
 	}
- } 
+ }
 
 /*
  * Place a call with the current account.
- * If there is no default account selected, place a call with the first 
+ * If there is no default account selected, place a call with the first
  * registered account of the account list
  * Else, popup an error message
  */
-void 
+void
 sflphone_place_call ( call_t * c )
 {
 
@@ -685,13 +687,13 @@ sflphone_place_call ( call_t * c )
             notify_no_accounts();
             sflphone_fail(c);
         }
-        
+
         else if( account_list_get_by_state( ACCOUNT_STATE_REGISTERED ) == NULL )
         {
             notify_no_registered_accounts();
             sflphone_fail(c);
         }
-    
+
         else
         {
             account_t * current;
@@ -708,7 +710,7 @@ sflphone_place_call ( call_t * c )
             if( current )
             {
 	            if(g_strcasecmp(g_hash_table_lookup( current->properties, "Status"),"REGISTERED")==0)
-	            { 
+	            {
 	                // OK, everything alright - the call is made with the current account
 	                c -> accountID = current -> accountID;
 	                status_bar_display_account(c);
@@ -716,7 +718,7 @@ sflphone_place_call ( call_t * c )
 	            }
 	            else
 	            {
-	                // Current account is not registered 
+	                // Current account is not registered
 	                // So we place a call with the first registered account
 	                // And we switch the current account
 	                current = account_list_get_by_state( ACCOUNT_STATE_REGISTERED );
@@ -729,7 +731,7 @@ sflphone_place_call ( call_t * c )
             }
             else
             {
-	            // No current accounts have been setup. 
+	            // No current accounts have been setup.
 	            // So we place a call with the first registered account
 	            // and we change the current account
 	            current = account_list_get_by_state( ACCOUNT_STATE_REGISTERED );
@@ -742,12 +744,13 @@ sflphone_place_call ( call_t * c )
         }
 	    // Update history
 	    c->history_state = OUTGOING;
+	    c->from;
 	    call_list_add(history, c);
     }
 }
 
 
-void 
+void
 sflphone_display_selected_codec (const gchar* codecName)
 {
     call_t * selectedCall = call_get_selected(current_calls);
@@ -755,8 +758,8 @@ sflphone_display_selected_codec (const gchar* codecName)
     account_t* acc;
     if(selectedCall->accountID != NULL){
       acc = account_list_get_by_id(selectedCall->accountID);
-      msg = g_markup_printf_escaped(_("%s account- %s             %s") , 
-		 (gchar*)g_hash_table_lookup( acc->properties , ACCOUNT_TYPE), 
+      msg = g_markup_printf_escaped(_("%s account- %s             %s") ,
+		 (gchar*)g_hash_table_lookup( acc->properties , ACCOUNT_TYPE),
                  (gchar*)g_hash_table_lookup( acc->properties , ACCOUNT_ALIAS),
                  codecName);
       statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT);
@@ -777,17 +780,17 @@ sflphone_rec_call()
 {
   call_t * selectedCall = call_get_selected(current_calls);
   dbus_set_record(selectedCall);
-  
+
 
   switch(selectedCall->state)
   {
       case CALL_STATE_CURRENT:
             selectedCall->state = CALL_STATE_RECORD;
-            break; 
+            break;
       case CALL_STATE_RECORD:
             selectedCall->state = CALL_STATE_CURRENT;
             break;
-      default: 
+      default:
             g_warning("Should not happen in sflphone_off_hold ()!");
         break;
   }
@@ -803,17 +806,17 @@ void
 sflphone_set_current_account()
 {
   if( account_list_get_size() > 0 )
-    account_list_set_current_pos( 0 );	
+    account_list_set_current_pos( 0 );
 }
 
 
 /* Internal to action - get the codec list */
-void	
+void
 sflphone_fill_codec_list()
 {
 
   codec_list_clear();
-    
+
   gchar** codecs = (gchar**)dbus_codec_list();
   gchar** order = (gchar**)dbus_get_active_codec_list();
   gchar** details;
@@ -851,7 +854,7 @@ sflphone_fill_codec_list()
     }
   }
   if( codec_list_get_size() == 0) {
-    
+
     gchar* markup = g_markup_printf_escaped(_("<b>Error: No audio codecs found.\n\n</b> SFL audio codecs have to be placed in <i>%s</i> or in the <b>.sflphone</b> directory in your home( <i>%s</i> )") , CODECS_DIR , g_get_home_dir());
     main_window_error_message( markup );
     dbus_unregister(getpid());
diff --git a/sflphone-gtk/src/calllist.c b/sflphone-gtk/src/calllist.c
index c9629ad463..ce12521404 100644
--- a/sflphone-gtk/src/calllist.c
+++ b/sflphone-gtk/src/calllist.c
@@ -1,22 +1,22 @@
 /*
  *  Copyright (C) 2007 Savoir-Faire Linux inc.
  *  Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
- *                                                                              
+ *
  *  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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
- 
+
 #include <calllist.h>
 #include <calltree.h>
 #include <dbus.h>
@@ -29,7 +29,7 @@
  */
 
 /* GCompareFunc to compare a callID (gchar* and a call_t) */
-gint 
+gint
 is_callID_callstruct ( gconstpointer a, gconstpointer b)
 {
   call_t * c = (call_t*)a;
@@ -44,7 +44,7 @@ is_callID_callstruct ( gconstpointer a, gconstpointer b)
 }
 
 /* GCompareFunc to get current call (gchar* and a call_t) */
-gint 
+gint
 get_state_callstruct ( gconstpointer a, gconstpointer b)
 {
   call_t * c = (call_t*)a;
@@ -58,30 +58,30 @@ get_state_callstruct ( gconstpointer a, gconstpointer b)
   }
 }
 
-void 
+void
 call_list_init (calltab_t* tab)
 {
   tab->callQueue = g_queue_new ();
   tab->selectedCall = NULL;
 }
 
-void 
+void
 call_list_clean (calltab_t* tab)
 {
   g_queue_free (tab->callQueue);
 }
 
-void 
+void
 call_list_reset (calltab_t* tab)
 {
   g_queue_free (tab->callQueue);
   tab->callQueue = g_queue_new();
 }
 
-void 
+void
 call_list_add (calltab_t* tab, call_t * c)
 {
-  if( tab == history )	
+  if( tab == history )
   {
     // First case: can still add calls to the list
     if( call_list_get_size(tab) < dbus_get_max_calls() )
@@ -92,7 +92,7 @@ call_list_add (calltab_t* tab, call_t * c)
     // List full -> Remove the last call from history and preprend the new call to the list
     else
     {
-      update_call_tree_remove( history , (call_t*)g_queue_pop_head( tab -> callQueue ) );      
+      update_call_tree_remove( history , (call_t*)g_queue_pop_head( tab -> callQueue ) );
       g_queue_push_tail (tab->callQueue, (gpointer *) c);
       update_call_tree_add( history , c );
     }
@@ -126,7 +126,7 @@ call_list_remove_from_history( call_t* c )
   g_print("Size of history = %i\n" , call_list_get_size( history ));
 }
 
-void 
+void
 call_list_remove (calltab_t* tab, const gchar * callID)
 {
   call_t * c = call_list_get(tab, callID);
@@ -137,7 +137,7 @@ call_list_remove (calltab_t* tab, const gchar * callID)
 }
 
 
-call_t * 
+call_t *
 call_list_get_by_state (calltab_t* tab, call_state_t state )
 {
   GList * c = g_queue_find_custom (tab->callQueue, &state, get_state_callstruct);
@@ -145,11 +145,11 @@ call_list_get_by_state (calltab_t* tab, call_state_t state )
   {
     return (call_t *)c->data;
   }
-  else 
+  else
   {
     return NULL;
   }
-  
+
 }
 
 guint
@@ -158,13 +158,13 @@ call_list_get_size (calltab_t* tab)
   return g_queue_get_length (tab->callQueue);
 }
 
-call_t * 
+call_t *
 call_list_get_nth (calltab_t* tab, guint n )
 {
   return g_queue_peek_nth (tab->callQueue, n);
 }
 
-gchar * 
+gchar *
 call_get_name (const call_t * c)
 {
   gchar * end = g_strrstr(c->from, "\"");
@@ -176,7 +176,7 @@ call_get_name (const call_t * c)
   }
 }
 
-gchar * 
+gchar *
 call_get_number (const call_t * c)
 {
   gchar * number = g_strrstr(c->from, "<") + 1;
@@ -192,7 +192,7 @@ call_get_recipient( const call_t * c )
 }
 
 
-call_t * 
+call_t *
 call_list_get (calltab_t* tab, const gchar * callID )
 {
   GList * c = g_queue_find_custom (tab->callQueue, callID, is_callID_callstruct);
@@ -200,7 +200,7 @@ call_list_get (calltab_t* tab, const gchar * callID )
   {
     return (call_t *)c->data;
   }
-  else 
+  else
   {
     return NULL;
   }
diff --git a/sflphone-gtk/src/calllist.h b/sflphone-gtk/src/calllist.h
index 98ed11dd7d..326979eb78 100644
--- a/sflphone-gtk/src/calllist.h
+++ b/sflphone-gtk/src/calllist.h
@@ -1,22 +1,22 @@
 /*
  *  Copyright (C) 2007 Savoir-Faire Linux inc.
  *  Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
- *                                                                              
+ *
  *  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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
- 
+
 #ifndef __CALLLIST_H__
 #define __CALLLIST_H__
 
@@ -25,31 +25,31 @@
 /** @file calllist.h
   * @brief A list to hold calls.
   */
-  
-/** @enum call_state_t 
+
+/** @enum call_state_t
   * This enum have all the states a call can take.
   */
 typedef enum
 {  /** Invalid state */
-   CALL_STATE_INVALID = 0, 
+   CALL_STATE_INVALID = 0,
    /** Ringing incoming call */
-   CALL_STATE_INCOMING, 
+   CALL_STATE_INCOMING,
    /** Ringing outgoing call */
-   CALL_STATE_RINGING,  
+   CALL_STATE_RINGING,
    /** Call to which the user can speak and hear */
-   CALL_STATE_CURRENT,  
+   CALL_STATE_CURRENT,
    /** Call which numbers are being added by the user */
-   CALL_STATE_DIALING,  
+   CALL_STATE_DIALING,
    /** Call is on hold */
-   CALL_STATE_HOLD,      
+   CALL_STATE_HOLD,
    /** Call has failed */
-   CALL_STATE_FAILURE,      
+   CALL_STATE_FAILURE,
    /** Call is busy */
-   CALL_STATE_BUSY,        
+   CALL_STATE_BUSY,
    /** Call is being transfert.  During this state, the user can enter the new number. */
    CALL_STATE_TRANSFERT,
    /** Call is on hold */
-   CALL_STATE_RECORD       
+   CALL_STATE_RECORD
 } call_state_t;
 
 /**
@@ -64,16 +64,29 @@ typedef enum
   MISSED
 } history_state_t;
 
+/**
+ * @enum call_type
+ * This enum have all types of call
+ */
+typedef enum
+{
+  CALL,
+  HISTORY,
+  CONTACT
+} call_type_t;
+
 /** @struct call_t
   * @brief Call information.
-  * This struct holds information about a call.    
+  * This struct holds information about a call.
   */
 typedef struct  {
+  /** Type of call entry */
+  call_type_t call_type;
   /** Unique identifier of the call */
   gchar * callID;
   /** The account used to place/receive the call */
   gchar * accountID;
-/** The information about the calling person.  See call_get_name() and call_get_number()
+  /** The information about the calling person.  See call_get_name() and call_get_number()
     * on how to get the name and number separately. */
   gchar * from;
   /** The number we are calling.  Only used when dialing out */
@@ -100,6 +113,7 @@ typedef struct {
 
 calltab_t* current_calls;
 calltab_t* history;
+calltab_t* contacts;
 
 /** This function initialize a call list. */
 void call_list_init (calltab_t* tab);
@@ -111,22 +125,22 @@ void call_list_clean(calltab_t* tab);
 void call_list_reset (calltab_t* tab);
 
 /** Get the maximun number of calls in the history calltab */
-gdouble call_history_get_max_calls( void ); 
+gdouble call_history_get_max_calls( void );
 
 /** Set the maximun number of calls in the history calltab */
-void call_history_set_max_calls( const gdouble number ); 
+void call_history_set_max_calls( const gdouble number );
 
-/** This function append a call to list. 
-  * @param c The call you want to add 
+/** This function append a call to list.
+  * @param c The call you want to add
   * */
 void call_list_add (calltab_t* tab, call_t * c);
 
-/** This function remove a call from list. 
+/** This function remove a call from list.
   * @param callID The callID of the call you want to remove
   */
 void call_list_remove (calltab_t* tab, const gchar * callID);
 
-/** Return the first call that corresponds to the state.  
+/** Return the first call that corresponds to the state.
   * This is usefull for unique states as DIALING and CURRENT.
   * @param state The state
   * @return A call or NULL */
@@ -151,10 +165,10 @@ call_t * call_list_get (calltab_t* tab, const gchar * callID );
   * @return The full name of the caller or an empty string */
 gchar * call_get_name ( const call_t * c);
 
-/** 
+/**
  * This function parse the call_t.from field to return the number
  * @param c The call
- * @return The number of the caller 
+ * @return The number of the caller
  */
 gchar * call_get_number (const call_t * c);
 
@@ -178,4 +192,4 @@ void call_list_clean_history();
  */
 void call_list_remove_from_history( call_t* c);
 
-#endif 
+#endif
diff --git a/sflphone-gtk/src/calltab.c b/sflphone-gtk/src/calltab.c
index ca78b0269c..1ec9a9a95d 100644
--- a/sflphone-gtk/src/calltab.c
+++ b/sflphone-gtk/src/calltab.c
@@ -1,17 +1,17 @@
 /*
  *  Copyright (C) 2007 Savoir-Faire Linux inc.
  *  Author: Antoine Reversat <antoine.reversat@savoirfairelinux.com>
- *                                                                              
+ *
  *  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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -27,6 +27,7 @@ calltab_t*
 calltab_init()
 {
 	calltab_t* ret;
+
 	ret = malloc(sizeof(calltab_t));
 
 	ret->store = NULL;
@@ -37,6 +38,6 @@ calltab_init()
 
 	create_call_tree(ret);
 	call_list_init(ret);
-	
+
 	return ret;
 }
diff --git a/sflphone-gtk/src/calltab.h b/sflphone-gtk/src/calltab.h
index dcc47b2605..7d84696df2 100644
--- a/sflphone-gtk/src/calltab.h
+++ b/sflphone-gtk/src/calltab.h
@@ -1,22 +1,22 @@
 /*
  *  Copyright (C) 2007 Savoir-Faire Linux inc.
  *  Author: Antoine Reversat <antoine.reversat@savoirfairelinux.com>
- *                                                                              
+ *
  *  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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
- 
+
 #ifndef __NOTEBOOK_H__
 #define __NOTEBOOK_H__
 
diff --git a/sflphone-gtk/src/calltree.c b/sflphone-gtk/src/calltree.c
index 591f276ca0..0f85ded7be 100644
--- a/sflphone-gtk/src/calltree.c
+++ b/sflphone-gtk/src/calltree.c
@@ -2,17 +2,17 @@
  *  Copyright (C) 2007 Savoir-Faire Linux inc.
  *  Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
  *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
- *                                                                              
+ *
  *  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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -27,7 +27,7 @@
 #include <calllist.h>
 #include <menus.h>
 #include <dbus.h>
-
+#include <contactlist/eds.h>
 
 
 GtkWidget   * toolbar;
@@ -41,26 +41,27 @@ GtkToolItem * unholdButton;
 GtkToolItem * mailboxButton;
 GtkToolItem * recButton;
 guint transfertButtonConnId; //The button toggled signal connection ID
-gboolean history_shown;
 
-  void
-switch_tab()
+void
+free_call_t (call_t *c)
 {
-  (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(historyButton)))? 
-    gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton), FALSE):
-    gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton), TRUE);
+    g_free (c->callID);
+    g_free (c->accountID);
+    g_free (c->from);
+    g_free (c->to);
+    g_free (c);
 }
 
 /**
  * Show popup menu
  */
-  static gboolean            
+  static gboolean
 popup_menu (GtkWidget *widget,
     gpointer   user_data UNUSED)
 {
   show_popup_menu(widget, NULL);
   return TRUE;
-}            
+}
 
   static gboolean
 is_inserted( GtkWidget* button )
@@ -89,7 +90,7 @@ button_pressed(GtkWidget* widget, GdkEventButton *event, gpointer user_data UNUS
 /**
  * Make a call
  */
-  static void 
+  static void
 call_button( GtkWidget *widget UNUSED, gpointer   data UNUSED)
 {
   call_t * selectedCall = call_get_selected(active_calltree);
@@ -106,7 +107,7 @@ call_button( GtkWidget *widget UNUSED, gpointer   data UNUSED)
       newCall->from = g_strconcat("\"\" <", call_get_number(selectedCall), ">",NULL);
       newCall->state = CALL_STATE_DIALING;
       newCall->callID = g_new0(gchar, 30);
-      g_sprintf(newCall->callID, "%d", rand()); 
+      g_sprintf(newCall->callID, "%d", rand());
       newCall->_start = 0;
       newCall->_stop = 0;
 
@@ -114,25 +115,25 @@ call_button( GtkWidget *widget UNUSED, gpointer   data UNUSED)
       call_list_add(current_calls, newCall);
       update_call_tree_add(current_calls, newCall);
       sflphone_place_call(newCall);
-      if( active_calltree == history )  switch_tab();
+      switch_tab(current_calls);
     }
     else
     {
       sflphone_new_call();
-      if( active_calltree == history )  switch_tab();
+      switch_tab(current_calls);
     }
   }
   else
   {
     sflphone_new_call();
-    if( active_calltree == history )  switch_tab();
+    switch_tab(current_calls);
   }
 }
 
 /**
  * Hang up the line
  */
-  static void 
+  static void
 hang_up( GtkWidget *widget UNUSED, gpointer   data UNUSED)
 {
   sflphone_hang_up();
@@ -141,7 +142,7 @@ hang_up( GtkWidget *widget UNUSED, gpointer   data UNUSED)
 /**
  * Hold the line
  */
-  static void 
+  static void
 hold( GtkWidget *widget UNUSED, gpointer   data UNUSED)
 {
   sflphone_on_hold();
@@ -150,7 +151,7 @@ hold( GtkWidget *widget UNUSED, gpointer   data UNUSED)
 /**
  * Transfert the line
  */
-  static void 
+  static void
 transfert  (GtkToggleToolButton *toggle_tool_button,
     gpointer             user_data UNUSED )
 {
@@ -168,33 +169,115 @@ transfert  (GtkToggleToolButton *toggle_tool_button,
 /**
  * Unhold call
  */
-  static void 
+  static void
 unhold( GtkWidget *widget UNUSED, gpointer   data UNUSED)
 {
   sflphone_off_hold();
 }
 
   static void
-toggle_history(GtkToggleToolButton *toggle_tool_button UNUSED,
+show_current_calls_tab(GtkToggleToolButton *toggle_tool_button UNUSED,
+    gpointer  user_data UNUSED)
+{
+  GtkTreeSelection *sel;
+  gchar* msg;
+
+  // temporary display in status bar
+  msg = g_strdup("Current calls");
+  statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT);
+  g_free(msg);
+
+  active_calltree = current_calls;
+  gtk_widget_hide(history->tree);
+  gtk_widget_hide(contacts->tree);
+  gtk_widget_show(current_calls->tree);
+  printf("current calls toggle\n");
+
+  sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (active_calltree->view));
+  g_signal_emit_by_name(sel, "changed");
+  toolbar_update_buttons();
+}
+
+  static void
+show_history_tab(GtkToggleToolButton *toggle_tool_button UNUSED,
     gpointer	user_data UNUSED)
 {
 	GtkTreeSelection *sel;
-	if(history_shown){
-		active_calltree = current_calls;
-		gtk_widget_hide(history->tree);
-		gtk_widget_show(current_calls->tree);
-		history_shown = FALSE;
-	}else{
-		active_calltree = history;
-		gtk_widget_hide(current_calls->tree);
-		gtk_widget_show(history->tree);
-		history_shown = TRUE;
-	}
+  gchar* msg;
+
+  // temporary display in status bar
+  msg = g_strdup("History");
+  statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT);
+  g_free(msg);
+
+  active_calltree = history;
+  gtk_widget_hide(current_calls->tree);
+  gtk_widget_hide(contacts->tree);
+  gtk_widget_show(history->tree);
+
 	sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (active_calltree->view));
 	g_signal_emit_by_name(sel, "changed");
 	toolbar_update_buttons();
 	gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(histfilter));
 
+}
+
+  static void
+show_contacts_tab(GtkToggleToolButton *toggle_tool_button UNUSED,
+    gpointer  user_data UNUSED)
+{
+  GtkTreeSelection *sel;
+  GList *results;
+  GList *i;
+  call_t *j;
+  gchar* msg;
+
+  // temporary display in status bar
+  msg = g_strdup("Contacts");
+  statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT);
+  g_free(msg);
+
+  // freeing calls
+  while((j = (call_t *)g_queue_pop_tail (contacts->callQueue)) != NULL)
+  {
+    free_call_t(j);
+  }
+
+  // reset previous results
+  reset_call_tree(contacts);
+  call_list_reset(contacts);
+
+  // do a synchronized search
+  results = search_sync (gtk_entry_get_text(GTK_ENTRY(filter_entry)), 50);
+
+  for (i = results; i != NULL; i = i->next)
+  {
+    Hit *entry;
+    entry = i->data;
+    if (i->data)
+    {
+      call_t * call;
+
+      call = g_new0 (call_t, 1);
+      call->from = g_strconcat("\"" , entry->name, "\"<", entry->phone, ">", NULL);
+      call->state = CALL_STATE_RECORD;
+      call->history_state = OUTGOING;
+
+      call_list_add (contacts, call);
+      update_call_tree_add(contacts,call);
+    }
+    free_hit(entry);
+  }
+  g_list_free(results);
+
+  active_calltree = contacts;
+  gtk_widget_hide(current_calls->tree);
+  gtk_widget_hide(history->tree);
+  gtk_widget_show(contacts->tree);
+
+  sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (active_calltree->view));
+  g_signal_emit_by_name(sel, "changed");
+  toolbar_update_buttons();
 }
 
   static void
@@ -202,7 +285,7 @@ call_mailbox( GtkWidget* widget UNUSED, gpointer data UNUSED)
 {
   account_t* current = account_list_get_current();
   if( current == NULL ) // Should not happens
-    return; 
+    return;
   call_t* mailboxCall = g_new0( call_t , 1);
   mailboxCall->state = CALL_STATE_DIALING;
   mailboxCall->to = g_strdup(g_hash_table_lookup(current->properties, ACCOUNT_MAILBOX));
@@ -214,10 +297,10 @@ call_mailbox( GtkWidget* widget UNUSED, gpointer data UNUSED)
   mailboxCall->_stop = 0;
   g_print("TO : %s\n" , mailboxCall->to);
   call_list_add( current_calls , mailboxCall );
-  update_call_tree_add( current_calls , mailboxCall );    
+  update_call_tree_add( current_calls , mailboxCall );
   update_menus();
   sflphone_place_call( mailboxCall );
-  if( active_calltree == history )  switch_tab();
+  switch_tab(current_calls);
 }
 
 
@@ -225,14 +308,14 @@ call_mailbox( GtkWidget* widget UNUSED, gpointer data UNUSED)
 /**
  * Static rec_button
  */
-static void 
+static void
 rec_button( GtkWidget *widget UNUSED, gpointer   data UNUSED)
 {
   sflphone_rec_call();
 }
 
 
-  void 
+  void
 toolbar_update_buttons ()
 {
   gtk_widget_set_sensitive( GTK_WIDGET(callButton),       FALSE);
@@ -262,12 +345,12 @@ toolbar_update_buttons ()
   call_t * selectedCall = call_get_selected(active_calltree);
   if (selectedCall)
   {
-    switch(selectedCall->state) 
+    switch(selectedCall->state)
     {
       case CALL_STATE_INCOMING:
 	gtk_widget_set_sensitive( GTK_WIDGET(pickupButton),     TRUE);
 	gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),	TRUE);
-	g_object_ref(callButton);	
+	g_object_ref(callButton);
 	gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton));
 	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), pickupButton, 0);
 	break;
@@ -300,7 +383,7 @@ toolbar_update_buttons ()
       case CALL_STATE_BUSY:
       case CALL_STATE_FAILURE:
 	gtk_widget_set_sensitive( GTK_WIDGET(hangupButton),     TRUE);
-	break; 
+	break;
       case CALL_STATE_TRANSFERT:
 	gtk_signal_handler_block(GTK_OBJECT(transfertButton),transfertButtonConnId);
 	gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transfertButton), TRUE);
@@ -322,7 +405,7 @@ toolbar_update_buttons ()
 	break;
     }
   }
-  else 
+  else
   {
     if( account_list_get_size() > 0 )
     {
@@ -339,8 +422,8 @@ toolbar_update_buttons ()
 
 
 /* Call back when the user click on a call in the list */
-  static void 
-selected(GtkTreeSelection *sel, void* data UNUSED ) 
+  static void
+selected(GtkTreeSelection *sel, void* data UNUSED )
 {
   GtkTreeIter  iter;
   GValue val;
@@ -362,7 +445,7 @@ selected(GtkTreeSelection *sel, void* data UNUSED )
 void  row_activated(GtkTreeView       *tree_view UNUSED,
     GtkTreePath       *path UNUSED,
     GtkTreeViewColumn *column UNUSED,
-    void * data UNUSED) 
+    void * data UNUSED)
 {
   g_print("double click action\n");
   call_t* selectedCall;
@@ -374,7 +457,7 @@ void  row_activated(GtkTreeView       *tree_view UNUSED,
     // Get the right event from the right calltree
     if( active_calltree == current_calls )
     {
-      switch(selectedCall->state)  
+      switch(selectedCall->state)
       {
 	case CALL_STATE_INCOMING:
 	  dbus_accept(selectedCall);
@@ -403,7 +486,7 @@ void  row_activated(GtkTreeView       *tree_view UNUSED,
       newCall->from = g_strconcat("\"\" <", call_get_number(selectedCall), ">",NULL);
       newCall->state = CALL_STATE_DIALING;
       newCall->callID = g_new0(gchar, 30);
-      g_sprintf(newCall->callID, "%d", rand()); 
+      g_sprintf(newCall->callID, "%d", rand());
       newCall->_start = 0;
       newCall->_stop = 0;
       printf("call : account : %s \n", selectedCall->accountID);
@@ -412,12 +495,12 @@ void  row_activated(GtkTreeView       *tree_view UNUSED,
       call_list_add(current_calls, newCall);
       update_call_tree_add(current_calls, newCall);
       sflphone_place_call(newCall);
-      switch_tab();
+      switch_tab(current_calls);
     }
   }
 }
 
-  GtkWidget * 
+  GtkWidget *
 create_toolbar ()
 {
   GtkWidget *ret;
@@ -444,7 +527,7 @@ create_toolbar ()
   gtk_widget_set_tooltip_text(GTK_WIDGET(pickupButton), _("Pick up"));
 #endif
   gtk_widget_set_state( GTK_WIDGET(pickupButton), GTK_STATE_INSENSITIVE);
-  g_signal_connect(G_OBJECT (pickupButton), "clicked", 
+  g_signal_connect(G_OBJECT (pickupButton), "clicked",
       G_CALLBACK (call_button), NULL);
   gtk_widget_show_all(GTK_WIDGET(pickupButton));
 
@@ -456,7 +539,7 @@ create_toolbar ()
   gtk_widget_set_state( GTK_WIDGET(hangupButton), GTK_STATE_INSENSITIVE);
   g_signal_connect (G_OBJECT (hangupButton), "clicked",
       G_CALLBACK (hang_up), NULL);
-  gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(hangupButton), -1);  
+  gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(hangupButton), -1);
 
   image = gtk_image_new_from_file( ICONS_DIR "/unhold.svg");
   unholdButton = gtk_tool_button_new (image, _("Off Hold"));
@@ -489,21 +572,27 @@ create_toolbar ()
   gtk_widget_set_state( GTK_WIDGET(transfertButton), GTK_STATE_INSENSITIVE);
   transfertButtonConnId = g_signal_connect (G_OBJECT (transfertButton), "toggled",
       G_CALLBACK (transfert), NULL);
-  gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(transfertButton), -1);  
+  gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(transfertButton), -1);
 
   image = gtk_image_new_from_file( ICONS_DIR "/history2.svg");
-  historyButton = gtk_toggle_tool_button_new();
-  gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(historyButton), image);
+  historyButton = gtk_tool_button_new(image, _("History"));
 #if GTK_CHECK_VERSION(2,12,0)
   gtk_widget_set_tooltip_text(GTK_WIDGET(historyButton), _("History"));
 #endif
-  gtk_tool_button_set_label(GTK_TOOL_BUTTON(historyButton), _("History"));
-  g_signal_connect (G_OBJECT (historyButton), "toggled",
-      G_CALLBACK (toggle_history), NULL);
-  gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(historyButton), -1);  
-  history_shown = FALSE;
+  g_signal_connect (G_OBJECT (historyButton), "clicked",
+      G_CALLBACK (show_history_tab), NULL);
+  gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(historyButton), -1);
   active_calltree = current_calls;
 
+  image = gtk_image_new_from_file( ICONS_DIR "/contacts.svg");
+  contactButton = gtk_tool_button_new(image, _("Contacts"));
+#if GTK_CHECK_VERSION(2,12,0)
+  gtk_widget_set_tooltip_text(GTK_WIDGET(contactButton), _("Contacts"));
+#endif
+  g_signal_connect (G_OBJECT (contactButton), "clicked",
+      G_CALLBACK (show_contacts_tab), NULL);
+  gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(contactButton), -1);
+
   image = gtk_image_new_from_file( ICONS_DIR "/mailbox.svg");
   mailboxButton = gtk_tool_button_new( image , _("Voicemail"));
   gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(mailboxButton), image);
@@ -515,7 +604,7 @@ create_toolbar ()
       G_CALLBACK (call_mailbox), NULL);
   gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(mailboxButton), -1);
 
-  
+
   //image = gtk_image_new_from_file( ICONS_DIR "/record.svg");
   //recButton = gtk_tool_button_new (image, _("Record a call"));
   recButton = gtk_tool_button_new_from_stock (GTK_STOCK_MEDIA_RECORD);
@@ -530,14 +619,14 @@ create_toolbar ()
 
   return ret;
 
-}  
+}
 static gboolean
 on_key_released (GtkWidget   *widget UNUSED,
                 GdkEventKey *event,
-                gpointer     user_data UNUSED)  
+                gpointer     user_data UNUSED)
 {
   // If a modifier key is pressed, it's a shortcut, pass along
-  if(event->state & GDK_CONTROL_MASK || 
+  if(event->state & GDK_CONTROL_MASK ||
      event->state & GDK_MOD1_MASK    ||
      event->keyval == 60             || // <
      event->keyval == 62             || // >
@@ -553,7 +642,16 @@ on_key_released (GtkWidget   *widget UNUSED,
   return TRUE;
 }
 
-  void 
+/**
+ * Reset call tree
+ */
+  void
+reset_call_tree (calltab_t* tab)
+{
+  gtk_list_store_clear (tab->store);
+}
+
+  void
 create_call_tree (calltab_t* tab)
 {
   GtkWidget *sw;
@@ -561,7 +659,7 @@ create_call_tree (calltab_t* tab)
   GtkTreeViewColumn *col;
   GtkTreeSelection *sel;
 
-  tab->tree = gtk_vbox_new(FALSE, 10); 
+  tab->tree = gtk_vbox_new(FALSE, 10);
 
   gtk_container_set_border_width (GTK_CONTAINER (tab->tree), 0);
 
@@ -570,8 +668,8 @@ create_call_tree (calltab_t* tab)
   gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
   g_signal_connect (G_OBJECT ( sw ), "key-release-event",G_CALLBACK (on_key_released), NULL);
 
-  tab->store = gtk_list_store_new (3, 
-      GDK_TYPE_PIXBUF,// Icon 
+  tab->store = gtk_list_store_new (3,
+      GDK_TYPE_PIXBUF,// Icon
       G_TYPE_STRING,  // Description
       G_TYPE_POINTER  // Pointer to the Object
       );
@@ -585,10 +683,10 @@ create_call_tree (calltab_t* tab)
 
   // Connect the popup menu
   g_signal_connect (G_OBJECT (tab->view), "popup-menu",
-      G_CALLBACK (popup_menu), 
+      G_CALLBACK (popup_menu),
       NULL);
   g_signal_connect (G_OBJECT (tab->view), "button-press-event",
-      G_CALLBACK (button_pressed), 
+      G_CALLBACK (button_pressed),
       NULL);
 
 
@@ -616,13 +714,13 @@ create_call_tree (calltab_t* tab)
 
   gtk_box_pack_start(GTK_BOX(tab->tree), sw, TRUE, TRUE, 0);
 
-  gtk_widget_show(tab->tree); 
+  gtk_widget_show(tab->tree);
 
   //toolbar_update_buttons();
 
 }
 
-  void 
+  void
 update_call_tree_remove (calltab_t* tab, call_t * c)
 {
   GtkTreeIter iter;
@@ -654,7 +752,7 @@ update_call_tree_remove (calltab_t* tab, call_t * c)
   toolbar_update_buttons();
 }
 
-  void 
+  void
 update_call_tree (calltab_t* tab, call_t * c)
 {
     g_print("update call tree\n");
@@ -684,16 +782,16 @@ update_call_tree (calltab_t* tab, call_t * c)
 	gchar * duration="";
 	if(c->state == CALL_STATE_TRANSFERT)
 	{
-	  description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>Transfert to:</i> %s",  
-	      call_get_number(c), 
-	      call_get_name(c), 
+	  description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>Transfert to:</i> %s",
+	      call_get_number(c),
+	      call_get_name(c),
 	      c->to);
 	}
 	else
 	{
-	  description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>", 
+	  description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>",
 	      call_get_number(c),
-	      call_get_name(c)); 
+	      call_get_name(c));
 	}
 
 	if( tab == current_calls )
@@ -745,10 +843,10 @@ update_call_tree (calltab_t* tab, call_t * c)
 	      pixbuf = gdk_pixbuf_new_from_file( ICONS_DIR "/missed.svg", NULL);
 	      break;
 	    default:
-	      g_print("No history state\n");  
+	      g_print("No history state\n");
 	      break;
 	  }
-	  date = timestamp_get_call_date(); 
+	  date = timestamp_get_call_date();
 	  duration = process_call_duration(c);
 	  duration = g_strconcat( date , duration , NULL);
 	  description = g_strconcat( description , duration, NULL);
@@ -769,14 +867,14 @@ update_call_tree (calltab_t* tab, call_t * c)
 	if (pixbuf != NULL)
 	  g_object_unref(G_OBJECT(pixbuf));
 
-      } 
+      }
     }
 
-  } 
+  }
   toolbar_update_buttons();
 }
 
-  void 
+  void
 update_call_tree_add (calltab_t* tab, call_t * c)
 {
   if( tab == history && ( call_list_get_size( tab ) > dbus_get_max_calls() ) )
@@ -789,9 +887,9 @@ update_call_tree_add (calltab_t* tab, call_t * c)
   // New call in the list
   gchar * description;
   gchar * date="";
-  description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>", 
+  description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>",
       call_get_number(c),
-      call_get_name(c)); 
+      call_get_name(c));
 
 
   gtk_list_store_prepend (tab->store, &iter);
@@ -828,8 +926,11 @@ update_call_tree_add (calltab_t* tab, call_t * c)
       default:
 	g_warning("History - Should not happen!");
     }
-    date = timestamp_get_call_date(); 
-    description = g_strconcat( date , description , NULL);
+    date = timestamp_get_call_date();
+    if(tab == contacts)
+      description = g_strconcat( description , NULL);
+    else
+      description = g_strconcat( date , description , NULL);
   }
 
   //Resize it
@@ -854,3 +955,40 @@ update_call_tree_add (calltab_t* tab, call_t * c)
   gtk_tree_selection_select_iter(GTK_TREE_SELECTION(sel), &iter);
   toolbar_update_buttons();
 }
+
+
+  void
+refresh_tab(calltab_t* tab)
+{
+  if(tab == contacts)
+  {
+    show_contacts_tab(NULL, NULL);
+  }
+  else if (tab == history)
+  {
+    show_history_tab(NULL, NULL);
+  }
+  else
+  {
+    show_current_calls_tab(NULL, NULL);
+  }
+}
+  void
+switch_tab(calltab_t* tab)
+{
+  if(active_calltree != tab)
+  {
+    if(tab == contacts)
+    {
+      show_contacts_tab(NULL, NULL);
+    }
+    else if (tab == history)
+    {
+      show_history_tab(NULL, NULL);
+    }
+    else
+    {
+      show_current_calls_tab(NULL, NULL);
+    }
+  }
+}
diff --git a/sflphone-gtk/src/calltree.h b/sflphone-gtk/src/calltree.h
index f1148a749f..7fc292b61c 100644
--- a/sflphone-gtk/src/calltree.h
+++ b/sflphone-gtk/src/calltree.h
@@ -1,22 +1,22 @@
 /*
  *  Copyright (C) 2007 Savoir-Faire Linux inc.
  *  Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
- *                                                                              
+ *
  *  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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
- 
+
 #ifndef __CALLTREE_H__
 #define __CALLTREE_H__
 
@@ -32,8 +32,14 @@
   */
 
 GtkToolItem * historyButton;
+GtkToolItem * contactButton;
+
+GtkWidget * filter_entry;
 
 calltab_t* active_calltree;
+
+void free_call_t (call_t *c);
+
 /**
  * Create a new widget calltree
  * @return GtkWidget* A new widget
@@ -54,7 +60,7 @@ void update_call_tree_add (calltab_t* ct, call_t * c);
 /*
  * Update the call tree if the call state changes
  * @param c The call to update
- */ 
+ */
 void update_call_tree (calltab_t* ct, call_t * c);
 /**
  * Remove a call from the call tree
@@ -62,12 +68,16 @@ void update_call_tree (calltab_t* ct, call_t * c);
  */
 void update_call_tree_remove (calltab_t* ct, call_t * c);
 
+void reset_call_tree (calltab_t* tab);
+
 /**
  * Build the toolbar
  * @return GtkWidget* The toolbar
  */
 GtkWidget * create_toolbar();
 
-void switch_tab( void );
+void switch_tab( calltab_t* tab );
+
+void refresh_tab( calltab_t* tab );
 
-#endif 
+#endif
diff --git a/sflphone-gtk/src/contactlist/Makefile.am b/sflphone-gtk/src/contactlist/Makefile.am
new file mode 100644
index 0000000000..d8fee4636b
--- /dev/null
+++ b/sflphone-gtk/src/contactlist/Makefile.am
@@ -0,0 +1,8 @@
+noinst_LTLIBRARIES = libcontact.la
+
+libcontact_la_SOURCES = \
+			eds.c
+
+libcontact_la_LDFLAGS= -pthread -lebook-1.2 -lgnome-2 -lpopt -ledataserver-1.2 -lxml2 -lgconf-2 -lsoup-2.4 -lbonobo-2 -lbonobo-activation -lORBit-2 -lgthread-2.0 -lrt -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lgio-2.0 -lcairo -lpango-1.0 -lfreetype -lz -lfontconfig -lgmodule-2.0 -lgobject-2.0 -lglib-2.0
+
+libcontact_la_CFLAGS=-DORBIT2=1 -pthread -I/usr/include/evolution-data-server-2.24 -I/usr/include/libbonobo-2.0 -I/usr/include/libgnome-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/orbit-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/gconf/2 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/libxml2 -I/usr/include/libsoup-2.4 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/pygtk-2.0
diff --git a/sflphone-gtk/src/contactlist/TODO b/sflphone-gtk/src/contactlist/TODO
new file mode 100644
index 0000000000..d455ea1a0f
--- /dev/null
+++ b/sflphone-gtk/src/contactlist/TODO
@@ -0,0 +1,5 @@
+* Adding dependencies for configure
+* Define better interface (to easily distinct contacts, history and current calls)
+* Make stuff more generic (to be able to add other contact list sources later)
+* Rename historyfilter.c ... for something more generic
+* Handle gtk_widget_hide et gtk_widget_show more cleanly
\ No newline at end of file
diff --git a/sflphone-gtk/src/contactlist/eds.c b/sflphone-gtk/src/contactlist/eds.c
new file mode 100644
index 0000000000..d7c98bcda5
--- /dev/null
+++ b/sflphone-gtk/src/contactlist/eds.c
@@ -0,0 +1,194 @@
+/*
+ *  Copyright (C) 2009 Savoir-Faire Linux inc.
+ *  Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com>
+ *
+ *  File originally copied from evolution module of deskbar-applet 2.24.1
+ *   Authors :
+ *    Nigel Tao <nigel.tao@myrealbox.com>
+ *    Raphaël Slinckx <raphael@slinckx.net>
+ *    Mikkel Kamstrup Erlandsen <kamstrup@daimi.au.dk>
+ *    Sebastian Pölsterl <marduk@k-d-w.org>
+ *
+ *  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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glib.h>
+#include <glib/gstring.h>
+#include <libebook/e-book.h>
+#include <pango/pango.h>
+#include "eds.h"
+
+static GSList *books = NULL;
+
+static EContactField search_fields[] = { E_CONTACT_FULL_NAME, E_CONTACT_PHONE_BUSINESS, E_CONTACT_NICKNAME, 0 };
+static int n_search_fields = G_N_ELEMENTS (search_fields) - 1;
+
+void
+free_hit (Hit *h)
+{
+    g_free (h->name);
+    g_free (h->phone);
+    g_free (h);
+}
+
+/**
+ * Split a string of tokens separated by whitespace into an array of tokens.
+ */
+static GArray *
+split_query_string (const gchar *str)
+{
+  GArray *parts = g_array_sized_new (FALSE, FALSE, sizeof (char *), 2);
+  PangoLogAttr *attrs;
+  guint str_len = strlen (str), word_start = 0, i;
+
+  attrs = g_new0 (PangoLogAttr, str_len + 1);
+  /* TODO: do we need to specify a particular language or is NULL ok? */
+  pango_get_log_attrs (str, -1, -1, NULL, attrs, str_len + 1);
+
+  for (i = 0; i < str_len + 1; i++) {
+    char *start_word, *end_word, *word;
+    if (attrs[i].is_word_end) {
+      start_word = g_utf8_offset_to_pointer (str, word_start);
+      end_word = g_utf8_offset_to_pointer (str, i);
+      word  = g_strndup (start_word, end_word - start_word);
+      g_array_append_val (parts, word);
+    }
+    if (attrs[i].is_word_start) {
+      word_start = i;
+    }
+  }
+  g_free (attrs);
+  return parts;
+}
+
+/**
+ * Create a query which looks for the specified string in a contact's full name, email addresses and
+ * nick name.
+ */
+static EBookQuery*
+create_query (const char* s)
+{
+  EBookQuery *query;
+  GArray *parts = split_query_string (s);
+  EBookQuery ***field_queries;
+  EBookQuery **q;
+  guint j;
+  int i;
+
+  q = g_new0 (EBookQuery *, n_search_fields);
+  field_queries = g_new0 (EBookQuery **, n_search_fields);
+
+  for (i = 0; i < n_search_fields; i++) {
+    field_queries[i] = g_new0 (EBookQuery *, parts->len);
+    for (j = 0; j < parts->len; j++) {
+      field_queries[i][j] = e_book_query_field_test (search_fields[i], E_BOOK_QUERY_CONTAINS, g_array_index (parts, gchar *, j));
+    }
+    q[i] = e_book_query_and (parts->len, field_queries[i], TRUE);
+  }
+  g_array_free (parts, TRUE);
+
+  query = e_book_query_or (n_search_fields, q, TRUE);
+
+  for (i = 0; i < n_search_fields; i++) {
+    g_free (field_queries[i]);
+  }
+  g_free (field_queries);
+  g_free (q);
+
+  return query;
+}
+
+/**
+ * Initialize address book
+ */
+void
+init (void)
+{
+  GSList *list, *l;
+  ESourceList *source_list;
+  source_list = e_source_list_new_for_gconf_default ("/apps/evolution/addressbook/sources");
+
+  if (source_list == NULL) {
+    return;
+  }
+  list = e_source_list_peek_groups (source_list);
+
+  for (l = list; l != NULL; l = l->next) {
+    ESourceGroup *group = l->data;
+    GSList *sources = NULL, *m;
+    sources = e_source_group_peek_sources (group);
+    for (m = sources; m != NULL; m = m->next) {
+      ESource *source = m->data;
+      EBook *book = e_book_new (source, NULL);
+      if (book != NULL) {
+        books = g_slist_prepend (books, book);
+        e_book_open(book, TRUE, NULL);
+      }
+    }
+  }
+
+  g_object_unref (source_list);
+}
+
+/**
+ * Do a synchronized search in EDS address book
+ */
+GList *
+search_sync (const char *query,
+             int         max_results)
+{
+  GSList *iter = NULL;
+  GList *contacts = NULL;
+  GList *hits = NULL;
+  char ext[30];
+
+  EBookQuery* book_query = create_query (query);
+  for (iter = books; iter != NULL; iter = iter->next) {
+    if (max_results <= 0) {
+      break;
+    }
+    EBook *book = (EBook *) iter->data;
+    e_book_get_contacts (book, book_query, &contacts, NULL);
+    for (; contacts != NULL; contacts = g_list_next (contacts)) {
+      EContact *contact;
+      Hit *hit;
+
+      contact = E_CONTACT (contacts->data);
+      hit = g_new (Hit, 1);
+
+      hit->phone = g_strdup ((char*) e_contact_get_const (contact, E_CONTACT_PHONE_BUSINESS));
+      if(! hit->phone)
+      {
+        // Temporary fix for empty phone numbers
+        sprintf(ext, "%d", rand()%100 + 100);
+        hit->phone = g_strconcat("rand",ext,NULL);
+        //hit->phone = "";
+      }
+
+      hit->name = g_strdup ((char*) e_contact_get_const (contact, E_CONTACT_NAME_OR_ORG));
+      if(! hit->name)
+        hit->name = "";
+
+      hits = g_list_append (hits, hit);
+      max_results--;
+      if (max_results <= 0) {
+        break;
+      }
+    }
+  }
+  e_book_query_unref (book_query);
+
+  return hits;
+}
diff --git a/sflphone-gtk/src/contactlist/eds.h b/sflphone-gtk/src/contactlist/eds.h
new file mode 100644
index 0000000000..893f03c461
--- /dev/null
+++ b/sflphone-gtk/src/contactlist/eds.h
@@ -0,0 +1,48 @@
+/*
+ *  Copyright (C) 2009 Savoir-Faire Linux inc.
+ *  Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com>
+ *
+ *  File originally copied from evolution module of deskbar-applet 2.24.1
+ *   Authors :
+ *    Nigel Tao <nigel.tao@myrealbox.com>
+ *    Raphaël Slinckx <raphael@slinckx.net>
+ *    Mikkel Kamstrup Erlandsen <kamstrup@daimi.au.dk>
+ *    Sebastian Pölsterl <marduk@k-d-w.org>
+ *
+ *  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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __EDS_H__
+#define __EDS_H__
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+typedef struct _Hit
+{
+  gchar *name;
+  gchar *phone;
+} Hit;
+
+void free_hit (Hit *hit);
+
+void init (void);
+
+GList * search_sync (const char *query, int max_results);
+
+G_END_DECLS
+
+#endif /* __EDS_H__ */
diff --git a/sflphone-gtk/src/historyfilter.c b/sflphone-gtk/src/historyfilter.c
index db1d405246..8d45ddc3e2 100644
--- a/sflphone-gtk/src/historyfilter.c
+++ b/sflphone-gtk/src/historyfilter.c
@@ -1,17 +1,17 @@
 /*
  *  Copyright (C) 2008 Savoir-Faire Linux inc.
  *  Author: Antoine Reversat <antoine.reversat@savoirfairelinux.com>
- *                                                                              
+ *
  *  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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -22,15 +22,13 @@
 #include <historyfilter.h>
 #include <calltree.h>
 
-GtkWidget * filter_entry;
-
 GtkTreeModel*
 create_filter(GtkTreeModel* child)
 {
 	GtkTreeModel* ret = gtk_tree_model_filter_new(child, NULL);
 	gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(ret), is_visible, NULL, NULL);
 	return GTK_TREE_MODEL(ret);
-} 
+}
 
 gboolean
 is_visible(GtkTreeModel* model, GtkTreeIter* iter, gpointer data UNUSED)
@@ -53,13 +51,15 @@ is_visible(GtkTreeModel* model, GtkTreeIter* iter, gpointer data UNUSED)
 	return TRUE;
   }
   return TRUE;
-} 
+}
 
 void
 filter_entry_changed(GtkEntry* entry UNUSED, gchar* arg1 UNUSED, gpointer data UNUSED)
-{ 
-	gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton), TRUE);
-	gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(histfilter));
+{
+  if(active_calltree == current_calls)
+    switch_tab(contacts);
+  else
+    refresh_tab(active_calltree);
 }
 
 void
@@ -70,17 +70,17 @@ clear_filter_entry_if_default(GtkWidget* widget UNUSED, gpointer user_data UNUSE
 }
 
 GtkWidget*
-create_filter_entry() 
+create_filter_entry()
 {
 	GtkWidget* image;
 	GtkWidget* ret = gtk_hbox_new(FALSE, 0);
-      
+
 	filter_entry = sexy_icon_entry_new();
 	//filter_entry = gtk_entry_new();
 	image = gtk_image_new_from_stock( GTK_STOCK_FIND , GTK_ICON_SIZE_SMALL_TOOLBAR);
-	sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(filter_entry), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) ); 
+	sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(filter_entry), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) );
 	sexy_icon_entry_add_clear_button( SEXY_ICON_ENTRY(filter_entry) );
-	gtk_entry_set_text(GTK_ENTRY(filter_entry), _("Search"));	
+	gtk_entry_set_text(GTK_ENTRY(filter_entry), _("Search"));
 	g_signal_connect(GTK_ENTRY(filter_entry), "changed", G_CALLBACK(filter_entry_changed), NULL);
 	g_signal_connect(GTK_ENTRY(filter_entry), "grab-focus", G_CALLBACK(clear_filter_entry_if_default), NULL);
 
diff --git a/sflphone-gtk/src/mainwindow.c b/sflphone-gtk/src/mainwindow.c
index 6eaa0c0c72..0858aff621 100644
--- a/sflphone-gtk/src/mainwindow.c
+++ b/sflphone-gtk/src/mainwindow.c
@@ -2,22 +2,22 @@
  *  Copyright (C) 2007 Savoir-Faire Linux inc.
  *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
  *  Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
- *                                                                              
+ *
  *  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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
- 
+
 #include <config.h>
 #include <actions.h>
 #include <calltab.h>
@@ -57,7 +57,7 @@ on_delete (GtkWidget * widget UNUSED, gpointer data UNUSED)
 }
 
 /** Ask the user if he wants to hangup current calls */
-gboolean 
+gboolean
 main_window_ask_quit(){
     guint count = call_list_get_size(current_calls);
     GtkWidget * dialog;
@@ -72,7 +72,7 @@ main_window_ask_quit(){
   {
     question = _("There are calls in progress.");
   }
-  
+
   dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW(window) ,
                                   GTK_DIALOG_MODAL,
                                   GTK_MESSAGE_QUESTION,
@@ -81,12 +81,12 @@ main_window_ask_quit(){
                                   question,
                                    _("Do you still want to quit?") );
 
-  
+
   response = gtk_dialog_run (GTK_DIALOG (dialog));
-  
+
   gtk_widget_destroy (dialog);
   if(response == GTK_RESPONSE_YES)
-  { 
+  {
     return TRUE;
   }
   else if(response == GTK_RESPONSE_NO)
@@ -105,7 +105,7 @@ create_main_window ()
   gtk_container_set_border_width (GTK_CONTAINER (window), 0);
   gtk_window_set_title (GTK_WINDOW (window), PACKAGE);
   gtk_window_set_default_size (GTK_WINDOW (window), 258, 320);
-  gtk_window_set_default_icon_from_file (ICONS_DIR "/sflphone.png", 
+  gtk_window_set_default_icon_from_file (ICONS_DIR "/sflphone.png",
                                           NULL);
   gtk_window_set_position( GTK_WINDOW( window ) , GTK_WIN_POS_MOUSE);
 
@@ -123,26 +123,27 @@ create_main_window ()
   vbox = gtk_vbox_new ( FALSE /*homogeneous*/, 0 /*spacing*/);
   subvbox = gtk_vbox_new ( FALSE /*homogeneous*/, 5 /*spacing*/);
   gtk_container_set_border_width (GTK_CONTAINER(subvbox), 5);
-  
+
   widget = create_menus();
   gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/);
-  
+
   widget = create_toolbar();
   gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/);
 
 
   gtk_box_pack_start (GTK_BOX (vbox), current_calls->tree, TRUE /*expand*/, TRUE /*fill*/,  0 /*padding*/);
   gtk_box_pack_start (GTK_BOX (vbox), history->tree, TRUE /*expand*/, TRUE /*fill*/,  0 /*padding*/);
-  
+  gtk_box_pack_start (GTK_BOX (vbox), contacts->tree, TRUE /*expand*/, TRUE /*fill*/,  0 /*padding*/);
+
   gtk_box_pack_start (GTK_BOX (vbox), subvbox, FALSE /*expand*/, FALSE /*fill*/, 0 /*padding*/);
-  
+
   if( SHOW_SEARCHBAR ){
     filterEntry = create_filter_entry();
     gtk_box_pack_start (GTK_BOX (subvbox), filterEntry, FALSE /*expand*/, TRUE /*fill*/,  0 /*padding*/);
     gtk_widget_show_all ( filterEntry );
   }
 
- if( SHOW_VOLUME ){ 
+ if( SHOW_VOLUME ){
     speaker_control = create_slider("speaker");
     gtk_box_pack_end (GTK_BOX (subvbox), speaker_control, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/);
     gtk_widget_show_all (speaker_control);
@@ -151,7 +152,7 @@ create_main_window ()
     gtk_widget_show_all (mic_control);
   }
 
-  if( SHOW_DIALPAD ){ 
+  if( SHOW_DIALPAD ){
     dialpad = create_dialpad();
     gtk_box_pack_end (GTK_BOX (subvbox), dialpad, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/);
     gtk_widget_show_all (dialpad);
@@ -167,10 +168,12 @@ create_main_window ()
 
   /* dont't show the history */
   gtk_widget_hide(history->tree);
-  //gtk_widget_show(current_calls->tree);
-  
+
+  /* dont't show the contact list */
+  gtk_widget_hide(contacts->tree);
+
   gtk_tree_view_set_model(GTK_TREE_VIEW(history->view), GTK_TREE_MODEL(histfilter));
-  // Configuration wizard 
+  // Configuration wizard
   if (account_list_get_size() == 0)
   {
 #if GTK_CHECK_VERSION(2,10,0)
@@ -194,13 +197,13 @@ create_main_window ()
   }
 }
 
-GtkAccelGroup * 
+GtkAccelGroup *
 get_accel_group()
 {
   return accelGroup;
 }
 
-GtkWidget * 
+GtkWidget *
 get_main_window()
 {
   return window;
@@ -215,7 +218,7 @@ main_window_message(GtkMessageType type, gchar * markup){
                                       "%s\n",
                                       markup);
   gtk_dialog_run (GTK_DIALOG(dialog));
-  
+
   gtk_widget_destroy (GTK_WIDGET(dialog));
 }
 
@@ -286,15 +289,15 @@ main_window_searchbar( gboolean *state ){
   }
 }
 
-void 
+void
 statusbar_push_message(const gchar * message, guint id)
-{ 
+{
   gtk_statusbar_push(GTK_STATUSBAR(statusBar), id, message);
 }
 
-void 
+void
 statusbar_pop_message(guint id)
-{ 
+{
   gtk_statusbar_pop(GTK_STATUSBAR(statusBar), id);
 }
 
diff --git a/sflphone-gtk/src/menus.c b/sflphone-gtk/src/menus.c
index c0a21e40f1..3ddd0264d7 100644
--- a/sflphone-gtk/src/menus.c
+++ b/sflphone-gtk/src/menus.c
@@ -2,17 +2,17 @@
  *  Copyright (C) 2007 Savoir-Faire Linux inc.
  *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
  *  Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
- *                                                                              
+ *
  *  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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -48,7 +48,7 @@ GtkWidget * searchbarMenu;
 
 
 void update_menus()
-{ 
+{
   //Block signals for holdMenu
   gtk_signal_handler_block(GTK_OBJECT(holdMenu), holdConnId);
 
@@ -63,7 +63,7 @@ void update_menus()
   if (selectedCall)
   {
     gtk_widget_set_sensitive( GTK_WIDGET(copyMenu),   TRUE);
-    switch(selectedCall->state) 
+    switch(selectedCall->state)
     {
       case CALL_STATE_INCOMING:
 	gtk_widget_set_sensitive( GTK_WIDGET(pickUpMenu), TRUE);
@@ -95,12 +95,12 @@ void update_menus()
       case CALL_STATE_BUSY:
       case CALL_STATE_FAILURE:
 	gtk_widget_set_sensitive( GTK_WIDGET(hangUpMenu), TRUE);
-	break; 
+	break;
       default:
 	g_warning("Should not happen in update_menus()!");
 	break;
     }
-  } 
+  }
   else
   {
     gtk_widget_set_sensitive( GTK_WIDGET(newCallMenu), TRUE);
@@ -109,22 +109,22 @@ void update_menus()
 
 }
 /* ----------------------------------------------------------------- */
-  static void 
+  static void
 help_about ( void * foo UNUSED)
 {
   gchar *authors[] = {
-    "Yan Morin <yan.morin@savoirfairelinux.com>", 
+    "Yan Morin <yan.morin@savoirfairelinux.com>",
     "Jérôme Oufella <jerome.oufella@savoirfairelinux.com>",
     "Julien Plissonneau Duquene <julien.plissonneau.duquene@savoirfairelinux.com>",
     "Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>",
-    "Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>", 
+    "Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>",
     "Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>",
     "Yun Liu <yun.liu@savoirfairelinux.com>"
     "Jean-Philippe Barrette-LaPierre",
     "Laurielle Lea",
     NULL};
   gchar *artists[] = {
-    "Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>", 
+    "Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>",
     "Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>",
     NULL};
 
@@ -141,7 +141,7 @@ help_about ( void * foo UNUSED)
 }
 
 
-  GtkWidget * 
+  GtkWidget *
 create_help_menu()
 {
   GtkWidget * menu;
@@ -153,7 +153,7 @@ create_help_menu()
   menu_items = gtk_image_menu_item_new_from_stock( GTK_STOCK_ABOUT, get_accel_group());
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
   g_signal_connect_swapped (G_OBJECT (menu_items), "activate",
-      G_CALLBACK (help_about), 
+      G_CALLBACK (help_about),
       NULL);
   gtk_widget_show (menu_items);
 
@@ -163,19 +163,19 @@ create_help_menu()
   return root_menu;
 }
 /* ----------------------------------------------------------------- */
-  static void 
+  static void
 call_new_call ( void * foo UNUSED)
 {
   sflphone_new_call();
 }
 
-  static void 
+  static void
 call_quit ( void * foo UNUSED)
 {
   sflphone_quit();
 }
 
-  static void 
+  static void
 call_minimize ( void * foo UNUSED)
 {
 #if GTK_CHECK_VERSION(2,10,0)
@@ -192,11 +192,11 @@ switch_account(  GtkWidget* item , gpointer data UNUSED)
   account_list_set_current_id( acc->accountID );
 }
 
-  static void 
+  static void
 call_hold  (void* foo UNUSED)
 {
   call_t * selectedCall = call_get_selected(current_calls);
-  
+
   if(selectedCall)
   {
     if(selectedCall->state == CALL_STATE_HOLD)
@@ -208,29 +208,29 @@ call_hold  (void* foo UNUSED)
     {
       gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( holdMenu ), gtk_image_new_from_file( ICONS_DIR "/icon_hold.svg"));
       sflphone_on_hold();
-    } 
-  } 
+    }
+  }
 }
 
-  static void 
+  static void
 call_pick_up ( void * foo UNUSED)
 {
   sflphone_pick_up();
 }
 
-  static void 
+  static void
 call_hang_up ( void * foo UNUSED)
 {
   sflphone_hang_up();
 }
 
-static void 
+static void
 call_record ( void * foo UNUSED)
 {
   sflphone_rec_call();
 }
 
-  static void 
+  static void
 call_wizard ( void * foo UNUSED)
 {
 #if GTK_CHECK_VERSION(2,10,0)
@@ -251,7 +251,7 @@ remove_from_history( void * foo UNUSED)
 static void
 call_back( void * foo UNUSED)
 {
-  call_t* selectedCall = call_get_selected( history );
+  call_t* selectedCall = call_get_selected( active_calltree );
   call_t* newCall =  g_new0 (call_t, 1);
   if( selectedCall )
   {
@@ -259,17 +259,17 @@ call_back( void * foo UNUSED)
     newCall->from = g_strconcat("\"\" <", call_get_number(selectedCall), ">",NULL);
     newCall->state = CALL_STATE_DIALING;
     newCall->callID = g_new0(gchar, 30);
-    g_sprintf(newCall->callID, "%d", rand()); 
+    g_sprintf(newCall->callID, "%d", rand());
     newCall->_start = 0;
     newCall->_stop = 0;
     call_list_add(current_calls, newCall);
     update_call_tree_add(current_calls, newCall);
     sflphone_place_call(newCall);
-    switch_tab();
-  } 
+    switch_tab(current_calls);
+  }
 }
-    
-  GtkWidget * 
+
+  GtkWidget *
 create_call_menu()
 {
   GtkWidget * menu;
@@ -284,7 +284,7 @@ create_call_menu()
   gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( newCallMenu ), image );
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), newCallMenu);
   g_signal_connect_swapped (G_OBJECT (newCallMenu), "activate",
-      G_CALLBACK (call_new_call), 
+      G_CALLBACK (call_new_call),
       NULL);
   gtk_widget_show (newCallMenu);
 
@@ -297,7 +297,7 @@ create_call_menu()
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), pickUpMenu);
   gtk_widget_set_sensitive( GTK_WIDGET(pickUpMenu), FALSE);
   g_signal_connect_swapped (G_OBJECT (pickUpMenu), "activate",
-      G_CALLBACK (call_pick_up), 
+      G_CALLBACK (call_pick_up),
       NULL);
   gtk_widget_show (pickUpMenu);
 
@@ -307,7 +307,7 @@ create_call_menu()
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), hangUpMenu);
   gtk_widget_set_sensitive( GTK_WIDGET(hangUpMenu), FALSE);
   g_signal_connect_swapped (G_OBJECT (hangUpMenu), "activate",
-      G_CALLBACK (call_hang_up), 
+      G_CALLBACK (call_hang_up),
       NULL);
   gtk_widget_show (hangUpMenu);
 
@@ -319,7 +319,7 @@ create_call_menu()
   //Here we connect only to activate
   //The toggled state is managed from update_menus()
   holdConnId = g_signal_connect(G_OBJECT (holdMenu), "activate",
-      G_CALLBACK (call_hold), 
+      G_CALLBACK (call_hold),
       NULL);
   gtk_widget_show (menu_items);
 
@@ -329,7 +329,7 @@ create_call_menu()
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), recordMenu);
   gtk_widget_set_sensitive( GTK_WIDGET(recordMenu), FALSE);
   g_signal_connect_swapped (G_OBJECT (recordMenu), "activate",
-      G_CALLBACK (call_record), 
+      G_CALLBACK (call_record),
       NULL);
   gtk_widget_show (recordMenu);
 
@@ -351,7 +351,7 @@ create_call_menu()
   menu_items = gtk_image_menu_item_new_from_stock( GTK_STOCK_CLOSE, get_accel_group());
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
   g_signal_connect_swapped (G_OBJECT (menu_items), "activate",
-      G_CALLBACK (call_minimize), 
+      G_CALLBACK (call_minimize),
       NULL);
   gtk_widget_show (menu_items);
 
@@ -363,7 +363,7 @@ create_call_menu()
   menu_items = gtk_image_menu_item_new_from_stock( GTK_STOCK_QUIT, get_accel_group());
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
   g_signal_connect_swapped (G_OBJECT (menu_items), "activate",
-      G_CALLBACK (call_quit), 
+      G_CALLBACK (call_quit),
       NULL);
   gtk_widget_show (menu_items);
 
@@ -375,20 +375,20 @@ create_call_menu()
 }
 /* ----------------------------------------------------------------- */
 
-  static void 
+  static void
 edit_preferences ( void * foo UNUSED)
 {
   show_config_window();
 }
 
-  static void 
+  static void
 edit_accounts ( void * foo UNUSED)
 {
   show_accounts_window();
 }
 
 // The menu Edit/Copy should copy the current selected call's number
-  static void 
+  static void
 edit_copy ( void * foo UNUSED)
 {
   GtkClipboard* clip = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
@@ -399,7 +399,7 @@ edit_copy ( void * foo UNUSED)
   {
     switch(selectedCall->state)
     {
-      case CALL_STATE_TRANSFERT:  
+      case CALL_STATE_TRANSFERT:
       case CALL_STATE_DIALING:
       case CALL_STATE_RINGING:
 	no = selectedCall->to;
@@ -420,7 +420,7 @@ edit_copy ( void * foo UNUSED)
 }
 
 // The menu Edit/Paste should paste the clipboard into the current selected call
-  static void 
+  static void
 edit_paste ( void * foo UNUSED)
 {
   GtkClipboard* clip = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
@@ -431,10 +431,10 @@ edit_paste ( void * foo UNUSED)
   {
     switch(selectedCall->state)
     {
-      case CALL_STATE_TRANSFERT:  
+      case CALL_STATE_TRANSFERT:
       case CALL_STATE_DIALING:
 	// Add the text to the number
-	{ 
+	{
 	  gchar * before = selectedCall->to;
 	  selectedCall->to = g_strconcat(selectedCall->to, no, NULL);
 	  g_free(before);
@@ -448,7 +448,7 @@ edit_paste ( void * foo UNUSED)
 	  update_call_tree(current_calls, selectedCall);
 	}
 	break;
-      case CALL_STATE_RINGING:  
+      case CALL_STATE_RINGING:
       case CALL_STATE_INCOMING:
       case CALL_STATE_BUSY:
       case CALL_STATE_FAILURE:
@@ -514,7 +514,7 @@ clear_history (void)
     }
 }
 
-  GtkWidget * 
+  GtkWidget *
 create_edit_menu()
 {
   GtkWidget * menu;
@@ -527,14 +527,14 @@ create_edit_menu()
   copyMenu = gtk_image_menu_item_new_from_stock( GTK_STOCK_COPY, get_accel_group());
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), copyMenu);
   g_signal_connect_swapped (G_OBJECT (copyMenu), "activate",
-      G_CALLBACK (edit_copy), 
+      G_CALLBACK (edit_copy),
       NULL);
   gtk_widget_show (copyMenu);
 
   pasteMenu = gtk_image_menu_item_new_from_stock( GTK_STOCK_PASTE, get_accel_group());
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), pasteMenu);
   g_signal_connect_swapped (G_OBJECT (pasteMenu), "activate",
-      G_CALLBACK (edit_paste), 
+      G_CALLBACK (edit_paste),
       NULL);
   gtk_widget_show (pasteMenu);
 
@@ -546,9 +546,9 @@ create_edit_menu()
   gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( menu_items ), image );
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
   g_signal_connect_swapped (G_OBJECT (menu_items), "activate",
-      G_CALLBACK (clear_history), 
+      G_CALLBACK (clear_history),
       NULL);
-  gtk_widget_show (menu_items);  
+  gtk_widget_show (menu_items);
 
   menu_items = gtk_separator_menu_item_new ();
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
@@ -556,16 +556,16 @@ create_edit_menu()
   menu_items = gtk_menu_item_new_with_mnemonic( _("_Accounts") );
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
   g_signal_connect_swapped (G_OBJECT (menu_items), "activate",
-      G_CALLBACK (edit_accounts), 
+      G_CALLBACK (edit_accounts),
       NULL);
-  gtk_widget_show (menu_items);  
+  gtk_widget_show (menu_items);
 
   menu_items = gtk_image_menu_item_new_from_stock( GTK_STOCK_PREFERENCES, get_accel_group());
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
   g_signal_connect_swapped (G_OBJECT (menu_items), "activate",
-      G_CALLBACK (edit_preferences), 
+      G_CALLBACK (edit_preferences),
       NULL);
-  gtk_widget_show (menu_items);  
+  gtk_widget_show (menu_items);
 
 
   root_menu = gtk_menu_item_new_with_mnemonic (_("_Edit"));
@@ -574,7 +574,7 @@ create_edit_menu()
   return root_menu;
 }
 /* ----------------------------------------------------------------- */
-  static void 
+  static void
 view_dialpad  (GtkImageMenuItem *imagemenuitem UNUSED,
     void* foo UNUSED)
 {
@@ -583,15 +583,15 @@ view_dialpad  (GtkImageMenuItem *imagemenuitem UNUSED,
   if( state )
     gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( dialpadMenu ),
 				  gtk_image_new_from_file( ICONS_DIR "/icon_dialpad_off.svg"));
-  else	
-    gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( dialpadMenu ), 
+  else
+    gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( dialpadMenu ),
 				  gtk_image_new_from_file( ICONS_DIR "/icon_dialpad.svg"));
   dbus_set_dialpad( state );
-  
+
 
 }
 
-  static void 
+  static void
 view_volume_controls  (GtkImageMenuItem *imagemenuitem UNUSED,
     void* foo UNUSED)
 {
@@ -600,13 +600,13 @@ view_volume_controls  (GtkImageMenuItem *imagemenuitem UNUSED,
   if( state )
     gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( volumeMenu ),
 				  gtk_image_new_from_file( ICONS_DIR "/icon_volume_off.svg"));
-  else	
-    gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( volumeMenu ), 
+  else
+    gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( volumeMenu ),
 				  gtk_image_new_from_file( ICONS_DIR "/icon_volume.svg"));
   dbus_set_volume_controls( state );
 }
 
-  static void 
+  static void
 view_searchbar  (GtkImageMenuItem *imagemenuitem UNUSED,
     void* foo UNUSED)
 {
@@ -615,7 +615,7 @@ view_searchbar  (GtkImageMenuItem *imagemenuitem UNUSED,
   dbus_set_searchbar( state );
 }
 
-  GtkWidget * 
+  GtkWidget *
 create_view_menu()
 {
   GtkWidget * menu;
@@ -632,7 +632,7 @@ create_view_menu()
   gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( dialpadMenu ), image );
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), dialpadMenu);
   g_signal_connect(G_OBJECT ( dialpadMenu ), "activate",
-      G_CALLBACK (view_dialpad), 
+      G_CALLBACK (view_dialpad),
       NULL);
   gtk_widget_show (dialpadMenu);
 
@@ -644,7 +644,7 @@ create_view_menu()
   gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( volumeMenu ), image );
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), volumeMenu);
   g_signal_connect(G_OBJECT (volumeMenu), "activate",
-      G_CALLBACK (view_volume_controls), 
+      G_CALLBACK (view_volume_controls),
       NULL);
   gtk_widget_show (volumeMenu);
 
@@ -653,7 +653,7 @@ create_view_menu()
   gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( searchbarMenu ), image );
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), searchbarMenu);
   g_signal_connect(G_OBJECT (searchbarMenu), "activate",
-      G_CALLBACK (view_searchbar), 
+      G_CALLBACK (view_searchbar),
       NULL);
   gtk_widget_show (searchbarMenu);
 
@@ -663,7 +663,7 @@ create_view_menu()
   return root_menu;
 }
 /* ----------------------------------------------------------------- */
-  GtkWidget * 
+  GtkWidget *
 create_menus ( )
 {
 
@@ -704,7 +704,7 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
   if (selectedCall)
   {
     copy = TRUE;
-    switch(selectedCall->state) 
+    switch(selectedCall->state)
     {
       case CALL_STATE_INCOMING:
 	pickup = TRUE;
@@ -731,12 +731,12 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
       case CALL_STATE_BUSY:
       case CALL_STATE_FAILURE:
 	hangup = TRUE;
-	break; 
+	break;
       default:
 	g_warning("Should not happen in show_popup_menu!");
 	break;
     }
-  } 
+  }
 
   GtkWidget *menu;
   GtkWidget *image;
@@ -744,7 +744,7 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
   GtkWidget * menu_items;
 
   menu = gtk_menu_new ();
-  //g_signal_connect (menu, "deactivate", 
+  //g_signal_connect (menu, "deactivate",
   //       G_CALLBACK (gtk_widget_destroy), NULL);
 
   if(copy)
@@ -752,7 +752,7 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
     menu_items = gtk_image_menu_item_new_from_stock( GTK_STOCK_COPY, get_accel_group());
     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
     g_signal_connect (G_OBJECT (menu_items), "activate",
-	G_CALLBACK (edit_copy), 
+	G_CALLBACK (edit_copy),
 	NULL);
     gtk_widget_show (menu_items);
   }
@@ -760,7 +760,7 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
   menu_items = gtk_image_menu_item_new_from_stock( GTK_STOCK_PASTE, get_accel_group());
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
   g_signal_connect (G_OBJECT (menu_items), "activate",
-      G_CALLBACK (edit_paste), 
+      G_CALLBACK (edit_paste),
       NULL);
   gtk_widget_show (menu_items);
 
@@ -779,7 +779,7 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
     gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_items), image);
     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
     g_signal_connect (G_OBJECT (menu_items), "activate",
-	G_CALLBACK (call_pick_up), 
+	G_CALLBACK (call_pick_up),
 	NULL);
     gtk_widget_show (menu_items);
   }
@@ -791,7 +791,7 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
     gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_items), image);
     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
     g_signal_connect (G_OBJECT (menu_items), "activate",
-	G_CALLBACK (call_hang_up), 
+	G_CALLBACK (call_hang_up),
 	NULL);
     gtk_widget_show (menu_items);
   }
@@ -800,13 +800,13 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
   {
     menu_items = gtk_check_menu_item_new_with_mnemonic (_("On _Hold"));
     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
-    gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_items), 
+    gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_items),
 	(selectedCall->state == CALL_STATE_HOLD ? TRUE : FALSE));
     g_signal_connect(G_OBJECT (menu_items), "activate",
-	G_CALLBACK (call_hold), 
+	G_CALLBACK (call_hold),
 	NULL);
     gtk_widget_show (menu_items);
-  }  
+  }
 
    if(record)
   {
@@ -815,7 +815,7 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
     gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_items), image);
     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
     g_signal_connect (G_OBJECT (menu_items), "activate",
-	G_CALLBACK (call_record), 
+	G_CALLBACK (call_record),
 	NULL);
     gtk_widget_show (menu_items);
   }
@@ -843,7 +843,7 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
 	      (g_strcasecmp( acc->accountID , account_list_get_current()->accountID) == 0)? TRUE : FALSE);
 	}
 	g_signal_connect (G_OBJECT (menu_items), "activate",
-	    G_CALLBACK (switch_account), 
+	    G_CALLBACK (switch_account),
 	    NULL);
 	gtk_widget_show (menu_items);
       } // fi
@@ -862,7 +862,7 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
   }
 
   gtk_menu_attach_to_widget (GTK_MENU (menu), my_widget, NULL);
-  gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 
+  gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
       button, event_time);
 }
 
@@ -874,12 +874,13 @@ show_popup_menu_history(GtkWidget *my_widget, GdkEventButton *event)
   gboolean pickup = FALSE;
   gboolean remove = FALSE;
 
-  call_t * selectedCall = call_get_selected( history );
+  call_t * selectedCall = call_get_selected( active_calltree );
   if (selectedCall)
   {
-    remove = TRUE;
     pickup = TRUE;
-  } 
+    if(active_calltree == history)
+      remove = TRUE;
+  }
 
   GtkWidget *menu;
   GtkWidget *image;
@@ -887,7 +888,7 @@ show_popup_menu_history(GtkWidget *my_widget, GdkEventButton *event)
   GtkWidget * menu_items;
 
   menu = gtk_menu_new ();
-  //g_signal_connect (menu, "deactivate", 
+  //g_signal_connect (menu, "deactivate",
   //       G_CALLBACK (gtk_widget_destroy), NULL);
 
   if(pickup)
@@ -901,12 +902,12 @@ show_popup_menu_history(GtkWidget *my_widget, GdkEventButton *event)
     gtk_widget_show (menu_items);
   }
 
-  menu_items = gtk_separator_menu_item_new ();
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
-  gtk_widget_show (menu_items);
-
   if(remove)
   {
+    menu_items = gtk_separator_menu_item_new ();
+    gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
+    gtk_widget_show (menu_items);
+
     menu_items = gtk_image_menu_item_new_from_stock( GTK_STOCK_DELETE, get_accel_group());
     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
     g_signal_connect (G_OBJECT (menu_items), "activate", G_CALLBACK (remove_from_history),  NULL);
@@ -925,6 +926,6 @@ show_popup_menu_history(GtkWidget *my_widget, GdkEventButton *event)
   }
 
   gtk_menu_attach_to_widget (GTK_MENU (menu), my_widget, NULL);
-  gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 
+  gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
       button, event_time);
 }
-- 
GitLab