void show_account_list_config_dialog(SFLPhoneClient *client) { account_list_dialog = GTK_DIALOG(gtk_dialog_new_with_buttons(_("Accounts"), GTK_WINDOW(client->win), GTK_DIALOG_DESTROY_WITH_PARENT, NULL, NULL)); /* Set window properties */ gtk_container_set_border_width(GTK_CONTAINER(account_list_dialog), 0); gtk_window_set_resizable(GTK_WINDOW(account_list_dialog), FALSE); GtkWidget *accountFrame = gnome_main_section_new(_("Configured Accounts")); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(account_list_dialog)), accountFrame, TRUE, TRUE, 0); gtk_widget_show(accountFrame); g_signal_connect(G_OBJECT(account_list_dialog), "destroy", G_CALLBACK(dialog_destroy_cb), NULL); /* Accounts tab */ GtkWidget *tab = create_account_list(client); gtk_widget_show(tab); gtk_container_add(GTK_CONTAINER(accountFrame), tab); /* Status bar for the account list */ account_list_status_bar = gtk_statusbar_new(); gtk_widget_show(account_list_status_bar); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(account_list_dialog)), account_list_status_bar, TRUE, TRUE, 0); const gint num_accounts = account_list_get_registered_accounts(); if (num_accounts) { gchar * message = g_strdup_printf(n_("There is %d active account", "There are %d active accounts", num_accounts), num_accounts); gtk_statusbar_push(GTK_STATUSBAR(account_list_status_bar), CONTEXT_ID_REGISTRATION, message); g_free(message); } else { gtk_statusbar_push(GTK_STATUSBAR(account_list_status_bar), CONTEXT_ID_REGISTRATION, _("You have no active accounts")); } gtk_dialog_run(account_list_dialog); status_bar_display_account(); gtk_widget_destroy(GTK_WIDGET(account_list_dialog)); /* Invalidate static pointers */ account_list_dialog = NULL; account_list_status_bar = NULL; edit_button = NULL; delete_button = NULL; move_down_button = NULL; move_up_button = NULL; account_store = NULL; update_actions(client); }
account_t* account_list_get_current() { // No account registered if (account_list_get_registered_accounts() == 0) return NULL; // if we are here, it means that we have at least one registered account in the list // So we get the first one return account_list_get_by_state(ACCOUNT_STATE_REGISTERED); }