Commit e26a2e55 authored by Pierre-Luc Beaudoin's avatar Pierre-Luc Beaudoin
Browse files

Merge commit 'origin/master'

parents 3231f100 20671d89
...@@ -53,6 +53,14 @@ sflphone-gtk/doc/html/* ...@@ -53,6 +53,14 @@ sflphone-gtk/doc/html/*
/libs/dbus/tools/dbusxx-* /libs/dbus/tools/dbusxx-*
/libs/dbus/dbus-c++-1.pc /libs/dbus/dbus-c++-1.pc
/libs/dbus/doc /libs/dbus/doc
/libs/dbus/INSTALL
/libs/dbus/config.guess
/libs/dbus/config.sub
/libs/dbus/depcomp
/libs/dbus/install-sh
/libs/dbus/ltmain.sh
/libs/dbus/missing
# Ignore sflphone-gtk stuff # Ignore sflphone-gtk stuff
/sflphone-gtk/config.* /sflphone-gtk/config.*
...@@ -71,7 +79,6 @@ sflphone-gtk/doc/html/* ...@@ -71,7 +79,6 @@ sflphone-gtk/doc/html/*
# Ignore temp libs stuff # Ignore temp libs stuff
tools/portaudio tools/portaudio
# Ignore sub-modules stuff # Ignore sub-modules stuff
## libiax2 ## libiax2
/libs/libiax2/doc/html /libs/libiax2/doc/html
......
This diff is collapsed.
...@@ -542,22 +542,22 @@ static ...@@ -542,22 +542,22 @@ static
inline inline
#endif #endif
gboolean gboolean
org_sflphone_SFLphone_ConfigurationManager_get_parameters (DBusGProxy *proxy, GHashTable** OUT_parameters, GError **error) org_sflphone_SFLphone_ConfigurationManager_get_default_account (DBusGProxy *proxy, GHashTable** OUT_parameters, GError **error)
{ {
return dbus_g_proxy_call (proxy, "getParameters", error, G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING), OUT_parameters, G_TYPE_INVALID); return dbus_g_proxy_call (proxy, "getDefaultAccount", error, G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING), OUT_parameters, G_TYPE_INVALID);
} }
typedef void (*org_sflphone_SFLphone_ConfigurationManager_get_parameters_reply) (DBusGProxy *proxy, GHashTable *OUT_parameters, GError *error, gpointer userdata); typedef void (*org_sflphone_SFLphone_ConfigurationManager_get_default_account_reply) (DBusGProxy *proxy, GHashTable *OUT_parameters, GError *error, gpointer userdata);
static void static void
org_sflphone_SFLphone_ConfigurationManager_get_parameters_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) org_sflphone_SFLphone_ConfigurationManager_get_default_account_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
{ {
DBusGAsyncData *data = (DBusGAsyncData*) user_data; DBusGAsyncData *data = (DBusGAsyncData*) user_data;
GError *error = NULL; GError *error = NULL;
GHashTable* OUT_parameters; GHashTable* OUT_parameters;
dbus_g_proxy_end_call (proxy, call, &error, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING), &OUT_parameters, G_TYPE_INVALID); dbus_g_proxy_end_call (proxy, call, &error, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING), &OUT_parameters, G_TYPE_INVALID);
(*(org_sflphone_SFLphone_ConfigurationManager_get_parameters_reply)data->cb) (proxy, OUT_parameters, error, data->userdata); (*(org_sflphone_SFLphone_ConfigurationManager_get_default_account_reply)data->cb) (proxy, OUT_parameters, error, data->userdata);
return; return;
} }
...@@ -566,35 +566,35 @@ static ...@@ -566,35 +566,35 @@ static
inline inline
#endif #endif
DBusGProxyCall* DBusGProxyCall*
org_sflphone_SFLphone_ConfigurationManager_get_parameters_async (DBusGProxy *proxy, org_sflphone_SFLphone_ConfigurationManager_get_parameters_reply callback, gpointer userdata) org_sflphone_SFLphone_ConfigurationManager_get_default_account_async (DBusGProxy *proxy, org_sflphone_SFLphone_ConfigurationManager_get_default_account_reply callback, gpointer userdata)
{ {
DBusGAsyncData *stuff; DBusGAsyncData *stuff;
stuff = g_new (DBusGAsyncData, 1); stuff = g_new (DBusGAsyncData, 1);
stuff->cb = G_CALLBACK (callback); stuff->cb = G_CALLBACK (callback);
stuff->userdata = userdata; stuff->userdata = userdata;
return dbus_g_proxy_begin_call (proxy, "getParameters", org_sflphone_SFLphone_ConfigurationManager_get_parameters_async_callback, stuff, g_free, G_TYPE_INVALID); return dbus_g_proxy_begin_call (proxy, "getDefaultAccount", org_sflphone_SFLphone_ConfigurationManager_get_default_account_async_callback, stuff, g_free, G_TYPE_INVALID);
} }
static static
#ifdef G_HAVE_INLINE #ifdef G_HAVE_INLINE
inline inline
#endif #endif
gboolean gboolean
org_sflphone_SFLphone_ConfigurationManager_set_parameters (DBusGProxy *proxy, const GHashTable* IN_parameters, GError **error) org_sflphone_SFLphone_ConfigurationManager_set_default_account (DBusGProxy *proxy, const char * IN_accountID, GError **error)
{ {
return dbus_g_proxy_call (proxy, "setParameters", error, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING), IN_parameters, G_TYPE_INVALID, G_TYPE_INVALID); return dbus_g_proxy_call (proxy, "setDefaultAccount", error, G_TYPE_STRING, IN_accountID, G_TYPE_INVALID, G_TYPE_INVALID);
} }
typedef void (*org_sflphone_SFLphone_ConfigurationManager_set_parameters_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); typedef void (*org_sflphone_SFLphone_ConfigurationManager_set_default_account_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
static void static void
org_sflphone_SFLphone_ConfigurationManager_set_parameters_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) org_sflphone_SFLphone_ConfigurationManager_set_default_account_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
{ {
DBusGAsyncData *data = (DBusGAsyncData*) user_data; DBusGAsyncData *data = (DBusGAsyncData*) user_data;
GError *error = NULL; GError *error = NULL;
dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
(*(org_sflphone_SFLphone_ConfigurationManager_set_parameters_reply)data->cb) (proxy, error, data->userdata); (*(org_sflphone_SFLphone_ConfigurationManager_set_default_account_reply)data->cb) (proxy, error, data->userdata);
return; return;
} }
...@@ -603,14 +603,14 @@ static ...@@ -603,14 +603,14 @@ static
inline inline
#endif #endif
DBusGProxyCall* DBusGProxyCall*
org_sflphone_SFLphone_ConfigurationManager_set_parameters_async (DBusGProxy *proxy, const GHashTable* IN_parameters, org_sflphone_SFLphone_ConfigurationManager_set_parameters_reply callback, gpointer userdata) org_sflphone_SFLphone_ConfigurationManager_set_default_account_async (DBusGProxy *proxy, const char * IN_accountID, org_sflphone_SFLphone_ConfigurationManager_set_default_account_reply callback, gpointer userdata)
{ {
DBusGAsyncData *stuff; DBusGAsyncData *stuff;
stuff = g_new (DBusGAsyncData, 1); stuff = g_new (DBusGAsyncData, 1);
stuff->cb = G_CALLBACK (callback); stuff->cb = G_CALLBACK (callback);
stuff->userdata = userdata; stuff->userdata = userdata;
return dbus_g_proxy_begin_call (proxy, "setParameters", org_sflphone_SFLphone_ConfigurationManager_set_parameters_async_callback, stuff, g_free, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING), IN_parameters, G_TYPE_INVALID); return dbus_g_proxy_begin_call (proxy, "setDefaultAccount", org_sflphone_SFLphone_ConfigurationManager_set_default_account_async_callback, stuff, g_free, G_TYPE_STRING, IN_accountID, G_TYPE_INVALID);
} }
#endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_org_sflphone_SFLphone_ConfigurationManager */ #endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_org_sflphone_SFLphone_ConfigurationManager */
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <accountlist.h> #include <accountlist.h>
#include <accountwindow.h> #include <accountwindow.h>
#include <actions.h> #include <actions.h>
...@@ -32,108 +32,123 @@ GtkListStore *account_store; ...@@ -32,108 +32,123 @@ GtkListStore *account_store;
GtkWidget * addButton; GtkWidget * addButton;
GtkWidget * editButton; GtkWidget * editButton;
GtkWidget * deleteButton; GtkWidget * deleteButton;
GtkWidget * defaultButton;
account_t * selectedAccount; account_t * selectedAccount;
/** Fills the treelist with accounts */ /** Fills the treelist with accounts */
void void
config_window_fill_account_list () config_window_fill_account_list ()
{ {
if(dialogOpen) if(dialogOpen)
{ {
GtkTreeIter iter; GtkTreeIter iter;
gtk_list_store_clear(account_store); gtk_list_store_clear(account_store);
int i; int i;
for( i = 0; i < account_list_get_size(); i++) for( i = 0; i < account_list_get_size(); i++)
{ {
account_t * a = account_list_get_nth (i); account_t * a = account_list_get_nth (i);
if (a) if (a)
{ {
gtk_list_store_append (account_store, &iter); gtk_list_store_append (account_store, &iter);
gtk_list_store_set(account_store, &iter, gtk_list_store_set(account_store, &iter,
0, g_hash_table_lookup(a->properties, ACCOUNT_ALIAS), // Name 0, g_hash_table_lookup(a->properties, ACCOUNT_ALIAS), // Name
1, g_hash_table_lookup(a->properties, ACCOUNT_TYPE), // Protocol 1, g_hash_table_lookup(a->properties, ACCOUNT_TYPE), // Protocol
2, account_state_name(a->state), // Status 2, account_state_name(a->state), // Status
3, a, // Pointer 3, a, // Pointer
-1); -1);
} }
} }
gtk_widget_set_sensitive( GTK_WIDGET(editButton), FALSE); gtk_widget_set_sensitive( GTK_WIDGET(editButton), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(deleteButton), FALSE); gtk_widget_set_sensitive( GTK_WIDGET(deleteButton), FALSE);
} gtk_widget_set_sensitive( GTK_WIDGET(defaultButton), FALSE);
}
} }
/** /**
* Delete an account * Delete an account
*/ */
static void static void
delete_account( GtkWidget *widget, gpointer data ) delete_account( GtkWidget *widget, gpointer data )
{ {
if(selectedAccount) if(selectedAccount)
{ {
dbus_remove_account(selectedAccount->accountID); dbus_remove_account(selectedAccount->accountID);
} }
} }
/** /**
* Edit an account * Edit an account
*/ */
static void static void
edit_account( GtkWidget *widget, gpointer data ) edit_account( GtkWidget *widget, gpointer data )
{ {
if(selectedAccount) if(selectedAccount)
{ {
show_account_window(selectedAccount); show_account_window(selectedAccount);
} }
} }
/** /**
* Add an account * Add an account
*/ */
static void static void
add_account( GtkWidget *widget, gpointer data ) add_account( GtkWidget *widget, gpointer data )
{ {
show_account_window(NULL); show_account_window(NULL);
}
/*
* Should mark the account as default
*/
default_account(GtkWidget *widget, gpointer data)
{
// set account as default
if(selectedAccount)
{
dbus_set_default_account(selectedAccount->accountID);
}
} }
/* Call back when the user click on an account in the list */ /* Call back when the user click on an account in the list */
static void static void
select_account(GtkTreeSelection *sel, GtkTreeModel *model) select_account(GtkTreeSelection *sel, GtkTreeModel *model)
{ {
GtkTreeIter iter; GtkTreeIter iter;
GValue val; GValue val;
if (! gtk_tree_selection_get_selected (sel, &model, &iter)) if (! gtk_tree_selection_get_selected (sel, &model, &iter))
{ {
selectedAccount = NULL; selectedAccount = NULL;
return; return;
} }
val.g_type = G_TYPE_POINTER; val.g_type = G_TYPE_POINTER;
gtk_tree_model_get_value (model, &iter, 3, &val); gtk_tree_model_get_value (model, &iter, 3, &val);
selectedAccount = (account_t*) g_value_get_pointer(&val); selectedAccount = (account_t*) g_value_get_pointer(&val);
g_value_unset(&val); g_value_unset(&val);
if(selectedAccount) if(selectedAccount)
{ {
gtk_widget_set_sensitive( GTK_WIDGET(editButton), TRUE); gtk_widget_set_sensitive( GTK_WIDGET(editButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(deleteButton), TRUE); gtk_widget_set_sensitive( GTK_WIDGET(deleteButton), TRUE);
} gtk_widget_set_sensitive( GTK_WIDGET(defaultButton), TRUE);
g_print("select"); }
g_print("select");
} }
GtkWidget * GtkWidget *
create_accounts_tab() create_accounts_tab()
{ {
GtkWidget *ret; GtkWidget *ret;
GtkWidget *sw; GtkWidget *sw;
GtkWidget *view; GtkWidget *view;
GtkWidget *bbox; GtkWidget *bbox;
...@@ -141,7 +156,7 @@ create_accounts_tab() ...@@ -141,7 +156,7 @@ create_accounts_tab()
GtkTreeViewColumn *col; GtkTreeViewColumn *col;
GtkTreeSelection *sel; GtkTreeSelection *sel;
GtkWidget *label; GtkWidget *label;
selectedAccount = NULL; selectedAccount = NULL;
ret = gtk_vbox_new(FALSE, 10); ret = gtk_vbox_new(FALSE, 10);
...@@ -162,41 +177,41 @@ create_accounts_tab() ...@@ -162,41 +177,41 @@ create_accounts_tab()
gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0);
account_store = gtk_list_store_new (4, account_store = gtk_list_store_new (4,
G_TYPE_STRING, // Name G_TYPE_STRING, // Name
G_TYPE_STRING, // Protocol G_TYPE_STRING, // Protocol
G_TYPE_STRING, // Status G_TYPE_STRING, // Status
G_TYPE_POINTER // Pointer to the Object G_TYPE_POINTER // Pointer to the Object
); );
view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(account_store)); view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(account_store));
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
g_signal_connect (G_OBJECT (sel), "changed", g_signal_connect (G_OBJECT (sel), "changed",
G_CALLBACK (select_account), G_CALLBACK (select_account),
account_store); account_store);
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(account_store), gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(account_store),
2, GTK_SORT_ASCENDING); 2, GTK_SORT_ASCENDING);
rend = gtk_cell_renderer_text_new(); rend = gtk_cell_renderer_text_new();
col = gtk_tree_view_column_new_with_attributes ("Alias", col = gtk_tree_view_column_new_with_attributes ("Alias",
rend, rend,
"markup", 0, "markup", 0,
NULL); NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW(view), col); gtk_tree_view_append_column (GTK_TREE_VIEW(view), col);
rend = gtk_cell_renderer_text_new(); rend = gtk_cell_renderer_text_new();
col = gtk_tree_view_column_new_with_attributes ("Protocol", col = gtk_tree_view_column_new_with_attributes ("Protocol",
rend, rend,
"markup", 1, "markup", 1,
NULL); NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW(view), col); gtk_tree_view_append_column (GTK_TREE_VIEW(view), col);
rend = gtk_cell_renderer_text_new(); rend = gtk_cell_renderer_text_new();
col = gtk_tree_view_column_new_with_attributes ("Status", col = gtk_tree_view_column_new_with_attributes ("Status",
rend, rend,
"markup", 2, "markup", 2,
NULL); NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW(view), col); gtk_tree_view_append_column (GTK_TREE_VIEW(view), col);
g_object_unref(G_OBJECT(account_store)); g_object_unref(G_OBJECT(account_store));
gtk_container_add(GTK_CONTAINER(sw), view); gtk_container_add(GTK_CONTAINER(sw), view);
...@@ -207,66 +222,77 @@ create_accounts_tab() ...@@ -207,66 +222,77 @@ create_accounts_tab()
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_START); gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_START);
gtk_box_pack_start(GTK_BOX(ret), bbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ret), bbox, FALSE, FALSE, 0);
gtk_widget_show (bbox); gtk_widget_show (bbox);
addButton = gtk_button_new_from_stock (GTK_STOCK_ADD); addButton = gtk_button_new_from_stock (GTK_STOCK_ADD);
g_signal_connect_swapped(G_OBJECT(addButton), "clicked", g_signal_connect_swapped(G_OBJECT(addButton), "clicked",
G_CALLBACK(add_account), NULL); G_CALLBACK(add_account), NULL);
gtk_box_pack_start(GTK_BOX(bbox), addButton, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(bbox), addButton, FALSE, FALSE, 0);
gtk_widget_show(addButton); gtk_widget_show(addButton);
editButton = gtk_button_new_from_stock (GTK_STOCK_EDIT); editButton = gtk_button_new_from_stock (GTK_STOCK_EDIT);
g_signal_connect_swapped(G_OBJECT(editButton), "clicked", g_signal_connect_swapped(G_OBJECT(editButton), "clicked",
G_CALLBACK(edit_account), NULL); G_CALLBACK(edit_account), NULL);
gtk_box_pack_start(GTK_BOX(bbox), editButton, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(bbox), editButton, FALSE, FALSE, 0);
gtk_widget_show(editButton); gtk_widget_show(editButton);
deleteButton = gtk_button_new_from_stock (GTK_STOCK_REMOVE); deleteButton = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
g_signal_connect_swapped(G_OBJECT(deleteButton), "clicked", g_signal_connect_swapped(G_OBJECT(deleteButton), "clicked",
G_CALLBACK(delete_account), NULL); G_CALLBACK(delete_account), NULL);
gtk_box_pack_start(GTK_BOX(bbox), deleteButton, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(bbox), deleteButton, FALSE, FALSE, 0);
gtk_widget_show(deleteButton); gtk_widget_show(deleteButton);
defaultButton = gtk_button_new_with_mnemonic("Set as Default");
g_signal_connect_swapped(G_OBJECT(defaultButton), "clicked",
G_CALLBACK(default_account), NULL);
gtk_box_pack_start(GTK_BOX(bbox), defaultButton, FALSE, FALSE, 0);
gtk_widget_show(defaultButton);
gtk_widget_show_all(ret); gtk_widget_show_all(ret);
config_window_fill_account_list(); config_window_fill_account_list();
return ret; return ret;
} }
void void
show_config_window () show_config_window ()
{ {
GtkDialog * dialog; GtkDialog * dialog;
GtkWidget * notebook; GtkWidget * notebook;
GtkWidget * tab; GtkWidget * tab;
dialogOpen = TRUE; dialogOpen = TRUE;
dialog = GTK_DIALOG(gtk_dialog_new_with_buttons ("Preferences", dialog = GTK_DIALOG(gtk_dialog_new_with_buttons ("Preferences",
GTK_WINDOW(get_main_window()), GTK_WINDOW(get_main_window()),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CLOSE, GTK_STOCK_CLOSE,
GTK_RESPONSE_ACCEPT, GTK_RESPONSE_ACCEPT,
NULL)); NULL));
gtk_dialog_set_has_separator(dialog, FALSE); gtk_dialog_set_has_separator(dialog, FALSE);
gtk_window_set_default_size( GTK_WINDOW(dialog), 400, 400); gtk_window_set_default_size( GTK_WINDOW(dialog), 400, 400);
gtk_container_set_border_width (GTK_CONTAINER(dialog), 0); gtk_container_set_border_width (GTK_CONTAINER(dialog), 0);
notebook = gtk_notebook_new (); notebook = gtk_notebook_new ();
gtk_box_pack_start (GTK_BOX (dialog->vbox), notebook, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (dialog->vbox), notebook, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER(notebook), 10); gtk_container_set_border_width (GTK_CONTAINER(notebook), 10);
gtk_widget_show(notebook); gtk_widget_show(notebook);
/* Create tabs */ /* Create tabs */
tab = create_accounts_tab(); tab = create_accounts_tab();
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new("Accounts")); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new("Accounts"));
gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab);
gtk_dialog_run (dialog); /*
GtkWidget* blob;//create_blob_tab();
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), blob, gtk_label_new("Audio"));
gtk_notebook_page_num(GTK_NOTEBOOK(notebook), blob);
*/
gtk_dialog_run (dialog);
dialogOpen = FALSE;
dialogOpen = FALSE; gtk_widget_destroy (GTK_WIDGET(dialog));
gtk_widget_destroy (GTK_WIDGET(dialog));
} }