Commit d56af3ed authored by Emmanuel Milou's avatar Emmanuel Milou

[#1214] Retrieve the history when the gnome client startsup

parent a874d31b
......@@ -237,8 +237,15 @@ gboolean sflphone_init()
history = calltab_init("history");
account_list_init ();
codec_list_init();
// Fetch the configured accounts
sflphone_fill_account_list(FALSE);
// Fetch the audio codecs
sflphone_fill_codec_list();
// Fetch the history list
// sflphone_fill_history ();
return TRUE;
}
}
......@@ -915,6 +922,28 @@ void sflphone_fill_call_list (void)
}
}
void sflphone_fill_history (void)
{
GHashTable *entries;
GHashTableIter iter;
gpointer key, value;
call_t *history_entry;
entries = dbus_get_history ();
if (entries)
{
// Init the iterator
g_hash_table_iter_init (&iter, entries);
while (g_hash_table_iter_next (&iter, &key, &value))
{
/* do something with key and value */
create_new_call_from_serialized_form ((gchar*)key, (gchar*)value, &history_entry);
// Add it and update the GUI
calltree_add_call (history, history_entry);
}
}
}
void format_phone_number (gchar **number) {
gchar *_number;
......
......@@ -175,4 +175,5 @@ void sflphone_display_selected_codec (const gchar* codecName);
void status_bar_display_account ();
void sflphone_fill_history (void);
#endif
......@@ -124,6 +124,23 @@ void create_new_call_from_details (const gchar *call_id, GHashTable *details, ca
*call = new_call;
}
void create_new_call_from_serialized_form (gchar *timestamp, gchar *details, call_t **call)
{
gchar *from, *to, *accountID, *state_str;
call_t *new_call;
call_state_t state;
// details is in serialized form, i e: calltype%to%from%callid
state = CALL_STATE_DIALING;
to = g_strdup (details);
from = g_markup_printf_escaped("\"\" <%s>", to);
create_new_call (from, from, state, "", &new_call);
new_call->history_state = MISSED;
*call = new_call;
}
void
free_call_t (call_t *c)
......
......@@ -146,6 +146,9 @@ create_new_call (gchar *, gchar *, call_state_t, gchar *, call_t **);
void
create_new_call_from_details (const gchar *, GHashTable *, call_t **);
void
create_new_call_from_serialized_form (gchar *, gchar *, call_t **);
void
attach_thumbnail (call_t *, GdkPixbuf *);
......
......@@ -302,6 +302,16 @@
<arg type="a{ss}" name="settings" direction="in"/>
</method>
<method name="getHistory">
<annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="MapStringString"/>
<arg type="a{ss}" name="entries" direction="out"/>
</method>
<method name="setHistory">
<annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="MapStringString"/>
<arg type="a{ss}" name="entries" direction="in"/>
</method>
<!-- ///////////////////////////// -->
<!--
......@@ -313,7 +323,7 @@
-->
<signal name="accountsChanged">
</signal>
</signal>
<signal name="errorAlert">
<arg type="i" name="code" direction="out"/>
......
......@@ -1678,3 +1678,27 @@ void dbus_set_accounts_order (const gchar* order) {
}
}
GHashTable* dbus_get_history (void)
{
GError *error = NULL;
GHashTable *entries = NULL;
org_sflphone_SFLphone_ConfigurationManager_get_history (configurationManagerProxy, &entries, &error);
if (error){
ERROR ("Error calling org_sflphone_SFLphone_CallManager_get_history");
g_error_free (error);
}
return entries;
}
void dbus_set_history (GHashTable* entries)
{
GError *error = NULL;
org_sflphone_SFLphone_ConfigurationManager_set_history (configurationManagerProxy, entries, &error);
if (error){
ERROR ("Error calling org_sflphone_SFLphone_CallManager_set_history");
g_error_free (error);
}
}
......@@ -485,4 +485,8 @@ gchar** dbus_get_call_list (void);
void dbus_set_accounts_order (const gchar* order);
GHashTable* dbus_get_history (void);
void dbus_set_history (GHashTable* entries);
#endif
......@@ -104,6 +104,7 @@ There is NO WARRANTY, to the extent permitted by law.\n\n");
// Get the active calls at startup
sflphone_fill_call_list ();
sflphone_fill_history ();
/* start the main loop */
gtk_main();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment