Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
8be3aa43
Commit
8be3aa43
authored
Sep 27, 2007
by
Pierre-Luc Beaudoin
Browse files
Add account
parent
c402fc49
Changes
7
Hide whitespace changes
Inline
Side-by-side
sflphone-gtk/src/accountlist.h
View file @
8be3aa43
...
...
@@ -62,7 +62,8 @@ typedef enum
*/
typedef
struct
{
gchar
*
accountID
;
account_state_t
state
;
GHashTable
*
properties
;
account_state_t
state
;
GHashTable
*
properties
;
}
account_t
;
/** This function initialize the account list. */
...
...
sflphone-gtk/src/accountwindow.c
View file @
8be3aa43
...
...
@@ -77,39 +77,48 @@ void
show_account_window
(
account_t
*
a
)
{
guint
response
;
currentAccount
=
a
;
// Current settings
gchar
*
curAccountType
=
NULL
;
gchar
*
curUserPart
=
NULL
;
gchar
*
curHostPart
=
NULL
;
gchar
*
curPassword
=
NULL
;
gchar
*
curUsername
=
NULL
;
gchar
*
curFullName
=
NULL
;
// Default settings
gchar
*
curAccountID
=
""
;
gchar
*
curAccountEnabled
=
"TRUE"
;
gchar
*
curAccountType
=
"SIP"
;
gchar
*
curUserPart
=
""
;
gchar
*
curHostPart
=
""
;
gchar
*
curPassword
=
""
;
gchar
*
curUsername
=
""
;
gchar
*
curFullName
=
""
;
/* TODO: add curProxy, and add boxes for Proxy support */
// Load from SIP/IAX/Unknown ?
curAccountType
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_TYPE
);
if
(
a
)
{
curAccountID
=
a
->
accountID
;
curAccountType
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_TYPE
);
curAccountEnabled
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_ENABLED
);
if
(
strcmp
(
curAccountType
,
"IAX"
)
==
0
)
{
curHostPart
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_IAX_HOST
);
curPassword
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_IAX_PASS
);
curUsername
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_IAX_USER
);
curFullName
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_IAX_FULL_NAME
);
}
else
if
(
strcmp
(
curAccountType
,
"SIP"
)
==
0
)
{
curHostPart
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_SIP_HOST_PART
);
curPassword
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_SIP_PASSWORD
);
curUsername
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_SIP_AUTH_NAME
);
curFullName
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_SIP_FULL_NAME
);
curUserPart
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_SIP_USER_PART
);
if
(
strcmp
(
curAccountType
,
"IAX"
)
==
0
)
{
curHostPart
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_IAX_HOST
);
curPassword
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_IAX_PASS
);
curUsername
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_IAX_USER
);
curFullName
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_IAX_FULL_NAME
);
}
else
if
(
strcmp
(
curAccountType
,
"SIP"
)
==
0
)
{
curHostPart
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_SIP_HOST_PART
);
curPassword
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_SIP_PASSWORD
);
curUsername
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_SIP_AUTH_NAME
);
curFullName
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_SIP_FULL_NAME
);
curUserPart
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_SIP_USER_PART
);
}
}
else
{
// Default values...
curAccountType
=
"SIP"
;
else
{
currentAccount
=
g_new0
(
account_t
,
1
);
currentAccount
->
properties
=
g_hash_table_new
(
NULL
,
g_str_equal
);
curAccountID
=
"test"
;
}
dialog
=
GTK_DIALOG
(
gtk_dialog_new_with_buttons
(
"Account settings"
,
GTK_WINDOW
(
get_main_window
()),
GTK_DIALOG_MODAL
|
GTK_DIALOG_DESTROY_WITH_PARENT
,
...
...
@@ -132,14 +141,14 @@ show_account_window (account_t * a)
gtk_misc_set_alignment
(
GTK_MISC
(
label
),
0
,
0
.
5
);
entryID
=
gtk_entry_new
();
gtk_label_set_mnemonic_widget
(
GTK_LABEL
(
label
),
entryID
);
gtk_entry_set_text
(
GTK_ENTRY
(
entryID
),
a
->
a
ccountID
);
gtk_entry_set_text
(
GTK_ENTRY
(
entryID
),
curA
ccountID
);
gtk_widget_set_sensitive
(
GTK_WIDGET
(
entryID
),
FALSE
);
gtk_table_attach
(
GTK_TABLE
(
table
),
entryID
,
1
,
2
,
0
,
1
,
GTK_EXPAND
|
GTK_FILL
,
GTK_EXPAND
|
GTK_FILL
,
0
,
0
);
#endif
entryEnabled
=
gtk_check_button_new_with_mnemonic
(
"_Enabled"
);
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
entryEnabled
),
strcmp
(
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_ENABLED
)
,
"TRUE"
)
==
0
?
TRUE
:
FALSE
);
strcmp
(
curAccountEnabled
,
"TRUE"
)
==
0
?
TRUE
:
FALSE
);
gtk_table_attach
(
GTK_TABLE
(
table
),
entryEnabled
,
0
,
2
,
1
,
2
,
GTK_EXPAND
|
GTK_FILL
,
GTK_EXPAND
|
GTK_FILL
,
0
,
0
);
//entryRegister = gtk_check_button_new_with_mnemonic("_Register on startup ");
...
...
@@ -249,6 +258,10 @@ show_account_window (account_t * a)
{
gchar
*
proto
=
(
gchar
*
)
gtk_combo_box_get_active_text
(
GTK_COMBO_BOX
(
entryProtocol
));
g_hash_table_replace
(
currentAccount
->
properties
,
g_strdup
(
"AccountID"
),
g_strdup
(
curAccountID
));
g_hash_table_replace
(
currentAccount
->
properties
,
g_strdup
(
ACCOUNT_ENABLED
),
g_strdup
(
gtk_toggle_button_get_active
(
GTK_TOGGLE_BUTTON
(
entryEnabled
))
?
"TRUE"
:
"FALSE"
));
...
...
@@ -259,7 +272,11 @@ show_account_window (account_t * a)
g_hash_table_replace
(
currentAccount
->
properties
,
g_strdup
(
ACCOUNT_ALIAS
),
g_strdup
((
gchar
*
)
gtk_entry_get_text
(
GTK_ENTRY
(
entryName
))));
g_hash_table_replace
(
currentAccount
->
properties
,
g_strdup
(
ACCOUNT_TYPE
),
g_strdup
(
proto
));
if
(
strcmp
(
proto
,
"SIP"
)
==
0
)
{
/* Protocol = SIP */
g_hash_table_replace
(
currentAccount
->
properties
,
g_strdup
(
ACCOUNT_SIP_FULL_NAME
),
...
...
@@ -295,7 +312,7 @@ show_account_window (account_t * a)
}
dbus_
set
_account
_details
(
currentAccount
);
dbus_
add
_account
(
currentAccount
);
}
gtk_widget_destroy
(
GTK_WIDGET
(
dialog
));
...
...
sflphone-gtk/src/configwindow.c
View file @
8be3aa43
...
...
@@ -76,7 +76,7 @@ delete_account( GtkWidget *widget, gpointer data )
}
/**
*
Delete
an account
*
Edit
an account
*/
static
void
edit_account
(
GtkWidget
*
widget
,
gpointer
data
)
...
...
@@ -88,6 +88,17 @@ edit_account( GtkWidget *widget, gpointer data )
}
}
/**
* Add an account
*/
static
void
add_account
(
GtkWidget
*
widget
,
gpointer
data
)
{
show_account_window
(
NULL
);
fill_account_list
();
}
/* Call back when the user click on an account in the list */
static
void
select_account
(
GtkTreeSelection
*
sel
,
GtkTreeModel
*
model
)
...
...
@@ -198,12 +209,10 @@ create_accounts_tab()
gtk_widget_show
(
bbox
);
addButton
=
gtk_button_new_from_stock
(
GTK_STOCK_ADD
);
/*
g_signal_connect_swapped(G_OBJECT(addButton), "clicked",
G_CALLBACK(
config_module), _gtkWindow);*/
g_signal_connect_swapped
(
G_OBJECT
(
addButton
),
"clicked"
,
G_CALLBACK
(
add_account
),
NULL
);
gtk_box_pack_start
(
GTK_BOX
(
bbox
),
addButton
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
addButton
);
/* TODO Set to TRUE when AddAccount is implemented */
gtk_widget_set_sensitive
(
GTK_WIDGET
(
addButton
),
FALSE
);
editButton
=
gtk_button_new_from_stock
(
GTK_STOCK_EDIT
);
g_signal_connect_swapped
(
G_OBJECT
(
editButton
),
"clicked"
,
...
...
sflphone-gtk/src/dbus.c
View file @
8be3aa43
...
...
@@ -141,6 +141,7 @@ accounts_changed_cb (DBusGProxy *proxy,
void
*
foo
)
{
g_print
(
"Accounts changed
\n
"
);
// TODO reload list
}
gboolean
...
...
@@ -459,6 +460,27 @@ dbus_set_account_details(account_t *a)
}
}
void
dbus_add_account
(
account_t
*
a
)
{
GError
*
error
=
NULL
;
org_sflphone_SFLphone_ConfigurationManager_add_account
(
configurationManagerProxy
,
a
->
properties
,
&
error
);
if
(
error
)
{
g_printerr
(
"Failed to call add_account() on ConfigurationManager: %s
\n
"
,
error
->
message
);
g_error_free
(
error
);
}
else
{
g_print
(
"DBus called add_account() on ConfigurationManager
\n
"
);
}
}
void
dbus_set_volume
(
const
gchar
*
device
,
gdouble
value
)
{
...
...
sflphone-gtk/src/dbus.h
View file @
8be3aa43
...
...
@@ -45,6 +45,7 @@ void dbus_place_call (const call_t * c);
gchar
**
dbus_account_list
();
GHashTable
*
dbus_account_details
(
gchar
*
accountID
);
void
dbus_set_account_details
(
account_t
*
a
);
void
dbus_add_account
(
account_t
*
a
);
void
dbus_remove_account
(
gchar
*
accountID
);
void
dbus_set_volume
(
const
gchar
*
device
,
gdouble
value
);
gdouble
dbus_get_volume
(
const
gchar
*
device
);
...
...
src/dbus/configurationmanager.cpp
View file @
8be3aa43
...
...
@@ -49,7 +49,8 @@ void
ConfigurationManager
::
addAccount
(
const
std
::
map
<
::
DBus
::
String
,
::
DBus
::
String
>&
details
)
{
_debug
(
"ConfigurationManager::addAccount received
\n
"
);
std
::
string
accountID
=
(
*
details
.
find
(
"AccountID"
)).
second
;
Manager
::
instance
().
setAccountDetails
(
accountID
,
details
);
}
...
...
src/managerimpl.cpp
View file @
8be3aa43
...
...
@@ -1709,11 +1709,12 @@ ManagerImpl::setAccountDetails( const ::DBus::String& accountID,
setConfig
(
accountID
,
IAX_USER
,
(
*
details
.
find
(
IAX_USER
)).
second
);
setConfig
(
accountID
,
IAX_PASS
,
(
*
details
.
find
(
IAX_PASS
)).
second
);
}
else
{
_debug
(
"Unknown account type in setAccountDetails(): %s"
,
accountType
.
c_str
());
_debug
(
"Unknown account type in setAccountDetails(): %s
\n
"
,
accountType
.
c_str
());
}
saveConfig
();
unloadAccountMap
();
loadAccountMap
();
/** @todo Then, reset the VoIP link with the new information */
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment