Commit 323cde5c authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

History - Add clear button

parent 3693dd6a
......@@ -26,8 +26,6 @@
* call_t * selectedCall = NULL;
*/
guint _HISTORY_MAX_CALLS;
/* GCompareFunc to compare a callID (gchar* and a call_t) */
gint
is_callID_callstruct ( gconstpointer a, gconstpointer b)
......@@ -71,15 +69,20 @@ call_list_clean (calltab_t* tab)
g_queue_free (tab->callQueue);
}
void
call_list_reset (calltab_t* tab)
{
g_queue_free (tab->callQueue);
tab->callQueue = g_queue_new();
}
void
call_list_add (calltab_t* tab, call_t * c)
{
if( tab == history )
{
g_print("HO HJOH OH HOSDVDBSGDNGNSFHNSGNBADFSVsv\n");
if( call_list_get_size(tab) < dbus_get_max_calls() )
{
g_print("SDVDBSGDNGNSFHNSGNBADFSVsv\n");
g_queue_push_tail (tab->callQueue, (gpointer *) c);
}
}
......@@ -88,15 +91,20 @@ call_list_add (calltab_t* tab, call_t * c)
}
void
call_history_set_max_calls( gdouble number )
call_list_clean_history( void )
{
_HISTORY_MAX_CALLS = number;
}
gdouble
call_history_get_max_calls( void )
{
return _HISTORY_MAX_CALLS;
int i;
guint size = call_list_get_size( history );
g_print("history list size = %i\n", call_list_get_size( history ));
for( i = 0 ; i < size ; i++ )
{
g_print("Delete calls");
call_t* c = call_list_get_nth( history , i );
// Delete the call from the call tree
g_print("Delete calls");
update_call_tree_remove(history , c);
}
call_list_reset( history );
}
void
......
......@@ -98,7 +98,10 @@ calltab_t* history;
void call_list_init (calltab_t* tab);
/** This function empty and free the call list. */
void call_list_clean (calltab_t* tab);
void call_list_clean(calltab_t* tab);
/** This function empty, free the call list and allocate a new one. */
void call_list_reset (calltab_t* tab);
/** Get the maximun number of calls in the history calltab */
gdouble call_history_get_max_calls( void );
......@@ -156,4 +159,6 @@ void call_select (calltab_t* tab, call_t * c );
/** Return the selected call.
* @return The number of the caller */
call_t * call_get_selected (calltab_t* tab);
void call_list_clean_history();
#endif
......@@ -1481,21 +1481,21 @@ static
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_get_max_calls (DBusGProxy *proxy, gdouble* OUT_calls, GError **error)
org_sflphone_SFLphone_ConfigurationManager_get_max_calls (DBusGProxy *proxy, gint* OUT_calls, GError **error)
{
return dbus_g_proxy_call (proxy, "getMaxCalls", error, G_TYPE_INVALID, G_TYPE_DOUBLE, OUT_calls, G_TYPE_INVALID);
return dbus_g_proxy_call (proxy, "getMaxCalls", error, G_TYPE_INVALID, G_TYPE_INT, OUT_calls, G_TYPE_INVALID);
}
typedef void (*org_sflphone_SFLphone_ConfigurationManager_get_max_calls_reply) (DBusGProxy *proxy, gdouble OUT_calls, GError *error, gpointer userdata);
typedef void (*org_sflphone_SFLphone_ConfigurationManager_get_max_calls_reply) (DBusGProxy *proxy, gint OUT_calls, GError *error, gpointer userdata);
static void
org_sflphone_SFLphone_ConfigurationManager_get_max_calls_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
{
DBusGAsyncData *data = (DBusGAsyncData*) user_data;
GError *error = NULL;
gdouble OUT_calls;
dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_DOUBLE, &OUT_calls, G_TYPE_INVALID);
gint OUT_calls;
dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INT, &OUT_calls, G_TYPE_INVALID);
(*(org_sflphone_SFLphone_ConfigurationManager_get_max_calls_reply)data->cb) (proxy, OUT_calls, error, data->userdata);
return;
}
......@@ -1519,10 +1519,10 @@ static
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_set_max_calls (DBusGProxy *proxy, const gdouble IN_calls, GError **error)
org_sflphone_SFLphone_ConfigurationManager_set_max_calls (DBusGProxy *proxy, const gint IN_calls, GError **error)
{
return dbus_g_proxy_call (proxy, "setMaxCalls", error, G_TYPE_DOUBLE, IN_calls, G_TYPE_INVALID, G_TYPE_INVALID);
return dbus_g_proxy_call (proxy, "setMaxCalls", error, G_TYPE_INT, IN_calls, G_TYPE_INVALID, G_TYPE_INVALID);
}
typedef void (*org_sflphone_SFLphone_ConfigurationManager_set_max_calls_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
......@@ -1542,14 +1542,14 @@ static
inline
#endif
DBusGProxyCall*
org_sflphone_SFLphone_ConfigurationManager_set_max_calls_async (DBusGProxy *proxy, const gdouble IN_calls, org_sflphone_SFLphone_ConfigurationManager_set_max_calls_reply callback, gpointer userdata)
org_sflphone_SFLphone_ConfigurationManager_set_max_calls_async (DBusGProxy *proxy, const gint IN_calls, org_sflphone_SFLphone_ConfigurationManager_set_max_calls_reply callback, gpointer userdata)
{
DBusGAsyncData *stuff;
stuff = g_new (DBusGAsyncData, 1);
stuff->cb = G_CALLBACK (callback);
stuff->userdata = userdata;
return dbus_g_proxy_begin_call (proxy, "setMaxCalls", org_sflphone_SFLphone_ConfigurationManager_set_max_calls_async_callback, stuff, g_free, G_TYPE_DOUBLE, IN_calls, G_TYPE_INVALID);
return dbus_g_proxy_begin_call (proxy, "setMaxCalls", org_sflphone_SFLphone_ConfigurationManager_set_max_calls_async_callback, stuff, g_free, G_TYPE_INT, IN_calls, G_TYPE_INVALID);
}
static
#ifdef G_HAVE_INLINE
......
......@@ -48,7 +48,6 @@ GtkListStore *inputAudioDeviceManagerStore;
GtkWidget *addButton;
GtkWidget *editButton;
GtkWidget *deleteButton;
//GtkWidget *defaultButton;
GtkWidget *restoreButton;
GtkWidget *accountMoveDownButton;
GtkWidget *accountMoveUpButton;
......@@ -529,6 +528,12 @@ update_max_value( GtkRange* scale )
dbus_set_max_calls(gtk_range_get_value( GTK_RANGE( scale )));
}
void
clean_history( void )
{
call_list_clean_history();
}
void
ringtone_enabled( void )
{
......@@ -1239,6 +1244,7 @@ create_general_settings ()
GtkWidget *historyBox;
GtkWidget *value;
GtkWidget *label;
GtkWidget *cleanButton;
// Main widget
ret = gtk_vbox_new(FALSE, 10);
......@@ -1297,17 +1303,20 @@ create_general_settings ()
gtk_widget_show( historyBox );
gtk_container_add( GTK_CONTAINER(historyFrame) , historyBox);
label = gtk_label_new_with_mnemonic(_("Maximum calls"));
label = gtk_label_new_with_mnemonic(_("Maximum number of calls"));
gtk_box_pack_start( GTK_BOX(historyBox) , label , TRUE , TRUE , 0);
value = gtk_hscale_new_with_range(0.0 , 50.0 , 1.0);
value = gtk_hscale_new_with_range(0.0 , 50.0 , 5.0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), value);
gtk_scale_set_digits( GTK_SCALE(value) , 0);
gtk_scale_set_value_pos( GTK_SCALE(value) , GTK_POS_RIGHT);
gtk_range_set_value( GTK_RANGE( value ) , dbus_get_max_calls());
gtk_box_pack_start( GTK_BOX(historyBox) , value , TRUE , TRUE , 0);
g_signal_connect( G_OBJECT( value) , "value-changed" , G_CALLBACK( update_max_value ) , NULL);
cleanButton = gtk_button_new_from_stock( GTK_STOCK_CLEAR );
gtk_box_pack_end( GTK_BOX(historyBox) , cleanButton , FALSE , TRUE , 0);
g_signal_connect( G_OBJECT( cleanButton ) , "clicked" , G_CALLBACK( clean_history ) , NULL);
gtk_widget_show_all(ret);
......
......@@ -1201,7 +1201,7 @@ dbus_set_volume_controls( )
}
void
dbus_set_max_calls( const gdouble calls )
dbus_set_max_calls( const guint calls )
{
GError* error = NULL;
org_sflphone_SFLphone_ConfigurationManager_set_max_calls(
......@@ -1212,15 +1212,13 @@ dbus_set_max_calls( const gdouble calls )
{
g_error_free(error);
}
else
g_print("DBus called set_max_calls on ConfigurationManager\n");
}
gdouble
guint
dbus_get_max_calls( void )
{
GError* error = NULL;
gdouble calls;
guint calls;
org_sflphone_SFLphone_ConfigurationManager_get_max_calls(
configurationManagerProxy,
&calls,
......@@ -1229,8 +1227,7 @@ dbus_get_max_calls( void )
{
g_error_free(error);
}
else
g_print("DBus called get_max_calls on ConfigurationManager\n");
g_print("GET MAX CALLS = %i\n" , calls);
return calls;
}
......
......@@ -313,12 +313,12 @@ void dbus_start_hidden( void );
* ConfigurationManager - Gives the maximum number of calls the user wants to have in the history
* @return double The maximum number of calls
*/
gdouble dbus_get_max_calls( void );
guint dbus_get_max_calls( void );
/**
* ConfigurationManager - Gives the maximum number of calls the user wants to have in the history
*/
void dbus_set_max_calls( const gdouble calls );
void dbus_set_max_calls( const guint calls );
/**
* ConfigurationManager - Configure the start-up option
* @return int 1 if SFLphone should start in the system tray
......
......@@ -266,12 +266,12 @@ public:
};
static ::DBus::IntrospectedArgument getMaxCalls_args[] =
{
{ "calls", "d", false },
{ "calls", "i", false },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument setMaxCalls_args[] =
{
{ "calls", "d", true },
{ "calls", "i", true },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument startHidden_args[] =
......@@ -426,8 +426,8 @@ public:
virtual void setDialpad( ) = 0;
virtual ::DBus::Int32 getVolumeControls( ) = 0;
virtual void setVolumeControls( ) = 0;
virtual ::DBus::Double getMaxCalls( ) = 0;
virtual void setMaxCalls( const ::DBus::Double& calls ) = 0;
virtual ::DBus::Int32 getMaxCalls( ) = 0;
virtual void setMaxCalls( const ::DBus::Int32& calls ) = 0;
virtual void startHidden( ) = 0;
virtual ::DBus::Int32 isStartHidden( ) = 0;
virtual ::DBus::Int32 popupMode( ) = 0;
......@@ -840,7 +840,7 @@ private:
{
::DBus::MessageIter ri = call.reader();
::DBus::Double argout1 = getMaxCalls();
::DBus::Int32 argout1 = getMaxCalls();
::DBus::ReturnMessage reply(call);
::DBus::MessageIter wi = reply.writer();
wi << argout1;
......@@ -850,7 +850,7 @@ private:
{
::DBus::MessageIter ri = call.reader();
::DBus::Double argin1; ri >> argin1;
::DBus::Int32 argin1; ri >> argin1;
setMaxCalls(argin1);
::DBus::ReturnMessage reply(call);
return reply;
......
......@@ -167,11 +167,11 @@
</method>
<method name="getMaxCalls">
<arg type="d" name="calls" direction="out"/>
<arg type="i" name="calls" direction="out"/>
</method>
<method name="setMaxCalls">
<arg type="d" name="calls" direction="in"/>
<arg type="i" name="calls" direction="in"/>
</method>
<method name="startHidden">
......
......@@ -273,14 +273,14 @@ ConfigurationManager::setVolumeControls( void )
Manager::instance().setVolumeControls( );
}
::DBus::Double
::DBus::Int32
ConfigurationManager::getMaxCalls( void )
{
return Manager::instance().getMaxCalls( );
}
void
ConfigurationManager::setMaxCalls( const ::DBus::Double& calls )
ConfigurationManager::setMaxCalls( const ::DBus::Int32& calls )
{
Manager::instance().setMaxCalls( calls );
}
......
......@@ -77,8 +77,8 @@ public:
void setRingtoneChoice( const ::DBus::String& tone );
::DBus::Int32 getDialpad( void );
void setDialpad( void );
void setMaxCalls( const ::DBus::Double& calls);
::DBus::Double getMaxCalls( void );
void setMaxCalls( const ::DBus::Int32& calls);
::DBus::Int32 getMaxCalls( void );
::DBus::Int32 getVolumeControls( void );
void setVolumeControls( void );
::DBus::Int32 isStartHidden( void );
......
......@@ -1355,15 +1355,15 @@ ManagerImpl::switchPopupMode( void )
}
void
ManagerImpl::setMaxCalls( const double& calls )
ManagerImpl::setMaxCalls( const int& calls )
{
setConfig( PREFERENCES , CONFIG_HISTORY , (int)calls );
setConfig( PREFERENCES , CONFIG_HISTORY , calls );
}
double
int
ManagerImpl::getMaxCalls( void )
{
_debug("a;kvnsnblsb %i\n" , getConfigInt( PREFERENCES , CONFIG_HISTORY ));
_debug("Max calls = %i\n" , getConfigInt( PREFERENCES , CONFIG_HISTORY ));
return getConfigInt( PREFERENCES , CONFIG_HISTORY );
}
......
......@@ -484,13 +484,13 @@ class ManagerImpl {
* Set the maximum number of calls to keep in the history
* @param calls The number of calls
*/
void setMaxCalls( const double& calls );
void setMaxCalls( const int& calls );
/**
* Get the maximum number of calls to keep in the history
* @return double The number of calls
*/
double getMaxCalls( void );
int getMaxCalls( void );
/**
* Configure the start-up option
......@@ -506,7 +506,7 @@ class ManagerImpl {
void startHidden( void );
/**
* Configure the popup behaviour
Configure the popup behaviour
* @return int 1 if it should popup on incoming calls
* 0 if it should never popups
*/
......
Supports Markdown
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