diff --git a/sflphone-gtk/src/accountlist.c b/sflphone-gtk/src/accountlist.c index b61dd75a23e78e54a2fd80cb1395fa43bcbe3a0e..761e41e7e7a9dfc6861a6def412c8fbf95c7c801 100644 --- a/sflphone-gtk/src/accountlist.c +++ b/sflphone-gtk/src/accountlist.c @@ -22,6 +22,7 @@ #include <string.h> GQueue * accountQueue; +gchar * DEFAULT_ACCOUNT=NULL; /* GCompareFunc to compare a accountID (gchar* and a account_t) */ gint @@ -98,6 +99,20 @@ account_list_get_by_state (account_state_t state ) } +account_t * +account_list_get_by_id(gchar * accountID) +{ + GList * c = g_queue_find_custom (accountQueue, accountID, is_accountID_struct); + if(c) + { + return (account_t *)c->data; + } + else + { + return NULL; + } +} + guint account_list_get_size ( ) { @@ -120,6 +135,7 @@ void account_list_set_default(const gchar * accountID) { DEFAULT_ACCOUNT = g_strdup(accountID); + g_print("DEFAULT_ACCOUNT = %s\n", DEFAULT_ACCOUNT); } const gchar * account_state_name(account_state_t s) diff --git a/sflphone-gtk/src/accountlist.h b/sflphone-gtk/src/accountlist.h index 4379ff141efe3754eabb0a2c0f0c0e1bbf87265c..2d1ebea9bb1095a6c39c346361dc3b5249d40e32 100644 --- a/sflphone-gtk/src/accountlist.h +++ b/sflphone-gtk/src/accountlist.h @@ -70,7 +70,6 @@ typedef struct { } account_t; -gchar * DEFAULT_ACCOUNT; /** This function initialize the account list. */ void account_list_init (); @@ -116,4 +115,10 @@ void account_list_set_default(const gchar * accountID); const gchar * account_state_name(account_state_t s); void account_list_clear ( ); + +/** Return the account associated with an ID + * @param accountID The ID of the account + * @return An account or NULL */ +account_t * account_list_get_by_id(gchar * accountID); + #endif diff --git a/sflphone-gtk/src/actions.c b/sflphone-gtk/src/actions.c index 9a834fea8ca02c839d58b9c8871bf4e10493e624..bfa8d49d69dac4993e56591b314f273d500d50a3 100644 --- a/sflphone-gtk/src/actions.c +++ b/sflphone-gtk/src/actions.c @@ -1,10 +1,11 @@ /* * Copyright (C) 2007 Savoir-Faire Linux inc. * Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info> + * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -34,511 +35,534 @@ #include <unistd.h> -void + void sflphone_notify_voice_mail (guint count) { - if(count > 0) - { - gchar * message = g_new0(gchar, 50); - g_sprintf(message, "%d new voice mail%s", count, (count > 1? "s" : "")); - status_bar_message(message); - g_free(message); - } - else - { - status_bar_message(""); - } + if(count > 0) + { + gchar * message = g_new0(gchar, 50); + g_sprintf(message, "%d new voice mail%s", count, (count > 1? "s" : "")); + status_bar_message(message); + g_free(message); + } + else + { + status_bar_message(""); + } } -gboolean + gboolean sflphone_quit () { - gboolean quit = FALSE; - guint count = call_list_get_size(); - if(count > 0){ - quit = main_window_ask_quit(); - } - else{ - quit = TRUE; - } - - if (quit) - { - dbus_unregister(getpid()); - dbus_clean (); - //call_list_clean(); TODO - //account_list_clean() - gtk_main_quit (); - } - return quit; + gboolean quit = FALSE; + guint count = call_list_get_size(); + if(count > 0){ + quit = main_window_ask_quit(); + } + else{ + quit = TRUE; + } + + if (quit) + { + dbus_unregister(getpid()); + dbus_clean (); + //call_list_clean(); TODO + //account_list_clean() + gtk_main_quit (); + } + return quit; } -void + void sflphone_hold(call_t * c ) { - c->state = CALL_STATE_HOLD; - update_call_tree(c); - update_menus(); - screen_clear(); + c->state = CALL_STATE_HOLD; + update_call_tree(c); + update_menus(); + screen_clear(); } -void + void sflphone_ringing(call_t * c ) { - c->state = CALL_STATE_RINGING; - update_call_tree(c); - update_menus(); + c->state = CALL_STATE_RINGING; + update_call_tree(c); + update_menus(); } /** Internal to actions: Fill account list */ -void + void sflphone_fill_account_list() { - account_list_clear ( ); - - gchar ** array = (gchar **)dbus_account_list(); - gchar ** accountID; - for (accountID = array; *accountID; accountID++) - { - account_t * a = g_new0(account_t,1); - a->accountID = g_strdup(*accountID); - account_list_add(a); - } - g_strfreev (array); - - int i; - for( i = 0; i < account_list_get_size(); i++) + account_list_clear ( ); + + gchar ** array = (gchar **)dbus_account_list(); + gchar ** accountID; + for (accountID = array; *accountID; accountID++) { - account_t * a = account_list_get_nth (i); - GHashTable * details = (GHashTable *) dbus_account_details(a->accountID); - a->properties = details; - - gchar * status = g_hash_table_lookup(details, "Status"); - if(strcmp(status, "REGISTERED") == 0) - { - a->state = ACCOUNT_STATE_REGISTERED; - } - else if(strcmp(status, "UNREGISTERED") == 0) - { - a->state = ACCOUNT_STATE_UNREGISTERED; - } - else if(strcmp(status, "TRYING") == 0) - { - a->state = ACCOUNT_STATE_TRYING; - } - else if(strcmp(status, "ERROR") == 0) - { - a->state = ACCOUNT_STATE_ERROR; - } - else - { - a->state = ACCOUNT_STATE_INVALID; - } - - } - + account_t * a = g_new0(account_t,1); + a->accountID = g_strdup(*accountID); + account_list_add(a); + } + g_strfreev (array); + + int i; + for( i = 0; i < account_list_get_size(); i++) + { + account_t * a = account_list_get_nth (i); + GHashTable * details = (GHashTable *) dbus_account_details(a->accountID); + a->properties = details; + + gchar * status = g_hash_table_lookup(details, "Status"); + if(strcmp(status, "REGISTERED") == 0) + { + a->state = ACCOUNT_STATE_REGISTERED; + } + else if(strcmp(status, "UNREGISTERED") == 0) + { + a->state = ACCOUNT_STATE_UNREGISTERED; + } + else if(strcmp(status, "TRYING") == 0) + { + a->state = ACCOUNT_STATE_TRYING; + } + else if(strcmp(status, "ERROR") == 0) + { + a->state = ACCOUNT_STATE_ERROR; + } + else + { + a->state = ACCOUNT_STATE_INVALID; + } + + } + toolbar_update_buttons(); } -gboolean + gboolean sflphone_init() { - call_list_init (); - account_list_init (); - if(!dbus_connect ()) - { - main_window_error_message("Unable to connect to the SFLphone server.\nMake sure the daemon is running."); - return FALSE; - } - else - { - dbus_register(getpid(), "Gtk+ Client"); - sflphone_fill_account_list(); - sflphone_set_default_account(); - return TRUE; - } + call_list_init (); + account_list_init (); + if(!dbus_connect ()) + { + main_window_error_message("Unable to connect to the SFLphone server.\nMake sure the daemon is running."); + return FALSE; + } + else + { + dbus_register(getpid(), "Gtk+ Client"); + sflphone_fill_account_list(); + sflphone_set_default_account(); + return TRUE; + } } -void + void sflphone_hang_up() { - call_t * selectedCall = call_get_selected(); - if(selectedCall) - { - switch(selectedCall->state) - { - case CALL_STATE_CURRENT: - case CALL_STATE_HOLD: - case CALL_STATE_DIALING: - case CALL_STATE_RINGING: - case CALL_STATE_BUSY: - case CALL_STATE_FAILURE: - dbus_hang_up (selectedCall); - break; - case CALL_STATE_INCOMING: - dbus_refuse (selectedCall); - break; - case CALL_STATE_TRANSFERT: - dbus_hang_up (selectedCall); - break; - default: - g_warning("Should not happen in sflphone_hang_up()!"); - break; - } - } + call_t * selectedCall = call_get_selected(); + if(selectedCall) + { + switch(selectedCall->state) + { + case CALL_STATE_CURRENT: + case CALL_STATE_HOLD: + case CALL_STATE_DIALING: + case CALL_STATE_RINGING: + case CALL_STATE_BUSY: + case CALL_STATE_FAILURE: + dbus_hang_up (selectedCall); + break; + case CALL_STATE_INCOMING: + dbus_refuse (selectedCall); + break; + case CALL_STATE_TRANSFERT: + dbus_hang_up (selectedCall); + break; + default: + g_warning("Should not happen in sflphone_hang_up()!"); + break; + } + } } -void + void sflphone_pick_up() { - call_t * selectedCall = call_get_selected(); - if(selectedCall) - { - switch(selectedCall->state) - { - case CALL_STATE_DIALING: - sflphone_place_call (selectedCall); - break; - case CALL_STATE_INCOMING: - dbus_accept (selectedCall); - break; - case CALL_STATE_HOLD: - dbus_unhold (selectedCall); - break; - case CALL_STATE_TRANSFERT: - dbus_transfert (selectedCall); - break; - default: - g_warning("Should not happen in sflphone_pick_up()!"); - break; - } - } + call_t * selectedCall = call_get_selected(); + if(selectedCall) + { + switch(selectedCall->state) + { + case CALL_STATE_DIALING: + sflphone_place_call (selectedCall); + break; + case CALL_STATE_INCOMING: + dbus_accept (selectedCall); + break; + case CALL_STATE_HOLD: + dbus_unhold (selectedCall); + break; + case CALL_STATE_TRANSFERT: + dbus_transfert (selectedCall); + break; + default: + g_warning("Should not happen in sflphone_pick_up()!"); + break; + } + } } -void + void sflphone_on_hold () { - call_t * selectedCall = call_get_selected(); - if(selectedCall) - { - switch(selectedCall->state) - { - case CALL_STATE_CURRENT: - dbus_hold (selectedCall); - break; - default: - g_warning("Should not happen in sflphone_on_hold!"); - break; - } - } + call_t * selectedCall = call_get_selected(); + if(selectedCall) + { + switch(selectedCall->state) + { + case CALL_STATE_CURRENT: + dbus_hold (selectedCall); + break; + default: + g_warning("Should not happen in sflphone_on_hold!"); + break; + } + } } -void + void sflphone_off_hold () { - call_t * selectedCall = call_get_selected(); - if(selectedCall) - { - switch(selectedCall->state) - { - case CALL_STATE_HOLD: - dbus_unhold (selectedCall); - break; - default: - g_warning("Should not happen in sflphone_off_hold ()!"); - break; - } - } + call_t * selectedCall = call_get_selected(); + if(selectedCall) + { + switch(selectedCall->state) + { + case CALL_STATE_HOLD: + dbus_unhold (selectedCall); + break; + default: + g_warning("Should not happen in sflphone_off_hold ()!"); + break; + } + } } -void + void sflphone_fail( call_t * c ) { - c->state = CALL_STATE_FAILURE; - update_call_tree(c); - update_menus(); - screen_set_call(c); + c->state = CALL_STATE_FAILURE; + update_call_tree(c); + update_menus(); + screen_set_call(c); } -void + void sflphone_busy( call_t * c ) { - c->state = CALL_STATE_BUSY; - update_call_tree(c); - update_menus(); - screen_set_call(c); + c->state = CALL_STATE_BUSY; + update_call_tree(c); + update_menus(); + screen_set_call(c); } -void + void sflphone_current( call_t * c ) { - c->state = CALL_STATE_CURRENT; - update_call_tree(c); - update_menus(); - screen_set_call(c); + c->state = CALL_STATE_CURRENT; + update_call_tree(c); + update_menus(); + screen_set_call(c); } -void + void sflphone_set_transfert() { - call_t * c = call_get_selected(); - if(c) - { - c->state = CALL_STATE_TRANSFERT; - c->to = g_strdup(""); - screen_set_call(c); - update_call_tree(c); - update_menus(); - } - toolbar_update_buttons(); + call_t * c = call_get_selected(); + if(c) + { + c->state = CALL_STATE_TRANSFERT; + c->to = g_strdup(""); + screen_set_call(c); + update_call_tree(c); + update_menus(); + } + toolbar_update_buttons(); } -void + void sflphone_unset_transfert() { - call_t * c = call_get_selected(); - if(c) - { - c->state = CALL_STATE_CURRENT; - c->to = g_strdup(""); - screen_set_call(c); - update_call_tree(c); - update_menus(); - } - toolbar_update_buttons(); + call_t * c = call_get_selected(); + if(c) + { + c->state = CALL_STATE_CURRENT; + c->to = g_strdup(""); + screen_set_call(c); + update_call_tree(c); + update_menus(); + } + toolbar_update_buttons(); } -void + void sflphone_incoming_call (call_t * c) { - call_list_add ( c ); - status_icon_unminimize(); - update_call_tree_add(c); - update_menus(); + call_list_add ( c ); + status_icon_unminimize(); + update_call_tree_add(c); + update_menus(); } -void + void sflphone_hung_up (call_t * c ) { - call_list_remove(c->callID); - update_call_tree_remove(c); - update_menus(); - screen_clear(); + call_list_remove(c->callID); + update_call_tree_remove(c); + update_menus(); + screen_clear(); } void process_dialing(call_t * c, guint keyval, gchar * key) { - switch (keyval) - { - case 65293: /* ENTER */ - case 65421: /* ENTER numpad */ - sflphone_place_call(c); - break; - case 65307: /* ESCAPE */ - dbus_hang_up(c); - break; - case 65288: /* BACKSPACE */ - { /* Brackets mandatory because of local vars */ - gchar * before = c->to; - if(strlen(c->to) > 1){ - c->to = g_strndup(c->to, strlen(c->to) -1); - g_free(before); - g_print("TO: %s\n", c->to); - - if(c->state == CALL_STATE_DIALING) - { - g_free(c->from); - c->from = g_strconcat("\"\" <", c->to, ">", NULL); - } - screen_set_call(c); - update_call_tree(c); - } - else if(strlen(c->to) == 1) - { - dbus_hang_up(c); - } - } - break; - case 65289: /* TAB */ - case 65513: /* ALT */ - case 65507: /* CTRL */ - case 65515: /* SUPER */ - case 65509: /* CAPS */ - break; - default: - if (keyval < 255 || (keyval >65453 && keyval < 65466)) - { - gchar * before = c->to; - c->to = g_strconcat(c->to, key, NULL); - g_free(before); - g_print("TO: %s\n", c->to); - - if(c->state == CALL_STATE_DIALING) - { - g_free(c->from); - c->from = g_strconcat("\"\" <", c->to, ">", NULL); - } - screen_set_call(c); - update_call_tree(c); - } - break; - } - + switch (keyval) + { + case 65293: /* ENTER */ + case 65421: /* ENTER numpad */ + sflphone_place_call(c); + break; + case 65307: /* ESCAPE */ + dbus_hang_up(c); + break; + case 65288: /* BACKSPACE */ + { /* Brackets mandatory because of local vars */ + gchar * before = c->to; + if(strlen(c->to) > 1){ + c->to = g_strndup(c->to, strlen(c->to) -1); + g_free(before); + g_print("TO: %s\n", c->to); + + if(c->state == CALL_STATE_DIALING) + { + g_free(c->from); + c->from = g_strconcat("\"\" <", c->to, ">", NULL); + } + screen_set_call(c); + update_call_tree(c); + } + else if(strlen(c->to) == 1) + { + dbus_hang_up(c); + } + } + break; + case 65289: /* TAB */ + case 65513: /* ALT */ + case 65507: /* CTRL */ + case 65515: /* SUPER */ + case 65509: /* CAPS */ + break; + default: + if (keyval < 255 || (keyval >65453 && keyval < 65466)) + { + gchar * before = c->to; + c->to = g_strconcat(c->to, key, NULL); + g_free(before); + g_print("TO: %s\n", c->to); + + if(c->state == CALL_STATE_DIALING) + { + g_free(c->from); + c->from = g_strconcat("\"\" <", c->to, ">", NULL); + } + screen_set_call(c); + update_call_tree(c); + } + break; + } + } call_t * sflphone_new_call() { - call_t * c = g_new0 (call_t, 1); - c->state = CALL_STATE_DIALING; - c->from = g_strconcat("\"\" <>", NULL); - - c->callID = g_new0(gchar, 30); - g_sprintf(c->callID, "%d", rand()); - - c->to = g_strdup(""); - - call_list_add(c); - screen_set_call(c); - update_call_tree_add(c); - update_menus(); - - return c; + call_t * c = g_new0 (call_t, 1); + c->state = CALL_STATE_DIALING; + c->from = g_strconcat("\"\" <>", NULL); + + c->callID = g_new0(gchar, 30); + g_sprintf(c->callID, "%d", rand()); + + c->to = g_strdup(""); + + call_list_add(c); + screen_set_call(c); + update_call_tree_add(c); + update_menus(); + + return c; } -void + void sflphone_keypad( guint keyval, gchar * key) { - call_t * c = call_get_selected(); - if(c) - { - - switch(c->state) - { - case CALL_STATE_DIALING: // Currently dialing => edit number - process_dialing(c, keyval, key); - break; - case CALL_STATE_CURRENT: - switch (keyval) - { - case 65307: /* ESCAPE */ - dbus_hang_up(c); - break; - default: // TODO should this be here? - dbus_play_dtmf(key); - if (keyval < 255 || (keyval >65453 && keyval < 65466)) - { - gchar * temp = g_strconcat(call_get_number(c), key, NULL); - gchar * before = c->from; - c->from = g_strconcat("\"",call_get_name(c) ,"\" <", temp, ">", NULL); - g_free(before); - g_free(temp); - screen_set_call(c); - update_call_tree(c); - } - break; - } - break; - case CALL_STATE_INCOMING: - switch (keyval) - { - case 65293: /* ENTER */ - case 65421: /* ENTER numpad */ - dbus_accept(c); - break; - case 65307: /* ESCAPE */ - dbus_refuse(c); - break; - } - break; - case CALL_STATE_TRANSFERT: - switch (keyval) - { - case 65293: /* ENTER */ - case 65421: /* ENTER numpad */ - dbus_transfert(c); - break; - case 65307: /* ESCAPE */ - sflphone_hang_up(c); - break; - default: // When a call is on transfert, typing new numbers will add it to c->to - process_dialing(c, keyval, key); - break; - } - break; - case CALL_STATE_HOLD: - switch (keyval) - { - case 65293: /* ENTER */ - case 65421: /* ENTER numpad */ - dbus_unhold(c); - break; - case 65307: /* ESCAPE */ - dbus_hang_up(c); - break; - default: // When a call is on hold, typing new numbers will create a new call - process_dialing(sflphone_new_call(), keyval, key); - break; - } - break; - case CALL_STATE_RINGING: - case CALL_STATE_BUSY: - case CALL_STATE_FAILURE: - switch (keyval) - { - case 65307: /* ESCAPE */ - dbus_hang_up(c); - break; - } - break; - default: - break; - } - } - else - { // Not in a call, not dialing, create a new call - switch (keyval) - { - case 65293: /* ENTER */ - case 65421: /* ENTER numpad */ - case 65307: /* ESCAPE */ - break; - default: - process_dialing(sflphone_new_call(), keyval, key); - break; - } - - - } -} + call_t * c = call_get_selected(); + if(c) + { + + switch(c->state) + { + case CALL_STATE_DIALING: // Currently dialing => edit number + process_dialing(c, keyval, key); + break; + case CALL_STATE_CURRENT: + switch (keyval) + { + case 65307: /* ESCAPE */ + dbus_hang_up(c); + break; + default: // TODO should this be here? + dbus_play_dtmf(key); + if (keyval < 255 || (keyval >65453 && keyval < 65466)) + { + gchar * temp = g_strconcat(call_get_number(c), key, NULL); + gchar * before = c->from; + c->from = g_strconcat("\"",call_get_name(c) ,"\" <", temp, ">", NULL); + g_free(before); + g_free(temp); + screen_set_call(c); + update_call_tree(c); + } + break; + } + break; + case CALL_STATE_INCOMING: + switch (keyval) + { + case 65293: /* ENTER */ + case 65421: /* ENTER numpad */ + dbus_accept(c); + break; + case 65307: /* ESCAPE */ + dbus_refuse(c); + break; + } + break; + case CALL_STATE_TRANSFERT: + switch (keyval) + { + case 65293: /* ENTER */ + case 65421: /* ENTER numpad */ + dbus_transfert(c); + break; + case 65307: /* ESCAPE */ + sflphone_hang_up(c); + break; + default: // When a call is on transfert, typing new numbers will add it to c->to + process_dialing(c, keyval, key); + break; + } + break; + case CALL_STATE_HOLD: + switch (keyval) + { + case 65293: /* ENTER */ + case 65421: /* ENTER numpad */ + dbus_unhold(c); + break; + case 65307: /* ESCAPE */ + dbus_hang_up(c); + break; + default: // When a call is on hold, typing new numbers will create a new call + process_dialing(sflphone_new_call(), keyval, key); + break; + } + break; + case CALL_STATE_RINGING: + case CALL_STATE_BUSY: + case CALL_STATE_FAILURE: + switch (keyval) + { + case 65307: /* ESCAPE */ + dbus_hang_up(c); + break; + } + break; + default: + break; + } + } + else + { // Not in a call, not dialing, create a new call + switch (keyval) + { + case 65293: /* ENTER */ + case 65421: /* ENTER numpad */ + case 65307: /* ESCAPE */ + break; + default: + process_dialing(sflphone_new_call(), keyval, key); + break; + } + } +} + +/* + * Place a call with the default account. + * If there is no default account selected, place a call with the first + * registered account of the account list + * Else, popup an error message + */ void sflphone_place_call ( call_t * c ) { - if(c->state == CALL_STATE_DIALING) - { - account_t * a = account_list_get_by_state (ACCOUNT_STATE_REGISTERED); - if(a) - { - c->accountID = a->accountID; - dbus_place_call(c); - } - else - { - main_window_error_message("There are no registered accounts to make this call with."); - } - - } + if(c->state == CALL_STATE_DIALING) + { + account_t * account; + gchar * default_account = account_list_get_default(); + account = account_list_get_by_id(default_account); + + if(account) + { + if(strcmp(g_hash_table_lookup(account->properties, "Status"),"REGISTERED")==0) + { + c->accountID = default_account; + dbus_place_call(c); + } + else + { + main_window_error_message("The account selected as default is not registered."); + } + + } + else{ + account = account_list_get_by_state (ACCOUNT_STATE_REGISTERED); + if(account) + { + c->accountID = account->accountID; + dbus_place_call(c); + } + else + { + main_window_error_message("There are no registered accounts to make this call with."); + } + + } + } } /* Internal to action - set the DEFAULT_ACCOUNT variable */ -void + void sflphone_set_default_account( ) { gchar* default_id = strdup(dbus_get_default_account()); - g_print("Default Account = %s\n", default_id); account_list_set_default(default_id); } diff --git a/sflphone-gtk/src/actions.h b/sflphone-gtk/src/actions.h index a2c9e6f7950c38c9264c1d58ab6d77fb40aef192..33a2664eca48515abb8cf6bcbdd298f6645f5e22 100644 --- a/sflphone-gtk/src/actions.h +++ b/sflphone-gtk/src/actions.h @@ -1,10 +1,11 @@ /* * Copyright (C) 2007 Savoir-Faire Linux inc. * Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info> + * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, diff --git a/sflphone-gtk/src/configwindow.c b/sflphone-gtk/src/configwindow.c index a2feab2a635022b0104b6f418b72b3466cf3e5e4..15d36cf6bc096a21a99af22f2ca01f4e9b4cbdd5 100644 --- a/sflphone-gtk/src/configwindow.c +++ b/sflphone-gtk/src/configwindow.c @@ -113,6 +113,7 @@ default_account(GtkWidget *widget, gpointer data) // set account as default if(selectedAccount) { + account_list_set_default(selectedAccount->accountID); dbus_set_default_account(selectedAccount->accountID); } } @@ -160,9 +161,12 @@ create_accounts_tab() GtkTreeSelection *sel; GtkWidget *label; - GtkTreeIter iter; + GtkTreeIter iter; GValue val; val.g_type = G_TYPE_POINTER; + account_t* current; + //GValue id; + //val.g_type = G_TYPE; selectedAccount = NULL; @@ -198,7 +202,7 @@ create_accounts_tab() account_store); gtk_tree_model_get_value(GTK_TREE_MODEL(account_store), &iter, 3, &val); - + //current = (account_t*) g_value_get_pointer(&val); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(account_store), 2, GTK_SORT_ASCENDING); @@ -208,6 +212,7 @@ create_accounts_tab() rend, "markup", 0, NULL); + //if(current->accountID == account_list_get_default()) g_object_set(G_OBJECT(rend), "weight", "bold", NULL); gtk_tree_view_append_column (GTK_TREE_VIEW(view), col);