diff --git a/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml b/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml index e7532d16cb2d161e29d042941a59fffd0d49ae1b..fa1433399af895a581321d58aeb5bdf6034291ba 100644 --- a/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml +++ b/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml @@ -4,12 +4,78 @@ <!-- Accounts-related methods --> <method name="getAccountDetails"> + <!--* Method that returns a hashtable containing the current + account configuration setting. + + CONFIG_ACCOUNT_ENABLE + CONFIG_ACCOUNT_RESOLVE_ONCE + CONFIG_ACCOUNT_TYPE + HOSTNAME + USERNAME + PASSWORD + REALM + AUTHENTICATION_USERNAME + CONFIG_ACCOUNT_MAILBOX + CONFIG_ACCOUNT_REGISTRATION_EXPIRE + LOCAL_INTERFACE + PUBLISHED_SAMEAS_LOCAL + PUBLISHED_ADDRESS + LOCAL_PORT + PUBLISHED_PORT + DISPLAY_NAME + STUN_ENABLE + STUN_SERVER + + REGISTRATION_STATUS + REGISTRATION_STATE_CODE + REGISTRATION_STATE_DESCRIPTION + SRTP_KEY_EXCHANGE + SRTP_ENABLE + + SRTP_RTP_FALLBACK + ZRTP_DISPLAY_SAS + ZRTP_DISPLAY_SAS_ONCE + ZRTP_HELLO_HASH + ZRTP_NOT_SUPP_WARNING + + TLS_LISTENER_PORT + TLS_ENABLE + TLS_CA_LIST_FILE + TLS_CERTIFICATE_FILE + TLS_PRIVATE_KEY_FILE + + TLS_METHOD + TLS_CIPHERS + TLS_SERVER_NAME + TLS_VERIFY_SERVER + TLS_VERIFY_CLIENT + TLS_REQUIRE_CLIENT_CERTIFICATE + TLS_NEGOTIATION_TIMEOUT_SEC + TLS_NEGOTIATION_TIMEOUT_MSEC + + + @param[in] input accountID + @param[out] output details + --> <arg type="s" name="accountID" direction="in"/> <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapStringString"/> <arg type="a{ss}" name="details" direction="out"/> </method> <method name="setAccountDetails"> + <!--* Modify the current accout parameter settings given an + accountID and a hash table containing the parameters to + update. The hash table is not required to be complete, + only the parameter to change may be specified. Only the + running parameters are updated dynamically, configuration + settings are stored in the configuration file when + SFLphone-daemon quit. + + For a complete list of account settings refer to getAccountDetails + + @param[in] input accountID + @param[in] input details + --> <annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="MapStringString"/> <arg type="s" name="accountID" direction="in"/> <arg type="a{ss}" name="details" direction="in"/> @@ -26,15 +92,59 @@ <arg type="i" name="number" direction="in"/> </method> - <method name="deleteAllCredential"> - <arg type="s" name="accountID" direction="in"/> + <method name="deleteAllCredential"> + <arg type="s" name="accountID" direction="in"/> </method> <method name="getIp2IpDetails"> + <!--* Specific call to get configuration settings of the + IP2IP_PROFILE. Which are sligthly different since no VoIP + Account parameters are envolved. + + ACCOUNT_ID + SRTP_KEY_EXCHANGE + SRTP_ENABLE + SRTP_RTP_FALLBACK + ZRTP_DISPLAY_SAS + ZRTP_HELLO_HASH + ZRTP_NOT_SUPP_WARNING + ZRTP_DISPLAY_SAS_ONCE + LOCAL_INTERFACE + LOCAL_PORT + + TLS_LISTENER_PORT + TLS_CA_LIST_FILE + TLS_CERTIFICATE_FILE + TLS_PRIVATE_KEY_FILE + TLS_PASSWORD + TLS_METHOD + TLS_CIPHERS + TLS_SERVER_NAME + TLS_VERIFY_SERVER + TLS_VERIFY_CLIENT + TLS_REQUIRE_CLIENT_CERTIFICATE + TLS_NEGOTIATION_TIMEOUT_SEC + TLS_NEGOTIATION_TIMEOUT_MSEC + + @param[in] input accountID + @param[out] output details + --> <arg type="a{ss}" name="details" direction="out"/> </method> <method name="setIp2IpDetails"> + <!--* Modify the IP2IP_PROFILE parameter settings a hash table + containing the parameters to update. The hash table is not required to be complete, + only the parameters to be modified may be specified. Also, + only the running configuration is updated dynamically, + settings are stored in the configuration file when + SFLphone-daemon quit. + + For a complete list of account settings refer to getAccountDetails + + @param[in] input accountID + @param[in] input details + --> <arg type="a{ss}" name="details" direction="in"/> </method> @@ -50,25 +160,50 @@ </method> <method name="addAccount"> + <!--* Add a new account to the SFLphone-daemon list. If no + details are specified, default parameters are used. + + @param[in] input details + @param[out] output accountID + --> <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="MapStringString"/> <arg type="a{ss}" name="details" direction="in"/> <arg type="s" name="createdAccountId" direction="out"/> </method> <method name="setAccountsOrder"> + <!--* Update the account list given a new list of accountID. If no account is specified + for a call, the first one in the list will be used. + + @param[in] input order + --> <arg type="s" name="order" direction="in"/> </method> <method name="removeAccount"> + <!--* Delete an account from SFLphone-daemon list and erase + account parameters from configuration file. + + @param[in] input accountID + --> <arg type="s" name="accoundID" direction="in"/> </method> <method name="getAccountList"> + <!--* Get teh accountlist as stored in SFLphone-daemon. + + @param[in] input accountID + --> <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/> <arg type="as" name="list" direction="out"/> </method> <method name="sendRegister"> + <!--* Send accout registration request to PBX server. Register + the account if expire=1, unregister if expire=0. + + @param[in] input accountID + --> <arg type="s" name="accountID" direction="in"/> <arg type="i" name="expire" direction="in"/> </method> @@ -292,7 +427,38 @@ <method name="switchPopupMode"> </method> + <method name="getWindowWidth"> + <arg type="i" name="width" direction="out"/> + </method> + + <method name="getWindowHeight"> + <arg type="i" name="height" direction="out"/> + </method> + <method name="setWindowWidth"> + <arg type="i" name="width" direction="in"/> + </method> + + <method name="setWindowHeight"> + <arg type="i" name="height" direction="in"/> + </method> + + <method name="getWindowPositionX"> + <arg type="i" name="posX" direction="out"/> + </method> + + <method name="setWindowPositionX"> + <arg type="i" name="posX" direction="in"/> + </method> + + <method name="getWindowPositionY"> + <arg type="i" name="posY" direction="out"/> + </method> + + <method name="setWindowPositionY"> + <arg type="i" name="posY" direction="in"/> + </method> + <!-- Addressbook configuration --> <method name="getAddressbookSettings"> <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapStringInt"/> diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index beb94b54daccc701bcc86f90f80bbcd5b439286e..3d2c6fe829c3be7d1ad7ce261d1d8ac8893c5b75 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -2464,3 +2464,115 @@ gchar ** dbus_get_all_ip_interface_by_name(void) } } +guint dbus_get_window_width (void) { + + GError *error = NULL; + guint value; + + org_sflphone_SFLphone_ConfigurationManager_get_window_width (configurationManagerProxy, &value, &error); + + if (error != NULL) { + ERROR ("Failed to call get_window_width() on ConfigurationManager: %s", + error->message); + g_error_free (error); + } + return value; +} + +guint dbus_get_window_height (void) { + + GError *error = NULL; + guint value; + + org_sflphone_SFLphone_ConfigurationManager_get_window_height (configurationManagerProxy, &value, &error); + + if (error != NULL) { + ERROR ("Failed to call get_window_height() on ConfigurationManager: %s", + error->message); + g_error_free (error); + } + return value; +} + +void dbus_set_window_width (const guint width) { + + GError *error = NULL; + + org_sflphone_SFLphone_ConfigurationManager_set_window_width (configurationManagerProxy, width, &error); + + if (error != NULL) { + ERROR ("Failed to call set_window_width() on ConfigurationManager: %s", + error->message); + g_error_free (error); + } +} + + +void dbus_set_window_height (const guint height) { + + GError *error = NULL; + + org_sflphone_SFLphone_ConfigurationManager_set_window_height (configurationManagerProxy, height, &error); + + if (error != NULL) { + ERROR ("Failed to call set_window_height() on ConfigurationManager: %s", + error->message); + g_error_free (error); + } +} + +guint dbus_get_window_position_x (void) { + + GError *error = NULL; + guint value; + + org_sflphone_SFLphone_ConfigurationManager_get_window_position_x (configurationManagerProxy, &value, &error); + + if (error != NULL) { + ERROR ("Failed to call get_window_position_x() on ConfigurationManager: %s", + error->message); + g_error_free (error); + } + return value; +} + +guint dbus_get_window_position_y (void) { + + GError *error = NULL; + guint value; + + org_sflphone_SFLphone_ConfigurationManager_get_window_position_y (configurationManagerProxy, &value, &error); + + if (error != NULL) { + ERROR ("Failed to call get_window_position_y() on ConfigurationManager: %s", + error->message); + g_error_free (error); + } + return value; +} + +void dbus_set_window_position_x (const guint posx) { + + GError *error = NULL; + + org_sflphone_SFLphone_ConfigurationManager_set_window_position_x (configurationManagerProxy, posx, &error); + + if (error != NULL) { + ERROR ("Failed to call set_window_position_x() on ConfigurationManager: %s", + error->message); + g_error_free (error); + } +} + +void dbus_set_window_position_y (const guint posy) { + + GError *error = NULL; + + org_sflphone_SFLphone_ConfigurationManager_set_window_position_y (configurationManagerProxy, posy, &error); + + if (error != NULL) { + ERROR ("Failed to call set_window_position_y() on ConfigurationManager: %s", + error->message); + g_error_free (error); + } +} diff --git a/sflphone-client-gnome/src/dbus/dbus.h b/sflphone-client-gnome/src/dbus/dbus.h index d4c7b8a2aafa875f647e665db4c07eea02389aee..acc961fba44646e42b5cad4e33b9646bc56e5160 100644 --- a/sflphone-client-gnome/src/dbus/dbus.h +++ b/sflphone-client-gnome/src/dbus/dbus.h @@ -597,5 +597,14 @@ gchar** dbus_get_supported_tls_method(); gchar** dbus_get_participant_list (const char * confID); +guint dbus_get_window_width (void); +guint dbus_get_window_height (void); +void dbus_set_window_height (const guint height); +void dbus_set_window_width (const guint width); +guint dbus_get_window_position_x (void); +guint dbus_get_window_position_y (void); +void dbus_set_window_position_x (const guint posx); +void dbus_set_window_position_y (const guint posy); + #endif diff --git a/sflphone-client-gnome/src/mainwindow.c b/sflphone-client-gnome/src/mainwindow.c index 8218938509eddeb310adac4d2670abdd0eaa3b67..6138e7c6373c6ff762098cfd9d998d8da25ccc40 100644 --- a/sflphone-client-gnome/src/mainwindow.c +++ b/sflphone-client-gnome/src/mainwindow.c @@ -47,6 +47,21 @@ GtkWidget * statusBar = NULL; GtkWidget * filterEntry = NULL; PidginScrollBook *embedded_error_notebook; +static gboolean window_configure_cb (GtkWidget *win, GdkEventConfigure *event) { + + int pos_x, pos_y; + + dbus_set_window_width ( (guint)event->width); + dbus_set_window_height ( (guint)event->height); + + gtk_window_get_position (GTK_WINDOW (window), &pos_x, &pos_y); + dbus_set_window_position_x ( (guint)pos_x); + dbus_set_window_position_y ( (guint)pos_y); + + return FALSE; +} + + /** * Minimize the main window. */ @@ -148,21 +163,25 @@ create_main_window () GError *error = NULL; gboolean ret; const char *window_title = "SFLphone VoIP Client"; + int width, height, position_x, position_y; focus_is_on_calltree = FALSE; focus_is_on_searchbar = FALSE; + // Get configuration stored + width = dbus_get_window_width (); + height = dbus_get_window_height (); + position_x = dbus_get_window_position_x (); + position_y = dbus_get_window_position_y (); + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (window), 0); gtk_window_set_title (GTK_WINDOW (window), window_title); - gtk_window_set_default_size (GTK_WINDOW (window), MAIN_WINDOW_WIDTH, MAIN_WINDOW_HEIGHT); + gtk_window_set_default_size (GTK_WINDOW (window), width, height); gtk_window_set_default_icon_from_file (LOGO, NULL); gtk_window_set_position( GTK_WINDOW( window ) , GTK_WIN_POS_MOUSE); - // GTK_WIDGET_SET_FLAGS (GTK_WIDGET(window),GTK_CAN_FOCUS); - // gtk_widget_grab_focus (GTK_WIDGET(window)); - /* Connect the destroy event of the window with our on_destroy function * When the window is about to be destroyed we get a notificaiton and * stop the main GTK loop @@ -179,6 +198,8 @@ create_main_window () g_signal_connect_after (G_OBJECT (window), "focus-out-event", G_CALLBACK (focus_on_mainwindow_out), NULL); + g_signal_connect_object (G_OBJECT (window), "configure-event", + G_CALLBACK (window_configure_cb), NULL, 0); gtk_widget_set_name (window, "mainwindow"); @@ -270,6 +291,9 @@ create_main_window () } #endif } + + // Move the main window + gtk_window_move (GTK_WINDOW (window), position_x, position_y); } GtkAccelGroup * diff --git a/sflphone-common/src/dbus/configurationmanager-introspec.xml b/sflphone-common/src/dbus/configurationmanager-introspec.xml index 944cf9f685ca044a59e91543d4da3fbc7a1d1b8d..fa1433399af895a581321d58aeb5bdf6034291ba 100644 --- a/sflphone-common/src/dbus/configurationmanager-introspec.xml +++ b/sflphone-common/src/dbus/configurationmanager-introspec.xml @@ -427,7 +427,38 @@ <method name="switchPopupMode"> </method> + <method name="getWindowWidth"> + <arg type="i" name="width" direction="out"/> + </method> + <method name="getWindowHeight"> + <arg type="i" name="height" direction="out"/> + </method> + + <method name="setWindowWidth"> + <arg type="i" name="width" direction="in"/> + </method> + + <method name="setWindowHeight"> + <arg type="i" name="height" direction="in"/> + </method> + + <method name="getWindowPositionX"> + <arg type="i" name="posX" direction="out"/> + </method> + + <method name="setWindowPositionX"> + <arg type="i" name="posX" direction="in"/> + </method> + + <method name="getWindowPositionY"> + <arg type="i" name="posY" direction="out"/> + </method> + + <method name="setWindowPositionY"> + <arg type="i" name="posY" direction="in"/> + </method> + <!-- Addressbook configuration --> <method name="getAddressbookSettings"> <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapStringInt"/> diff --git a/sflphone-common/src/dbus/configurationmanager.cpp b/sflphone-common/src/dbus/configurationmanager.cpp index 7575cc36764dd9e17fefb676520900b28fde9563..797dcc7a5b319d04daf5975188fbfd373e8d95b5 100644 --- a/sflphone-common/src/dbus/configurationmanager.cpp +++ b/sflphone-common/src/dbus/configurationmanager.cpp @@ -828,3 +828,45 @@ std::vector<std::string> ConfigurationManager::getAllIpInterfaceByName(void) return vector; } + +int32_t ConfigurationManager::getWindowWidth (void) { + + return Manager::instance ().getConfigInt (PREFERENCES, WINDOW_WIDTH); +} + +int32_t ConfigurationManager::getWindowHeight (void) { + + return Manager::instance ().getConfigInt (PREFERENCES, WINDOW_HEIGHT); +} + +void ConfigurationManager::setWindowWidth (const int32_t& width) { + + Manager::instance ().setConfig (PREFERENCES, WINDOW_WIDTH, width); +} + +void ConfigurationManager::setWindowHeight (const int32_t& height){ + + Manager::instance ().setConfig (PREFERENCES, WINDOW_HEIGHT, height); +} + +int32_t ConfigurationManager::getWindowPositionX (void) { + + return Manager::instance ().getConfigInt (PREFERENCES, WINDOW_POSITION_X); +} + +int32_t ConfigurationManager::getWindowPositionY (void) { + + return Manager::instance ().getConfigInt (PREFERENCES, WINDOW_POSITION_Y); +} + +void ConfigurationManager::setWindowPositionX (const int32_t& posX) { + + Manager::instance ().setConfig (PREFERENCES, WINDOW_POSITION_X, posX); +} + +void ConfigurationManager::setWindowPositionY (const int32_t& posY) { + + Manager::instance ().setConfig (PREFERENCES, WINDOW_POSITION_Y, posY); +} + + diff --git a/sflphone-common/src/dbus/configurationmanager.h b/sflphone-common/src/dbus/configurationmanager.h index b4cfbc4dc4fa7a640b6ffb314d33779be6eb00b1..7749fd233ad4fc6073a5564b3feb63800a28c3ca 100644 --- a/sflphone-common/src/dbus/configurationmanager.h +++ b/sflphone-common/src/dbus/configurationmanager.h @@ -114,6 +114,15 @@ public: int32_t getMailNotify( void ); void setMailNotify( void ); + int32_t getWindowWidth (void); + int32_t getWindowHeight (void); + void setWindowWidth (const int32_t& width); + void setWindowHeight (const int32_t& height); + int32_t getWindowPositionX (void); + int32_t getWindowPositionY (void); + void setWindowPositionX (const int32_t& posX); + void setWindowPositionY (const int32_t& posY); + std::map<std::string, int32_t> getAddressbookSettings (void); void setAddressbookSettings (const std::map<std::string, int32_t>& settings); std::vector< std::string > getAddressbookList ( void ); diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 501e490911ca9bc663f13093be4ea85d4b97310f..e63a43d0e9f43e3de27ba6e8cf05861611b25f47 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -2317,6 +2317,10 @@ ManagerImpl::initConfigFile (bool load_user_value, std::string alternate) _config.addDefaultValue (std::pair<std::string, std::string> (CONFIG_SIP_PORT, DFT_SIP_PORT), PREFERENCES); _config.addDefaultValue (std::pair<std::string, std::string> (CONFIG_ACCOUNTS_ORDER, EMPTY_FIELD), PREFERENCES); _config.addDefaultValue (std::pair<std::string, std::string> (CONFIG_MD5HASH, FALSE_STR), PREFERENCES); + _config.addDefaultValue (std::pair<std::string, std::string> (WINDOW_WIDTH, DFT_WINDOW_WIDTH), PREFERENCES); + _config.addDefaultValue (std::pair<std::string, std::string> (WINDOW_HEIGHT, DFT_WINDOW_HEIGHT), PREFERENCES); + _config.addDefaultValue (std::pair<std::string, std::string> (WINDOW_POSITION_X, "0"), PREFERENCES); + _config.addDefaultValue (std::pair<std::string, std::string> (WINDOW_POSITION_Y, "0"), PREFERENCES); // Addressbook settings _config.addDefaultValue (std::pair<std::string, std::string> (ADDRESSBOOK_ENABLE, TRUE_STR), ADDRESSBOOK); diff --git a/sflphone-common/src/user_cfg.h b/sflphone-common/src/user_cfg.h index 652027dc7481634f47d04c5d084c446627a90e37..eb7c3750ee0154a752d419309ea9753197193bf7 100644 --- a/sflphone-common/src/user_cfg.h +++ b/sflphone-common/src/user_cfg.h @@ -60,6 +60,10 @@ #define CONFIG_PA_VOLUME_CTRL "Pulseaudio.volumeCtrl" /** Whether or not PA should modify volume of other applications on the same sink */ #define CONFIG_SIP_PORT "SIP.portNum" #define CONFIG_ACCOUNTS_ORDER "Accounts.order" /** To restore account order */ +#define WINDOW_WIDTH "Window.width" +#define WINDOW_HEIGHT "Window.height" +#define WINDOW_POSITION_X "Window.positionX" +#define WINDOW_POSITION_Y "Window.positionY" #define IP2IP_PROFILE "IP2IP" #define SIGNALISATION "VoIPLink" /** Section Signalisation */ @@ -110,5 +114,7 @@ #define DFT_SIP_PORT "5060" #define DFT_STUN_ENABLE FALSE_STR #define DFT_RECORD_PATH HOMEDIR +#define DFT_WINDOW_WIDTH "240" +#define DFT_WINDOW_HEIGHT "320" #endif // __USER_CFG_H__