Commit 25829fa8 authored by Emmanuel Milou's avatar Emmanuel Milou

Add general settings panel

Functionnalities added: dialpad preferences saved ( display or not at start-up )
			start hidden
parent 61c6dc0e
......@@ -1214,6 +1214,156 @@ org_sflphone_SFLphone_ConfigurationManager_is_iax2_enabled_async (DBusGProxy *pr
stuff->userdata = userdata;
return dbus_g_proxy_begin_call (proxy, "isIax2Enabled", org_sflphone_SFLphone_ConfigurationManager_is_iax2_enabled_async_callback, stuff, g_free, G_TYPE_INVALID);
}
static
#ifdef G_HAVE_INLINE
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_get_dialpad (DBusGProxy *proxy, gint* OUT_state, GError **error)
{
return dbus_g_proxy_call (proxy, "getDialpad", error, G_TYPE_INVALID, G_TYPE_INT, OUT_state, G_TYPE_INVALID);
}
typedef void (*org_sflphone_SFLphone_ConfigurationManager_get_dialpad_reply) (DBusGProxy *proxy, gint OUT_state, GError *error, gpointer userdata);
static void
org_sflphone_SFLphone_ConfigurationManager_get_dialpad_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
{
DBusGAsyncData *data = (DBusGAsyncData*) user_data;
GError *error = NULL;
gint OUT_state;
dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INT, &OUT_state, G_TYPE_INVALID);
(*(org_sflphone_SFLphone_ConfigurationManager_get_dialpad_reply)data->cb) (proxy, OUT_state, error, data->userdata);
return;
}
static
#ifdef G_HAVE_INLINE
inline
#endif
DBusGProxyCall*
org_sflphone_SFLphone_ConfigurationManager_get_dialpad_async (DBusGProxy *proxy, org_sflphone_SFLphone_ConfigurationManager_get_dialpad_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, "getDialpad", org_sflphone_SFLphone_ConfigurationManager_get_dialpad_async_callback, stuff, g_free, G_TYPE_INVALID);
}
static
#ifdef G_HAVE_INLINE
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_set_dialpad (DBusGProxy *proxy, GError **error)
{
return dbus_g_proxy_call (proxy, "setDialpad", error, G_TYPE_INVALID, G_TYPE_INVALID);
}
typedef void (*org_sflphone_SFLphone_ConfigurationManager_set_dialpad_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
static void
org_sflphone_SFLphone_ConfigurationManager_set_dialpad_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
{
DBusGAsyncData *data = (DBusGAsyncData*) user_data;
GError *error = NULL;
dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
(*(org_sflphone_SFLphone_ConfigurationManager_set_dialpad_reply)data->cb) (proxy, error, data->userdata);
return;
}
static
#ifdef G_HAVE_INLINE
inline
#endif
DBusGProxyCall*
org_sflphone_SFLphone_ConfigurationManager_set_dialpad_async (DBusGProxy *proxy, org_sflphone_SFLphone_ConfigurationManager_set_dialpad_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, "setDialpad", org_sflphone_SFLphone_ConfigurationManager_set_dialpad_async_callback, stuff, g_free, G_TYPE_INVALID);
}
static
#ifdef G_HAVE_INLINE
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_start_hidden (DBusGProxy *proxy, GError **error)
{
return dbus_g_proxy_call (proxy, "startHidden", error, G_TYPE_INVALID, G_TYPE_INVALID);
}
typedef void (*org_sflphone_SFLphone_ConfigurationManager_start_hidden_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
static void
org_sflphone_SFLphone_ConfigurationManager_start_hidden_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
{
DBusGAsyncData *data = (DBusGAsyncData*) user_data;
GError *error = NULL;
dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
(*(org_sflphone_SFLphone_ConfigurationManager_start_hidden_reply)data->cb) (proxy, error, data->userdata);
return;
}
static
#ifdef G_HAVE_INLINE
inline
#endif
DBusGProxyCall*
org_sflphone_SFLphone_ConfigurationManager_start_hidden_async (DBusGProxy *proxy, org_sflphone_SFLphone_ConfigurationManager_start_hidden_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, "startHidden", org_sflphone_SFLphone_ConfigurationManager_start_hidden_async_callback, stuff, g_free, G_TYPE_INVALID);
}
static
#ifdef G_HAVE_INLINE
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_is_start_hidden (DBusGProxy *proxy, gint* OUT_state, GError **error)
{
return dbus_g_proxy_call (proxy, "isStartHidden", error, G_TYPE_INVALID, G_TYPE_INT, OUT_state, G_TYPE_INVALID);
}
typedef void (*org_sflphone_SFLphone_ConfigurationManager_is_start_hidden_reply) (DBusGProxy *proxy, gint OUT_state, GError *error, gpointer userdata);
static void
org_sflphone_SFLphone_ConfigurationManager_is_start_hidden_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
{
DBusGAsyncData *data = (DBusGAsyncData*) user_data;
GError *error = NULL;
gint OUT_state;
dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INT, &OUT_state, G_TYPE_INVALID);
(*(org_sflphone_SFLphone_ConfigurationManager_is_start_hidden_reply)data->cb) (proxy, OUT_state, error, data->userdata);
return;
}
static
#ifdef G_HAVE_INLINE
inline
#endif
DBusGProxyCall*
org_sflphone_SFLphone_ConfigurationManager_is_start_hidden_async (DBusGProxy *proxy, org_sflphone_SFLphone_ConfigurationManager_is_start_hidden_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, "isStartHidden", org_sflphone_SFLphone_ConfigurationManager_is_start_hidden_async_callback, stuff, g_free, G_TYPE_INVALID);
}
#endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_org_sflphone_SFLphone_ConfigurationManager */
G_END_DECLS
......@@ -500,6 +500,12 @@ is_ringtone_enabled( void )
return res;
}
void
start_hidden( void )
{
dbus_start_hidden();
}
void
ringtone_enabled( void )
{
......@@ -1071,9 +1077,9 @@ create_audio_tab ()
GtkWidget* box = gtk_hbox_new( TRUE , 1);
gtk_box_pack_start( GTK_BOX(ret) , box , FALSE , FALSE , 1);
enableTone = gtk_check_button_new_with_mnemonic( _("_Enable ringtones"));
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableTone), dbus_is_ringtone_enabled() );
gtk_box_pack_start( GTK_BOX(box) , enableTone , TRUE , TRUE , 1);
g_signal_connect(G_OBJECT( enableTone) , "clicked" , G_CALLBACK( ringtone_enabled ) , NULL);
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableTone), dbus_is_ringtone_enabled() );
gtk_box_pack_start( GTK_BOX(box) , enableTone , TRUE , TRUE , 1);
g_signal_connect(G_OBJECT( enableTone) , "clicked" , G_CALLBACK( ringtone_enabled ) , NULL);
// file chooser button
fileChooser = gtk_file_chooser_button_new(_("Choose a ringtone"), GTK_FILE_CHOOSER_ACTION_OPEN);
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER( fileChooser) , g_get_home_dir());
......@@ -1093,6 +1099,83 @@ create_audio_tab ()
return ret;
}
GtkWidget*
create_general_settings ()
{
GtkWidget *ret;
GtkWidget *notifFrame;
GtkWidget *notifBox;
GtkWidget *notifAll;
GtkWidget *notifIncoming;
GtkWidget *notifMails;
GtkWidget *trayFrame;
GtkWidget *trayBox;
GtkWidget *trayItem;
GtkWidget *dialFrame;
GtkWidget *dialBox;
GtkWidget *dialItem;
// Main widget
ret = gtk_vbox_new(FALSE, 10);
gtk_container_set_border_width(GTK_CONTAINER(ret), 10);
// Notifications Frame
notifFrame = gtk_frame_new(_("Notifications"));
gtk_box_pack_start(GTK_BOX(ret), notifFrame, FALSE, FALSE, 0);
gtk_widget_show( notifFrame );
notifBox = gtk_vbox_new(FALSE, 10);
gtk_box_pack_start(GTK_BOX(notifFrame), notifBox, FALSE, FALSE, 0);
gtk_widget_show( notifBox );
gtk_container_add( GTK_CONTAINER(notifFrame) , notifBox);
notifAll = gtk_radio_button_new_with_label( NULL, _("Enable All"));
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(notifAll), TRUE );
gtk_box_pack_start( GTK_BOX(notifBox) , notifAll , TRUE , TRUE , 1);
//TODO callback
notifIncoming = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON(notifAll) , _("Only Incoming Calls"));
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(notifIncoming), FALSE );
gtk_box_pack_start( GTK_BOX(notifBox) , notifIncoming , TRUE , TRUE , 1);
//TODO callback
notifMails = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON(notifAll) , _("Only Voice Mails"));
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(notifMails), FALSE );
gtk_box_pack_start( GTK_BOX(notifBox) , notifMails , TRUE , TRUE , 1);
//TODO callback
// System Tray option frame
trayFrame = gtk_frame_new(_("System Tray Icon"));
gtk_box_pack_start(GTK_BOX(ret), trayFrame, FALSE, FALSE, 0);
gtk_widget_show( trayFrame );
trayBox = gtk_vbox_new(FALSE, 10);
gtk_box_pack_start(GTK_BOX(trayFrame), trayBox, FALSE, FALSE, 0);
gtk_widget_show( trayBox );
gtk_container_add( GTK_CONTAINER(trayFrame) , trayBox);
trayItem = gtk_check_button_new_with_label(_("Start Hidden"));
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(trayItem), dbus_is_start_hidden() );
gtk_box_pack_start( GTK_BOX(trayBox) , trayItem , TRUE , TRUE , 1);
g_signal_connect(G_OBJECT( trayItem ) , "clicked" , G_CALLBACK( start_hidden ) , NULL);
GtkWidget* trayItem1 = gtk_radio_button_new_with_label(NULL, _("Popup Main Window On Incoming Call"));
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(trayItem1), TRUE );
gtk_box_pack_start( GTK_BOX(trayBox) , trayItem1 , TRUE , TRUE , 1);
//TODO callback
trayItem = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(trayItem1), _("Never Popup Main Window"));
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(trayItem), TRUE );
gtk_box_pack_start( GTK_BOX(trayBox) , trayItem , TRUE , TRUE , 1);
//TODO callback
gtk_widget_show_all(ret);
return ret;
}
/**
* Show configuration window with tabs
*/
......@@ -1123,10 +1206,10 @@ show_config_window ()
gtk_container_set_border_width(GTK_CONTAINER(notebook), 10);
gtk_widget_show(notebook);
// Accounts tab
//tab = create_accounts_tab();
//gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Accounts")));
//gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab);
// General settings tab
tab = create_general_settings();
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("General Settings")));
gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab);
// Audio tab
tab = create_audio_tab();
......
......@@ -1186,3 +1186,74 @@ dbus_is_iax2_enabled()
g_print("DBus called is_iax2_enabled() on ConfigurationManager\n");
return res;
}
int
dbus_get_dialpad()
{
int state;
GError* error = NULL;
org_sflphone_SFLphone_ConfigurationManager_get_dialpad(
configurationManagerProxy,
&state,
&error);
g_print("After");
if(error)
{
g_error_free(error);
}
else
g_print("DBus called get_dialpad on ConfigurationManager\n");
return state;
}
void
dbus_set_dialpad( )
{
GError* error = NULL;
org_sflphone_SFLphone_ConfigurationManager_set_dialpad(
configurationManagerProxy,
&error);
g_print("After");
if(error)
{
g_error_free(error);
}
else
g_print("DBus called set_dialpad on ConfigurationManager\n");
}
void
dbus_start_hidden( void )
{
GError* error = NULL;
org_sflphone_SFLphone_ConfigurationManager_start_hidden(
configurationManagerProxy,
&error);
g_print("After");
if(error)
{
g_error_free(error);
}
else
g_print("DBus called start_hidden on ConfigurationManager\n");
}
int
dbus_is_start_hidden( void )
{
GError* error = NULL;
int state;
org_sflphone_SFLphone_ConfigurationManager_is_start_hidden(
configurationManagerProxy,
&state,
&error);
g_print("After");
if(error)
{
g_error_free(error);
}
else
g_print("DBus called start_hidden on ConfigurationManager\n");
return state;
}
......@@ -79,6 +79,10 @@ int dbus_is_ringtone_enabled( void );
void dbus_ringtone_enabled( void );
gchar* dbus_get_ringtone_choice( void );
void dbus_set_ringtone_choice( const gchar* tone );
void dbus_set_dialpad( );
int dbus_get_dialpad( void );
void dbus_start_hidden( void );
int dbus_is_start_hidden( void );
/* Instance */
void dbus_register( int pid, gchar * name);
......
......@@ -49,6 +49,12 @@ There is NO WARRANTY, to the extent permitted by law.\n\n");
show_status_icon();
create_main_window ();
if( dbus_is_start_hidden() )
{
gtk_widget_hide(GTK_WIDGET( get_main_window() ));
set_minimized( TRUE );
}
/* start the main loop */
gtk_main ();
}
......
......@@ -169,7 +169,6 @@ static void
call_minimize ( void * foo)
{
gtk_widget_hide(GTK_WIDGET( get_main_window() ));
set_minimized( TRUE );
}
......@@ -464,10 +463,11 @@ create_edit_menu()
}
/* ----------------------------------------------------------------- */
static void
view_dial_pad (GtkCheckMenuItem *checkmenuitem,
view_dialpad (GtkCheckMenuItem *checkmenuitem,
void* foo)
{
main_window_dialpad(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkmenuitem)));
dbus_set_dialpad(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkmenuitem)));
}
GtkWidget *
......@@ -482,20 +482,17 @@ create_view_menu()
menu = gtk_menu_new ();
menu_items = gtk_check_menu_item_new_with_mnemonic (_("_Dialpad"));
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM ( menu_items ), TRUE);
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM ( menu_items ), dbus_get_dialpad());
main_window_dialpad(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menu_items)));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
g_signal_connect(G_OBJECT (menu_items), "toggled",
G_CALLBACK (view_dial_pad),
G_CALLBACK (view_dialpad),
NULL);
gtk_widget_show (menu_items);
menu_items = gtk_check_menu_item_new_with_mnemonic (_("_Volume controls"));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
gtk_widget_set_sensitive( GTK_WIDGET(menu_items), FALSE);
g_signal_connect(G_OBJECT (menu_items), "toggled",
G_CALLBACK (view_dial_pad),
NULL);
gtk_widget_show (menu_items);
menu_items = gtk_menu_item_new_with_mnemonic(_("_Toolbar"));
......
......@@ -52,6 +52,10 @@ public:
register_method(ConfigurationManager, getAudioDeviceIndex, _getAudioDeviceIndex_stub);
register_method(ConfigurationManager, getCurrentAudioOutputPlugin, _getCurrentAudioOutputPlugin_stub);
register_method(ConfigurationManager, isIax2Enabled, _isIax2Enabled_stub);
register_method(ConfigurationManager, getDialpad, _getDialpad_stub);
register_method(ConfigurationManager, setDialpad, _setDialpad_stub);
register_method(ConfigurationManager, startHidden, _startHidden_stub);
register_method(ConfigurationManager, isStartHidden, _isStartHidden_stub);
}
::DBus::IntrospectedInterface* const introspect() const
......@@ -219,6 +223,24 @@ public:
{ "res", "i", false },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument getDialpad_args[] =
{
{ "state", "i", false },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument setDialpad_args[] =
{
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument startHidden_args[] =
{
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument isStartHidden_args[] =
{
{ "state", "i", false },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument parametersChanged_args[] =
{
{ "list", "a{ss}", false },
......@@ -267,6 +289,10 @@ public:
{ "getAudioDeviceIndex", getAudioDeviceIndex_args },
{ "getCurrentAudioOutputPlugin", getCurrentAudioOutputPlugin_args },
{ "isIax2Enabled", isIax2Enabled_args },
{ "getDialpad", getDialpad_args },
{ "setDialpad", setDialpad_args },
{ "startHidden", startHidden_args },
{ "isStartHidden", isStartHidden_args },
{ 0, 0 }
};
static ::DBus::IntrospectedMethod ConfigurationManager_signals[] =
......@@ -333,6 +359,10 @@ public:
virtual ::DBus::Int32 getAudioDeviceIndex( const ::DBus::String& name ) = 0;
virtual ::DBus::String getCurrentAudioOutputPlugin( ) = 0;
virtual ::DBus::Int32 isIax2Enabled( ) = 0;
virtual ::DBus::Int32 getDialpad( ) = 0;
virtual void setDialpad( ) = 0;
virtual void startHidden( ) = 0;
virtual ::DBus::Int32 isStartHidden( ) = 0;
public:
......@@ -674,6 +704,42 @@ private:
wi << argout1;
return reply;
}
::DBus::Message _getDialpad_stub( const ::DBus::CallMessage& call )
{
::DBus::MessageIter ri = call.reader();
::DBus::Int32 argout1 = getDialpad();
::DBus::ReturnMessage reply(call);
::DBus::MessageIter wi = reply.writer();
wi << argout1;
return reply;
}
::DBus::Message _setDialpad_stub( const ::DBus::CallMessage& call )
{
::DBus::MessageIter ri = call.reader();
setDialpad();
::DBus::ReturnMessage reply(call);
return reply;
}
::DBus::Message _startHidden_stub( const ::DBus::CallMessage& call )
{
::DBus::MessageIter ri = call.reader();
startHidden();
::DBus::ReturnMessage reply(call);
return reply;
}
::DBus::Message _isStartHidden_stub( const ::DBus::CallMessage& call )
{
::DBus::MessageIter ri = call.reader();
::DBus::Int32 argout1 = isStartHidden();
::DBus::ReturnMessage reply(call);
::DBus::MessageIter wi = reply.writer();
wi << argout1;
return reply;
}
};
} } }
......
......@@ -141,6 +141,20 @@
<arg type="i" name="res" direction="out"/>
</method>
<method name="getDialpad">
<arg type="i" name="state" direction="out"/>
</method>
<method name="setDialpad">
</method>
<method name="startHidden">
</method>
<method name="isStartHidden">
<arg type="i" name="state" direction="out"/>
</method>
<!-- ///////////////////////////// -->
<signal name="parametersChanged">
<arg type="a{ss}" name="list" direction="out"/>
......
......@@ -261,3 +261,28 @@ ConfigurationManager::setRingtoneChoice( const ::DBus::String& tone )
Manager::instance().setRingtoneChoice( tone );
}
::DBus::Int32
ConfigurationManager::getDialpad( void )
{
return Manager::instance().getDialpad( );
}
void
ConfigurationManager::setDialpad( void )
{
Manager::instance().setDialpad( );
}
void
ConfigurationManager::startHidden( void )
{
Manager::instance().startHidden( );
}
::DBus::Int32
ConfigurationManager::isStartHidden( void )
{
return Manager::instance().isStartHidden( );
}
......@@ -76,6 +76,11 @@ public:
void ringtoneEnabled( void );
::DBus::String getRingtoneChoice( void );
void setRingtoneChoice( const ::DBus::String& tone );
::DBus::Int32 getDialpad( void );
void setDialpad( void );
::DBus::Int32 isStartHidden( void );
void startHidden( void );
};
......
......@@ -109,6 +109,8 @@ typedef short int16;
#define SPEEX_STRING_DESCRIPTION "speex"
#define ILBC_STRING_DESCRIPTION "ilbc"
#define RINGTONE_ENABLED 1
#define DISPLAY_DIALPAD 1
#define START_HIDDEN 1
#define ERROR_ALSA_CAPTURE_DEVICE 0
#define ERROR_ALSA_PLAYBACK_DEVICE 1
......
......@@ -1098,6 +1098,8 @@ ManagerImpl::initConfigFile (void)
fill_config_str(VOICEMAIL_NUM, DFT_VOICEMAIL);
fill_config_int(CONFIG_ZEROCONF, CONFIG_